@grapesjs/studio-sdk-plugins 1.0.37 → 1.0.38

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.
Files changed (93) hide show
  1. package/dist/accordionComponent/index.cjs.js +3 -3
  2. package/dist/accordionComponent/index.es.js +12 -12
  3. package/dist/accordionComponent/index.umd.js +3 -3
  4. package/dist/aiChat/index.cjs.js +85 -85
  5. package/dist/aiChat/index.es.js +9759 -9332
  6. package/dist/aiChat/index.js +85 -85
  7. package/dist/aiChat/index.umd.js +86 -86
  8. package/dist/aiChat/locales/en.d.ts +11 -0
  9. package/dist/aiChat/server/index.cjs.js +1 -1
  10. package/dist/aiChat/server/index.es.js +1 -1
  11. package/dist/aiChat/server/index.js +1 -1
  12. package/dist/aiChat/server/index.umd.js +1 -1
  13. package/dist/aiChat/types.d.ts +1 -1
  14. package/dist/animationComponent/index.cjs.js +3 -3
  15. package/dist/animationComponent/index.es.js +10 -10
  16. package/dist/animationComponent/index.umd.js +3 -3
  17. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  18. package/dist/canvasAbsoluteMode/index.es.js +10 -10
  19. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  20. package/dist/canvasEmptyState/index.cjs.js +1 -1
  21. package/dist/canvasEmptyState/index.es.js +1 -1
  22. package/dist/canvasEmptyState/index.umd.js +1 -1
  23. package/dist/canvasFullSize/index.cjs.js +4 -4
  24. package/dist/canvasFullSize/index.es.js +15 -15
  25. package/dist/canvasFullSize/index.umd.js +3 -3
  26. package/dist/canvasGridMode/index.cjs.js +2 -2
  27. package/dist/canvasGridMode/index.es.js +233 -228
  28. package/dist/canvasGridMode/index.umd.js +2 -2
  29. package/dist/canvasScreenshot/index.cjs.js +1 -1
  30. package/dist/canvasScreenshot/index.es.js +11 -11
  31. package/dist/canvasScreenshot/index.umd.js +1 -1
  32. package/dist/dataSourceEjs/index.cjs.js +2 -2
  33. package/dist/dataSourceEjs/index.es.js +5 -5
  34. package/dist/dataSourceEjs/index.umd.js +1 -1
  35. package/dist/dataSourceHandlebars/index.cjs.js +1 -1
  36. package/dist/dataSourceHandlebars/index.es.js +105 -105
  37. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  38. package/dist/dialogComponent/index.cjs.js +3 -3
  39. package/dist/dialogComponent/index.es.js +18 -18
  40. package/dist/dialogComponent/index.umd.js +3 -3
  41. package/dist/flexComponent/index.cjs.js +1 -1
  42. package/dist/flexComponent/index.es.js +1 -1
  43. package/dist/flexComponent/index.umd.js +3 -3
  44. package/dist/fsLightboxComponent/index.cjs.js +1 -1
  45. package/dist/fsLightboxComponent/index.es.js +7 -7
  46. package/dist/fsLightboxComponent/index.umd.js +2 -2
  47. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  48. package/dist/googleFontsAssetProvider/index.es.js +12 -12
  49. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  50. package/dist/iconifyComponent/index.cjs.js +2 -2
  51. package/dist/iconifyComponent/index.es.js +61 -61
  52. package/dist/iconifyComponent/index.umd.js +2 -2
  53. package/dist/index.cjs.js +24 -24
  54. package/dist/index.es.js +335 -330
  55. package/dist/index.umd.js +25 -25
  56. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  57. package/dist/layoutSidebarButtons/index.es.js +15 -15
  58. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  59. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  60. package/dist/lightGalleryComponent/index.es.js +20 -20
  61. package/dist/lightGalleryComponent/index.umd.js +1 -1
  62. package/dist/linkImageComponent/index.cjs.js +1 -1
  63. package/dist/linkImageComponent/index.es.js +1 -1
  64. package/dist/linkImageComponent/index.umd.js +2 -2
  65. package/dist/listPagesComponent/index.cjs.js +2 -2
  66. package/dist/listPagesComponent/index.es.js +10 -10
  67. package/dist/listPagesComponent/index.umd.js +2 -2
  68. package/dist/presetPrintable/index.cjs.js +5 -5
  69. package/dist/presetPrintable/index.es.js +47 -47
  70. package/dist/presetPrintable/index.umd.js +4 -4
  71. package/dist/prosemirror/index.cjs.js +1 -1
  72. package/dist/prosemirror/index.es.js +1 -1
  73. package/dist/prosemirror/index.umd.js +1 -1
  74. package/dist/rendererReact/index.cjs.js +1 -1
  75. package/dist/rendererReact/index.es.js +16 -16
  76. package/dist/rendererReact/index.js +1 -1
  77. package/dist/rendererReact/index.umd.js +1 -1
  78. package/dist/rteTinyMce/index.cjs.js +2 -2
  79. package/dist/rteTinyMce/index.es.js +27 -27
  80. package/dist/rteTinyMce/index.umd.js +1 -1
  81. package/dist/shapeDividerComponent/index.cjs.js +1 -1
  82. package/dist/shapeDividerComponent/index.es.js +10 -10
  83. package/dist/shapeDividerComponent/index.umd.js +2 -2
  84. package/dist/swiperComponent/index.cjs.js +1 -1
  85. package/dist/swiperComponent/index.es.js +1 -1
  86. package/dist/swiperComponent/index.umd.js +1 -1
  87. package/dist/tableComponent/index.cjs.js +1 -1
  88. package/dist/tableComponent/index.es.js +9 -9
  89. package/dist/tableComponent/index.umd.js +1 -1
  90. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  91. package/dist/youtubeAssetProvider/index.es.js +5 -5
  92. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  93. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- (function(on,lr){typeof exports=="object"&&typeof module<"u"?module.exports=lr(require("@ai-sdk/react"),require("ai"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-dom/client"),require("marked"),require("react-markdown"),require("remark-gfm")):typeof define=="function"&&define.amd?define(["@ai-sdk/react","ai","react/jsx-runtime","react","react-dom","react-dom/client","marked","react-markdown","remark-gfm"],lr):(on=typeof globalThis<"u"?globalThis:on||self,on.StudioSdkPlugins_aiChat=lr(on.AiSdkReact,on.Ai,on.jsxRuntime,on.React,on.ReactDOM,on.ReactDOMClient,on.Marked,on.ReactMarkdown,on.RemarkGfm))})(this,function(on,lr,c,h,On,KS,ZS,YS,XS){"use strict";function sg(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const nt=sg(h),JS=sg(On),ag="app.grapesjs.com",ig="app-stage.grapesjs.com",lg=[ag,"app2.grapesjs.com",ig,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],QS="license:check:start",Zu="license:check:end",Un=()=>typeof window<"u",hs=e=>e&&e.stopPropagation(),RS=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),eC=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},tC=(e="")=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},nC=e=>eC("Escape",e),rC=(e,t={})=>{const n=ct(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var f,g;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((f=t.onScript)==null||f.call(t,l),s&&!s.get(i)){l.addEventListener("load",()=>r(a)),l.addEventListener("error",()=>o(a));return}return r(a)}const u=window.define;window.define=void 0;const d=()=>{s==null||s.set(i,!0),window.define=u},p=document.createElement("script");p.src=i,p.onload=()=>{r(a),d()},p.onerror=()=>{o(a),d()},document.head.appendChild(p),(g=t.onScript)==null||g.call(t,p)})},oC=e=>{const t=e.map(n=>rC(n));return Promise.allSettled(t)};function sC(e){const t=e.ownerDocument.createElement("script");return t.text=e.innerHTML,Array.from(e.attributes).forEach(n=>t.setAttribute(n.nodeName,n.nodeValue)),t}function cg(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=sC(s);a.onerror=a.onload=t.bind(null,r),(o=s.parentNode)==null||o.replaceChild(a,s)}},n=Array.from(e.querySelectorAll("script"));t(n)}const ug=e=>new DOMParser().parseFromString(e,"text/html"),aC=(e="")=>ug(`<body>${e}</body>`).body.innerHTML,iC=(e="")=>ug(`<head>${e}</head>`).head.innerHTML,lC=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=gC(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},Yu=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?ig:ag}`}/${n?"platform-api":"api"}`,cC=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},dg=(e={})=>{const{width:t=300,height:n,text:r="IMAGE",bg:o="777",fg:s="white"}=e,a=n?`x${n}`:"";return`https://placehold.co/${t}${a}/${o}/${s}.png?text=${r}`},uC=dg(),dC=()=>{if(!Un())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},Xu=()=>{const e=dC();return!!e&&(lg.includes(e)||lg.some(t=>e.endsWith(t)))},Lr=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),pC=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),fC=()=>{},hC=240,Ht=e=>typeof e<"u",ct=e=>typeof e=="string",gC=e=>typeof e=="number";function et(e){return typeof e=="function"}function no(e){return e&&!Array.isArray(e)&&typeof e=="object"}const mC=e=>!e||Object.keys(e).length===0,Ys=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},vC=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},bC=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*r));return t},pg=e=>!!e.Components.getType("mjml"),Pl=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),yC=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(s,a)=>{const i=a.trim();return!i||!n.has(i)?"":`__var__${i}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(s,a)=>`{{ ${a} }}`)};async function wC({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||Yu({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...r}};s&&(l.body=JSON.stringify(s));const u=o?new URLSearchParams(o).toString():"",d=u?`?${u}`:"",p=await fetch(`${i}${d}`,l);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var Xs=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Xs||{}),sn=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(sn||{}),ne=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(ne||{}),_n=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(_n||{}),Eo=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(Eo||{}),xt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(xt||{});const fg={[Xs.free]:0,[Xs.startup]:10,[Xs.business]:20,[Xs.enterprise]:30};function SC(e){const t=e;return t.init=n=>r=>e(r,n),t}const CC=e=>SC(e);async function xC({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i;const l=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),s()},u=(p={})=>{var b;const{error:f,sdkLicense:g}=p,m=(b=p.plan)==null?void 0:b.category;if(!(g||p.license)||f)l(f||"Invalid license");else if(m){const w=fg[t],y=fg[m];w>y&&l({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(ne.settings)&&(i=e.runCommand(ne.settings),a=(i==null?void 0:i.baseUrl)||"");const d=p=>{o==null||o(p),p&&u(p)};if(!i){e.onReady(async()=>{if(!Xu())if(r){const p=await PC({licenseKey:r,pluginName:n,baseApiUrl:a});d(p)}else l("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const p=EC(i);d(p);return}e.on(Zu,p=>d(p))}const EC=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function PC(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await wC({baseApiUrl:r,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}var TC="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M11 7H13V13H11V7M11 15H13V17H11V15Z",OC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",_C="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",AC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",LC="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z",MC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",NC="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z",$C="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",kC="M20 13.5C20 17.09 17.09 20 13.5 20H6V18H13.5C16 18 18 16 18 13.5S16 9 13.5 9H7.83L10.91 12.09L9.5 13.5L4 8L9.5 2.5L10.92 3.91L7.83 7H13.5C17.09 7 20 9.91 20 13.5Z",IC="M10.5 18H18V20H10.5C6.91 20 4 17.09 4 13.5S6.91 7 10.5 7H16.17L13.08 3.91L14.5 2.5L20 8L14.5 13.5L13.09 12.09L16.17 9H10.5C8 9 6 11 6 13.5S8 18 10.5 18Z",VC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",HC="M3,21V3H21V21H3M5,5V19H19V5H5Z",jC="M3 16C3 18.8 5.2 21 8 21H10V19H8C6.3 19 5 17.7 5 16V14H3V16M21 8C21 5.2 18.8 3 16 3H14V5H16C17.7 5 19 6.3 19 8V10H21V8M16 21C18.8 21 21 18.8 21 16V14H19V16C19 17.7 17.7 19 16 19H14V21H16M8 3C5.2 3 3 5.2 3 8V10H5V8C5 6.3 6.3 5 8 5H10V3H8Z",DC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",FC="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",BC="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z",zC="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z",hg="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",UC="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",WC="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",GC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",qC="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",KC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",ZC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",gg="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",YC="M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z",XC="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",JC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",QC="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M12.5,11H11.5A1.5,1.5 0 0,1 10,9.5A1.5,1.5 0 0,1 11.5,8H12.5A1.5,1.5 0 0,1 14,9.5H16A3.5,3.5 0 0,0 12.5,6H11.5A3.5,3.5 0 0,0 8,9.5A3.5,3.5 0 0,0 11.5,13H12.5A1.5,1.5 0 0,1 14,14.5A1.5,1.5 0 0,1 12.5,16H11.5A1.5,1.5 0 0,1 10,14.5H8A3.5,3.5 0 0,0 11.5,18H12.5A3.5,3.5 0 0,0 16,14.5A3.5,3.5 0 0,0 12.5,11Z",RC="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",e2="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",t2="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",n2="M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74",r2="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z",o2="M23 19C22.9 19.2 22.8 19.4 22.7 19.5L18.3 15.1C20.5 15.6 22.2 17.1 23 19M12 5C15.9 5 18 6.5 18 7C18 7.5 15.9 8.9 12.2 9L14.1 10.9C15.6 10.7 17 10.3 18 9.7V12.5C17.7 12.7 17.4 12.9 17 13.1C18 13.1 19 13.3 20 13.7V7C20 4.8 16.4 3 12 3C10.1 3 8.4 3.3 7.1 3.9L8.7 5.5C9.5 5.2 10.7 5 12 5M22.1 21.5L20.8 22.8L20.2 22.2C19.2 22.7 18.1 23.1 17 23.1C14.3 23.1 11.9 21.4 11 19.1C11.6 17.7 12.6 16.6 13.9 15.9L12.4 14.4C11.7 14.8 11.1 15.4 10.5 16C8.8 15.9 7.2 15.5 5.9 14.8V17C5.9 17.3 7 18.2 8.9 18.6L8.8 19L9.1 19.7C9.3 20.1 9.4 20.4 9.6 20.8C6.4 20.3 4 18.8 4 17V7C4 6.7 4.1 6.4 4.2 6.1L1.1 3L2.4 1.7L22.1 21.5M12.1 14L8.7 10.6C7.6 10.4 6.7 10 5.9 9.6V12.4C7.2 13.4 9.5 13.9 11.9 13.9C12 14 12.1 14 12.1 14M18.8 20.7L17.7 19.6C17.6 19.9 17.3 20 17 20C16.4 20 16 19.6 16 19C16 18.7 16.1 18.4 16.4 18.2L15.3 17.1C14.8 17.6 14.5 18.2 14.5 18.9C14.5 20.3 15.6 21.4 17 21.4C17.7 21.5 18.4 21.2 18.8 20.7Z",s2="M9.1 19.7L8.8 19L9 18.6C7.1 18.1 6 17.3 6 17V14.8C7.3 15.4 8.8 15.8 10.6 16C11.3 15.2 12.2 14.5 13.1 14H12C9.6 14 7.3 13.4 6 12.5V9.6C7.5 10.4 9.6 11 12 11S16.5 10.5 18 9.6V12.4C17.7 12.6 17.4 12.8 17 13C18 13 19 13.2 20 13.6V7C20 4.8 16.4 3 12 3S4 4.8 4 7V17C4 18.8 6.4 20.3 9.7 20.8C9.5 20.5 9.3 20.1 9.1 19.7M12 5C15.9 5 18 6.5 18 7S15.9 9 12 9 6 7.5 6 7 8.1 5 12 5M17 18C17.6 18 18 18.4 18 19S17.6 20 17 20 16 19.6 16 19 16.4 18 17 18M17 15C14.3 15 11.9 16.7 11 19C11.9 21.3 14.3 23 17 23S22.1 21.3 23 19C22.1 16.7 19.7 15 17 15M17 21.5C15.6 21.5 14.5 20.4 14.5 19S15.6 16.5 17 16.5 19.5 17.6 19.5 19 18.4 21.5 17 21.5Z",a2="M12 3C7.58 3 4 4.79 4 7V17C4 19.21 7.59 21 12 21S20 19.21 20 17V7C20 4.79 16.42 3 12 3M18 17C18 17.5 15.87 19 12 19S6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16S16.39 15.55 18 14.77V17M18 12.45C16.7 13.4 14.42 14 12 14C9.58 14 7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11C14.39 11 16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5C15.87 5 18 6.5 18 7S15.87 9 12 9Z",i2="M20 13.09V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.46 21 12.9 21 13.33 20.94C13.12 20.33 13 19.68 13 19L13 18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.65 16 13.27 15.96 13.88 15.89C14.93 14.16 16.83 13 19 13C19.34 13 19.67 13.04 20 13.09M18 12.45C16.7 13.4 14.42 14 12 14S7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5 18 6.5 18 7 15.87 9 12 9M20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88L20.41 19",l2="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",c2="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",u2="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",d2="M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z",p2="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",f2="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",h2="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z",g2="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z",m2="M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z",v2="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",b2="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",y2="M7,11H1V13H7V11M9.17,7.76L7.05,5.64L5.64,7.05L7.76,9.17L9.17,7.76M13,1H11V7H13V1M18.36,7.05L16.95,5.64L14.83,7.76L16.24,9.17L18.36,7.05M17,11V13H23V11H17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M14.83,16.24L16.95,18.36L18.36,16.95L16.24,14.83L14.83,16.24M5.64,16.95L7.05,18.36L9.17,16.24L7.76,14.83L5.64,16.95M11,23H13V17H11V23Z",w2="M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5.5L18.5,3H17V9A1,1 0 0,1 16,10H8A1,1 0 0,1 7,9V3H5M12,4V9H15V4H12M7,12H17A1,1 0 0,1 18,13V19H6V13A1,1 0 0,1 7,12Z",S2="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",C2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",x2="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",E2="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",P2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",T2="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",O2="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6",_2="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",A2="M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z",L2="M12,16L19.36,10.27L21,9L12,2L3,9L4.63,10.27M12,18.54L4.62,12.81L3,14.07L12,21.07L21,14.07L19.37,12.8L12,18.54Z",M2="M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",N2="M11 15H6L13 1V9H18L11 23V15Z",$2="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",k2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",I2="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",V2="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z",H2="M7,10L12,15L17,10H7Z",j2="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",D2="M19,11C19,12.19 18.66,13.3 18.1,14.28L16.87,13.05C17.14,12.43 17.3,11.74 17.3,11H19M15,11.16L9,5.18V5A3,3 0 0,1 12,2A3,3 0 0,1 15,5V11L15,11.16M4.27,3L21,19.73L19.73,21L15.54,16.81C14.77,17.27 13.91,17.58 13,17.72V21H11V17.72C7.72,17.23 5,14.41 5,11H6.7C6.7,14 9.24,16.1 12,16.1C12.81,16.1 13.6,15.91 14.31,15.58L12.65,13.92L12,14A3,3 0 0,1 9,11V10.28L3,4.27L4.27,3Z",F2="M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z",B2="M12,2C13.85,2 15.55,2.78 16.9,4.1L18.6,1.93L20.18,3.16L18.2,5.68C19.33,7.41 20,9.6 20,12C20,17.5 16.42,22 12,22C10.15,22 8.45,21.22 7.1,19.9L5.4,22.07L3.82,20.84L5.8,18.32C4.67,16.59 4,14.4 4,12C4,6.5 7.58,2 12,2M12,4C8.69,4 6,7.58 6,12C6,13.73 6.41,15.33 7.11,16.64L15.67,5.67C14.66,4.62 13.38,4 12,4M12,20C15.31,20 18,16.42 18,12C18,10.27 17.59,8.67 16.89,7.36L8.33,18.33C9.34,19.38 10.62,20 12,20Z",z2="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",mg="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",U2="M2.53,19.65L3.87,20.21V11.18L1.44,17.04C1.03,18.06 1.5,19.23 2.53,19.65M22.03,15.95L17.07,4C16.76,3.23 16.03,2.77 15.26,2.75C15,2.75 14.73,2.79 14.47,2.9L7.1,5.95C6.35,6.26 5.89,7 5.87,7.75C5.86,8 5.91,8.29 6,8.55L11,20.5C11.29,21.28 12.03,21.74 12.81,21.75C13.07,21.75 13.33,21.7 13.58,21.6L20.94,18.55C21.96,18.13 22.45,16.96 22.03,15.95M7.88,8.75A1,1 0 0,1 6.88,7.75A1,1 0 0,1 7.88,6.75C8.43,6.75 8.88,7.2 8.88,7.75C8.88,8.3 8.43,8.75 7.88,8.75M5.88,19.75A2,2 0 0,0 7.88,21.75H9.33L5.88,13.41V19.75Z",W2="M12,2.5L8,7H16L12,2.5M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M8,17L12,21.5L16,17H8Z",G2="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",q2="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",K2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Z2="M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",Y2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",X2="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",J2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L20 12L12 20L4 12Z",Q2="M12 2C11.5 2 11 2.19 10.59 2.59L7.29 5.88L12 10.58L16.71 5.88L13.41 2.59C13 2.19 12.5 2 12 2M5.88 7.29L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L5.88 16.71L10.58 12L5.88 7.29M18.12 7.29L13.42 12L18.12 16.71L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L18.12 7.29M12 13.42L7.29 18.12L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L16.71 18.12L12 13.42Z",R2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L15.29 7.29L12 10.59L8.71 7.29L12 4M7.29 8.71L10.59 12L7.29 15.29L4 12L7.29 8.71M16.71 8.71L20 12L16.71 15.29L13.41 12L16.71 8.71M12 13.41L15.29 16.71L12 20L8.71 16.71L12 13.41Z",ex="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",tx="M18,18H6V6H18V18Z",nx="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",rx="M11,2V4.07C7.38,4.53 4.53,7.38 4.07,11H2V13H4.07C4.53,16.62 7.38,19.47 11,19.93V22H13V19.93C16.62,19.47 19.47,16.62 19.93,13H22V11H19.93C19.47,7.38 16.62,4.53 13,4.07V2M11,6.08V8H13V6.09C15.5,6.5 17.5,8.5 17.92,11H16V13H17.91C17.5,15.5 15.5,17.5 13,17.92V16H11V17.91C8.5,17.5 6.5,15.5 6.08,13H8V11H6.09C6.5,8.5 8.5,6.5 11,6.08M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11Z",ox="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",sx="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",ax="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",ix="M17 6H7C3.69 6 1 8.69 1 12S3.69 18 7 18H17C20.31 18 23 15.31 23 12S20.31 6 17 6M17 16H7C4.79 16 3 14.21 3 12S4.79 8 7 8H17C19.21 8 21 9.79 21 12S19.21 16 17 16M17 9C15.34 9 14 10.34 14 12S15.34 15 17 15 20 13.66 20 12 18.66 9 17 9Z",lx="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z",cx="M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z",ux="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z",dx="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",px="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z",fx="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",hx="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",gx="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const ae=X;function X(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(o=>typeof o=="string"?o.split(" ").map(s=>{if(s=s.replace(/gjs-/g,"gs-utl-"),!s.includes("gs-utl-")&&!s.startsWith("gs-")){const a=s.split(":"),i=a.pop(),l=a.join(":"),u=i==null?void 0:i.startsWith("!"),p=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,f=u?`!${p}`:p;return l?`${l}:${f}`:f}return s}):o).join(" ")}const mx=Number.parseInt(h.version,10)||0,qt=e=>{if(mx>=19){const t=n=>e(n,n.ref??null);return t.displayName=e.displayName??e.name,t}return h.forwardRef(e)},k=qt(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:p,...f},g){const m=t||"div";return c.jsx(m,{ref:g,className:X([r,"gs-utl-flex",o&&!s&&"gs-utl-flex-col",o&&s&&"gs-utl-flex-col-reverse",!o&&s&&"gs-utl-flex-row-reverse",a&&!o&&"gs-utl-w-full",a&&o&&"gs-utl-h-full",i?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(o?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(o?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(o?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(o?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(o?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(o?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",p==="start"&&"gs-utl-items-start",p==="end"&&"gs-utl-items-end",p==="center"&&"gs-utl-items-center",d==="start"&&"gs-utl-justify-start",d==="end"&&"gs-utl-justify-end",d==="center"&&"gs-utl-justify-center",d==="between"&&"gs-utl-justify-between"]),...f,children:n})}),F=qt(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:X([n,r&&"flex-1"]),...o,children:t})});function Ju(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},Ru,vg;function vx(){if(vg)return Ru;vg=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ru=e,Ru}var ed,bg;function bx(){if(bg)return ed;bg=1;var e=vx();function t(){}function n(){}return n.resetWarningCache=t,ed=function(){function r(a,i,l,u,d,p){if(p!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},ed}var yg;function yx(){return yg||(yg=1,Qu.exports=bx()()),Qu.exports}var wx=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(r,o,s){n.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,o){if(1&o&&(r=n(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var a in r)n.d(s,a,(function(i){return r[i]}).bind(null,a));return s},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},n.p="",n(n.s=2)}([function(e,t){e.exports=yx()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var r=n(1),o=n(0),s=function(){return(s=Object.assign||function(m){for(var v,b=1,w=arguments.length;b<w;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},a=function(m,v){var b={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},i=0,l=r.forwardRef(function(m,v){var b=m.title,w=b===void 0?null:b,y=m.description,S=y===void 0?null:y,C=m.size,x=C===void 0?null:C,E=m.color,P=E===void 0?"currentColor":E,_=m.horizontal,T=_===void 0?null:_,O=m.vertical,L=O===void 0?null:O,A=m.rotate,$=A===void 0?null:A,B=m.spin,M=B===void 0?null:B,j=m.style,W=j===void 0?{}:j,D=m.children,z=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var I,H=M!==null&&M,V=r.Children.map(D,function(Q){var R=Q;H!==!0&&(H=(M===null?R.props.spin:M)===!0);var q=R.props.size;typeof x=="number"&&typeof R.props.size=="number"&&(q=R.props.size/x);var ee={size:q,color:P===null?R.props.color:P,horizontal:T===null?R.props.horizontal:T,vertical:L===null?R.props.vertical:L,rotate:$===null?R.props.rotate:$,spin:M===null?R.props.spin:M,inStack:!0};return r.cloneElement(R,ee)});x!==null&&(W.width=typeof x=="string"?x:1.5*x+"rem");var G,Y="stack_labelledby_"+i,J="stack_describedby_"+i;if(w)I=S?Y+" "+J:Y;else if(G="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:v,viewBox:"0 0 24 24",style:W,role:G,"aria-labelledby":I},z),w&&r.createElement("title",{id:Y},w),S&&r.createElement("desc",{id:J},S),H&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),V)});l.displayName="Stack",l.propTypes={size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),children:o.oneOfType([o.arrayOf(o.node),o.node]).isRequired,className:o.string,style:o.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var v,b=1,w=arguments.length;b<w;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},p=function(m,v){var b={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},f=0,g=r.forwardRef(function(m,v){var b=m.path,w=m.id,y=w===void 0?++f:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,P=m.size,_=P===void 0?null:P,T=m.color,O=T===void 0?"currentColor":T,L=m.horizontal,A=L!==void 0&&L,$=m.vertical,B=$!==void 0&&$,M=m.rotate,j=M===void 0?0:M,W=m.spin,D=W!==void 0&&W,z=m.style,I=z===void 0?{}:z,H=m.inStack,V=H!==void 0&&H,G=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},J=[];_!==null&&(V?J.push("scale("+_+")"):(I.width=typeof _=="string"?_:1.5*_+"rem",I.height=I.width)),A&&J.push("scaleX(-1)"),B&&J.push("scaleY(-1)"),j!==0&&J.push("rotate("+j+"deg)"),O!==null&&(Y.fill=O);var Q=r.createElement("path",d({d:b,style:Y},V?G:{})),R=Q;J.length>0&&(I.transform=J.join(" "),I.transformOrigin="center",V&&(R=r.createElement("g",{style:I},Q,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var q,ee=R,le=D===!0||typeof D!="number"?2:D,ge=!V&&(A||B);if(le<0&&(ge=!ge),D&&(ee=r.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(le)+"s infinite",transformOrigin:"center"}},R,!(A||B||j!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),V)return ee;var Pe,Ce="icon_labelledby_"+y,tt="icon_describedby_"+y;if(C)q=E?Ce+" "+tt:Ce;else if(Pe="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",d({ref:v,viewBox:"0 0 24 24",style:I,role:Pe,"aria-labelledby":q},G),C&&r.createElement("title",{id:Ce},C),E&&r.createElement("desc",{id:tt},E),!V&&D&&(ge?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),ee)});g.displayName="Icon",g.propTypes={path:o.string.isRequired,size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),style:o.object,inStack:o.bool,className:o.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const za=Ju(wx);var wg={exports:{}};/*!
1
+ (function(on,cr){typeof exports=="object"&&typeof module<"u"?module.exports=cr(require("@ai-sdk/react"),require("ai"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-dom/client"),require("marked"),require("react-markdown"),require("remark-gfm")):typeof define=="function"&&define.amd?define(["@ai-sdk/react","ai","react/jsx-runtime","react","react-dom","react-dom/client","marked","react-markdown","remark-gfm"],cr):(on=typeof globalThis<"u"?globalThis:on||self,on.StudioSdkPlugins_aiChat=cr(on.AiSdkReact,on.Ai,on.jsxRuntime,on.React,on.ReactDOM,on.ReactDOMClient,on.Marked,on.ReactMarkdown,on.RemarkGfm))})(this,function(on,cr,c,g,On,lC,cC,uC,dC){"use strict";function uh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const st=uh(g),pC=uh(On),dh="app.grapesjs.com",ph="app-stage.grapesjs.com",fh="gs-utl-dark",gh=[dh,"app2.grapesjs.com",ph,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],fC="license:check:start",Qu="license:check:end",Wn=()=>typeof window<"u",ms=e=>e&&e.stopPropagation(),gC=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),hC=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},mC=(e="")=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},bC=e=>hC("Escape",e),vC=(e,t={})=>{const n=dt(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var f,h;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((f=t.onScript)==null||f.call(t,l),s&&!s.get(i)){l.addEventListener("load",()=>r(a)),l.addEventListener("error",()=>o(a));return}return r(a)}const u=window.define;window.define=void 0;const d=()=>{s==null||s.set(i,!0),window.define=u},p=document.createElement("script");p.src=i,p.onload=()=>{r(a),d()},p.onerror=()=>{o(a),d()},document.head.appendChild(p),(h=t.onScript)==null||h.call(t,p)})},hh=e=>{const t=e.map(n=>vC(n));return Promise.allSettled(t)},yC=async e=>{const t=window.define;window.define=void 0;const n=await hh(e);return window.define=t,n};function wC(e){const t=e.ownerDocument.createElement("script");return t.text=e.innerHTML,Array.from(e.attributes).forEach(n=>t.setAttribute(n.nodeName,n.nodeValue)),t}function mh(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=wC(s);a.onerror=a.onload=t.bind(null,r),(o=s.parentNode)==null||o.replaceChild(a,s)}},n=Array.from(e.querySelectorAll("script"));t(n)}const bh=e=>new DOMParser().parseFromString(e,"text/html"),SC=(e="")=>bh(`<body>${e}</body>`).body.innerHTML,CC=(e="")=>bh(`<head>${e}</head>`).head.innerHTML,xC=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=MC(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},Ru=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?ph:dh}`}/${n?"platform-api":"api"}`,EC=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},vh=(e={})=>{const{width:t=300,height:n,text:r="IMAGE",bg:o="777",fg:s="white"}=e,a=n?`x${n}`:"";return`https://placehold.co/${t}${a}/${o}/${s}.png?text=${r}`},PC=vh(),TC=()=>{if(!Wn())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},ed=()=>{const e=TC();return!!e&&(gh.includes(e)||gh.some(t=>e.endsWith(t)))},$r=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),OC=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),_C=()=>{},AC=240,Ht=e=>typeof e<"u",dt=e=>typeof e=="string",MC=e=>typeof e=="number";function ot(e){return typeof e=="function"}function oo(e){return e&&!Array.isArray(e)&&typeof e=="object"}const yh=e=>!e||Object.keys(e).length===0,Xs=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},LC=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},NC=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*r));return t},wh=e=>!!e.Components.getType("mjml"),Al=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),$C=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(s,a)=>{const i=a.trim();return!i||!n.has(i)?"":`__var__${i}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(s,a)=>`{{ ${a} }}`)};async function kC({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||Ru({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...r}};s&&(l.body=JSON.stringify(s));const u=o?new URLSearchParams(o).toString():"",d=u?`?${u}`:"",p=await fetch(`${i}${d}`,l);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var Js=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Js||{}),sn=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(sn||{}),te=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(te||{}),_n=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(_n||{}),To=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(To||{}),Et=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(Et||{});const Sh={[Js.free]:0,[Js.startup]:10,[Js.business]:20,[Js.enterprise]:30};function IC(e){const t=e;return t.init=n=>r=>e(r,n),t}const VC=e=>IC(e);async function HC({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i;const l=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),s()},u=(p={})=>{var v;const{error:f,sdkLicense:h}=p,m=(v=p.plan)==null?void 0:v.category;if(!(h||p.license)||f)l(f||"Invalid license");else if(m){const w=Sh[t],y=Sh[m];w>y&&l({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(te.settings)&&(i=e.runCommand(te.settings),a=(i==null?void 0:i.baseUrl)||"");const d=p=>{o==null||o(p),p&&u(p)};if(!i){e.onReady(async()=>{if(!ed())if(r){const p=await DC({licenseKey:r,pluginName:n,baseApiUrl:a});d(p)}else l("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const p=jC(i);d(p);return}e.on(Qu,p=>d(p))}const jC=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function DC(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await kC({baseApiUrl:r,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}var FC="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M11 7H13V13H11V7M11 15H13V17H11V15Z",BC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",zC="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",UC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",WC="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z",GC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",qC="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z",KC="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",ZC="M20 13.5C20 17.09 17.09 20 13.5 20H6V18H13.5C16 18 18 16 18 13.5S16 9 13.5 9H7.83L10.91 12.09L9.5 13.5L4 8L9.5 2.5L10.92 3.91L7.83 7H13.5C17.09 7 20 9.91 20 13.5Z",YC="M10.5 18H18V20H10.5C6.91 20 4 17.09 4 13.5S6.91 7 10.5 7H16.17L13.08 3.91L14.5 2.5L20 8L14.5 13.5L13.09 12.09L16.17 9H10.5C8 9 6 11 6 13.5S8 18 10.5 18Z",XC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",JC="M3,21V3H21V21H3M5,5V19H19V5H5Z",QC="M3 16C3 18.8 5.2 21 8 21H10V19H8C6.3 19 5 17.7 5 16V14H3V16M21 8C21 5.2 18.8 3 16 3H14V5H16C17.7 5 19 6.3 19 8V10H21V8M16 21C18.8 21 21 18.8 21 16V14H19V16C19 17.7 17.7 19 16 19H14V21H16M8 3C5.2 3 3 5.2 3 8V10H5V8C5 6.3 6.3 5 8 5H10V3H8Z",RC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",e2="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",t2="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z",n2="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z",Ch="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",r2="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",o2="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",s2="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",a2="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",i2="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",l2="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",xh="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",c2="M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z",u2="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",d2="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",p2="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M12.5,11H11.5A1.5,1.5 0 0,1 10,9.5A1.5,1.5 0 0,1 11.5,8H12.5A1.5,1.5 0 0,1 14,9.5H16A3.5,3.5 0 0,0 12.5,6H11.5A3.5,3.5 0 0,0 8,9.5A3.5,3.5 0 0,0 11.5,13H12.5A1.5,1.5 0 0,1 14,14.5A1.5,1.5 0 0,1 12.5,16H11.5A1.5,1.5 0 0,1 10,14.5H8A3.5,3.5 0 0,0 11.5,18H12.5A3.5,3.5 0 0,0 16,14.5A3.5,3.5 0 0,0 12.5,11Z",f2="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",g2="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",h2="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",m2="M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74",b2="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z",v2="M23 19C22.9 19.2 22.8 19.4 22.7 19.5L18.3 15.1C20.5 15.6 22.2 17.1 23 19M12 5C15.9 5 18 6.5 18 7C18 7.5 15.9 8.9 12.2 9L14.1 10.9C15.6 10.7 17 10.3 18 9.7V12.5C17.7 12.7 17.4 12.9 17 13.1C18 13.1 19 13.3 20 13.7V7C20 4.8 16.4 3 12 3C10.1 3 8.4 3.3 7.1 3.9L8.7 5.5C9.5 5.2 10.7 5 12 5M22.1 21.5L20.8 22.8L20.2 22.2C19.2 22.7 18.1 23.1 17 23.1C14.3 23.1 11.9 21.4 11 19.1C11.6 17.7 12.6 16.6 13.9 15.9L12.4 14.4C11.7 14.8 11.1 15.4 10.5 16C8.8 15.9 7.2 15.5 5.9 14.8V17C5.9 17.3 7 18.2 8.9 18.6L8.8 19L9.1 19.7C9.3 20.1 9.4 20.4 9.6 20.8C6.4 20.3 4 18.8 4 17V7C4 6.7 4.1 6.4 4.2 6.1L1.1 3L2.4 1.7L22.1 21.5M12.1 14L8.7 10.6C7.6 10.4 6.7 10 5.9 9.6V12.4C7.2 13.4 9.5 13.9 11.9 13.9C12 14 12.1 14 12.1 14M18.8 20.7L17.7 19.6C17.6 19.9 17.3 20 17 20C16.4 20 16 19.6 16 19C16 18.7 16.1 18.4 16.4 18.2L15.3 17.1C14.8 17.6 14.5 18.2 14.5 18.9C14.5 20.3 15.6 21.4 17 21.4C17.7 21.5 18.4 21.2 18.8 20.7Z",y2="M9.1 19.7L8.8 19L9 18.6C7.1 18.1 6 17.3 6 17V14.8C7.3 15.4 8.8 15.8 10.6 16C11.3 15.2 12.2 14.5 13.1 14H12C9.6 14 7.3 13.4 6 12.5V9.6C7.5 10.4 9.6 11 12 11S16.5 10.5 18 9.6V12.4C17.7 12.6 17.4 12.8 17 13C18 13 19 13.2 20 13.6V7C20 4.8 16.4 3 12 3S4 4.8 4 7V17C4 18.8 6.4 20.3 9.7 20.8C9.5 20.5 9.3 20.1 9.1 19.7M12 5C15.9 5 18 6.5 18 7S15.9 9 12 9 6 7.5 6 7 8.1 5 12 5M17 18C17.6 18 18 18.4 18 19S17.6 20 17 20 16 19.6 16 19 16.4 18 17 18M17 15C14.3 15 11.9 16.7 11 19C11.9 21.3 14.3 23 17 23S22.1 21.3 23 19C22.1 16.7 19.7 15 17 15M17 21.5C15.6 21.5 14.5 20.4 14.5 19S15.6 16.5 17 16.5 19.5 17.6 19.5 19 18.4 21.5 17 21.5Z",w2="M12 3C7.58 3 4 4.79 4 7V17C4 19.21 7.59 21 12 21S20 19.21 20 17V7C20 4.79 16.42 3 12 3M18 17C18 17.5 15.87 19 12 19S6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16S16.39 15.55 18 14.77V17M18 12.45C16.7 13.4 14.42 14 12 14C9.58 14 7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11C14.39 11 16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5C15.87 5 18 6.5 18 7S15.87 9 12 9Z",S2="M20 13.09V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.46 21 12.9 21 13.33 20.94C13.12 20.33 13 19.68 13 19L13 18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.65 16 13.27 15.96 13.88 15.89C14.93 14.16 16.83 13 19 13C19.34 13 19.67 13.04 20 13.09M18 12.45C16.7 13.4 14.42 14 12 14S7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5 18 6.5 18 7 15.87 9 12 9M20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88L20.41 19",C2="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",x2="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",E2="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",P2="M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z",T2="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",O2="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",_2="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z",A2="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z",M2="M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z",L2="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",N2="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",$2="M7,11H1V13H7V11M9.17,7.76L7.05,5.64L5.64,7.05L7.76,9.17L9.17,7.76M13,1H11V7H13V1M18.36,7.05L16.95,5.64L14.83,7.76L16.24,9.17L18.36,7.05M17,11V13H23V11H17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M14.83,16.24L16.95,18.36L18.36,16.95L16.24,14.83L14.83,16.24M5.64,16.95L7.05,18.36L9.17,16.24L7.76,14.83L5.64,16.95M11,23H13V17H11V23Z",k2="M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5.5L18.5,3H17V9A1,1 0 0,1 16,10H8A1,1 0 0,1 7,9V3H5M12,4V9H15V4H12M7,12H17A1,1 0 0,1 18,13V19H6V13A1,1 0 0,1 7,12Z",I2="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",V2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",H2="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",j2="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",D2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",F2="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",B2="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6",z2="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",U2="M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z",W2="M12,16L19.36,10.27L21,9L12,2L3,9L4.63,10.27M12,18.54L4.62,12.81L3,14.07L12,21.07L21,14.07L19.37,12.8L12,18.54Z",G2="M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",q2="M11 15H6L13 1V9H18L11 23V15Z",K2="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",Z2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",Y2="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",X2="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z",J2="M7,10L12,15L17,10H7Z",Q2="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",R2="M19,11C19,12.19 18.66,13.3 18.1,14.28L16.87,13.05C17.14,12.43 17.3,11.74 17.3,11H19M15,11.16L9,5.18V5A3,3 0 0,1 12,2A3,3 0 0,1 15,5V11L15,11.16M4.27,3L21,19.73L19.73,21L15.54,16.81C14.77,17.27 13.91,17.58 13,17.72V21H11V17.72C7.72,17.23 5,14.41 5,11H6.7C6.7,14 9.24,16.1 12,16.1C12.81,16.1 13.6,15.91 14.31,15.58L12.65,13.92L12,14A3,3 0 0,1 9,11V10.28L3,4.27L4.27,3Z",ex="M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z",tx="M12,2C13.85,2 15.55,2.78 16.9,4.1L18.6,1.93L20.18,3.16L18.2,5.68C19.33,7.41 20,9.6 20,12C20,17.5 16.42,22 12,22C10.15,22 8.45,21.22 7.1,19.9L5.4,22.07L3.82,20.84L5.8,18.32C4.67,16.59 4,14.4 4,12C4,6.5 7.58,2 12,2M12,4C8.69,4 6,7.58 6,12C6,13.73 6.41,15.33 7.11,16.64L15.67,5.67C14.66,4.62 13.38,4 12,4M12,20C15.31,20 18,16.42 18,12C18,10.27 17.59,8.67 16.89,7.36L8.33,18.33C9.34,19.38 10.62,20 12,20Z",nx="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",Eh="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",rx="M2.53,19.65L3.87,20.21V11.18L1.44,17.04C1.03,18.06 1.5,19.23 2.53,19.65M22.03,15.95L17.07,4C16.76,3.23 16.03,2.77 15.26,2.75C15,2.75 14.73,2.79 14.47,2.9L7.1,5.95C6.35,6.26 5.89,7 5.87,7.75C5.86,8 5.91,8.29 6,8.55L11,20.5C11.29,21.28 12.03,21.74 12.81,21.75C13.07,21.75 13.33,21.7 13.58,21.6L20.94,18.55C21.96,18.13 22.45,16.96 22.03,15.95M7.88,8.75A1,1 0 0,1 6.88,7.75A1,1 0 0,1 7.88,6.75C8.43,6.75 8.88,7.2 8.88,7.75C8.88,8.3 8.43,8.75 7.88,8.75M5.88,19.75A2,2 0 0,0 7.88,21.75H9.33L5.88,13.41V19.75Z",ox="M12,2.5L8,7H16L12,2.5M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M8,17L12,21.5L16,17H8Z",sx="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",ax="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",ix="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",lx="M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",cx="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",ux="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",dx="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L20 12L12 20L4 12Z",px="M12 2C11.5 2 11 2.19 10.59 2.59L7.29 5.88L12 10.58L16.71 5.88L13.41 2.59C13 2.19 12.5 2 12 2M5.88 7.29L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L5.88 16.71L10.58 12L5.88 7.29M18.12 7.29L13.42 12L18.12 16.71L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L18.12 7.29M12 13.42L7.29 18.12L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L16.71 18.12L12 13.42Z",fx="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L15.29 7.29L12 10.59L8.71 7.29L12 4M7.29 8.71L10.59 12L7.29 15.29L4 12L7.29 8.71M16.71 8.71L20 12L16.71 15.29L13.41 12L16.71 8.71M12 13.41L15.29 16.71L12 20L8.71 16.71L12 13.41Z",gx="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",hx="M18,18H6V6H18V18Z",mx="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",bx="M11,2V4.07C7.38,4.53 4.53,7.38 4.07,11H2V13H4.07C4.53,16.62 7.38,19.47 11,19.93V22H13V19.93C16.62,19.47 19.47,16.62 19.93,13H22V11H19.93C19.47,7.38 16.62,4.53 13,4.07V2M11,6.08V8H13V6.09C15.5,6.5 17.5,8.5 17.92,11H16V13H17.91C17.5,15.5 15.5,17.5 13,17.92V16H11V17.91C8.5,17.5 6.5,15.5 6.08,13H8V11H6.09C6.5,8.5 8.5,6.5 11,6.08M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11Z",vx="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",yx="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",wx="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",Sx="M17 6H7C3.69 6 1 8.69 1 12S3.69 18 7 18H17C20.31 18 23 15.31 23 12S20.31 6 17 6M17 16H7C4.79 16 3 14.21 3 12S4.79 8 7 8H17C19.21 8 21 9.79 21 12S19.21 16 17 16M17 9C15.34 9 14 10.34 14 12S15.34 15 17 15 20 13.66 20 12 18.66 9 17 9Z",Cx="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z",xx="M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z",Ex="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z",Px="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",Tx="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z",Ox="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",_x="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",Ax="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const ie=Q;function Q(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(o=>typeof o=="string"?o.split(" ").map(s=>{if(s=s.replace(/gjs-/g,"gs-utl-"),!s.includes("gs-utl-")&&!s.startsWith("gs-")){const a=s.split(":"),i=a.pop(),l=a.join(":"),u=i==null?void 0:i.startsWith("!"),p=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,f=u?`!${p}`:p;return l?`${l}:${f}`:f}return s}):o).join(" ")}const Mx=Number.parseInt(g.version,10)||0,Kt=e=>{if(Mx>=19){const t=n=>e(n,n.ref??null);return t.displayName=e.displayName??e.name,t}return g.forwardRef(e)},I=Kt(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:p,...f},h){const m=t||"div";return c.jsx(m,{ref:h,className:Q([r,"gs-utl-flex",o&&!s&&"gs-utl-flex-col",o&&s&&"gs-utl-flex-col-reverse",!o&&s&&"gs-utl-flex-row-reverse",a&&!o&&"gs-utl-w-full",a&&o&&"gs-utl-h-full",i?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(o?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(o?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(o?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(o?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(o?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(o?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",p==="start"&&"gs-utl-items-start",p==="end"&&"gs-utl-items-end",p==="center"&&"gs-utl-items-center",d==="start"&&"gs-utl-justify-start",d==="end"&&"gs-utl-justify-end",d==="center"&&"gs-utl-justify-center",d==="between"&&"gs-utl-justify-between"]),...f,children:n})}),F=Kt(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:Q([n,r&&"flex-1"]),...o,children:t})});function td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nd={exports:{}},rd,Ph;function Lx(){if(Ph)return rd;Ph=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return rd=e,rd}var od,Th;function Nx(){if(Th)return od;Th=1;var e=Lx();function t(){}function n(){}return n.resetWarningCache=t,od=function(){function r(a,i,l,u,d,p){if(p!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},od}var Oh;function $x(){return Oh||(Oh=1,nd.exports=Nx()()),nd.exports}var kx=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(r,o,s){n.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,o){if(1&o&&(r=n(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var a in r)n.d(s,a,(function(i){return r[i]}).bind(null,a));return s},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},n.p="",n(n.s=2)}([function(e,t){e.exports=$x()},function(e,t){e.exports=g},function(e,t,n){n.r(t);var r=n(1),o=n(0),s=function(){return(s=Object.assign||function(m){for(var b,v=1,w=arguments.length;v<w;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},a=function(m,b){var v={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&b.indexOf(w)<0&&(v[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)b.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(v[w[y]]=m[w[y]])}return v},i=0,l=r.forwardRef(function(m,b){var v=m.title,w=v===void 0?null:v,y=m.description,S=y===void 0?null:y,C=m.size,E=C===void 0?null:C,x=m.color,P=x===void 0?"currentColor":x,_=m.horizontal,T=_===void 0?null:_,O=m.vertical,M=O===void 0?null:O,A=m.rotate,$=A===void 0?null:A,j=m.spin,L=j===void 0?null:j,H=m.style,W=H===void 0?{}:H,B=m.children,G=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var D,V=L!==null&&L,k=r.Children.map(B,function(ee){var J=ee;V!==!0&&(V=(L===null?J.props.spin:L)===!0);var q=J.props.size;typeof E=="number"&&typeof J.props.size=="number"&&(q=J.props.size/E);var R={size:q,color:P===null?J.props.color:P,horizontal:T===null?J.props.horizontal:T,vertical:M===null?J.props.vertical:M,rotate:$===null?J.props.rotate:$,spin:L===null?J.props.spin:L,inStack:!0};return r.cloneElement(J,R)});E!==null&&(W.width=typeof E=="string"?E:1.5*E+"rem");var z,Y="stack_labelledby_"+i,X="stack_describedby_"+i;if(w)D=S?Y+" "+X:Y;else if(z="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:b,viewBox:"0 0 24 24",style:W,role:z,"aria-labelledby":D},G),w&&r.createElement("title",{id:Y},w),S&&r.createElement("desc",{id:X},S),V&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),k)});l.displayName="Stack",l.propTypes={size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),children:o.oneOfType([o.arrayOf(o.node),o.node]).isRequired,className:o.string,style:o.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return h}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var b,v=1,w=arguments.length;v<w;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},p=function(m,b){var v={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&b.indexOf(w)<0&&(v[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)b.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(v[w[y]]=m[w[y]])}return v},f=0,h=r.forwardRef(function(m,b){var v=m.path,w=m.id,y=w===void 0?++f:w,S=m.title,C=S===void 0?null:S,E=m.description,x=E===void 0?null:E,P=m.size,_=P===void 0?null:P,T=m.color,O=T===void 0?"currentColor":T,M=m.horizontal,A=M!==void 0&&M,$=m.vertical,j=$!==void 0&&$,L=m.rotate,H=L===void 0?0:L,W=m.spin,B=W!==void 0&&W,G=m.style,D=G===void 0?{}:G,V=m.inStack,k=V!==void 0&&V,z=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},X=[];_!==null&&(k?X.push("scale("+_+")"):(D.width=typeof _=="string"?_:1.5*_+"rem",D.height=D.width)),A&&X.push("scaleX(-1)"),j&&X.push("scaleY(-1)"),H!==0&&X.push("rotate("+H+"deg)"),O!==null&&(Y.fill=O);var ee=r.createElement("path",d({d:v,style:Y},k?z:{})),J=ee;X.length>0&&(D.transform=X.join(" "),D.transformOrigin="center",k&&(J=r.createElement("g",{style:D},ee,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var q,R=J,ae=B===!0||typeof B!="number"?2:B,le=!k&&(A||j);if(ae<0&&(le=!le),B&&(R=r.createElement("g",{style:{animation:"spin"+(le?"-inverse":"")+" linear "+Math.abs(ae)+"s infinite",transformOrigin:"center"}},J,!(A||j||H!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),k)return R;var me,ve="icon_labelledby_"+y,He="icon_describedby_"+y;if(C)q=x?ve+" "+He:ve;else if(me="presentation",x)throw new Error("title attribute required when description is set");return r.createElement("svg",d({ref:b,viewBox:"0 0 24 24",style:D,role:me,"aria-labelledby":q},z),C&&r.createElement("title",{id:ve},C),x&&r.createElement("desc",{id:He},x),!k&&B&&(le?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),R)});h.displayName="Icon",h.propTypes={path:o.string.isRequired,size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),style:o.object,inStack:o.bool,className:o.string},h.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=h}]);const Wa=td(kx);var _h={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",a=0;a<arguments.length;a++){var i=arguments[a];i&&(s=o(s,r(i)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var i in s)t.call(s,i)&&s[i]&&(a=o(a,i));return a}function o(s,a){return a?s?s+" "+a:s+a:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(wg);var Sx=wg.exports;const N=Ju(Sx);var Xt={NODE_ENV:"production"};function We(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Cx={};function Tl(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Cx}var Sg=Object.assign,Ol=Object.getOwnPropertyDescriptor,Mr=Object.defineProperty,Ua=Object.prototype,td=[];Object.freeze(td);var Cg={};Object.freeze(Cg);var xx=typeof Proxy<"u",Ex=Object.toString();function xg(){xx||We("Proxy not available")}function Eg(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Js=function(){};function cr(e){return typeof e=="function"}function gs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function _l(e){return e!==null&&typeof e=="object"}function ro(e){if(!_l(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===Ex}function Pg(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Wa(e,t,n){Mr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Tg(e,t,n){Mr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Po(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return _l(r)&&r[n]===!0}}function Qs(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Px(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function oo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Og=typeof Object.getOwnPropertySymbols<"u";function Tx(e){var t=Object.keys(e);if(!Og)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Ua.propertyIsEnumerable.call(e,r)})):t}var Rs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Og?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function _g(e){return e===null?null:typeof e=="object"?""+e:e}function so(e,t){return Ua.hasOwnProperty.call(e,t)}var Ox=Object.getOwnPropertyDescriptors||function(t){var n={};return Rs(t).forEach(function(r){n[r]=Ol(t,r)}),n};function An(e,t){return!!(e&t)}function Ln(e,t,n){return n?e|=t:e&=~t,e}function Ag(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lx(r.key),r)}}function ea(e,t,n){return t&&_x(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ta(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Mx(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ms(){return ms=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ms.apply(null,arguments)}function Lg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,nd(e,t)}function nd(e,t){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nd(e,t)}function Ax(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Lx(e){var t=Ax(e,"string");return typeof t=="symbol"?t:t+""}function Mx(e,t){if(e){if(typeof e=="string")return Ag(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ag(e,t):void 0}}var ur=Symbol("mobx-stored-annotations");function Nr(e){function t(n,r){if(qa(r))return e.decorate_20223_(n,r);Ga(n,r,e)}return Object.assign(t,e)}function Ga(e,t,n){so(e,ur)||Wa(e,ur,ms({},e[ur])),Fx(n)||(e[ur][t]=n)}function Nx(e){return so(e,ur)||Wa(e,ur,ms({},e[ur])),e[ur]}function qa(e){return typeof e=="object"&&typeof e.kind=="string"}var Ee=Symbol("mobx administration"),To=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Xe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Yg(this)},t.reportChanged=function(){Wn(),Xg(this),Gn()},t.toString=function(){return this.name_},ea(e,[{key:"isBeingObserved",get:function(){return An(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return An(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ln(this.flags_,e.diffValueMask_,r===1)}}])}();To.isBeingObservedMask_=1,To.isPendingUnobservationMask_=2,To.diffValueMask_=4;var rd=Po("Atom",To);function Mg(e,t,n){t===void 0&&(t=Js),n===void 0&&(n=Js);var r=new To(e);return t!==Js&&GE(r,t),n!==Js&&t1(r,n),r}function $x(e,t){return e===t}function kx(e,t){return Cd(e,t)}function Ix(e,t){return Cd(e,t,1)}function Vx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Al={identity:$x,structural:kx,default:Vx,shallow:Ix};function vs(e,t,n){return md(e)?e:Array.isArray(e)?Kt.array(e,{name:n}):ro(e)?Kt.object(e,void 0,{name:n}):Qs(e)?Kt.map(e,{name:n}):oo(e)?Kt.set(e,{name:n}):typeof e=="function"&&!Ja(e)&&!Qa(e)?Pg(e)?Ss(e):Xa(n,e):e}function Hx(e,t,n){if(e==null||ni(e)||ti(e)||Ao(e)||mr(e))return e;if(Array.isArray(e))return Kt.array(e,{name:n,deep:!1});if(ro(e))return Kt.object(e,void 0,{name:n,deep:!1});if(Qs(e))return Kt.map(e,{name:n,deep:!1});if(oo(e))return Kt.set(e,{name:n,deep:!1})}function Ll(e){return e}function jx(e,t){return Cd(e,t)?t:e}var Dx="override";function Fx(e){return e.annotationType_===Dx}function Ka(e,t){return{annotationType_:e,options_:t,make_:Bx,extend_:zx,decorate_20223_:Ux}}function Bx(e,t,n,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Ja(n.value))return 1;var s=Ng(e,this,t,n,!1);return Mr(r,t,s),2}function zx(e,t,n,r){var o=Ng(e,this,t,n);return e.defineProperty_(t,o,r)}function Ux(e,t){var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,p,f,g;return bs((d=(p=s.options_)==null?void 0:p.name)!=null?d:r.toString(),u,(f=(g=s.options_)==null?void 0:g.autoAction)!=null?f:!1)};if(n=="field")return function(l){var u,d=l;return Ja(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Ja(e)||(e=a(e)),(i=this.options_)!=null&&i.bound&&o(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}We("Cannot apply '"+s.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
7
- '`+s.annotationType_+"' can only be used on properties with a function value."))}function Wx(e,t,n,r){t.annotationType_,r.value}function Ng(e,t,n,r,o){var s,a,i,l,u,d,p;o===void 0&&(o=pe.safeDescriptors),Wx(e,t,n,r);var f=r.value;if((s=t.options_)!=null&&s.bound){var g;f=f.bind((g=e.proxy_)!=null?g:e.target_)}return{value:bs((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),f,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function $g(e,t){return{annotationType_:e,options_:t,make_:Gx,extend_:qx,decorate_20223_:Kx}}function Gx(e,t,n,r){var o;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!so(e.target_,t)||!Qa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Qa(n.value))return 1;var s=kg(e,this,t,n,!1,!1);return Mr(r,t,s),2}function qx(e,t,n,r){var o,s=kg(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function Kx(e,t){var n,r=t.name,o=t.addInitializer;return Qa(e)||(e=Ss(e)),(n=this.options_)!=null&&n.bound&&o(function(){var s=this,a=s[r].bind(s);a.isMobXFlow=!0,s[r]=a}),e}function Zx(e,t,n,r){t.annotationType_,r.value}function kg(e,t,n,r,o,s){s===void 0&&(s=pe.safeDescriptors),Zx(e,t,n,r);var a=r.value;if(Qa(a)||(a=Ss(a)),o){var i;a=a.bind((i=e.proxy_)!=null?i:e.target_),a.isMobXFlow=!0}return{value:a,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function od(e,t){return{annotationType_:e,options_:t,make_:Yx,extend_:Xx,decorate_20223_:Jx}}function Yx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Xx(e,t,n,r){return Qx(e,this,t,n),e.defineComputedProperty_(t,ms({},this.options_,{get:n.get,set:n.set}),r)}function Jx(e,t){var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=Cs(this)[Ee],a=ms({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),s.values_.set(r,new dr(a))}),function(){return this[Ee].getObservablePropValue_(r)}}function Qx(e,t,n,r){t.annotationType_,r.get}function Ml(e,t){return{annotationType_:e,options_:t,make_:Rx,extend_:eE,decorate_20223_:tE}}function Rx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function eE(e,t,n,r){var o,s;return nE(e,this),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:vs,r)}function tE(e,t){var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,p=Cs(i)[Ee],f=new Oo(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:vs,"ObservableObject."+o.toString(),!1);p.values_.set(o,f),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[Ee].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function nE(e,t,n,r){t.annotationType_}var rE="true",oE=Ig();function Ig(e){return{annotationType_:rE,options_:e,make_:sE,extend_:aE,decorate_20223_:iE}}function sE(e,t,n,r){var o,s;if(n.get)return kl.make_(e,t,n,r);if(n.set){var a=bs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Mr(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if(Pg(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?Ss.bound:Ss;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Xa.bound:Xa;return d.make_(e,t,n,r)}var p=((o=this.options_)==null?void 0:o.deep)===!1?Kt.ref:Kt;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var f;n.value=n.value.bind((f=e.proxy_)!=null?f:e.target_)}return p.make_(e,t,n,r)}function aE(e,t,n,r){var o,s;if(n.get)return kl.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:bs(t.toString(),n.set)},r);if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var a;n.value=n.value.bind((a=e.proxy_)!=null?a:e.target_)}var i=((s=this.options_)==null?void 0:s.deep)===!1?Kt.ref:Kt;return i.extend_(e,t,n,r)}function iE(e,t){We("'"+this.annotationType_+"' cannot be used as a decorator")}var lE="observable",cE="observable.ref",uE="observable.shallow",dE="observable.struct",Vg={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Vg);function Nl(e){return e||Vg}var sd=Ml(lE),pE=Ml(cE,{enhancer:Ll}),fE=Ml(uE,{enhancer:Hx}),hE=Ml(dE,{enhancer:jx}),Hg=Nr(sd);function $l(e){return e.deep===!0?vs:e.deep===!1?Ll:mE(e.defaultDecorator)}function gE(e){var t;return e?(t=e.defaultDecorator)!=null?t:Ig(e):void 0}function mE(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:vs}function jg(e,t,n){if(qa(t))return sd.decorate_20223_(e,t);if(gs(t)){Ga(e,t,sd);return}return md(e)?e:ro(e)?Kt.object(e,t,n):Array.isArray(e)?Kt.array(e,t):Qs(e)?Kt.map(e,t):oo(e)?Kt.set(e,t):typeof e=="object"&&e!==null?e:Kt.box(e,t)}Sg(jg,Hg);var vE={box:function(t,n){var r=Nl(n);return new Oo(t,$l(r),r.name,!0,r.equals)},array:function(t,n){var r=Nl(n);return(pe.useProxies===!1||r.proxy===!1?mP:aP)(t,$l(r),r.name)},map:function(t,n){var r=Nl(n);return new c1(t,$l(r),r.name)},set:function(t,n){var r=Nl(n);return new d1(t,$l(r),r.name)},object:function(t,n,r){return Lo(function(){return r1(pe.useProxies===!1||(r==null?void 0:r.proxy)===!1?Cs({},r):nP({},r),t,n)})},ref:Nr(pE),shallow:Nr(fE),deep:Hg,struct:Nr(hE)},Kt=Sg(jg,vE),Dg="computed",bE="computed.struct",ad=od(Dg),yE=od(bE,{equals:Al.structural}),kl=function(t,n){if(qa(n))return ad.decorate_20223_(t,n);if(gs(n))return Ga(t,n,ad);if(ro(t))return Nr(od(Dg,t));var r=ro(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new dr(r)};Object.assign(kl,ad),kl.struct=Nr(yE);var Fg,Bg,Il=0,wE=1,SE=(Fg=(Bg=Ol(function(){},"name"))==null?void 0:Bg.configurable)!=null?Fg:!1,zg={value:"action",configurable:!0,writable:!1,enumerable:!1};function bs(e,t,n,r){n===void 0&&(n=!1);function o(){return CE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},SE&&(zg.value=e,Mr(o,"name",zg)),o}function CE(e,t,n,r,o){var s=xE(e,t);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{EE(s)}}function xE(e,t,n,r){var o=Xt.NODE_ENV!=="production",s=0,a=pe.trackingDerivation,i=!t||!a;Wn();var l=pe.allowStateChanges;i&&(ys(),l=id(!0));var u=dd(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:o,startTime_:s,actionId_:wE++,parentActionId_:Il};return Il=d.actionId_,d}function EE(e){Il!==e.actionId_&&We(30),Il=e.parentActionId_,e.error_!==void 0&&(pe.suppressReactionErrors=!0),ld(e.prevAllowStateChanges_),Ya(e.prevAllowStateReads_),Gn(),e.runAsAction_&&ao(e.prevDerivation_),pe.suppressReactionErrors=!1}function id(e){var t=pe.allowStateChanges;return pe.allowStateChanges=e,t}function ld(e){pe.allowStateChanges=e}var Oo=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s="ObservableValue"),i===void 0&&(i=Al.default),l=e.call(this,s)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=o,l.name_=s,l.equals=i,l.value_=o(r,void 0,s),l}Lg(t,e);var n=t.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){this.value_,o=this.prepareNewValue_(o),o!==pe.UNCHANGED&&this.setNewValue_(o)},n.prepareNewValue_=function(o){if(qn(this)){var s=Kn(this,{object:this,type:$r,newValue:o});if(!s)return pe.UNCHANGED;o=s.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?pe.UNCHANGED:o},n.setNewValue_=function(o){var s=this.value_;this.value_=o,this.reportChanged(),fr(this)&&hr(this,{type:$r,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Ra(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:$r,newValue:this.value_,oldValue:void 0}),ei(this,o)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return _g(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(To),PE=Po("ObservableValue",Oo),dr=function(){function e(n){this.dependenciesState_=Xe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Xe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Hl(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Vl.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||We(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=bs("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Al.structural:Al.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){LE(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&We(32,this.name_,this.derivation),pe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)cd(this)&&(this.warnAboutUntrackedRead_(),Wn(),this.value_=this.computeValue_(!1),Gn());else if(Yg(this),cd(this)){var r=pe.trackingContext;this.keepAlive_&&!r&&(pe.trackingContext=this),this.trackAndCompute()&&AE(this),pe.trackingContext=r}var o=this.value_;if(jl(o))throw o.cause;return o},t.set=function(r){if(this.setter_){this.isRunningSetter&&We(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else We(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===Xe.NOT_TRACKING_,s=this.computeValue_(!0),a=o||jl(r)||jl(s)||!this.equals_(r,s);return a&&(this.value_=s),a},t.computeValue_=function(r){this.isComputing=!0;var o=id(!1),s;if(r)s=Ug(this,this.derivation,this.scope_);else if(pe.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(a){s=new Hl(a)}return ld(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(ud(this),this.value_=void 0)},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return FE(function(){var l=s.get();if(!a||o){var u=ys();r({observableKind:"computed",debugObjectName:s.name_,type:$r,object:s,newValue:l,oldValue:i}),ao(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return _g(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ea(e,[{key:"isComputing",get:function(){return An(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return An(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return An(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return An(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ln(this.flags_,e.diffValueMask_,r===1)}}])}();dr.isComputingMask_=1,dr.isRunningSetterMask_=2,dr.isBeingObservedMask_=4,dr.isPendingUnobservationMask_=8,dr.diffValueMask_=16;var Za=Po("ComputedValue",dr),Xe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Xe||(Xe={}));var Vl;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Vl||(Vl={}));var Hl=function(t){this.cause=void 0,this.cause=t};function jl(e){return e instanceof Hl}function cd(e){switch(e.dependenciesState_){case Xe.UP_TO_DATE_:return!1;case Xe.NOT_TRACKING_:case Xe.STALE_:return!0;case Xe.POSSIBLY_STALE_:{for(var t=dd(!0),n=ys(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Za(a)){if(pe.disableErrorBoundaries)a.get();else try{a.get()}catch{return ao(n),Ya(t),!0}if(e.dependenciesState_===Xe.STALE_)return ao(n),Ya(t),!0}}return Gg(e),ao(n),Ya(t),!1}}}function Yj(e){}function Ug(e,t,n){var r=dd(!0);Gg(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++pe.runId;var o=pe.trackingDerivation;pe.trackingDerivation=e,pe.inBatch++;var s;if(pe.disableErrorBoundaries===!0)s=t.call(n);else try{s=t.call(n)}catch(a){s=new Hl(a)}return pe.inBatch--,pe.trackingDerivation=o,TE(e),Ya(r),s}function TE(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Xe.UP_TO_DATE_,o=0,s=e.unboundDepsCount_,a=0;a<s;a++){var i=n[a];i.diffValue===0&&(i.diffValue=1,o!==a&&(n[o]=i),o++),i.dependenciesState_>r&&(r=i.dependenciesState_)}for(n.length=o,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&Kg(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,_E(u,e))}r!==Xe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function ud(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Kg(t[n],e);e.dependenciesState_=Xe.NOT_TRACKING_}function Wg(e){var t=ys();try{return e()}finally{ao(t)}}function ys(){var e=pe.trackingDerivation;return pe.trackingDerivation=null,e}function ao(e){pe.trackingDerivation=e}function dd(e){var t=pe.allowStateReads;return pe.allowStateReads=e,t}function Ya(e){pe.allowStateReads=e}function Gg(e){if(e.dependenciesState_!==Xe.UP_TO_DATE_){e.dependenciesState_=Xe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Xe.UP_TO_DATE_}}var Dl=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Fl=!0,qg=!1,pe=function(){var e=Tl();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Fl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Dl().version&&(Fl=!1),Fl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Dl):(setTimeout(function(){qg||We(35)},1),new Dl)}();function OE(){if((pe.pendingReactions.length||pe.inBatch||pe.isRunningReactions)&&We(36),qg=!0,Fl){var e=Tl();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),pe=new Dl}}function _E(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Kg(e,t){e.observers_.delete(t),e.observers_.size===0&&Zg(e)}function Zg(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,pe.pendingUnobservations.push(e))}function Wn(){pe.inBatch++}function Gn(){if(--pe.inBatch===0){Jg();for(var e=pe.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof dr&&n.suspend_())}pe.pendingUnobservations=[]}}function Yg(e){var t=pe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&pe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&pe.inBatch>0&&Zg(e),!1)}function Xg(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Xe.STALE_}))}function AE(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.POSSIBLY_STALE_?t.dependenciesState_=Xe.STALE_:t.dependenciesState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.UP_TO_DATE_)}))}function LE(e){e.lowestObserverState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&(t.dependenciesState_=Xe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var io=function(){function e(n,r,o,s){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Xe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Vl.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,pe.pendingReactions.push(this),Jg())},t.runReaction_=function(){if(!this.isDisposed){Wn(),this.isScheduled=!1;var r=pe.trackingContext;if(pe.trackingContext=this,cd(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Xt.NODE_ENV!=="production"&&this.isTrackPending&&ws()}catch(o){this.reportExceptionInDerivation_(o)}}pe.trackingContext=r,Gn()}},t.track=function(r){if(!this.isDisposed){Wn(),this.isRunning=!0;var o=pe.trackingContext;pe.trackingContext=this;var s=Ug(this,r,void 0);pe.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&ud(this),jl(s)&&this.reportExceptionInDerivation_(s.cause),Gn()}},t.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(pe.disableErrorBoundaries)throw r;var s="[mobx] uncaught error in '"+this+"'";pe.suppressReactionErrors||console.error(s,r),pe.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Wn(),ud(this),Gn()))},t.getDisposer_=function(r){var o=this,s=function a(){o.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",s),s[Ee]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},ea(e,[{key:"isDisposed",get:function(){return An(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return An(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return An(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return An(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Ln(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ln(this.flags_,e.diffValueMask_,r===1)}}])}();io.isDisposedMask_=1,io.isScheduledMask_=2,io.isTrackPendingMask_=4,io.isRunningMask_=8,io.diffValueMask_=16;var ME=100,pd=function(t){return t()};function Jg(){pe.inBatch>0||pe.isRunningReactions||pd(NE)}function NE(){pe.isRunningReactions=!0;for(var e=pe.pendingReactions,t=0;e.length>0;){++t===ME&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction_()}pe.isRunningReactions=!1}var Bl=Po("Reaction",io);function $E(e){var t=pd;pd=function(r){return e(function(){return t(r)})}}function ws(){return Xt.NODE_ENV!=="production"}function Xj(e){}function Jj(e){}function Qj(e){}function kE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Qg="action",IE="action.bound",Rg="autoAction",VE="autoAction.bound",HE="<unnamed action>",fd=Ka(Qg),jE=Ka(IE,{bound:!0}),hd=Ka(Rg,{autoAction:!0}),DE=Ka(VE,{autoAction:!0,bound:!0});function e1(e){var t=function(r,o){if(cr(r))return bs(r.name||HE,r,e);if(cr(o))return bs(r,o,e);if(qa(o))return(e?hd:fd).decorate_20223_(r,o);if(gs(o))return Ga(r,o,e?hd:fd);if(gs(r))return Nr(Ka(e?Rg:Qg,{name:r,autoAction:e}))};return t}var na=e1(!1);Object.assign(na,fd);var Xa=e1(!0);Object.assign(Xa,hd),na.bound=Nr(jE),Xa.bound=Nr(DE);function Ja(e){return cr(e)&&e.isMobxAction===!0}function FE(e,t){var n,r,o,s;t===void 0&&(t=Cg);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new io(a,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=zE(t),d=!1;l=new io(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(p)}))},t.onError,t.requiresObservable)}function p(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var BE=function(t){return t()};function zE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:BE}var UE="onBO",WE="onBUO";function GE(e,t,n){return n1(UE,e,t,n)}function t1(e,t,n){return n1(WE,e,t,n)}function n1(e,t,n,r){var o=ql(t),s=cr(r)?r:n,a=e+"L";return o[a]?o[a].add(s):o[a]=new Set([s]),function(){var i=o[a];i&&(i.delete(s),i.size===0&&delete o[a])}}var qE="never",zl="always",KE="observed";function ZE(e){e.isolateGlobalState===!0&&OE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(pe.useProxies=t===zl?!0:t===qE?!1:typeof Proxy<"u"),t==="ifavailable"&&(pe.verifyProxies=!0),n!==void 0){var r=n===zl?zl:n===KE;pe.enforceActions=r,pe.allowStateChanges=!(r===!0||r===zl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(pe[o]=!!e[o])}),pe.allowStateReads=!pe.observableRequiresReaction,e.reactionScheduler&&$E(e.reactionScheduler)}function r1(e,t,n,r){var o=Ox(t);return Lo(function(){var s=Cs(e,r)[Ee];Rs(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function YE(e,t){return o1(ql(e,t))}function o1(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=XE(e.observing_).map(o1)),t}function XE(e){return Array.from(new Set(e))}var JE=0;function s1(){this.message="FLOW_CANCELLED"}s1.prototype=Object.create(Error.prototype);var gd=$g("flow"),QE=$g("flow.bound",{bound:!0}),Ss=Object.assign(function(t,n){if(qa(n))return gd.decorate_20223_(t,n);if(gs(n))return Ga(t,n,gd);var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++JE,d=na(o+" - runid: "+u+" - init",r).apply(i,l),p,f=void 0,g=new Promise(function(m,v){var b=0;p=v;function w(C){f=void 0;var x;try{x=na(o+" - runid: "+u+" - yield "+b++,d.next).call(d,C)}catch(E){return v(E)}S(x)}function y(C){f=void 0;var x;try{x=na(o+" - runid: "+u+" - yield "+b++,d.throw).call(d,C)}catch(E){return v(E)}S(x)}function S(C){if(cr(C==null?void 0:C.then)){C.then(S,v);return}return C.done?m(C.value):(f=Promise.resolve(C.value),f.then(w,y))}w(void 0)});return g.cancel=na(o+" - runid: "+u+" - cancel",function(){try{f&&a1(f);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(Js,Js),a1(v),p(new s1)}catch(b){p(b)}}),g};return s.isMobXFlow=!0,s},gd);Ss.bound=Nr(QE);function a1(e){cr(e.cancel)&&e.cancel()}function Qa(e){return(e==null?void 0:e.isMobXFlow)===!0}function RE(e,t){return e?ni(e)||!!e[Ee]||rd(e)||Bl(e)||Za(e):!1}function md(e){return RE(e)}function eP(e){if(ni(e))return e[Ee].ownKeys_();We(38)}function Ul(e,t,n){return e.set(t,n),n}function ra(e,t){if(e==null||typeof e!="object"||e instanceof Date||!md(e))return e;if(PE(e)||Za(e))return ra(e.get(),t);if(t.has(e))return t.get(e);if(ti(e)){var n=Ul(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=ra(a,t)}),n}if(mr(e)){var r=Ul(t,e,new Set);return e.forEach(function(a){r.add(ra(a,t))}),r}if(Ao(e)){var o=Ul(t,e,new Map);return e.forEach(function(a,i){o.set(i,ra(a,t))}),o}else{var s=Ul(t,e,{});return eP(e).forEach(function(a){Ua.propertyIsEnumerable.call(e,a)&&(s[a]=ra(e[a],t))}),s}}function pr(e,t){return ra(e,new Map)}function lo(e,t){t===void 0&&(t=void 0),Wn();try{return e.apply(t)}finally{Gn()}}function oa(e){return e[Ee]}var tP={has:function(t,n){return oa(t).has_(n)},get:function(t,n){return oa(t).get_(n)},set:function(t,n,r){var o;return gs(n)?(o=oa(t).set_(n,r,!0))!=null?o:!0:!1},deleteProperty:function(t,n){var r;return gs(n)?(r=oa(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return(o=oa(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return oa(t).ownKeys_()},preventExtensions:function(t){We(13)}};function nP(e,t){var n,r;return xg(),e=Cs(e,t),(r=(n=e[Ee]).proxy_)!=null?r:n.proxy_=new Proxy(e,tP)}function qn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Ra(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Eg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Kn(e,t){var n=ys();try{for(var r=[].concat(e.interceptors_||[]),o=0,s=r.length;o<s&&(t=r[o](t),t&&!t.type&&We(14),!!t);o++);return t}finally{ao(n)}}function fr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ei(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Eg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function hr(e,t){var n=ys(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);ao(n)}}function rP(e,t,n){return Lo(function(){var r,o=Cs(e,n)[Ee];Xt.NODE_ENV!=="production"&&t&&e[ur],(r=t)!=null||(t=Nx(e)),Rs(t).forEach(function(s){return o.make_(s,t[s])})}),e}var vd=Symbol("mobx-keys");function an(e,t,n){return ro(e)?r1(e,e,t,n):(Lo(function(){var r=Cs(e,n)[Ee];if(!e[vd]){var o=Object.getPrototypeOf(e),s=new Set([].concat(Rs(e),Rs(o)));s.delete("constructor"),s.delete(Ee),Wa(o,vd,s)}e[vd].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var i1="splice",$r="update",oP=1e4,sP={get:function(t,n){var r=t[Ee];return n===Ee?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):so(Wl,n)?Wl[n]:t[n]},set:function(t,n,r){var o=t[Ee];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){We(15)}},bd=function(){function e(n,r,o,s){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=o,this.legacyMode_=s,this.atom_=new To(n),this.enhancer_=function(a,i){return r(a,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Ra(this,r)},t.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ei(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&We("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var s=new Array(r-o),a=0;a<r-o;a++)s[a]=void 0;this.spliceWithArray_(o,0,s)}else this.spliceWithArray_(r,o-r)},t.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&We(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&w1(r+o+1)},t.spliceWithArray_=function(r,o,s){var a=this;this.atom_;var i=this.values_.length;if(r===void 0?r=0:r>i?r=i:r<0&&(r=Math.max(0,i+r)),arguments.length===1?o=i-r:o==null?o=0:o=Math.max(0,Math.min(o,i-r)),s===void 0&&(s=td),qn(this)){var l=Kn(this,{object:this.proxy_,type:i1,index:r,removedCount:o,added:s});if(!l)return td;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(p){return a.enhancer_(p,void 0)}),this.legacyMode_||Xt.NODE_ENV!=="production"){var u=s.length-o;this.updateArrayLength_(i,u)}var d=this.spliceItemsIntoValues_(r,o,s);return(o!==0||s.length!==0)&&this.notifyArraySplice_(r,s,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,o,s){if(s.length<oP){var a;return(a=this.values_).splice.apply(a,[r,o].concat(s))}else{var i=this.values_.slice(r,r+o),l=this.values_.slice(r+o);this.values_.length+=s.length-o;for(var u=0;u<s.length;u++)this.values_[r+u]=s[u];for(var d=0;d<l.length;d++)this.values_[r+s.length+d]=l[d];return i}},t.notifyArrayChildUpdate_=function(r,o,s){var a=!this.owned_&&ws(),i=fr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:$r,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;this.atom_.reportChanged(),i&&hr(this,l)},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&ws(),i=fr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:i1,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;this.atom_.reportChanged(),i&&hr(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,o){var s=this.values_;if(this.legacyMode_&&r>s.length&&We(17,r,s.length),r<s.length){this.atom_;var a=s[r];if(qn(this)){var i=Kn(this,{type:$r,object:this.proxy_,index:r,newValue:o});if(!i)return;o=i.newValue}o=this.enhancer_(o,a);var l=o!==a;l&&(s[r]=o,this.notifyArrayChildUpdate_(r,o,a))}else{for(var u=new Array(r+1-s.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=o,this.spliceWithArray_(s.length,0,u)}},e}();function aP(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),xg(),Lo(function(){var o=new bd(n,t,r,!1);Tg(o.values_,Ee,o);var s=new Proxy(o.values_,sP);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Wl={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ee];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var a=this[Ee];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(t);case 2:return a.spliceWithArray_(t,n)}return a.spliceWithArray_(t,n,o)},spliceWithArray:function(t,n,r){return this[Ee].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Ee],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ee],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return pe.trackingDerivation&&We(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){pe.trackingDerivation&&We(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ee],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};vt("at",Mn),vt("concat",Mn),vt("flat",Mn),vt("includes",Mn),vt("indexOf",Mn),vt("join",Mn),vt("lastIndexOf",Mn),vt("slice",Mn),vt("toString",Mn),vt("toLocaleString",Mn),vt("toSorted",Mn),vt("toSpliced",Mn),vt("with",Mn),vt("every",gr),vt("filter",gr),vt("find",gr),vt("findIndex",gr),vt("findLast",gr),vt("findLastIndex",gr),vt("flatMap",gr),vt("forEach",gr),vt("map",gr),vt("some",gr),vt("toReversed",gr),vt("reduce",l1),vt("reduceRight",l1);function vt(e,t){typeof Array.prototype[e]=="function"&&(Wl[e]=t(e))}function Mn(e){return function(){var t=this[Ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function gr(e){return function(t,n){var r=this,o=this[Ee];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function l1(e){return function(){var t=this,n=this[Ee];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(s,a,i){return o(s,a,i,t)},r[e].apply(r,arguments)}}var iP=Po("ObservableArrayAdministration",bd);function ti(e){return _l(e)&&iP(e[Ee])}var lP={},_o="add",Gl="delete",c1=function(){function e(n,r,o){var s=this;r===void 0&&(r=vs),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ee]=lP,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=o,cr(Map)||We(18),Lo(function(){s.keysAtom_=Mg(Xt.NODE_ENV!=="production"?s.name_+".keys()":"ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,n&&s.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var o=this;if(!pe.trackingDerivation)return this.has_(r);var s=this.hasMap_.get(r);if(!s){var a=s=new Oo(this.has_(r),Ll,"ObservableMap.key?",!1);this.hasMap_.set(r,a),t1(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(qn(this)){var a=Kn(this,{type:s?$r:_o,object:this,newValue:o,name:r});if(!a)return this;o=a.newValue}return s?this.updateValue_(r,o):this.addValue_(r,o),this},t.delete=function(r){var o=this;if(this.keysAtom_,qn(this)){var s=Kn(this,{type:Gl,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=ws(),i=fr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Gl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return lo(function(){var u;o.keysAtom_.reportChanged(),(u=o.hasMap_.get(r))==null||u.setNewValue_(!1);var d=o.data_.get(r);d.setNewValue_(void 0),o.data_.delete(r)}),i&&hr(this,l),!0}return!1},t.updateValue_=function(r,o){var s=this.data_.get(r);if(o=s.prepareNewValue_(o),o!==pe.UNCHANGED){var a=ws(),i=fr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:$r,object:this,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&hr(this,l)}},t.addValue_=function(r,o){var s=this;this.keysAtom_,lo(function(){var u,d=new Oo(o,s.enhancer_,"ObservableMap.key",!1);s.data_.set(r,d),o=d.value_,(u=s.hasMap_.get(r))==null||u.setNewValue_(!0),s.keysAtom_.reportChanged()});var a=ws(),i=fr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:_o,object:this,name:r,newValue:o}:null;i&&hr(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,o=this.keys();return u1({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:r.get(l)}}})},t.entries=function(){var r=this,o=this.keys();return u1({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,o){for(var s=ta(this),a;!(a=s()).done;){var i=a.value,l=i[0],u=i[1];r.call(o,u,l,this)}},t.merge=function(r){var o=this;return Ao(r)&&(r=new Map(r)),lo(function(){ro(r)?Tx(r).forEach(function(s){return o.set(s,r[s])}):Array.isArray(r)?r.forEach(function(s){var a=s[0],i=s[1];return o.set(a,i)}):Qs(r)?(Px(r)||We(19,r),r.forEach(function(s,a){return o.set(a,s)})):r!=null&&We(20,r)}),this},t.clear=function(){var r=this;lo(function(){Wg(function(){for(var o=ta(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return lo(function(){for(var s=cP(r),a=new Map,i=!1,l=ta(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var p=o.delete(d);if(p)i=!0;else{var f=o.data_.get(d);a.set(d,f)}}}for(var g=ta(s.entries()),m;!(m=g()).done;){var v=m.value,b=v[0],w=v[1],y=o.data_.has(b);if(o.set(b,w),o.data_.has(b)){var S=o.data_.get(b);a.set(b,S),y||(i=!0)}}if(!i)if(o.data_.size!==a.size)o.keysAtom_.reportChanged();else for(var C=o.data_.keys(),x=a.keys(),E=C.next(),P=x.next();!E.done;){if(E.value!==P.value){o.keysAtom_.reportChanged();break}E=C.next(),P=x.next()}o.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},ea(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Ao=Po("ObservableMap",c1);function u1(e){return e[Symbol.toStringTag]="MapIterator",Ed(e)}function cP(e){if(Qs(e)||Ao(e))return e;if(Array.isArray(e))return new Map(e);if(ro(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return We(21,e)}var uP={},d1=function(){function e(n,r,o){var s=this;r===void 0&&(r=vs),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[Ee]=uP,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=o,cr(Set)||We(22),this.enhancer_=function(a,i){return r(a,i,o)},Lo(function(){s.atom_=Mg(s.name_),n&&s.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;lo(function(){Wg(function(){for(var o=ta(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=ta(this),a;!(a=s()).done;){var i=a.value;r.call(o,i,i,this)}},t.add=function(r){var o=this;if(this.atom_,qn(this)){var s=Kn(this,{type:_o,object:this,newValue:r});if(!s)return this}if(!this.has(r)){lo(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=Xt.NODE_ENV!=="production",i=fr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:_o,object:this,newValue:r}:null;i&&hr(this,l)}return this},t.delete=function(r){var o=this;if(qn(this)){var s=Kn(this,{type:Gl,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=Xt.NODE_ENV!=="production",i=fr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Gl,object:this,oldValue:r}:null;return lo(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&hr(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,o=Array.from(this.keys()),s=Array.from(this.values());return p1({next:function(){var i=r;return r+=1,i<s.length?{value:[o[i],s[i]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,o=0,s=Array.from(this.data_.values());return p1({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(oo(r)&&!mr(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(oo(r)&&!mr(r))return r.union(this);var o=new Set(this);return o.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(oo(r)&&!mr(r))return r.symmetricDifference(this);var o=new Set(this);return o.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(oo(r)&&!mr(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return mr(r)&&(r=new Set(r)),lo(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):oo(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):r!=null&&We("Cannot initialize set from "+r)}),this},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ea(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),mr=Po("ObservableSet",d1);function p1(e){return e[Symbol.toStringTag]="SetIterator",Ed(e)}var f1=Object.create(null),h1="remove",g1=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=oE),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=o,this.defaultAnnotation_=s,this.keysAtom_=new To("ObservableObject.keys"),this.isPlainObject_=ro(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,o){var s=this.values_.get(r);if(s instanceof dr)return s.set(o),!0;if(qn(this)){var a=Kn(this,{type:$r,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=s.prepareNewValue_(o),o!==pe.UNCHANGED){var i=fr(this),l=Xt.NODE_ENV!=="production",u=i||l?{type:$r,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&hr(this,u)}return!0},t.get_=function(r){return pe.trackingDerivation&&!so(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),so(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):s?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(r){if(!pe.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Oo(r in this.target_,Ll,"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},t.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(!(r in this.target_)){var s;if((s=this.target_[ur])!=null&&s[r])return;We(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==Ua;){var i=Ol(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}v1(this,o,r)}},t.extend_=function(r,o,s,a){if(a===void 0&&(a=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(r,o,a);var i=s.extend_(this,r,o,a);return i&&v1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Wn();var a=this.delete_(r);if(!a)return a;if(qn(this)){var i=Kn(this,{object:this.proxy_||this.target_,name:r,type:_o,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=ms({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else Mr(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{Gn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),this.keysAtom_;try{Wn();var i=this.delete_(r);if(!i)return i;if(qn(this)){var l=Kn(this,{object:this.proxy_||this.target_,name:r,type:_o,newValue:o});if(!l)return null;o=l.newValue}var u=m1(r),d={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Mr(this.target_,r,d);var p=new Oo(o,s,Xt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,p),this.notifyPropertyAddition_(r,p.value_)}finally{Gn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Wn();var a=this.delete_(r);if(!a)return a;if(qn(this)){var i=Kn(this,{object:this.proxy_||this.target_,name:r,type:_o,newValue:void 0});if(!i)return null}o.name||(o.name=Xt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=m1(r),u={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Mr(this.target_,r,u);this.values_.set(r,new dr(o)),this.notifyPropertyAddition_(r,void 0)}finally{Gn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),this.keysAtom_,!so(this.target_,r))return!0;if(qn(this)){var s=Kn(this,{object:this.proxy_||this.target_,name:r,type:h1});if(!s)return null}try{var a;Wn();var i=fr(this),l=Xt.NODE_ENV!=="production"&&ws(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var p;d=(p=Ol(this.target_,r))==null?void 0:p.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Xt.NODE_ENV,u&&(this.values_.delete(r),u instanceof Oo&&(d=u.value_),Xg(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var f={type:h1,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Xt.NODE_ENV,i&&hr(this,f),Xt.NODE_ENV}}finally{Gn()}return!0},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=fr(this),i=Xt.NODE_ENV!=="production";if(a||i){var l=a||i?{type:_o,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;a&&hr(this,l)}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Rs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Cs(e,t){var n;if(so(e,Ee))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",o=new g1(e,new Map,String(r),gE(t));return Wa(e,Ee,o),e}var dP=Po("ObservableObjectAdministration",g1);function m1(e){return f1[e]||(f1[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(n){return this[Ee].setObservablePropValue_(e,n)}})}function ni(e){return _l(e)?dP(e[Ee]):!1}function v1(e,t,n){var r;(r=e.target_[ur])==null||delete r[n]}var pP=y1(0),fP=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),yd=0,b1=function(){};function hP(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}hP(b1,Array.prototype);var wd=function(e){function t(r,o,s,a){var i;return s===void 0&&(s="ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,Lo(function(){var l=new bd(s,o,a,!0);l.proxy_=i,Tg(i,Ee,l),r&&r.length&&i.spliceWithArray(0,0,r),fP&&Object.defineProperty(i,"0",pP)}),i}Lg(t,e);var n=t.prototype;return n.concat=function(){this[Ee].atom_.reportObserved();for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return Array.prototype.concat.apply(this.slice(),s.map(function(i){return ti(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return Ed({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},ea(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(o){this[Ee].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(b1);Object.entries(Wl).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Wa(wd.prototype,t,n)});function y1(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(n){this[Ee].set_(e,n)}}}function gP(e){Mr(wd.prototype,""+e,y1(e))}function w1(e){if(e>yd){for(var t=yd;t<e+100;t++)gP(t);yd=e}}w1(1e3);function mP(e,t,n){return new wd(e,t,n)}function ql(e,t){if(typeof e=="object"&&e!==null){if(ti(e))return t!==void 0&&We(23),e[Ee].atom_;if(mr(e))return e.atom_;if(Ao(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||We(25,t,Sd(e)),n}if(ni(e)){if(!t)return We(26);var r=e[Ee].values_.get(t);return r||We(27,t,Sd(e)),r}if(rd(e)||Za(e)||Bl(e))return e}else if(cr(e)&&Bl(e[Ee]))return e[Ee];We(28)}function vP(e,t){if(e||We(29),rd(e)||Za(e)||Bl(e)||Ao(e)||mr(e))return e;if(e[Ee])return e[Ee];We(24,e)}function Sd(e,t){var n;if(t!==void 0)n=ql(e,t);else{if(Ja(e))return e.name;ni(e)||Ao(e)||mr(e)?n=vP(e):n=ql(e)}return n.name_}function Lo(e){var t=ys(),n=id(!0);Wn();try{return e()}finally{Gn(),ld(n),ao(t)}}var S1=Ua.toString;function Cd(e,t,n){return n===void 0&&(n=-1),xd(e,t,n)}function xd(e,t,n,r,o){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var a=S1.call(e);if(a!==S1.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=C1(e),t=C1(t);var i=a==="[object Array]";if(!i){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(cr(l)&&l instanceof l&&cr(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],o=o||[];for(var d=r.length;d--;)if(r[d]===e)return o[d]===t;if(r.push(e),o.push(t),i){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!xd(e[d],t[d],n-1,r,o))return!1}else{var p=Object.keys(e),f;if(d=p.length,Object.keys(t).length!==d)return!1;for(;d--;)if(f=p[d],!(so(t,f)&&xd(e[f],t[f],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function C1(e){return ti(e)?e.slice():Qs(e)||Ao(e)||oo(e)||mr(e)?Array.from(e.entries()):e}var x1,bP=((x1=Tl().Iterator)==null?void 0:x1.prototype)||{};function Ed(e){return e[Symbol.iterator]=yP,Object.assign(Object.create(bP),e)}function yP(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=Tl();typeof t[e]>"u"&&We("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:kE,extras:{getDebugName:Sd},$mobx:Ee}),!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!rP)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function wP(e){e()}function SP(e){e||(e=wP),ZE({reactionScheduler:e})}function CP(e){return YE(e)}var xP=1e4,EP=1e4,PP=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=xP),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var o=Date.now();n.registrations.forEach(function(s,a){o-s.registeredAt>=r&&(n.finalize(s.value),n.registrations.delete(a))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,EP))}}),e}(),TP=typeof FinalizationRegistry<"u"?FinalizationRegistry:PP,Pd=new TP(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),E1={exports:{}},Td={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",a=0;a<arguments.length;a++){var i=arguments[a];i&&(s=o(s,r(i)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var i in s)t.call(s,i)&&s[i]&&(a=o(a,i));return a}function o(s,a){return a?s?s+" "+a:s+a:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(_h);var Ix=_h.exports;const N=td(Ix);var Jt={NODE_ENV:"production"};function Ze(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Vx={};function Ml(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Vx}var Ah=Object.assign,Ll=Object.getOwnPropertyDescriptor,kr=Object.defineProperty,Ga=Object.prototype,sd=[];Object.freeze(sd);var Mh={};Object.freeze(Mh);var Hx=typeof Proxy<"u",jx=Object.toString();function Lh(){Hx||Ze("Proxy not available")}function Nh(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Qs=function(){};function ur(e){return typeof e=="function"}function bs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Nl(e){return e!==null&&typeof e=="object"}function so(e){if(!Nl(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===jx}function $h(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function qa(e,t,n){kr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function kh(e,t,n){kr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Oo(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return Nl(r)&&r[n]===!0}}function Rs(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Dx(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function ao(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Ih=typeof Object.getOwnPropertySymbols<"u";function Fx(e){var t=Object.keys(e);if(!Ih)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Ga.propertyIsEnumerable.call(e,r)})):t}var ea=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Ih?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Vh(e){return e===null?null:typeof e=="object"?""+e:e}function io(e,t){return Ga.hasOwnProperty.call(e,t)}var Bx=Object.getOwnPropertyDescriptors||function(t){var n={};return ea(t).forEach(function(r){n[r]=Ll(t,r)}),n};function An(e,t){return!!(e&t)}function Mn(e,t,n){return n?e|=t:e&=~t,e}function Hh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zx(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wx(r.key),r)}}function ta(e,t,n){return t&&zx(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function na(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Gx(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vs(){return vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vs.apply(null,arguments)}function jh(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ad(e,t)}function ad(e,t){return ad=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ad(e,t)}function Ux(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Wx(e){var t=Ux(e,"string");return typeof t=="symbol"?t:t+""}function Gx(e,t){if(e){if(typeof e=="string")return Hh(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hh(e,t):void 0}}var dr=Symbol("mobx-stored-annotations");function Ir(e){function t(n,r){if(Za(r))return e.decorate_20223_(n,r);Ka(n,r,e)}return Object.assign(t,e)}function Ka(e,t,n){io(e,dr)||qa(e,dr,vs({},e[dr])),eE(n)||(e[dr][t]=n)}function qx(e){return io(e,dr)||qa(e,dr,vs({},e[dr])),e[dr]}function Za(e){return typeof e=="object"&&typeof e.kind=="string"}var Pe=Symbol("mobx administration"),_o=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=tt.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return r1(this)},t.reportChanged=function(){Gn(),o1(this),qn()},t.toString=function(){return this.name_},ta(e,[{key:"isBeingObserved",get:function(){return An(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return An(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Mn(this.flags_,e.diffValueMask_,r===1)}}])}();_o.isBeingObservedMask_=1,_o.isPendingUnobservationMask_=2,_o.diffValueMask_=4;var id=Oo("Atom",_o);function Dh(e,t,n){t===void 0&&(t=Qs),n===void 0&&(n=Qs);var r=new _o(e);return t!==Qs&&sP(r,t),n!==Qs&&c1(r,n),r}function Kx(e,t){return e===t}function Zx(e,t){return Td(e,t)}function Yx(e,t){return Td(e,t,1)}function Xx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var $l={identity:Kx,structural:Zx,default:Xx,shallow:Yx};function ys(e,t,n){return wd(e)?e:Array.isArray(e)?Zt.array(e,{name:n}):so(e)?Zt.object(e,void 0,{name:n}):Rs(e)?Zt.map(e,{name:n}):ao(e)?Zt.set(e,{name:n}):typeof e=="function"&&!Ra(e)&&!ei(e)?$h(e)?xs(e):Qa(n,e):e}function Jx(e,t,n){if(e==null||oi(e)||ri(e)||Lo(e)||br(e))return e;if(Array.isArray(e))return Zt.array(e,{name:n,deep:!1});if(so(e))return Zt.object(e,void 0,{name:n,deep:!1});if(Rs(e))return Zt.map(e,{name:n,deep:!1});if(ao(e))return Zt.set(e,{name:n,deep:!1})}function kl(e){return e}function Qx(e,t){return Td(e,t)?t:e}var Rx="override";function eE(e){return e.annotationType_===Rx}function Ya(e,t){return{annotationType_:e,options_:t,make_:tE,extend_:nE,decorate_20223_:rE}}function tE(e,t,n,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Ra(n.value))return 1;var s=Fh(e,this,t,n,!1);return kr(r,t,s),2}function nE(e,t,n,r){var o=Fh(e,this,t,n);return e.defineProperty_(t,o,r)}function rE(e,t){var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,p,f,h;return ws((d=(p=s.options_)==null?void 0:p.name)!=null?d:r.toString(),u,(f=(h=s.options_)==null?void 0:h.autoAction)!=null?f:!1)};if(n=="field")return function(l){var u,d=l;return Ra(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Ra(e)||(e=a(e)),(i=this.options_)!=null&&i.bound&&o(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}Ze("Cannot apply '"+s.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
7
+ '`+s.annotationType_+"' can only be used on properties with a function value."))}function oE(e,t,n,r){t.annotationType_,r.value}function Fh(e,t,n,r,o){var s,a,i,l,u,d,p;o===void 0&&(o=fe.safeDescriptors),oE(e,t,n,r);var f=r.value;if((s=t.options_)!=null&&s.bound){var h;f=f.bind((h=e.proxy_)!=null?h:e.target_)}return{value:ws((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),f,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Bh(e,t){return{annotationType_:e,options_:t,make_:sE,extend_:aE,decorate_20223_:iE}}function sE(e,t,n,r){var o;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!io(e.target_,t)||!ei(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(ei(n.value))return 1;var s=zh(e,this,t,n,!1,!1);return kr(r,t,s),2}function aE(e,t,n,r){var o,s=zh(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function iE(e,t){var n,r=t.name,o=t.addInitializer;return ei(e)||(e=xs(e)),(n=this.options_)!=null&&n.bound&&o(function(){var s=this,a=s[r].bind(s);a.isMobXFlow=!0,s[r]=a}),e}function lE(e,t,n,r){t.annotationType_,r.value}function zh(e,t,n,r,o,s){s===void 0&&(s=fe.safeDescriptors),lE(e,t,n,r);var a=r.value;if(ei(a)||(a=xs(a)),o){var i;a=a.bind((i=e.proxy_)!=null?i:e.target_),a.isMobXFlow=!0}return{value:a,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function ld(e,t){return{annotationType_:e,options_:t,make_:cE,extend_:uE,decorate_20223_:dE}}function cE(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function uE(e,t,n,r){return pE(e,this,t,n),e.defineComputedProperty_(t,vs({},this.options_,{get:n.get,set:n.set}),r)}function dE(e,t){var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=Es(this)[Pe],a=vs({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),s.values_.set(r,new pr(a))}),function(){return this[Pe].getObservablePropValue_(r)}}function pE(e,t,n,r){t.annotationType_,r.get}function Il(e,t){return{annotationType_:e,options_:t,make_:fE,extend_:gE,decorate_20223_:hE}}function fE(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function gE(e,t,n,r){var o,s;return mE(e,this),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:ys,r)}function hE(e,t){var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,p=Es(i)[Pe],f=new Ao(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:ys,"ObservableObject."+o.toString(),!1);p.values_.set(o,f),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[Pe].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[Pe].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function mE(e,t,n,r){t.annotationType_}var bE="true",vE=Uh();function Uh(e){return{annotationType_:bE,options_:e,make_:yE,extend_:wE,decorate_20223_:SE}}function yE(e,t,n,r){var o,s;if(n.get)return jl.make_(e,t,n,r);if(n.set){var a=ws(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(kr(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if($h(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?xs.bound:xs;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Qa.bound:Qa;return d.make_(e,t,n,r)}var p=((o=this.options_)==null?void 0:o.deep)===!1?Zt.ref:Zt;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var f;n.value=n.value.bind((f=e.proxy_)!=null?f:e.target_)}return p.make_(e,t,n,r)}function wE(e,t,n,r){var o,s;if(n.get)return jl.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:ws(t.toString(),n.set)},r);if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var a;n.value=n.value.bind((a=e.proxy_)!=null?a:e.target_)}var i=((s=this.options_)==null?void 0:s.deep)===!1?Zt.ref:Zt;return i.extend_(e,t,n,r)}function SE(e,t){Ze("'"+this.annotationType_+"' cannot be used as a decorator")}var CE="observable",xE="observable.ref",EE="observable.shallow",PE="observable.struct",Wh={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Wh);function Vl(e){return e||Wh}var cd=Il(CE),TE=Il(xE,{enhancer:kl}),OE=Il(EE,{enhancer:Jx}),_E=Il(PE,{enhancer:Qx}),Gh=Ir(cd);function Hl(e){return e.deep===!0?ys:e.deep===!1?kl:ME(e.defaultDecorator)}function AE(e){var t;return e?(t=e.defaultDecorator)!=null?t:Uh(e):void 0}function ME(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:ys}function qh(e,t,n){if(Za(t))return cd.decorate_20223_(e,t);if(bs(t)){Ka(e,t,cd);return}return wd(e)?e:so(e)?Zt.object(e,t,n):Array.isArray(e)?Zt.array(e,t):Rs(e)?Zt.map(e,t):ao(e)?Zt.set(e,t):typeof e=="object"&&e!==null?e:Zt.box(e,t)}Ah(qh,Gh);var LE={box:function(t,n){var r=Vl(n);return new Ao(t,Hl(r),r.name,!0,r.equals)},array:function(t,n){var r=Vl(n);return(fe.useProxies===!1||r.proxy===!1?MP:wP)(t,Hl(r),r.name)},map:function(t,n){var r=Vl(n);return new b1(t,Hl(r),r.name)},set:function(t,n){var r=Vl(n);return new y1(t,Hl(r),r.name)},object:function(t,n,r){return No(function(){return d1(fe.useProxies===!1||(r==null?void 0:r.proxy)===!1?Es({},r):mP({},r),t,n)})},ref:Ir(TE),shallow:Ir(OE),deep:Gh,struct:Ir(_E)},Zt=Ah(qh,LE),Kh="computed",NE="computed.struct",ud=ld(Kh),$E=ld(NE,{equals:$l.structural}),jl=function(t,n){if(Za(n))return ud.decorate_20223_(t,n);if(bs(n))return Ka(t,n,ud);if(so(t))return Ir(ld(Kh,t));var r=so(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new pr(r)};Object.assign(jl,ud),jl.struct=Ir($E);var Zh,Yh,Dl=0,kE=1,IE=(Zh=(Yh=Ll(function(){},"name"))==null?void 0:Yh.configurable)!=null?Zh:!1,Xh={value:"action",configurable:!0,writable:!1,enumerable:!1};function ws(e,t,n,r){n===void 0&&(n=!1);function o(){return VE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},IE&&(Xh.value=e,kr(o,"name",Xh)),o}function VE(e,t,n,r,o){var s=HE(e,t);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{jE(s)}}function HE(e,t,n,r){var o=Jt.NODE_ENV!=="production",s=0,a=fe.trackingDerivation,i=!t||!a;Gn();var l=fe.allowStateChanges;i&&(Ss(),l=dd(!0));var u=hd(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:o,startTime_:s,actionId_:kE++,parentActionId_:Dl};return Dl=d.actionId_,d}function jE(e){Dl!==e.actionId_&&Ze(30),Dl=e.parentActionId_,e.error_!==void 0&&(fe.suppressReactionErrors=!0),pd(e.prevAllowStateChanges_),Ja(e.prevAllowStateReads_),qn(),e.runAsAction_&&lo(e.prevDerivation_),fe.suppressReactionErrors=!1}function dd(e){var t=fe.allowStateChanges;return fe.allowStateChanges=e,t}function pd(e){fe.allowStateChanges=e}var Ao=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s="ObservableValue"),i===void 0&&(i=$l.default),l=e.call(this,s)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=o,l.name_=s,l.equals=i,l.value_=o(r,void 0,s),l}jh(t,e);var n=t.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){this.value_,o=this.prepareNewValue_(o),o!==fe.UNCHANGED&&this.setNewValue_(o)},n.prepareNewValue_=function(o){if(Kn(this)){var s=Zn(this,{object:this,type:Vr,newValue:o});if(!s)return fe.UNCHANGED;o=s.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?fe.UNCHANGED:o},n.setNewValue_=function(o){var s=this.value_;this.value_=o,this.reportChanged(),gr(this)&&hr(this,{type:Vr,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return ti(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:Vr,newValue:this.value_,oldValue:void 0}),ni(this,o)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Vh(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(_o),DE=Oo("ObservableValue",Ao),pr=function(){function e(n){this.dependenciesState_=tt.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tt.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Bl(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Fl.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||Ze(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=ws("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?$l.structural:$l.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){WE(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&Ze(32,this.name_,this.derivation),fe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)fd(this)&&(this.warnAboutUntrackedRead_(),Gn(),this.value_=this.computeValue_(!1),qn());else if(r1(this),fd(this)){var r=fe.trackingContext;this.keepAlive_&&!r&&(fe.trackingContext=this),this.trackAndCompute()&&UE(this),fe.trackingContext=r}var o=this.value_;if(zl(o))throw o.cause;return o},t.set=function(r){if(this.setter_){this.isRunningSetter&&Ze(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else Ze(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===tt.NOT_TRACKING_,s=this.computeValue_(!0),a=o||zl(r)||zl(s)||!this.equals_(r,s);return a&&(this.value_=s),a},t.computeValue_=function(r){this.isComputing=!0;var o=dd(!1),s;if(r)s=Jh(this,this.derivation,this.scope_);else if(fe.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(a){s=new Bl(a)}return pd(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(gd(this),this.value_=void 0)},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return eP(function(){var l=s.get();if(!a||o){var u=Ss();r({observableKind:"computed",debugObjectName:s.name_,type:Vr,object:s,newValue:l,oldValue:i}),lo(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Vh(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ta(e,[{key:"isComputing",get:function(){return An(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return An(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return An(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return An(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Mn(this.flags_,e.diffValueMask_,r===1)}}])}();pr.isComputingMask_=1,pr.isRunningSetterMask_=2,pr.isBeingObservedMask_=4,pr.isPendingUnobservationMask_=8,pr.diffValueMask_=16;var Xa=Oo("ComputedValue",pr),tt;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(tt||(tt={}));var Fl;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Fl||(Fl={}));var Bl=function(t){this.cause=void 0,this.cause=t};function zl(e){return e instanceof Bl}function fd(e){switch(e.dependenciesState_){case tt.UP_TO_DATE_:return!1;case tt.NOT_TRACKING_:case tt.STALE_:return!0;case tt.POSSIBLY_STALE_:{for(var t=hd(!0),n=Ss(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Xa(a)){if(fe.disableErrorBoundaries)a.get();else try{a.get()}catch{return lo(n),Ja(t),!0}if(e.dependenciesState_===tt.STALE_)return lo(n),Ja(t),!0}}return Rh(e),lo(n),Ja(t),!1}}}function wD(e){}function Jh(e,t,n){var r=hd(!0);Rh(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++fe.runId;var o=fe.trackingDerivation;fe.trackingDerivation=e,fe.inBatch++;var s;if(fe.disableErrorBoundaries===!0)s=t.call(n);else try{s=t.call(n)}catch(a){s=new Bl(a)}return fe.inBatch--,fe.trackingDerivation=o,FE(e),Ja(r),s}function FE(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=tt.UP_TO_DATE_,o=0,s=e.unboundDepsCount_,a=0;a<s;a++){var i=n[a];i.diffValue===0&&(i.diffValue=1,o!==a&&(n[o]=i),o++),i.dependenciesState_>r&&(r=i.dependenciesState_)}for(n.length=o,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&t1(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,zE(u,e))}r!==tt.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function gd(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)t1(t[n],e);e.dependenciesState_=tt.NOT_TRACKING_}function Qh(e){var t=Ss();try{return e()}finally{lo(t)}}function Ss(){var e=fe.trackingDerivation;return fe.trackingDerivation=null,e}function lo(e){fe.trackingDerivation=e}function hd(e){var t=fe.allowStateReads;return fe.allowStateReads=e,t}function Ja(e){fe.allowStateReads=e}function Rh(e){if(e.dependenciesState_!==tt.UP_TO_DATE_){e.dependenciesState_=tt.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=tt.UP_TO_DATE_}}var Ul=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Wl=!0,e1=!1,fe=function(){var e=Ml();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Wl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Ul().version&&(Wl=!1),Wl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ul):(setTimeout(function(){e1||Ze(35)},1),new Ul)}();function BE(){if((fe.pendingReactions.length||fe.inBatch||fe.isRunningReactions)&&Ze(36),e1=!0,Wl){var e=Ml();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),fe=new Ul}}function zE(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function t1(e,t){e.observers_.delete(t),e.observers_.size===0&&n1(e)}function n1(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,fe.pendingUnobservations.push(e))}function Gn(){fe.inBatch++}function qn(){if(--fe.inBatch===0){s1();for(var e=fe.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof pr&&n.suspend_())}fe.pendingUnobservations=[]}}function r1(e){var t=fe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&fe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&fe.inBatch>0&&n1(e),!1)}function o1(e){e.lowestObserverState_!==tt.STALE_&&(e.lowestObserverState_=tt.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===tt.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=tt.STALE_}))}function UE(e){e.lowestObserverState_!==tt.STALE_&&(e.lowestObserverState_=tt.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===tt.POSSIBLY_STALE_?t.dependenciesState_=tt.STALE_:t.dependenciesState_===tt.UP_TO_DATE_&&(e.lowestObserverState_=tt.UP_TO_DATE_)}))}function WE(e){e.lowestObserverState_===tt.UP_TO_DATE_&&(e.lowestObserverState_=tt.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===tt.UP_TO_DATE_&&(t.dependenciesState_=tt.POSSIBLY_STALE_,t.onBecomeStale_())}))}var co=function(){function e(n,r,o,s){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=tt.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Fl.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,fe.pendingReactions.push(this),s1())},t.runReaction_=function(){if(!this.isDisposed){Gn(),this.isScheduled=!1;var r=fe.trackingContext;if(fe.trackingContext=this,fd(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Jt.NODE_ENV!=="production"&&this.isTrackPending&&Cs()}catch(o){this.reportExceptionInDerivation_(o)}}fe.trackingContext=r,qn()}},t.track=function(r){if(!this.isDisposed){Gn(),this.isRunning=!0;var o=fe.trackingContext;fe.trackingContext=this;var s=Jh(this,r,void 0);fe.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&gd(this),zl(s)&&this.reportExceptionInDerivation_(s.cause),qn()}},t.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(fe.disableErrorBoundaries)throw r;var s="[mobx] uncaught error in '"+this+"'";fe.suppressReactionErrors||console.error(s,r),fe.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Gn(),gd(this),qn()))},t.getDisposer_=function(r){var o=this,s=function a(){o.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",s),s[Pe]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},ta(e,[{key:"isDisposed",get:function(){return An(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return An(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return An(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return An(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Mn(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return An(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Mn(this.flags_,e.diffValueMask_,r===1)}}])}();co.isDisposedMask_=1,co.isScheduledMask_=2,co.isTrackPendingMask_=4,co.isRunningMask_=8,co.diffValueMask_=16;var GE=100,md=function(t){return t()};function s1(){fe.inBatch>0||fe.isRunningReactions||md(qE)}function qE(){fe.isRunningReactions=!0;for(var e=fe.pendingReactions,t=0;e.length>0;){++t===GE&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction_()}fe.isRunningReactions=!1}var Gl=Oo("Reaction",co);function KE(e){var t=md;md=function(r){return e(function(){return t(r)})}}function Cs(){return Jt.NODE_ENV!=="production"}function SD(e){}function CD(e){}function xD(e){}function ZE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var a1="action",YE="action.bound",i1="autoAction",XE="autoAction.bound",JE="<unnamed action>",bd=Ya(a1),QE=Ya(YE,{bound:!0}),vd=Ya(i1,{autoAction:!0}),RE=Ya(XE,{autoAction:!0,bound:!0});function l1(e){var t=function(r,o){if(ur(r))return ws(r.name||JE,r,e);if(ur(o))return ws(r,o,e);if(Za(o))return(e?vd:bd).decorate_20223_(r,o);if(bs(o))return Ka(r,o,e?vd:bd);if(bs(r))return Ir(Ya(e?i1:a1,{name:r,autoAction:e}))};return t}var ra=l1(!1);Object.assign(ra,bd);var Qa=l1(!0);Object.assign(Qa,vd),ra.bound=Ir(QE),Qa.bound=Ir(RE);function Ra(e){return ur(e)&&e.isMobxAction===!0}function eP(e,t){var n,r,o,s;t===void 0&&(t=Mh);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new co(a,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=nP(t),d=!1;l=new co(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(p)}))},t.onError,t.requiresObservable)}function p(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var tP=function(t){return t()};function nP(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:tP}var rP="onBO",oP="onBUO";function sP(e,t,n){return u1(rP,e,t,n)}function c1(e,t,n){return u1(oP,e,t,n)}function u1(e,t,n,r){var o=Xl(t),s=ur(r)?r:n,a=e+"L";return o[a]?o[a].add(s):o[a]=new Set([s]),function(){var i=o[a];i&&(i.delete(s),i.size===0&&delete o[a])}}var aP="never",ql="always",iP="observed";function lP(e){e.isolateGlobalState===!0&&BE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(fe.useProxies=t===ql?!0:t===aP?!1:typeof Proxy<"u"),t==="ifavailable"&&(fe.verifyProxies=!0),n!==void 0){var r=n===ql?ql:n===iP;fe.enforceActions=r,fe.allowStateChanges=!(r===!0||r===ql)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(fe[o]=!!e[o])}),fe.allowStateReads=!fe.observableRequiresReaction,e.reactionScheduler&&KE(e.reactionScheduler)}function d1(e,t,n,r){var o=Bx(t);return No(function(){var s=Es(e,r)[Pe];ea(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function cP(e,t){return p1(Xl(e,t))}function p1(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=uP(e.observing_).map(p1)),t}function uP(e){return Array.from(new Set(e))}var dP=0;function f1(){this.message="FLOW_CANCELLED"}f1.prototype=Object.create(Error.prototype);var yd=Bh("flow"),pP=Bh("flow.bound",{bound:!0}),xs=Object.assign(function(t,n){if(Za(n))return yd.decorate_20223_(t,n);if(bs(n))return Ka(t,n,yd);var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++dP,d=ra(o+" - runid: "+u+" - init",r).apply(i,l),p,f=void 0,h=new Promise(function(m,b){var v=0;p=b;function w(C){f=void 0;var E;try{E=ra(o+" - runid: "+u+" - yield "+v++,d.next).call(d,C)}catch(x){return b(x)}S(E)}function y(C){f=void 0;var E;try{E=ra(o+" - runid: "+u+" - yield "+v++,d.throw).call(d,C)}catch(x){return b(x)}S(E)}function S(C){if(ur(C==null?void 0:C.then)){C.then(S,b);return}return C.done?m(C.value):(f=Promise.resolve(C.value),f.then(w,y))}w(void 0)});return h.cancel=ra(o+" - runid: "+u+" - cancel",function(){try{f&&g1(f);var m=d.return(void 0),b=Promise.resolve(m.value);b.then(Qs,Qs),g1(b),p(new f1)}catch(v){p(v)}}),h};return s.isMobXFlow=!0,s},yd);xs.bound=Ir(pP);function g1(e){ur(e.cancel)&&e.cancel()}function ei(e){return(e==null?void 0:e.isMobXFlow)===!0}function fP(e,t){return e?oi(e)||!!e[Pe]||id(e)||Gl(e)||Xa(e):!1}function wd(e){return fP(e)}function gP(e){if(oi(e))return e[Pe].ownKeys_();Ze(38)}function Kl(e,t,n){return e.set(t,n),n}function oa(e,t){if(e==null||typeof e!="object"||e instanceof Date||!wd(e))return e;if(DE(e)||Xa(e))return oa(e.get(),t);if(t.has(e))return t.get(e);if(ri(e)){var n=Kl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=oa(a,t)}),n}if(br(e)){var r=Kl(t,e,new Set);return e.forEach(function(a){r.add(oa(a,t))}),r}if(Lo(e)){var o=Kl(t,e,new Map);return e.forEach(function(a,i){o.set(i,oa(a,t))}),o}else{var s=Kl(t,e,{});return gP(e).forEach(function(a){Ga.propertyIsEnumerable.call(e,a)&&(s[a]=oa(e[a],t))}),s}}function fr(e,t){return oa(e,new Map)}function uo(e,t){t===void 0&&(t=void 0),Gn();try{return e.apply(t)}finally{qn()}}function sa(e){return e[Pe]}var hP={has:function(t,n){return sa(t).has_(n)},get:function(t,n){return sa(t).get_(n)},set:function(t,n,r){var o;return bs(n)?(o=sa(t).set_(n,r,!0))!=null?o:!0:!1},deleteProperty:function(t,n){var r;return bs(n)?(r=sa(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return(o=sa(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return sa(t).ownKeys_()},preventExtensions:function(t){Ze(13)}};function mP(e,t){var n,r;return Lh(),e=Es(e,t),(r=(n=e[Pe]).proxy_)!=null?r:n.proxy_=new Proxy(e,hP)}function Kn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ti(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Nh(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Zn(e,t){var n=Ss();try{for(var r=[].concat(e.interceptors_||[]),o=0,s=r.length;o<s&&(t=r[o](t),t&&!t.type&&Ze(14),!!t);o++);return t}finally{lo(n)}}function gr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ni(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Nh(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function hr(e,t){var n=Ss(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);lo(n)}}function bP(e,t,n){return No(function(){var r,o=Es(e,n)[Pe];Jt.NODE_ENV!=="production"&&t&&e[dr],(r=t)!=null||(t=qx(e)),ea(t).forEach(function(s){return o.make_(s,t[s])})}),e}var Sd=Symbol("mobx-keys");function an(e,t,n){return so(e)?d1(e,e,t,n):(No(function(){var r=Es(e,n)[Pe];if(!e[Sd]){var o=Object.getPrototypeOf(e),s=new Set([].concat(ea(e),ea(o)));s.delete("constructor"),s.delete(Pe),qa(o,Sd,s)}e[Sd].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var h1="splice",Vr="update",vP=1e4,yP={get:function(t,n){var r=t[Pe];return n===Pe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):io(Zl,n)?Zl[n]:t[n]},set:function(t,n,r){var o=t[Pe];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){Ze(15)}},Cd=function(){function e(n,r,o,s){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=o,this.legacyMode_=s,this.atom_=new _o(n),this.enhancer_=function(a,i){return r(a,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return ti(this,r)},t.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ni(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&Ze("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var s=new Array(r-o),a=0;a<r-o;a++)s[a]=void 0;this.spliceWithArray_(o,0,s)}else this.spliceWithArray_(r,o-r)},t.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&Ze(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&_1(r+o+1)},t.spliceWithArray_=function(r,o,s){var a=this;this.atom_;var i=this.values_.length;if(r===void 0?r=0:r>i?r=i:r<0&&(r=Math.max(0,i+r)),arguments.length===1?o=i-r:o==null?o=0:o=Math.max(0,Math.min(o,i-r)),s===void 0&&(s=sd),Kn(this)){var l=Zn(this,{object:this.proxy_,type:h1,index:r,removedCount:o,added:s});if(!l)return sd;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(p){return a.enhancer_(p,void 0)}),this.legacyMode_||Jt.NODE_ENV!=="production"){var u=s.length-o;this.updateArrayLength_(i,u)}var d=this.spliceItemsIntoValues_(r,o,s);return(o!==0||s.length!==0)&&this.notifyArraySplice_(r,s,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,o,s){if(s.length<vP){var a;return(a=this.values_).splice.apply(a,[r,o].concat(s))}else{var i=this.values_.slice(r,r+o),l=this.values_.slice(r+o);this.values_.length+=s.length-o;for(var u=0;u<s.length;u++)this.values_[r+u]=s[u];for(var d=0;d<l.length;d++)this.values_[r+s.length+d]=l[d];return i}},t.notifyArrayChildUpdate_=function(r,o,s){var a=!this.owned_&&Cs(),i=gr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:Vr,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;this.atom_.reportChanged(),i&&hr(this,l)},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&Cs(),i=gr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:h1,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;this.atom_.reportChanged(),i&&hr(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,o){var s=this.values_;if(this.legacyMode_&&r>s.length&&Ze(17,r,s.length),r<s.length){this.atom_;var a=s[r];if(Kn(this)){var i=Zn(this,{type:Vr,object:this.proxy_,index:r,newValue:o});if(!i)return;o=i.newValue}o=this.enhancer_(o,a);var l=o!==a;l&&(s[r]=o,this.notifyArrayChildUpdate_(r,o,a))}else{for(var u=new Array(r+1-s.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=o,this.spliceWithArray_(s.length,0,u)}},e}();function wP(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),Lh(),No(function(){var o=new Cd(n,t,r,!1);kh(o.values_,Pe,o);var s=new Proxy(o.values_,yP);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Zl={clear:function(){return this.splice(0)},replace:function(t){var n=this[Pe];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var a=this[Pe];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(t);case 2:return a.spliceWithArray_(t,n)}return a.spliceWithArray_(t,n,o)},spliceWithArray:function(t,n,r){return this[Pe].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Pe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[Pe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Pe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return fe.trackingDerivation&&Ze(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){fe.trackingDerivation&&Ze(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Pe],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};vt("at",Ln),vt("concat",Ln),vt("flat",Ln),vt("includes",Ln),vt("indexOf",Ln),vt("join",Ln),vt("lastIndexOf",Ln),vt("slice",Ln),vt("toString",Ln),vt("toLocaleString",Ln),vt("toSorted",Ln),vt("toSpliced",Ln),vt("with",Ln),vt("every",mr),vt("filter",mr),vt("find",mr),vt("findIndex",mr),vt("findLast",mr),vt("findLastIndex",mr),vt("flatMap",mr),vt("forEach",mr),vt("map",mr),vt("some",mr),vt("toReversed",mr),vt("reduce",m1),vt("reduceRight",m1);function vt(e,t){typeof Array.prototype[e]=="function"&&(Zl[e]=t(e))}function Ln(e){return function(){var t=this[Pe];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mr(e){return function(t,n){var r=this,o=this[Pe];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function m1(e){return function(){var t=this,n=this[Pe];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(s,a,i){return o(s,a,i,t)},r[e].apply(r,arguments)}}var SP=Oo("ObservableArrayAdministration",Cd);function ri(e){return Nl(e)&&SP(e[Pe])}var CP={},Mo="add",Yl="delete",b1=function(){function e(n,r,o){var s=this;r===void 0&&(r=ys),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Pe]=CP,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=o,ur(Map)||Ze(18),No(function(){s.keysAtom_=Dh(Jt.NODE_ENV!=="production"?s.name_+".keys()":"ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,n&&s.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var o=this;if(!fe.trackingDerivation)return this.has_(r);var s=this.hasMap_.get(r);if(!s){var a=s=new Ao(this.has_(r),kl,"ObservableMap.key?",!1);this.hasMap_.set(r,a),c1(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(Kn(this)){var a=Zn(this,{type:s?Vr:Mo,object:this,newValue:o,name:r});if(!a)return this;o=a.newValue}return s?this.updateValue_(r,o):this.addValue_(r,o),this},t.delete=function(r){var o=this;if(this.keysAtom_,Kn(this)){var s=Zn(this,{type:Yl,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=Cs(),i=gr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Yl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return uo(function(){var u;o.keysAtom_.reportChanged(),(u=o.hasMap_.get(r))==null||u.setNewValue_(!1);var d=o.data_.get(r);d.setNewValue_(void 0),o.data_.delete(r)}),i&&hr(this,l),!0}return!1},t.updateValue_=function(r,o){var s=this.data_.get(r);if(o=s.prepareNewValue_(o),o!==fe.UNCHANGED){var a=Cs(),i=gr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Vr,object:this,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&hr(this,l)}},t.addValue_=function(r,o){var s=this;this.keysAtom_,uo(function(){var u,d=new Ao(o,s.enhancer_,"ObservableMap.key",!1);s.data_.set(r,d),o=d.value_,(u=s.hasMap_.get(r))==null||u.setNewValue_(!0),s.keysAtom_.reportChanged()});var a=Cs(),i=gr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Mo,object:this,name:r,newValue:o}:null;i&&hr(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,o=this.keys();return v1({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:r.get(l)}}})},t.entries=function(){var r=this,o=this.keys();return v1({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,o){for(var s=na(this),a;!(a=s()).done;){var i=a.value,l=i[0],u=i[1];r.call(o,u,l,this)}},t.merge=function(r){var o=this;return Lo(r)&&(r=new Map(r)),uo(function(){so(r)?Fx(r).forEach(function(s){return o.set(s,r[s])}):Array.isArray(r)?r.forEach(function(s){var a=s[0],i=s[1];return o.set(a,i)}):Rs(r)?(Dx(r)||Ze(19,r),r.forEach(function(s,a){return o.set(a,s)})):r!=null&&Ze(20,r)}),this},t.clear=function(){var r=this;uo(function(){Qh(function(){for(var o=na(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return uo(function(){for(var s=xP(r),a=new Map,i=!1,l=na(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var p=o.delete(d);if(p)i=!0;else{var f=o.data_.get(d);a.set(d,f)}}}for(var h=na(s.entries()),m;!(m=h()).done;){var b=m.value,v=b[0],w=b[1],y=o.data_.has(v);if(o.set(v,w),o.data_.has(v)){var S=o.data_.get(v);a.set(v,S),y||(i=!0)}}if(!i)if(o.data_.size!==a.size)o.keysAtom_.reportChanged();else for(var C=o.data_.keys(),E=a.keys(),x=C.next(),P=E.next();!x.done;){if(x.value!==P.value){o.keysAtom_.reportChanged();break}x=C.next(),P=E.next()}o.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,o){return ni(this,r)},t.intercept_=function(r){return ti(this,r)},ta(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Lo=Oo("ObservableMap",b1);function v1(e){return e[Symbol.toStringTag]="MapIterator",_d(e)}function xP(e){if(Rs(e)||Lo(e))return e;if(Array.isArray(e))return new Map(e);if(so(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return Ze(21,e)}var EP={},y1=function(){function e(n,r,o){var s=this;r===void 0&&(r=ys),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[Pe]=EP,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=o,ur(Set)||Ze(22),this.enhancer_=function(a,i){return r(a,i,o)},No(function(){s.atom_=Dh(s.name_),n&&s.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;uo(function(){Qh(function(){for(var o=na(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=na(this),a;!(a=s()).done;){var i=a.value;r.call(o,i,i,this)}},t.add=function(r){var o=this;if(this.atom_,Kn(this)){var s=Zn(this,{type:Mo,object:this,newValue:r});if(!s)return this}if(!this.has(r)){uo(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=Jt.NODE_ENV!=="production",i=gr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Mo,object:this,newValue:r}:null;i&&hr(this,l)}return this},t.delete=function(r){var o=this;if(Kn(this)){var s=Zn(this,{type:Yl,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=Jt.NODE_ENV!=="production",i=gr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Yl,object:this,oldValue:r}:null;return uo(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&hr(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,o=Array.from(this.keys()),s=Array.from(this.values());return w1({next:function(){var i=r;return r+=1,i<s.length?{value:[o[i],s[i]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,o=0,s=Array.from(this.data_.values());return w1({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(ao(r)&&!br(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(ao(r)&&!br(r))return r.union(this);var o=new Set(this);return o.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(ao(r)&&!br(r))return r.symmetricDifference(this);var o=new Set(this);return o.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(ao(r)&&!br(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return br(r)&&(r=new Set(r)),uo(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):ao(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):r!=null&&Ze("Cannot initialize set from "+r)}),this},t.observe_=function(r,o){return ni(this,r)},t.intercept_=function(r){return ti(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ta(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),br=Oo("ObservableSet",y1);function w1(e){return e[Symbol.toStringTag]="SetIterator",_d(e)}var S1=Object.create(null),C1="remove",x1=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=vE),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=o,this.defaultAnnotation_=s,this.keysAtom_=new _o("ObservableObject.keys"),this.isPlainObject_=so(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,o){var s=this.values_.get(r);if(s instanceof pr)return s.set(o),!0;if(Kn(this)){var a=Zn(this,{type:Vr,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=s.prepareNewValue_(o),o!==fe.UNCHANGED){var i=gr(this),l=Jt.NODE_ENV!=="production",u=i||l?{type:Vr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&hr(this,u)}return!0},t.get_=function(r){return fe.trackingDerivation&&!io(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),io(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):s?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(r){if(!fe.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Ao(r in this.target_,kl,"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},t.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(!(r in this.target_)){var s;if((s=this.target_[dr])!=null&&s[r])return;Ze(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==Ga;){var i=Ll(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}P1(this,o,r)}},t.extend_=function(r,o,s,a){if(a===void 0&&(a=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(r,o,a);var i=s.extend_(this,r,o,a);return i&&P1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Gn();var a=this.delete_(r);if(!a)return a;if(Kn(this)){var i=Zn(this,{object:this.proxy_||this.target_,name:r,type:Mo,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=vs({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else kr(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{qn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),this.keysAtom_;try{Gn();var i=this.delete_(r);if(!i)return i;if(Kn(this)){var l=Zn(this,{object:this.proxy_||this.target_,name:r,type:Mo,newValue:o});if(!l)return null;o=l.newValue}var u=E1(r),d={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else kr(this.target_,r,d);var p=new Ao(o,s,Jt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,p),this.notifyPropertyAddition_(r,p.value_)}finally{qn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Gn();var a=this.delete_(r);if(!a)return a;if(Kn(this)){var i=Zn(this,{object:this.proxy_||this.target_,name:r,type:Mo,newValue:void 0});if(!i)return null}o.name||(o.name=Jt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=E1(r),u={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else kr(this.target_,r,u);this.values_.set(r,new pr(o)),this.notifyPropertyAddition_(r,void 0)}finally{qn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),this.keysAtom_,!io(this.target_,r))return!0;if(Kn(this)){var s=Zn(this,{object:this.proxy_||this.target_,name:r,type:C1});if(!s)return null}try{var a;Gn();var i=gr(this),l=Jt.NODE_ENV!=="production"&&Cs(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var p;d=(p=Ll(this.target_,r))==null?void 0:p.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Jt.NODE_ENV,u&&(this.values_.delete(r),u instanceof Ao&&(d=u.value_),o1(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var f={type:C1,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Jt.NODE_ENV,i&&hr(this,f),Jt.NODE_ENV}}finally{qn()}return!0},t.observe_=function(r,o){return ni(this,r)},t.intercept_=function(r){return ti(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=gr(this),i=Jt.NODE_ENV!=="production";if(a||i){var l=a||i?{type:Mo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;a&&hr(this,l)}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ea(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Es(e,t){var n;if(io(e,Pe))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",o=new x1(e,new Map,String(r),AE(t));return qa(e,Pe,o),e}var PP=Oo("ObservableObjectAdministration",x1);function E1(e){return S1[e]||(S1[e]={get:function(){return this[Pe].getObservablePropValue_(e)},set:function(n){return this[Pe].setObservablePropValue_(e,n)}})}function oi(e){return Nl(e)?PP(e[Pe]):!1}function P1(e,t,n){var r;(r=e.target_[dr])==null||delete r[n]}var TP=O1(0),OP=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),xd=0,T1=function(){};function _P(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}_P(T1,Array.prototype);var Ed=function(e){function t(r,o,s,a){var i;return s===void 0&&(s="ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,No(function(){var l=new Cd(s,o,a,!0);l.proxy_=i,kh(i,Pe,l),r&&r.length&&i.spliceWithArray(0,0,r),OP&&Object.defineProperty(i,"0",TP)}),i}jh(t,e);var n=t.prototype;return n.concat=function(){this[Pe].atom_.reportObserved();for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return Array.prototype.concat.apply(this.slice(),s.map(function(i){return ri(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return _d({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},ta(t,[{key:"length",get:function(){return this[Pe].getArrayLength_()},set:function(o){this[Pe].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(T1);Object.entries(Zl).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&qa(Ed.prototype,t,n)});function O1(e){return{enumerable:!1,configurable:!0,get:function(){return this[Pe].get_(e)},set:function(n){this[Pe].set_(e,n)}}}function AP(e){kr(Ed.prototype,""+e,O1(e))}function _1(e){if(e>xd){for(var t=xd;t<e+100;t++)AP(t);xd=e}}_1(1e3);function MP(e,t,n){return new Ed(e,t,n)}function Xl(e,t){if(typeof e=="object"&&e!==null){if(ri(e))return t!==void 0&&Ze(23),e[Pe].atom_;if(br(e))return e.atom_;if(Lo(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Ze(25,t,Pd(e)),n}if(oi(e)){if(!t)return Ze(26);var r=e[Pe].values_.get(t);return r||Ze(27,t,Pd(e)),r}if(id(e)||Xa(e)||Gl(e))return e}else if(ur(e)&&Gl(e[Pe]))return e[Pe];Ze(28)}function LP(e,t){if(e||Ze(29),id(e)||Xa(e)||Gl(e)||Lo(e)||br(e))return e;if(e[Pe])return e[Pe];Ze(24,e)}function Pd(e,t){var n;if(t!==void 0)n=Xl(e,t);else{if(Ra(e))return e.name;oi(e)||Lo(e)||br(e)?n=LP(e):n=Xl(e)}return n.name_}function No(e){var t=Ss(),n=dd(!0);Gn();try{return e()}finally{qn(),pd(n),lo(t)}}var A1=Ga.toString;function Td(e,t,n){return n===void 0&&(n=-1),Od(e,t,n)}function Od(e,t,n,r,o){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var a=A1.call(e);if(a!==A1.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=M1(e),t=M1(t);var i=a==="[object Array]";if(!i){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(ur(l)&&l instanceof l&&ur(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],o=o||[];for(var d=r.length;d--;)if(r[d]===e)return o[d]===t;if(r.push(e),o.push(t),i){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Od(e[d],t[d],n-1,r,o))return!1}else{var p=Object.keys(e),f;if(d=p.length,Object.keys(t).length!==d)return!1;for(;d--;)if(f=p[d],!(io(t,f)&&Od(e[f],t[f],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function M1(e){return ri(e)?e.slice():Rs(e)||Lo(e)||ao(e)||br(e)?Array.from(e.entries()):e}var L1,NP=((L1=Ml().Iterator)==null?void 0:L1.prototype)||{};function _d(e){return e[Symbol.iterator]=$P,Object.assign(Object.create(NP),e)}function $P(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=Ml();typeof t[e]>"u"&&Ze("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:ZE,extras:{getDebugName:Pd},$mobx:Pe}),!g.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!bP)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function kP(e){e()}function IP(e){e||(e=kP),lP({reactionScheduler:e})}function VP(e){return cP(e)}var HP=1e4,jP=1e4,DP=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=HP),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var o=Date.now();n.registrations.forEach(function(s,a){o-s.registeredAt>=r&&(n.finalize(s.value),n.registrations.delete(a))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,jP))}}),e}(),FP=typeof FinalizationRegistry<"u"?FinalizationRegistry:DP,Ad=new FP(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),N1={exports:{}},Md={};/**
8
8
  * @license React
9
9
  * use-sync-external-store-shim.production.min.js
10
10
  *
@@ -12,38 +12,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var P1;function OP(){if(P1)return Td;P1=1;var e=h;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(p,f){var g=f(),m=r({inst:{value:g,getSnapshot:f}}),v=m[0].inst,b=m[1];return s(function(){v.value=g,v.getSnapshot=f,l(v)&&b({inst:v})},[p,g,f]),o(function(){return l(v)&&b({inst:v}),p(function(){l(v)&&b({inst:v})})},[p]),a(g),g}function l(p){var f=p.getSnapshot;p=p.value;try{var g=f();return!n(p,g)}catch{return!0}}function u(p,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return Td.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Td}E1.exports=OP();var _P=E1.exports;function T1(e){e.reaction=new io("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function AP(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(i){return Pd.unregister(r),r.onStoreChange=i,r.reaction||(T1(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var o=n.current;o.reaction||(T1(o),Pd.register(n,o,o)),h.useDebugValue(o.reaction,CP),_P.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot);var s,a;if(o.reaction.track(function(){try{s=e()}catch(i){a=i}}),a)throw a;return s}var Od,_d,O1=typeof Symbol=="function"&&Symbol.for,LP=(_d=(Od=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Od===void 0?void 0:Od.configurable)!==null&&_d!==void 0?_d:!1,_1=O1?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,A1=O1?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(A1&&e.$$typeof===A1)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,o=e,s=e.displayName||e.name;if(_1&&e.$$typeof===_1&&(r=!0,o=e.render,typeof o!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(i,l){return AP(function(){return o(i,l)},s)};return a.displayName=e.displayName,LP&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),r&&(a=h.forwardRef(a)),a=h.memo(a),NP(e,a),a}var MP={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function NP(e,t){Object.keys(e).forEach(function(n){MP[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Ad;SP(On.unstable_batchedUpdates),Ad=Pd.finalizeAllImmediately;const L1=new Map,$P=(e,t)=>`${t}-${e}`,M1=qt(function({svg:t,iconSize:n,...r},o){const s=$P(t,n);let a=L1.get(s);return a||(a=lC(t,n),L1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let N1;const kP=e=>{N1=e},IP=()=>N1;var K=(e=>(e.alertRhombus="alertRhombus",e.alignHorizontalCenter="alignHorizontalCenter",e.alignHorizontalLeft="alignHorizontalLeft",e.alignHorizontalRight="alignHorizontalRight",e.applicationBracketsOutline="applicationBracketsOutline",e.arrowDown="arrowDown",e.arrowExpandAll="arrowExpandAll",e.arrowRight="arrowRight",e.arrowULeftTop="arrowULeftTop",e.arrowURightTop="arrowURightTop",e.borderAllVariant="borderAllVariant",e.borderRadius="borderRadius",e.borderStyle="borderStyle",e.calendar="calendar",e.cellphoneLink="cellphoneLink",e.check="check",e.checkBold="checkBold",e.checkboxBlank="checkboxBlank",e.chevronUp="chevronUp",e.chevronDown="chevronDown",e.chevronLeft="chevronLeft",e.chevronRight="chevronRight",e.close="close",e.codeBraces="codeBraces",e.cog="cog",e.contentCopy="contentCopy",e.contentSave="contentSave",e.delete="delete",e.dotsVertical="dotsVertical",e.email="email",e.emailOutline="emailOutline",e.eye="eye",e.eyedropperVariant="eyedropperVariant",e.eyeOff="eyeOff",e.eyeOffOutline="eyeOffOutline",e.eyeOutline="eyeOutline",e.fire="fire",e.flare="flare",e.floppy="floppy",e.folder="folder",e.fullscreen="fullscreen",e.gradientVertical="gradientVertical",e.helpCircle="helpCircle",e.home="home",e.image="image",e.information="information",e.informationVariant="informationVariant",e.layers="layers",e.link="link",e.lock="lock",e.lockOpenVariant="lockOpenVariant",e.menuDown="menuDown",e.newspaperVariantOutline="newspaperVariantOutline",e.openInNew="openInNew",e.paletteSwatch="paletteSwatch",e.panVertical="panVertical",e.pencil="pencil",e.phone="phone",e.plus="plus",e.plusBox="plusBox",e.powerPlug="powerPlug",e.refresh="refresh",e.rhombusOutline="rhombusOutline",e.rhombusSplit="rhombusSplit",e.rhombusSplitOutline="rhombusSplitOutline",e.tag="tag",e.target="target",e.targetVariant="targetVariant",e.textBoxMultiple="textBoxMultiple",e.trayArrowDown="trayArrowDown",e.unfoldLessHorizontal="unfoldLessHorizontal",e.unfoldMoreHorizontal="unfoldMoreHorizontal",e.viewDayOutline="viewDayOutline",e.viewGridPlus="viewGridPlus",e.web="web",e.xml="xml",e.database="database",e.databaseOutline="databaseOutline",e.databaseOutlineOn="databaseOutlineOn",e.databaseOutlineOff="databaseOutlineOff",e.databaseOutlineRemove="databaseOutlineRemove",e.toggleSwitchOutline="toggleSwitchOutline",e.toggleSwitchOffOutline="toggleSwitchOffOutline",e.codeBrackets="codeBrackets",e.null="null",e.codeString="string",e.number="number",e.cloudUpload="cloudUpload",e.chat="chat",e.creation="creation",e.viewDashboard="viewDashboard",e.rocketLaunch="rocketLaunch",e.lightningBolt="lightningBolt",e.stop="stop",e.arrowUp="arrowUp",e))(K||{});const Kl={alertRhombus:TC,alignHorizontalCenter:OC,alignHorizontalLeft:_C,alignHorizontalRight:AC,applicationBracketsOutline:LC,arrowDown:MC,arrowExpandAll:NC,arrowRight:$C,arrowULeftTop:kC,arrowURightTop:IC,borderAllVariant:HC,borderRadius:jC,borderStyle:DC,calendar:FC,cellphoneLink:BC,check:hg,checkBold:UC,checkboxBlank:WC,chevronUp:ZC,chevronDown:GC,chevronLeft:qC,chevronRight:KC,close:gg,codeBraces:XC,cog:RC,contentCopy:e2,contentSave:t2,delete:l2,dotsVertical:c2,email:u2,emailOutline:d2,eye:p2,eyedropperVariant:m2,eyeOff:f2,eyeOffOutline:h2,eyeOutline:g2,fire:b2,flare:y2,floppy:w2,folder:S2,fullscreen:C2,gradientVertical:x2,helpCircle:E2,home:P2,image:T2,information:_2,informationVariant:A2,layers:L2,link:$2,lock:I2,lockOpenVariant:V2,menuDown:H2,newspaperVariantOutline:F2,openInNew:mg,paletteSwatch:U2,panVertical:W2,pencil:G2,phone:q2,plus:K2,plusBox:Z2,powerPlug:Y2,refresh:X2,rhombusOutline:J2,rhombusSplit:Q2,rhombusSplitOutline:R2,tag:nx,target:rx,targetVariant:ox,textBoxMultiple:sx,trayArrowDown:lx,unfoldLessHorizontal:cx,unfoldMoreHorizontal:ux,viewDayOutline:px,viewGridPlus:fx,web:hx,xml:gx,database:r2,databaseOutline:a2,databaseOutlineOn:s2,databaseOutlineOff:o2,databaseOutlineRemove:i2,codeBrackets:JC,toggleSwitchOutline:ix,toggleSwitchOffOutline:ax,null:B2,string:QC,number:z2,cloudUpload:YC,chat:zC,creation:n2,viewDashboard:dx,rocketLaunch:ex,lightningBolt:N2,stop:tx,arrowUp:VC},VP="gs-cmp-icon",re=ce(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=IP(),l=(i==null?void 0:i[n])||(Kl==null?void 0:Kl[n])||n,u=[s&&"scaleX(-1)",a&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(p=>!!p).join(" ");if(!l)return null;const d=N(VP,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(M1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(za,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),Ld=150,U={bgTr:"gs-utl-bg-transparent",txt:"gs-theme-cl-txt gs-utl-text-gray-900 dark:gs-utl-text-gray-400",txtLowEmphasis:"gs-utl-text-neutral-500 dark:gs-utl-text-neutral-500",txtHighEmphasis:"gs-utl-text-black dark:gs-utl-text-gray-200",txtHighEmphasisH:"hover:gs-utl-text-black hover:dark:gs-utl-text-gray-200",tA:"gs-theme-cl-tA gs-utl-text-violet-400",tAo:"gs-theme-cl-tAo gs-utl-text-violet-800 dark:gs-utl-text-violet-400",hTAo:"gs-theme-cl-hTAo hover:gs-utl-text-violet-800 hover:dark:gs-utl-text-violet-400",grouphTAo:"gs-theme-cl-grouphTAo group-hover:gs-utl-text-violet-800 group-hover:dark:gs-utl-text-violet-400",bA:"gs-theme-cl-bA gs-utl-border-violet-400",bgA:"gs-theme-cl-bgA gs-utl-bg-violet-400 gs-utl-text-white dark:gs-utl-bg-violet-500",bgA2:"gs-theme-cl-bgA2 gs-utl-bg-violet-500 gs-utl-text-white",bgO:"gs-theme-cl-bg0 gs-utl-bg-violet-50 gs-utl-text-violet-900 dark:gs-utl-bg-zinc-800 dark:gs-utl-text-violet-400",bg:"gs-theme-cl-bg gs-utl-bg-white dark:gs-utl-bg-zinc-900",bgBlur:"gs-utl-bg-white/50 dark:gs-utl-bg-zinc-900/50 gs-utl-backdrop-blur-sm",bgH:"gs-theme-cl-bgH gs-utl-bg-gray-100 dark:gs-utl-bg-zinc-700",bgH75:"gs-utl-bg-gray-100/75 dark:gs-utl-bg-zinc-700/75",bgH50:"gs-utl-bg-gray-100/50 dark:gs-utl-bg-zinc-700/50",bgH25:"gs-utl-bg-gray-100/25 dark:gs-utl-bg-zinc-700/25",hBgH:"gs-theme-cl-hBgH hover:gs-utl-bg-gray-50 hover:dark:gs-utl-bg-zinc-800",bgH2:"gs-theme-cl-bgH2 gs-utl-bg-gray-25 dark:gs-utl-bg-zinc-800",hBgH2:"gs-theme-cl-hBgH2 hover:gs-utl-bg-gray-25 hover:dark:gs-utl-bg-zinc-800",hBgAct:"gs-theme-cl-hBgAct hover:gs-utl-bg-violet-800 hover:dark:gs-utl-bg-violet-400",hBgA2:"gs-theme-cl-hBgA2 hover:gs-utl-bg-violet-500 hover:dark:gs-utl-bg-violet-600",hBgDark:"hover:gs-utl-bg-black/10",sel:"gs-theme-cl-sel gs-utl-bg-pink-200 gs-utl-text-pink-900",selBr:"gs-theme-cl-selBr gs-utl-border-pink-900",cmp:"gs-theme-cl-cmp gs-utl-bg-blue-450 gs-utl-text-white",cmpSymbol:"gs-theme-cl-cmpSymbol gs-utl-bg-[#7b61ff] gs-utl-text-white",cmpBgSoft:"gs-theme-cl-cmpBgSoft gs-utl-bg-blue-100 dark:gs-utl-bg-sky-800",cmpBgSymbolSoft:"gs-theme-cl-cmpBgSymbolSoft gs-utl-bg-violet-200 dark:gs-utl-bg-violet-800",cmpBgSoftX:"gs-theme-cl-cmpBgSoftX gs-utl-bg-blue-50 dark:gs-utl-bg-gray-800",cmpBgSymbolSoftX:"gs-theme-cl-cmpBgSymbolSoftX gs-utl-bg-[#edebff] dark:gs-utl-bg-[#2d1b4b]",cmpTxtActive:"gs-theme-cl-cmpTxtActive dark:gs-utl-text-gray-300",cmpBr:"gs-theme-cl-cmpBr gs-utl-border-blue-450",cmpSymbolBr:"gs-theme-cl-cmpSymbolBr gs-utl-border-[#7b61ff]",cmpTargetBg:"gs-utl-bg-amber-500 gs-utl-text-white",cmpTargetBgOpac:"gs-utl-bg-amber-500/5",cmpTargetBr:"gs-utl-border-amber-500",tW:"gs-utl-text-amber-500",tE:"gs-utl-text-red-500",tS:"gs-utl-text-green-500",boxWarn:"gs-utl-bg-amber-50 gs-utl-border-amber-200 gs-utl-text-amber-700 dark:gs-utl-bg-amber-200/10 dark:gs-utl-border-amber-200/20 dark:gs-utl-text-amber-100/80",boxSuccess:"gs-utl-bg-green-50 gs-utl-border-green-200 gs-utl-text-green-700 dark:gs-utl-bg-green-500/20 dark:gs-utl-border-green-500/20 dark:gs-utl-text-green-100/80",boxDanger:"gs-utl-bg-red-50 gs-utl-border-red-200 gs-utl-text-red-700 dark:gs-utl-bg-red-500/20 dark:gs-utl-border-red-500/20 dark:gs-utl-text-red-100/80",bgW:"gs-utl-bg-amber-500",bgRed:"gs-utl-bg-red-500",hBgRed:"hover:gs-utl-bg-red-600",hBgW:"hover:gs-utl-bg-amber-600",br:"gs-theme-cl-br gs-utl-border-gray-300 dark:gs-utl-border-zinc-700",brRed:"gs-utl-border-red-500",brLight:"gs-utl-border-white/25"},$1={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-scale-95 gs-utl-opacity-0",enterTo:"gs-utl-opacity-100",leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-scale-100 gs-utl-opacity-100",leaveTo:"gs-utl-scale-95 gs-utl-opacity-0"},HP={...{enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},...{leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"}},Te={xy:"gs-utl-px-4 gs-utl-py-2",xyS:"gs-utl-px-2 gs-utl-py-1",xyS2:"gs-utl-px-2 gs-utl-py-0.5",x:"gs-utl-px-4",xS:"gs-utl-px-2",y:"gs-utl-py-2",s:"gs-utl-p-2",m:"gs-utl-p-4"},Md={bg:U.bg,bgH:U.bgH},k1={bg:"gs-utl-bg-zinc-700",txt:"gs-utl-text-white",block:"gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-rounded gs-utl-px-2 gs-utl-py-1"},te={rnd:"gs-utl-rounded",rndMd:"gs-utl-rounded-md",rndLg:"gs-utl-rounded-lg",pill:"gs-utl-rounded-full",b:"gs-utl-border",bT:"gs-utl-border-transparent",bS:"gs-utl-border-2",bt:"gs-utl-border-t",bb:"gs-utl-border-b",br:"gs-utl-border-r",bl:"gs-utl-border-l",none:"gs-utl-border-0",bA:"gs-theme-cl-bA gs-utl-border-violet-400 dark:gs-utl-border-violet-500"},ri={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},se={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Oe={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverM:"gs-utl-transition-opacity gs-utl-opacity-80 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollX:"gs-utl-overflow-x-auto gs-utl-overflow-y-hidden",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",hiddenVisually:"gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001]",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",disabledM:"gs-utl-opacity-50 gs-utl-cursor-not-allowed",noFocusOut:"focus:gs-utl-outline-none",noResize:"gs-utl-resize-none",spin:"gs-utl-animate-spin-fast",bounce:"gs-utl-animate-bounce"},Mo={link:U.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},vn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},bn={xs:"gs-utl-text-xs",sm:"gs-utl-text-sm",base:"gs-utl-text-base",lg:"gs-utl-text-lg",xl:"gs-utl-text-xl",xl2:"gs-utl-text-2xl"},jP={all:"gs-utl-break-all"},co="gs-utl-my-2",DP="gs-utl-my-3",I1=` gs-utl-rounded ${bn.xs} ${vn.mono} ${U.bgH25}`,V1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${co} gs-utl-ml-1`,jt={h1:`${bn.xl2} ${vn.bold} ${DP}`,h2:`${bn.xl} ${vn.bold} ${co}`,h3:`${bn.lg} ${vn.semibold} ${co}`,h4:`${bn.base} ${vn.semibold} ${co}`,h5:`${bn.sm} ${vn.semibold} ${co}`,h6:`${bn.xs} ${vn.semibold} ${co}`,strong:vn.bold,em:vn.italic,ul:`gs-utl-list-disc ${V1}`,ol:`gs-utl-list-decimal ${V1}`,codeInline:`${I1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${I1} gs-utl-p-3 gs-utl-overflow-x-auto ${co}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${co} ${vn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${co}`,thead:`${U.bgH2}`,tr:`gs-utl-border-b ${U.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${vn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Zl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Nd={itemList:({index:e=0,open:t=!1,length:n=0}={})=>X(U.bgH2,Te.xyS,U.br,e&&te.bt,(t||e===n-1)&&te.bb)},H1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),j1=e=>{let t={isSymbol:!1,bg:U.cmp,bgSoft:`${U.cmpBgSoft} ${U.cmpTxtActive}`,bgSoftX:U.cmpBgSoftX,border:U.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:U.cmpSymbol,bgSoft:`${U.cmpBgSymbolSoft} ${U.cmpTxtActive}`,bgSoftX:U.cmpBgSymbolSoftX,border:U.cmpSymbolBr,txt:""}),t},D1=({variant:e,size:t="m",className:n,disabledClassName:r,active:o,border:s=!0,rounded:a=!0,disabled:i=!1,withBg:l,block:u,full:d})=>{const p=e==="pr",f=e==="out",g=e==="out-clear",m=e==="warn",v=e==="danger",b=s&&(f||g||!e);return["gs-utl-transition-colors gs-utl-cursor-pointer",u&&"gs-utl-block",t==="x2s"&&"gs-utl-text-xs",t==="s"&&"gs-utl-p-1 gs-utl-text-sm",t==="m"&&"gs-utl-p-1 gs-utl-px-2",t==="m2"&&"gs-utl-p-1 gs-utl-px-3",t==="lg"&&"gs-utl-p-2 gs-utl-px-4 gs-utl-text-lg",n,a&&te.rnd,l&&U.bg,b?X(te.b,U.br,f&&U.bA,f&&U.tAo,!i&&U.hBgH):X(te.b,te.bT),m&&X(U.bgW,!i&&U.hBgW,"gs-utl-text-white"),v&&X(U.bgRed,!i&&U.hBgRed,"gs-utl-text-white"),p&&X(U.bgA2,!i&&U.hBgAct),o&&U.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",ri.focus]};function Ke({children:e,...t}){const{variant:n,size:r,active:o,border:s,rounded:a,block:i,full:l,className:u,icon:d,loading:p,withBg:f,disabled:g,type:m="button",disabledClassName:v,...b}=t,w=p?{icon:k2,size:"18px",className:X("animate-spin-fast")}:ct(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:X(D1(t)),disabled:g||p,type:m,...b,children:w?c.jsxs(k,{className:X("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(F,{children:c.jsx(re,{...w})}),e&&c.jsx(F,{children:e})]}):e})}function No({full:e,abs:t,small:n,size:r,className:o,bg:s,currentColor:a}){const i=N(e&&"gs-utl-w-full gs-utl-h-full",t?Oe.coverAbs:"gs-utl-relative",o),l=N(!r&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),r==="x2s"&&"gs-utl-size-3",r==="xs"&&"gs-utl-size-4",r==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",te.pill,te.bS,a?"gs-utl-border-current":te.bA);return c.jsxs(k,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:N(Oe.coverAbs,U.bg,Oe.disabled)}),c.jsx("div",{className:l})]})}const Jt={accessToken:""},FP=()=>{Jt.timeout&&(clearTimeout(Jt.timeout),Jt.timeout=void 0),Jt.accessToken="",Jt.license=void 0},F1=async()=>{var t;let e={accessToken:""};try{const n=await((t=Jt.getAccessToken)==null?void 0:t.call(Jt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Jt.getAccessToken&&console.error("Failed to get access token");return}if(Jt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Jt.timeout||void 0),Jt.timeout=setTimeout(F1,n-Date.now()-1)}},B1=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},sa=e=>B1(e)==="email",BP=e=>{var o;const t=U1(e),n=sa(e),r=e.getWrapper();return t.length>1?!1:n?((o=r==null?void 0:r.findFirstType("mj-body"))==null?void 0:o.components().length)===0:(r==null?void 0:r.components().length)===0},z1=(e,t={})=>{const{selectedComponents:n=[],withPageContent:r,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=B1(e),l=U1(e),u=BP(e),d=s?{id:s.getId(),name:s.getName(),content:r?KP(e):void 0}:void 0,p=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:p,selectedComponents:n.map(f=>({id:f.getId(),content:""})),projectType:i,availablePages:l,globalStyles:zP(e),installedPlugins:UP(e),devices:qP(e),isEmail:i==="email",imageUrls:o}},$d=(e,t,n)=>{const{layoutComponents:r}=n||{},o=t,s=o.type,a=s?r==null?void 0:r[s]:void 0;return a?{...o,...a({editor:e,props:t})}:t},Qt=(e,t,n)=>{const r=$d(e,t,n);return e.runCommand(ne.layoutComponentRender,{components:r})};function zP(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
- `)}const U1=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),UP=e=>{const t=GP(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},WP=e=>e.getModel().get("customData")??{},GP=e=>e&&WP(e).plugins||[];function qP(e){return e.Devices.getAll().map(t=>t.toJSON())}function Yl(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const Xl=(e="",t,n={})=>{if(!(!t||!e)){if(t.innerHTML=Yl(e),n.scrollDocument){requestAnimationFrame(()=>{const r=t.ownerDocument,o=r.scrollingElement||r.documentElement;o==null||o.scrollTo({top:o.scrollHeight,behavior:"smooth"})});return}n.skipScroll||(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var r;return(r=t==null?void 0:t.lastElementChild)==null?void 0:r.scrollIntoView({block:"nearest"})}))}},W1=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Jl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Ql(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function KP(e){const t=e.getWrapper(),n=W1(t);return`${sa(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const ZP=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],r=new Map,o=document.createElement("div");o.setAttribute("data-temp-els","true");const s=(a,i)=>{try{i.innerHTML=a.innerHTML,Array.from(a.attributes).forEach(l=>i.setAttribute(l.name,l.value))}catch{}};return{cleanup(){o==null||o.remove()},update:a=>{var f;const i=new DOMParser,l=Yl(a),u=i.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),p=e.getWrapper();return(f=p==null?void 0:p.getEl())==null||f.appendChild(o),d.forEach(g=>{var v,b;let m=g.id;if(m){const w=r.get(m),y=t.getById(m),S=y==null?void 0:y.getEl();S&&(s(g,S),!w&&requestAnimationFrame(()=>S==null?void 0:S.scrollIntoView({block:"nearest"}))),r.set(m,{cmp:y,cmpEl:S,newNode:g})}else if(n.includes(g.tagName)){m=[((v=g.tagName)==null?void 0:v.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const w=(b=r.get(m))==null?void 0:b.newNode;w?s(g,w):(o.appendChild(g),r.set(m,{newNode:g}))}}),r}}},YP=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:r,Css:o}=n,{html:s,css:a}=r.parseHtml(t,{returnArray:!0}),i=s[0];e.getId()===((u=i==null?void 0:i.attributes)==null?void 0:u.id)?(e.components().reset(i.components),e.addAttributes({...i==null?void 0:i.attributes,class:(d=i==null?void 0:i.classes)==null?void 0:d.join(" ")}),a&&o.addCollection(a,{extend:!0})):e.components(t)};function XP(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Zn="gs-cmp-ai-chat-tool-generate-image",JP=e=>{var x;const{editor:t,part:n,chatContext:r,isProcessing:o}=e,s=(E,P)=>t.t(`aiChat.message.tool.generateImage.${E}`,P),a=n.input||{},i=r.toolStatusProgress.get(n.toolCallId),l=(x=i==null?void 0:i.content)==null?void 0:x.trim(),u=l||s("generating"),d=Math.min(Math.max(a.n||1,1),4),p=XP(n.output),f=sa(t),g=E=>{const P=t.getSelected(),_=f?"mj-image":"image",T={type:_,attributes:{src:E}};let O;if(P!=null&&P.is(_)){P.addAttributes({src:E});return}if(P&&t.Components.canMove(P,T))O=P.append(T)[0];else if(!P){const L=t.getWrapper(),A=f?L==null?void 0:L.findFirstType("mj-column"):L;O=A==null?void 0:A.append(T)[0]}O&&t.select(O,{scroll:!0})},m=E=>{t.Canvas.startDrag({content:{type:f?"mj-image":"image",attributes:{src:E}}})},v=()=>{t.Canvas.endDrag()},b=N(`${Zn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),w=N(`${Zn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=N(`${Zn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),S=N(`${Zn}__item-actions`,Oe.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let C=null;return o?C=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:N(`${Zn}__status`,bn.xs,U.txtLowEmphasis),children:u}),c.jsx("div",{className:N(`${Zn}__placeholders`,b),children:Array.from({length:d}).map((E,P)=>c.jsx(k,{className:N(`${Zn}__placeholder`,w,U.bgH50,U.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(No,{className:`${Zn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${P}`))})]}):p.length?C=c.jsx("div",{className:N(`${Zn}__output`,b),children:p.map((E,P)=>c.jsxs("div",{className:w,children:[c.jsx("img",{className:y,src:E,alt:s("imageAlt",{num:P+1}),draggable:!0,onDragStart:()=>m(E),onDragEnd:v}),c.jsx(k,{className:S,children:c.jsx(Ke,{full:!0,variant:"pr",className:N(`${Zn}__btn-use`),onClick:()=>g(E),children:s("useImage")})})]},E))}):l&&(C=c.jsx("div",{className:N(`${Zn}__status`,bn.xs,U.txtLowEmphasis),children:l})),c.jsx(k,{className:Zn,col:!0,gap:"xs",children:C})};function QP(e){return{type:"custom",component:()=>c.jsx(JP,{...e})}}var xs=(e=>(e.ADD_NEW_COMPONENT="addNewComponent",e.EDIT_COMPONENT="editComponent",e.REMOVE_COMPONENT="removeComponent",e.MOVE_COMPONENT="moveComponent",e.ADD_NEW_PAGE="addNewPage",e.ADD_NEW_PROJECT_PAGE="addNewProjectPage",e.GET_PAGE_CONTENT="getPageContent",e.LIST_PAGES="listPages",e.FETCH_WEBSITE="fetchWebsite",e.GENERATE_IMAGE="generateImage",e.RUN_COMMAND="runCommand",e))(xs||{}),uo=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(uo||{}),oi=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(oi||{}),vr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(vr||{});function RP(e){const t=sa(e),n=o=>e.t(`aiChat.message.tool.command.${o}`),r={[oi.SHOW_CODE]:{label:({isExecuted:o})=>n(o?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(ne.dialogExportCode)},[oi.IMPORT_CODE]:{label:({isExecuted:o})=>n(o?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(ne.dialogImportCode)},[oi.PREVIEW]:{label:({isExecuted:o})=>n(o?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(r[oi.PAGE_SETTINGS]={label:({isExecuted:o})=>n(o?"pageSettings.done":"pageSettings.pending"),execute:()=>{const o=e.Pages.getSelected();e.runCommand(ne.setPageSettings,{page:o,isOpen:!0})}}),r}function G1(e,t={}){const{skipDefault:n,commands:r={}}=t,o=new Map(Object.entries(n?{}:RP(e))),s=(a,i)=>e.t(`aiChat.message.tool.command.${a}`,i);return Object.entries(r).forEach(([a,i])=>{if(!i)return;const l=a,u=o.get(l);o.set(l,{execute:i.execute??(u==null?void 0:u.execute),label:i.label??(u==null?void 0:u.label)})}),{async execute(a,i){const l=o.get(a.commandId);if(!l)throw new Error(s("notFound",{id:a.commandId}));if(!l.execute)throw new Error(s("missingHandler",{id:a.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:a,context:i})??{success:!0}},layoutToolLabel:({part:a})=>{const i=a.input,l=i!=null&&i.commandId?o.get(i.commandId):void 0;if(!(l!=null&&l.label))return;const u=a.state==="output-available";return l.label({isExecuted:u})}}}function eT(e){const t={async execute(i){const{componentId:l}=i,u=e.Components.getById(l);return u?(u.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${l}'`}}},n={async execute(i){const{sourceId:l,targetId:u,targetIndex:d}=i,p=e.Components.getById(l),f=e.Components.getById(u);return p?f?(f.append(p,{at:d}),e.select(p,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${u}'`}:{success:!1,error:`Source component not found with ID '${l}'`}}},r={async execute(i){const{pageId:l}=i,u=e.Pages.get(l),d=u==null?void 0:u.getMainComponent();return d?{content:W1(d)}:{success:!1,error:"Page not found"}}},o={async execute(){return{pages:e.Pages.getAll().map(l=>({id:l.getId(),name:l.getName()}))}}},s={layoutToolResult:i=>QP(i)},a=G1(e);return{[xs.REMOVE_COMPONENT]:t,[xs.MOVE_COMPONENT]:n,[xs.GET_PAGE_CONTENT]:r,[xs.LIST_PAGES]:o,[xs.GENERATE_IMAGE]:s,[xs.RUN_COMMAND]:a}}const q1="mjml-code-to-html";function tT(e){var s;const{editor:t,content:n,isEmail:r}=e;if(!r)return n;const o=Yl(n);try{const a=(s=t.runCommand(q1,{mjml:o}))==null?void 0:s.html;if(a)return a}catch{}return n}function nT(e){const{editor:t,component:n,content:r,isEmail:o,scrollDocument:s}=e,a=n==null?void 0:n.getEl();if(!a)return;const i=tT({editor:t,content:r,isEmail:o});Xl(i,a,{skipScroll:!0,scrollDocument:s})}function rT(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}function oT(e){Jl(e)}function sT(e){Ql(e)}function aT(e,t){var w;const{componentId:n,position:r}=t,o=sa(e),s=e.getWrapper(),a=o?s.findFirstType("mj-body"):s;Jl(e);const i=document.createElement("div");i.style.display="contents";const{Components:l}=e;let d=l.getById(n)||a;o&&d===s&&(d=a);const p=d==null?void 0:d.parent(),f=d==null?void 0:d.index(),g=d==null?void 0:d.getEl();let m="afterend",v;switch(r){case"before":p?(m="beforebegin",d=p,v=f):(m="afterbegin",v=0);break;case"beforeInside":m="afterbegin",v=0;break;case"afterInside":m="beforeend";break;case"after":p?(m="afterend",d=p,v=(f??0)+1):m="beforeend";break}return g?g==null||g.insertAdjacentElement(m,i):(w=p==null?void 0:p.getEl())==null||w.appendChild(i),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:i,updatePreview:y=>{let S=y;o&&(S=uT(e,d,y,v)),Xl(S,i,{skipScroll:!0})},cleanUp(){i==null||i.remove(),Ql(e)}}}const Rl="mjml",iT="mj-head",kd="gs-ai-chat-mjml-preview";function K1(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function lT(e,t){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(r.body.children).forEach(o=>{const a=[o.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();o.setAttribute("css-class",a)}),r.body.innerHTML}function cT(e,t,n){var f,g;const r=e.closestType(Rl),o=((f=r==null?void 0:r.findFirstType(iT))==null?void 0:f.toHTML())||"",s=e.components().map(m=>m.toHTML()),a=typeof n=="number"?Math.max(0,Math.min(n,s.length)):s.length;s.splice(a,0,t);const i=s.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==Rl;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>K1(m)).join(""),p=l.map(m=>`</${m.tagName}>`).join("");return`<${Rl}>${o}${d}${K1(e)}${i}</${e.tagName}>${p}</${Rl}>`}function uT(e,t,n,r){var s;const o=Yl(n);if(!(o!=null&&o.trim()))return"";try{const a=lT(o,kd),i=cT(t,a,r),l=(s=e.runCommand(q1,{mjml:i}))==null?void 0:s.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),p=Array.from(d.querySelectorAll(`.${kd}`));return p.length?p.map(f=>(f.classList.remove(kd),f.outerHTML)).join(""):""}catch{return""}}function dT(e,t,n){const{target:r,at:o}=t,s=r==null?void 0:r.append(n,{at:o})[0];return s&&setTimeout(()=>e.select(s,{scroll:!0}),50),s}function pT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:uo.ADD_COMPONENT_CODE,toolSetup:aT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.updatePreview(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;dT(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function fT(e){Jl(e);const t=ZP(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Ql(e)}}}function hT(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?YP(o,a):n==null||n.append(a)})}function gT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:uo.EDIT_COMPONENT_CODE,toolSetup:fT(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content),hT(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function mT(e,t){const{name:n}=t,{Pages:r,Components:o}=e;Jl(e);const s=r.add({name:n,component:"<h1></h1>"},{select:!0}),a=s.getMainComponent();return a.once(o.events.render,()=>{const i=a.getEl();i&&Xl(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
15
+ */var $1;function BP(){if($1)return Md;$1=1;var e=g;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(p,f){var h=f(),m=r({inst:{value:h,getSnapshot:f}}),b=m[0].inst,v=m[1];return s(function(){b.value=h,b.getSnapshot=f,l(b)&&v({inst:b})},[p,h,f]),o(function(){return l(b)&&v({inst:b}),p(function(){l(b)&&v({inst:b})})},[p]),a(h),h}function l(p){var f=p.getSnapshot;p=p.value;try{var h=f();return!n(p,h)}catch{return!0}}function u(p,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return Md.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Md}N1.exports=BP();var zP=N1.exports;function k1(e){e.reaction=new co("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function UP(e,t){t===void 0&&(t="observed");var n=g.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(i){return Ad.unregister(r),r.onStoreChange=i,r.reaction||(k1(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var o=n.current;o.reaction||(k1(o),Ad.register(n,o,o)),g.useDebugValue(o.reaction,VP),zP.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot);var s,a;if(o.reaction.track(function(){try{s=e()}catch(i){a=i}}),a)throw a;return s}var Ld,Nd,I1=typeof Symbol=="function"&&Symbol.for,WP=(Nd=(Ld=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Ld===void 0?void 0:Ld.configurable)!==null&&Nd!==void 0?Nd:!1,V1=I1?Symbol.for("react.forward_ref"):typeof g.forwardRef=="function"&&g.forwardRef(function(e){return null}).$$typeof,H1=I1?Symbol.for("react.memo"):typeof g.memo=="function"&&g.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(H1&&e.$$typeof===H1)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,o=e,s=e.displayName||e.name;if(V1&&e.$$typeof===V1&&(r=!0,o=e.render,typeof o!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(i,l){return UP(function(){return o(i,l)},s)};return a.displayName=e.displayName,WP&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),r&&(a=g.forwardRef(a)),a=g.memo(a),qP(e,a),a}var GP={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function qP(e,t){Object.keys(e).forEach(function(n){GP[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var $d;IP(On.unstable_batchedUpdates),$d=Ad.finalizeAllImmediately;const j1=new Map,KP=(e,t)=>`${t}-${e}`,D1=Kt(function({svg:t,iconSize:n,...r},o){const s=KP(t,n);let a=j1.get(s);return a||(a=xC(t,n),j1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let F1;const ZP=e=>{F1=e},YP=()=>F1;var K=(e=>(e.alertRhombus="alertRhombus",e.alignHorizontalCenter="alignHorizontalCenter",e.alignHorizontalLeft="alignHorizontalLeft",e.alignHorizontalRight="alignHorizontalRight",e.applicationBracketsOutline="applicationBracketsOutline",e.arrowDown="arrowDown",e.arrowExpandAll="arrowExpandAll",e.arrowRight="arrowRight",e.arrowULeftTop="arrowULeftTop",e.arrowURightTop="arrowURightTop",e.borderAllVariant="borderAllVariant",e.borderRadius="borderRadius",e.borderStyle="borderStyle",e.calendar="calendar",e.cellphoneLink="cellphoneLink",e.check="check",e.checkBold="checkBold",e.checkboxBlank="checkboxBlank",e.chevronUp="chevronUp",e.chevronDown="chevronDown",e.chevronLeft="chevronLeft",e.chevronRight="chevronRight",e.close="close",e.codeBraces="codeBraces",e.cog="cog",e.contentCopy="contentCopy",e.contentSave="contentSave",e.delete="delete",e.dotsVertical="dotsVertical",e.email="email",e.emailOutline="emailOutline",e.eye="eye",e.eyedropperVariant="eyedropperVariant",e.eyeOff="eyeOff",e.eyeOffOutline="eyeOffOutline",e.eyeOutline="eyeOutline",e.fire="fire",e.flare="flare",e.floppy="floppy",e.folder="folder",e.fullscreen="fullscreen",e.gradientVertical="gradientVertical",e.helpCircle="helpCircle",e.home="home",e.image="image",e.information="information",e.informationVariant="informationVariant",e.layers="layers",e.link="link",e.lock="lock",e.lockOpenVariant="lockOpenVariant",e.menuDown="menuDown",e.newspaperVariantOutline="newspaperVariantOutline",e.openInNew="openInNew",e.paletteSwatch="paletteSwatch",e.panVertical="panVertical",e.pencil="pencil",e.phone="phone",e.plus="plus",e.plusBox="plusBox",e.powerPlug="powerPlug",e.refresh="refresh",e.rhombusOutline="rhombusOutline",e.rhombusSplit="rhombusSplit",e.rhombusSplitOutline="rhombusSplitOutline",e.tag="tag",e.target="target",e.targetVariant="targetVariant",e.textBoxMultiple="textBoxMultiple",e.trayArrowDown="trayArrowDown",e.unfoldLessHorizontal="unfoldLessHorizontal",e.unfoldMoreHorizontal="unfoldMoreHorizontal",e.viewDayOutline="viewDayOutline",e.viewGridPlus="viewGridPlus",e.web="web",e.xml="xml",e.database="database",e.databaseOutline="databaseOutline",e.databaseOutlineOn="databaseOutlineOn",e.databaseOutlineOff="databaseOutlineOff",e.databaseOutlineRemove="databaseOutlineRemove",e.toggleSwitchOutline="toggleSwitchOutline",e.toggleSwitchOffOutline="toggleSwitchOffOutline",e.codeBrackets="codeBrackets",e.null="null",e.codeString="string",e.number="number",e.cloudUpload="cloudUpload",e.chat="chat",e.creation="creation",e.viewDashboard="viewDashboard",e.rocketLaunch="rocketLaunch",e.lightningBolt="lightningBolt",e.stop="stop",e.arrowUp="arrowUp",e))(K||{});const Jl={alertRhombus:FC,alignHorizontalCenter:BC,alignHorizontalLeft:zC,alignHorizontalRight:UC,applicationBracketsOutline:WC,arrowDown:GC,arrowExpandAll:qC,arrowRight:KC,arrowULeftTop:ZC,arrowURightTop:YC,borderAllVariant:JC,borderRadius:QC,borderStyle:RC,calendar:e2,cellphoneLink:t2,check:Ch,checkBold:r2,checkboxBlank:o2,chevronUp:l2,chevronDown:s2,chevronLeft:a2,chevronRight:i2,close:xh,codeBraces:u2,cog:f2,contentCopy:g2,contentSave:h2,delete:C2,dotsVertical:x2,email:E2,emailOutline:P2,eye:T2,eyedropperVariant:M2,eyeOff:O2,eyeOffOutline:_2,eyeOutline:A2,fire:N2,flare:$2,floppy:k2,folder:I2,fullscreen:V2,gradientVertical:H2,helpCircle:j2,home:D2,image:F2,information:z2,informationVariant:U2,layers:W2,link:K2,lock:Y2,lockOpenVariant:X2,menuDown:J2,newspaperVariantOutline:ex,openInNew:Eh,paletteSwatch:rx,panVertical:ox,pencil:sx,phone:ax,plus:ix,plusBox:lx,powerPlug:cx,refresh:ux,rhombusOutline:dx,rhombusSplit:px,rhombusSplitOutline:fx,tag:mx,target:bx,targetVariant:vx,textBoxMultiple:yx,trayArrowDown:Cx,unfoldLessHorizontal:xx,unfoldMoreHorizontal:Ex,viewDayOutline:Tx,viewGridPlus:Ox,web:_x,xml:Ax,database:b2,databaseOutline:w2,databaseOutlineOn:y2,databaseOutlineOff:v2,databaseOutlineRemove:S2,codeBrackets:d2,toggleSwitchOutline:Sx,toggleSwitchOffOutline:wx,null:tx,string:p2,number:nx,cloudUpload:c2,chat:n2,creation:m2,viewDashboard:Px,rocketLaunch:gx,lightningBolt:q2,stop:hx,arrowUp:XC},XP="gs-cmp-icon",ne=ce(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=YP(),l=(i==null?void 0:i[n])||(Jl==null?void 0:Jl[n])||n,u=[s&&"scaleX(-1)",a&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(p=>!!p).join(" ");if(!l)return null;const d=N(XP,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(D1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(Wa,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),kd=150,U={bgTr:"gs-utl-bg-transparent",txt:"gs-theme-cl-txt gs-utl-text-gray-900 dark:gs-utl-text-gray-400",txtLowEmphasis:"gs-utl-text-neutral-500 dark:gs-utl-text-neutral-500",txtHighEmphasis:"gs-utl-text-black dark:gs-utl-text-gray-200",txtHighEmphasisH:"hover:gs-utl-text-black hover:dark:gs-utl-text-gray-200",tA:"gs-theme-cl-tA gs-utl-text-violet-400",tAo:"gs-theme-cl-tAo gs-utl-text-violet-800 dark:gs-utl-text-violet-400",hTAo:"gs-theme-cl-hTAo hover:gs-utl-text-violet-800 hover:dark:gs-utl-text-violet-400",grouphTAo:"gs-theme-cl-grouphTAo group-hover:gs-utl-text-violet-800 group-hover:dark:gs-utl-text-violet-400",bA:"gs-theme-cl-bA gs-utl-border-violet-400",bgA:"gs-theme-cl-bgA gs-utl-bg-violet-400 gs-utl-text-white dark:gs-utl-bg-violet-500",bgA2:"gs-theme-cl-bgA2 gs-utl-bg-violet-500 gs-utl-text-white",bgO:"gs-theme-cl-bg0 gs-utl-bg-violet-50 gs-utl-text-violet-900 dark:gs-utl-bg-zinc-800 dark:gs-utl-text-violet-400",bg:"gs-theme-cl-bg gs-utl-bg-white dark:gs-utl-bg-zinc-900",bgBlur:"gs-utl-bg-white/50 dark:gs-utl-bg-zinc-900/50 gs-utl-backdrop-blur-sm",bgBlurM:"gs-utl-bg-white/80 dark:gs-utl-bg-zinc-900/80 gs-utl-backdrop-blur-md",bgH:"gs-theme-cl-bgH gs-utl-bg-gray-100 dark:gs-utl-bg-zinc-700",bgH75:"gs-utl-bg-gray-100/75 dark:gs-utl-bg-zinc-700/75",bgH50:"gs-utl-bg-gray-100/50 dark:gs-utl-bg-zinc-700/50",bgH25:"gs-utl-bg-gray-100/25 dark:gs-utl-bg-zinc-700/25",hBgH:"gs-theme-cl-hBgH hover:gs-utl-bg-gray-50 hover:dark:gs-utl-bg-zinc-800",bgH2:"gs-theme-cl-bgH2 gs-utl-bg-gray-25 dark:gs-utl-bg-zinc-800",hBgH2:"gs-theme-cl-hBgH2 hover:gs-utl-bg-gray-25 hover:dark:gs-utl-bg-zinc-800",hBgAct:"gs-theme-cl-hBgAct hover:gs-utl-bg-violet-800 hover:dark:gs-utl-bg-violet-400",hBgA2:"gs-theme-cl-hBgA2 hover:gs-utl-bg-violet-500 hover:dark:gs-utl-bg-violet-600",hBgDark:"hover:gs-utl-bg-black/10",sel:"gs-theme-cl-sel gs-utl-bg-pink-200 gs-utl-text-pink-900",selBr:"gs-theme-cl-selBr gs-utl-border-pink-900",cmp:"gs-theme-cl-cmp gs-utl-bg-blue-450 gs-utl-text-white",cmpSymbol:"gs-theme-cl-cmpSymbol gs-utl-bg-[#7b61ff] gs-utl-text-white",cmpBgSoft:"gs-theme-cl-cmpBgSoft gs-utl-bg-blue-100 dark:gs-utl-bg-sky-800",cmpBgSymbolSoft:"gs-theme-cl-cmpBgSymbolSoft gs-utl-bg-violet-200 dark:gs-utl-bg-violet-800",cmpBgSoftX:"gs-theme-cl-cmpBgSoftX gs-utl-bg-blue-50 dark:gs-utl-bg-gray-800",cmpBgSymbolSoftX:"gs-theme-cl-cmpBgSymbolSoftX gs-utl-bg-[#edebff] dark:gs-utl-bg-[#2d1b4b]",cmpTxtActive:"gs-theme-cl-cmpTxtActive dark:gs-utl-text-gray-300",cmpBr:"gs-theme-cl-cmpBr gs-utl-border-blue-450",cmpSymbolBr:"gs-theme-cl-cmpSymbolBr gs-utl-border-[#7b61ff]",cmpTargetBg:"gs-utl-bg-amber-500 gs-utl-text-white",cmpTargetBgOpac:"gs-utl-bg-amber-500/5",cmpTargetBr:"gs-utl-border-amber-500",tW:"gs-utl-text-amber-500",tE:"gs-utl-text-red-500",tS:"gs-utl-text-green-500",boxWarn:"gs-utl-bg-amber-50 gs-utl-border-amber-200 gs-utl-text-amber-700 dark:gs-utl-bg-amber-200/10 dark:gs-utl-border-amber-200/20 dark:gs-utl-text-amber-100/80",boxSuccess:"gs-utl-bg-green-50 gs-utl-border-green-200 gs-utl-text-green-700 dark:gs-utl-bg-green-500/20 dark:gs-utl-border-green-500/20 dark:gs-utl-text-green-100/80",boxDanger:"gs-utl-bg-red-50 gs-utl-border-red-200 gs-utl-text-red-700 dark:gs-utl-bg-red-500/20 dark:gs-utl-border-red-500/20 dark:gs-utl-text-red-100/80",bgW:"gs-utl-bg-amber-500",bgRed:"gs-utl-bg-red-500",hBgRed:"hover:gs-utl-bg-red-600",hBgW:"hover:gs-utl-bg-amber-600",br:"gs-theme-cl-br gs-utl-border-gray-300 dark:gs-utl-border-zinc-700",brRed:"gs-utl-border-red-500",brLight:"gs-utl-border-white/25"},B1={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-scale-95 gs-utl-opacity-0",enterTo:"gs-utl-opacity-100",leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-scale-100 gs-utl-opacity-100",leaveTo:"gs-utl-scale-95 gs-utl-opacity-0"},JP={...{enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},...{leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"}},Te={xy:"gs-utl-px-4 gs-utl-py-2",xyS:"gs-utl-px-2 gs-utl-py-1",xyS2:"gs-utl-px-2 gs-utl-py-0.5",x:"gs-utl-px-4",xS:"gs-utl-px-2",y:"gs-utl-py-2",s:"gs-utl-p-2",m:"gs-utl-p-4"},Id={bg:U.bg,bgH:U.bgH},z1={bg:"gs-utl-bg-zinc-700",txt:"gs-utl-text-white",block:"gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-rounded gs-utl-px-2 gs-utl-py-1"},re={rnd:"gs-utl-rounded",rndMd:"gs-utl-rounded-md",rndLg:"gs-utl-rounded-lg",pill:"gs-utl-rounded-full",b:"gs-utl-border",bT:"gs-utl-border-transparent",bS:"gs-utl-border-2",bt:"gs-utl-border-t",bb:"gs-utl-border-b",br:"gs-utl-border-r",bl:"gs-utl-border-l",none:"gs-utl-border-0",bA:"gs-theme-cl-bA gs-utl-border-violet-400 dark:gs-utl-border-violet-500"},si={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},se={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Oe={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverM:"gs-utl-transition-opacity gs-utl-opacity-80 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollX:"gs-utl-overflow-x-auto gs-utl-overflow-y-hidden",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",hiddenVisually:"gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001]",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",disabledM:"gs-utl-opacity-50 gs-utl-cursor-not-allowed",noFocusOut:"focus:gs-utl-outline-none",noResize:"gs-utl-resize-none",spin:"gs-utl-animate-spin-fast",bounce:"gs-utl-animate-bounce"},$o={link:U.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},bn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},vn={xs:"gs-utl-text-xs",sm:"gs-utl-text-sm",base:"gs-utl-text-base",lg:"gs-utl-text-lg",xl:"gs-utl-text-xl",xl2:"gs-utl-text-2xl"},QP={all:"gs-utl-break-all"},po="gs-utl-my-2",RP="gs-utl-my-3",U1=` gs-utl-rounded ${vn.xs} ${bn.mono} ${U.bgH25}`,W1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${po} gs-utl-ml-1`,jt={h1:`${vn.xl2} ${bn.bold} ${RP}`,h2:`${vn.xl} ${bn.bold} ${po}`,h3:`${vn.lg} ${bn.semibold} ${po}`,h4:`${vn.base} ${bn.semibold} ${po}`,h5:`${vn.sm} ${bn.semibold} ${po}`,h6:`${vn.xs} ${bn.semibold} ${po}`,strong:bn.bold,em:bn.italic,ul:`gs-utl-list-disc ${W1}`,ol:`gs-utl-list-decimal ${W1}`,codeInline:`${U1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${U1} gs-utl-p-3 gs-utl-overflow-x-auto ${po}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${po} ${bn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${po}`,thead:`${U.bgH2}`,tr:`gs-utl-border-b ${U.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${bn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Ql={s:"gs-utl-size-5",m:"gs-utl-size-10"},Vd={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Q(U.bgH2,Te.xyS,U.br,e&&re.bt,(t||e===n-1)&&re.bb)},G1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),q1=e=>{let t={isSymbol:!1,bg:U.cmp,bgSoft:`${U.cmpBgSoft} ${U.cmpTxtActive}`,bgSoftX:U.cmpBgSoftX,border:U.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:U.cmpSymbol,bgSoft:`${U.cmpBgSymbolSoft} ${U.cmpTxtActive}`,bgSoftX:U.cmpBgSymbolSoftX,border:U.cmpSymbolBr,txt:""}),t},K1=({variant:e,size:t="m",className:n,disabledClassName:r,active:o,border:s=!0,rounded:a=!0,disabled:i=!1,withBg:l,block:u,full:d})=>{const p=e==="pr",f=e==="out",h=e==="out-clear",m=e==="warn",b=e==="danger",v=s&&(f||h||!e);return["gs-utl-transition-colors gs-utl-cursor-pointer",u&&"gs-utl-block",t==="x2s"&&"gs-utl-text-xs",t==="s"&&"gs-utl-p-1 gs-utl-text-sm",t==="m"&&"gs-utl-p-1 gs-utl-px-2",t==="m2"&&"gs-utl-p-1 gs-utl-px-3",t==="lg"&&"gs-utl-p-2 gs-utl-px-4 gs-utl-text-lg",n,a&&re.rnd,l&&U.bg,v?Q(re.b,U.br,f&&U.bA,f&&U.tAo,!i&&U.hBgH):Q(re.b,re.bT),m&&Q(U.bgW,!i&&U.hBgW,"gs-utl-text-white"),b&&Q(U.bgRed,!i&&U.hBgRed,"gs-utl-text-white"),p&&Q(U.bgA2,!i&&U.hBgAct),o&&U.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",si.focus]};function Je({children:e,...t}){const{variant:n,size:r,active:o,border:s,rounded:a,block:i,full:l,className:u,icon:d,loading:p,withBg:f,disabled:h,type:m="button",disabledClassName:b,...v}=t,w=p?{icon:Z2,size:"18px",className:Q("animate-spin-fast")}:dt(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:Q(K1(t)),disabled:h||p,type:m,...v,children:w?c.jsxs(I,{className:Q("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(F,{children:c.jsx(ne,{...w})}),e&&c.jsx(F,{children:e})]}):e})}function ko({full:e,abs:t,small:n,size:r,className:o,bg:s,currentColor:a}){const i=N(e&&"gs-utl-w-full gs-utl-h-full",t?Oe.coverAbs:"gs-utl-relative",o),l=N(!r&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),r==="x2s"&&"gs-utl-size-3",r==="xs"&&"gs-utl-size-4",r==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",re.pill,re.bS,a?"gs-utl-border-current":re.bA);return c.jsxs(I,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:N(Oe.coverAbs,U.bg,Oe.disabled)}),c.jsx("div",{className:l})]})}const eT=1e3,tT=5e3,Bt={accessToken:""},nT=()=>{Bt.timeout&&(clearTimeout(Bt.timeout),Bt.timeout=void 0),Bt.accessToken="",Bt.license=void 0},Hd=async()=>{var t;let e={accessToken:""};try{const n=await((t=Bt.getAccessToken)==null?void 0:t.call(Bt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Bt.getAccessToken&&console.error("Failed to get access token");return}if(Bt.accessToken=e.accessToken,clearTimeout(Bt.timeout),Bt.timeout=void 0,e.expiresAt){const n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)){console.error("Failed to parse access token expiration date",e.expiresAt);return}const r=n-Date.now()-eT;if(r<=0){console.warn("Received an already expired access token, retrying access token refresh soon"),Bt.timeout=setTimeout(Hd,tT);return}Bt.timeout=setTimeout(Hd,r)}},Z1=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},aa=e=>Z1(e)==="email",Y1=e=>{var o;const t=J1(e),n=aa(e),r=e.getWrapper();return t.length>1?!1:n?((o=r==null?void 0:r.findFirstType("mj-body"))==null?void 0:o.components().length)===0:(r==null?void 0:r.components().length)===0},X1=(e,t={})=>{const{selectedComponents:n=[],withPageContent:r,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=Z1(e),l=J1(e),u=Y1(e),d=s?{id:s.getId(),name:s.getName(),content:r?lT(e):void 0}:void 0,p=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:p,selectedComponents:n.map(f=>({id:f.getId(),content:""})),projectType:i,availablePages:l,globalStyles:rT(e),installedPlugins:oT(e),devices:iT(e),isEmail:i==="email",imageUrls:o}},jd=(e,t,n)=>{const{layoutComponents:r}=n||{},o=t,s=o.type,a=s?r==null?void 0:r[s]:void 0;return a?{...o,...a({editor:e,props:t})}:t},Qt=(e,t,n)=>{const r=jd(e,t,n);return e.runCommand(te.layoutComponentRender,{components:r})};function rT(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
+ `)}const J1=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),oT=e=>{const t=aT(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},sT=e=>e.getModel().get("customData")??{},aT=e=>e&&sT(e).plugins||[];function iT(e){return e.Devices.getAll().map(t=>t.toJSON())}function Rl(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const ec=(e="",t,n={})=>{if(!(!t||!e)){if(t.innerHTML=Rl(e),n.scrollDocument){requestAnimationFrame(()=>{const r=t.ownerDocument,o=r.scrollingElement||r.documentElement;o==null||o.scrollTo({top:o.scrollHeight,behavior:"smooth"})});return}n.skipScroll||(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var r;return(r=t==null?void 0:t.lastElementChild)==null?void 0:r.scrollIntoView({block:"nearest"})}))}},Q1=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function tc(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function nc(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function lT(e){const t=e.getWrapper(),n=Q1(t);return`${aa(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const cT=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],r=new Map,o=document.createElement("div");o.setAttribute("data-temp-els","true");const s=(a,i)=>{try{i.innerHTML=a.innerHTML,Array.from(a.attributes).forEach(l=>i.setAttribute(l.name,l.value))}catch{}};return{cleanup(){o==null||o.remove()},update:a=>{var f;const i=new DOMParser,l=Rl(a),u=i.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),p=e.getWrapper();return(f=p==null?void 0:p.getEl())==null||f.appendChild(o),d.forEach(h=>{var b,v;let m=h.id;if(m){const w=r.get(m),y=t.getById(m),S=y==null?void 0:y.getEl();S&&(s(h,S),!w&&requestAnimationFrame(()=>S==null?void 0:S.scrollIntoView({block:"nearest"}))),r.set(m,{cmp:y,cmpEl:S,newNode:h})}else if(n.includes(h.tagName)){m=[((b=h.tagName)==null?void 0:b.toLowerCase())||"",...Array.from(h.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const w=(v=r.get(m))==null?void 0:v.newNode;w?s(h,w):(o.appendChild(h),r.set(m,{newNode:h}))}}),r}}},uT=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:r,Css:o}=n,{html:s,css:a}=r.parseHtml(t,{returnArray:!0}),i=s[0];e.getId()===((u=i==null?void 0:i.attributes)==null?void 0:u.id)?(e.components().reset(i.components),e.addAttributes({...i==null?void 0:i.attributes,class:(d=i==null?void 0:i.classes)==null?void 0:d.join(" ")}),a&&o.addCollection(a,{extend:!0})):e.components(t)};function dT(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Yn="gs-cmp-ai-chat-tool-generate-image",pT=e=>{var E;const{editor:t,part:n,chatContext:r,isProcessing:o}=e,s=(x,P)=>t.t(`aiChat.message.tool.generateImage.${x}`,P),a=n.input||{},i=r.toolStatusProgress.get(n.toolCallId),l=(E=i==null?void 0:i.content)==null?void 0:E.trim(),u=l||s("generating"),d=Math.min(Math.max(a.n||1,1),4),p=dT(n.output),f=aa(t),h=x=>{const P=t.getSelected(),_=f?"mj-image":"image",T={type:_,attributes:{src:x}};let O;if(P!=null&&P.is(_)){P.addAttributes({src:x});return}if(P&&t.Components.canMove(P,T))O=P.append(T)[0];else if(!P){const M=t.getWrapper(),A=f?M==null?void 0:M.findFirstType("mj-column"):M;O=A==null?void 0:A.append(T)[0]}O&&t.select(O,{scroll:!0})},m=x=>{t.Canvas.startDrag({content:{type:f?"mj-image":"image",attributes:{src:x}}})},b=()=>{t.Canvas.endDrag()},v=N(`${Yn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),w=N(`${Yn}__item`,re.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=N(`${Yn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),S=N(`${Yn}__item-actions`,Oe.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let C=null;return o?C=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:N(`${Yn}__status`,vn.xs,U.txtLowEmphasis),children:u}),c.jsx("div",{className:N(`${Yn}__placeholders`,v),children:Array.from({length:d}).map((x,P)=>c.jsx(I,{className:N(`${Yn}__placeholder`,w,U.bgH50,U.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(ko,{className:`${Yn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${P}`))})]}):p.length?C=c.jsx("div",{className:N(`${Yn}__output`,v),children:p.map((x,P)=>c.jsxs("div",{className:w,children:[c.jsx("img",{className:y,src:x,alt:s("imageAlt",{num:P+1}),draggable:!0,onDragStart:()=>m(x),onDragEnd:b}),c.jsx(I,{className:S,children:c.jsx(Je,{full:!0,variant:"pr",className:N(`${Yn}__btn-use`),onClick:()=>h(x),children:s("useImage")})})]},x))}):l&&(C=c.jsx("div",{className:N(`${Yn}__status`,vn.xs,U.txtLowEmphasis),children:l})),c.jsx(I,{className:Yn,col:!0,gap:"xs",children:C})};function fT(e){return{type:"custom",component:()=>c.jsx(pT,{...e})}}var Io=(e=>(e.ADD_NEW_COMPONENT="addNewComponent",e.EDIT_COMPONENT="editComponent",e.REMOVE_COMPONENT="removeComponent",e.MOVE_COMPONENT="moveComponent",e.ADD_NEW_PAGE="addNewPage",e.ADD_NEW_PROJECT_PAGE="addNewProjectPage",e.GET_PAGE_CONTENT="getPageContent",e.LIST_PAGES="listPages",e.FETCH_WEBSITE="fetchWebsite",e.GENERATE_IMAGE="generateImage",e.RUN_COMMAND="runCommand",e))(Io||{}),fo=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(fo||{}),ai=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(ai||{}),vr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(vr||{});function gT(e){const t=aa(e),n=o=>e.t(`aiChat.message.tool.command.${o}`),r={[ai.SHOW_CODE]:{label:({isExecuted:o})=>n(o?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(te.dialogExportCode)},[ai.IMPORT_CODE]:{label:({isExecuted:o})=>n(o?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(te.dialogImportCode)},[ai.PREVIEW]:{label:({isExecuted:o})=>n(o?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(r[ai.PAGE_SETTINGS]={label:({isExecuted:o})=>n(o?"pageSettings.done":"pageSettings.pending"),execute:()=>{const o=e.Pages.getSelected();e.runCommand(te.setPageSettings,{page:o,isOpen:!0})}}),r}function R1(e,t={}){const{skipDefault:n,commands:r={}}=t,o=new Map(Object.entries(n?{}:gT(e))),s=(a,i)=>e.t(`aiChat.message.tool.command.${a}`,i);return Object.entries(r).forEach(([a,i])=>{if(!i)return;const l=a,u=o.get(l);o.set(l,{execute:i.execute??(u==null?void 0:u.execute),label:i.label??(u==null?void 0:u.label)})}),{async execute(a,i){const l=o.get(a.commandId);if(!l)throw new Error(s("notFound",{id:a.commandId}));if(!l.execute)throw new Error(s("missingHandler",{id:a.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:a,context:i})??{success:!0}},layoutToolLabel:({part:a})=>{const i=a.input,l=i!=null&&i.commandId?o.get(i.commandId):void 0;if(!(l!=null&&l.label))return;const u=a.state==="output-available";return l.label({isExecuted:u})}}}function hT(e){const t={async execute(l){const{componentId:u}=l,d=e.Components.getById(u);return d?(d.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${u}'`}}},n={async execute(l){const{sourceId:u,targetId:d,targetIndex:p}=l,f=e.Components.getById(u),h=e.Components.getById(d);return f?h?(h.append(f,{at:p}),e.select(f,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${d}'`}:{success:!1,error:`Source component not found with ID '${u}'`}}},r={async execute(l){const{pageId:u}=l,d=e.Pages.get(u),p=d==null?void 0:d.getMainComponent();return p?{content:Q1(p)}:{success:!1,error:"Page not found"}}},o={async execute(){return{pages:e.Pages.getAll().map(u=>({id:u.getId(),name:u.getName()}))}}},s={layoutToolResult:l=>fT(l)},a={layoutToolLabel:({part:l})=>{const u=l.input,d=String((u==null?void 0:u.url)||"").trim(),f=(typeof l.state=="string"?l.state:void 0)==="output-available";return e.t(`aiChat.message.tool.fetchWebsite.${f?"done":"pending"}`,{params:{url:d}})},onData:({editor:l,toolStatus:u})=>{const{data:d}=u,{status:p,content:f,input:h}=d;if(p!=="done")return;const m=f==null?void 0:f.trim();if(!m)throw new Error(l.t("aiChat.message.tool.fetchWebsite.missingContent"));const{Pages:b}=l,v=b.getAll();Y1(l)&&v[0]&&b.remove(v[0]);const w=String((h==null?void 0:h.name)||"").trim()||l.t("aiChat.message.tool.fetchWebsite.defaultPageName");b.add({name:w,component:m},{select:!0}),l.runCommand(te.canvasReload)}},i=R1(e);return{[Io.REMOVE_COMPONENT]:t,[Io.MOVE_COMPONENT]:n,[Io.GET_PAGE_CONTENT]:r,[Io.LIST_PAGES]:o,[Io.FETCH_WEBSITE]:a,[Io.GENERATE_IMAGE]:s,[Io.RUN_COMMAND]:i}}const em="mjml-code-to-html";function mT(e){var s;const{editor:t,content:n,isEmail:r}=e;if(!r)return n;const o=Rl(n);try{const a=(s=t.runCommand(em,{mjml:o}))==null?void 0:s.html;if(a)return a}catch{}return n}function bT(e){const{editor:t,component:n,content:r,isEmail:o,scrollDocument:s}=e,a=n==null?void 0:n.getEl();if(!a)return;const i=mT({editor:t,content:r,isEmail:o});ec(i,a,{skipScroll:!0,scrollDocument:s})}function vT(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}function yT(e){tc(e)}function wT(e){nc(e)}function ST(e,t){var w;const{componentId:n,position:r}=t,o=aa(e),s=e.getWrapper(),a=o?s.findFirstType("mj-body"):s;tc(e);const i=document.createElement("div");i.style.display="contents";const{Components:l}=e;let d=l.getById(n)||a;o&&d===s&&(d=a);const p=d==null?void 0:d.parent(),f=d==null?void 0:d.index(),h=d==null?void 0:d.getEl();let m="afterend",b;switch(r){case"before":p?(m="beforebegin",d=p,b=f):(m="afterbegin",b=0);break;case"beforeInside":m="afterbegin",b=0;break;case"afterInside":m="beforeend";break;case"after":p?(m="afterend",d=p,b=(f??0)+1):m="beforeend";break}return h?h==null||h.insertAdjacentElement(m,i):(w=p==null?void 0:p.getEl())==null||w.appendChild(i),{target:d,at:b,domPosition:m,tempTargetEl:h,tempDOM:i,updatePreview:y=>{let S=y;o&&(S=PT(e,d,y,b)),ec(S,i,{skipScroll:!0})},cleanUp(){i==null||i.remove(),nc(e)}}}const rc="mjml",CT="mj-head",Dd="gs-ai-chat-mjml-preview";function tm(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function xT(e,t){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(r.body.children).forEach(o=>{const a=[o.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();o.setAttribute("css-class",a)}),r.body.innerHTML}function ET(e,t,n){var f,h;const r=e.closestType(rc),o=((f=r==null?void 0:r.findFirstType(CT))==null?void 0:f.toHTML())||"",s=e.components().map(m=>m.toHTML()),a=typeof n=="number"?Math.max(0,Math.min(n,s.length)):s.length;s.splice(a,0,t);const i=s.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==rc;)(h=u.tagName)!=null&&h.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>tm(m)).join(""),p=l.map(m=>`</${m.tagName}>`).join("");return`<${rc}>${o}${d}${tm(e)}${i}</${e.tagName}>${p}</${rc}>`}function PT(e,t,n,r){var s;const o=Rl(n);if(!(o!=null&&o.trim()))return"";try{const a=xT(o,Dd),i=ET(t,a,r),l=(s=e.runCommand(em,{mjml:i}))==null?void 0:s.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),p=Array.from(d.querySelectorAll(`.${Dd}`));return p.length?p.map(f=>(f.classList.remove(Dd),f.outerHTML)).join(""):""}catch{return""}}function TT(e,t,n){const{target:r,at:o}=t,s=r==null?void 0:r.append(n,{at:o})[0];return s&&setTimeout(()=>e.select(s,{scroll:!0}),50),s}function OT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:fo.ADD_COMPONENT_CODE,toolSetup:ST(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.updatePreview(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;TT(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function _T(e){tc(e);const t=cT(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),nc(e)}}}function AT(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?uT(o,a):n==null||n.append(a)})}function MT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:fo.EDIT_COMPONENT_CODE,toolSetup:_T(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content),AT(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function LT(e,t){const{name:n}=t,{Pages:r,Components:o}=e;tc(e);const s=r.add({name:n,component:"<h1></h1>"},{select:!0}),a=s.getMainComponent();return a.once(o.events.render,()=>{const i=a.getEl();i&&ec(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
17
17
  Generating ${n?`"${n}" `:""}page...
18
- </h1>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){Ql(e)}}}function vT(e,t){const{cmpRoot:n}=e;n.components(t)}function bT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:uo.ADD_PAGE_CODE,toolSetup:mT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&Xl(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;vT(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function yT(e){oT(e);const t=e.getWrapper(),n=z1(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){sT(e)}}}function wT(e,t,n){rT(e,t,n)}function ST(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:uo.ADD_PROJECT_PAGE_CODE,toolSetup:yT(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,nT({editor:t,component:i.toolSetup.cmpRoot,content:o.content,isEmail:i.toolSetup.isEmail}));return}if(a==="done"&&i&&o.content){if(i.completed)return;wT(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const Z1={[uo.ADD_COMPONENT_CODE]:pT,[uo.EDIT_COMPONENT_CODE]:gT,[uo.ADD_PAGE_CODE]:bT,[uo.ADD_PROJECT_PAGE_CODE]:ST},CT=({editor:e,data:t,toolStatusProgress:n,tools:r,chatApi:o})=>{var u;if(t.type!=="data-tool-status")return;const s=t,a=((u=s.data)==null?void 0:u.name)||"",i=Z1[a];i?i({editor:e,toolStatus:s,toolStatusProgress:n}):xT({toolStatus:s,toolStatusProgress:n});const l=r[a];if(!(!(l!=null&&l.onData)||!o))try{l.onData({editor:e,chatApi:o,toolStatus:s,toolStatusProgress:n})}catch(d){o.setError(d)}};function xT({toolStatus:e,toolStatusProgress:t}){const{id:n,data:r}=e;if(!n||!r)return;const{status:o,content:s}=r;let a=t.get(n);a||(a={type:"generic",content:"",completed:!1},t.set(n,a)),o==="streaming"&&s&&(a.content=s),o==="done"&&(s&&(a.content=s),t.delete(n)),o==="error"&&t.delete(n)}var ET={NODE_ENV:"production"};class PT{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=eT(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,createCommandTool:a=>G1(t,a),editor:t}))||r;const{chat:o}=this.createChat();this.currentChatId=o.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const r=this.createChat();this.currentChatId=r.chat.id}}}createChat(t){const n=this.editor,r=new Map,o=new Set,s=new Set,{tools:a}=this,{chatApi:i,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:p={},onMessagesUpdate:f,messages:g}=this.options,{onFinish:m,onData:v,...b}=p,w=typeof g=="function",y=[],S=new on.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:lr.lastAssistantMessageIsCompleteWithToolCalls,transport:new lr.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:T,messages:O,body:L,id:A,trigger:$,credentials:B}){var V;const M={...L,id:A,trigger:$,messages:O.slice(-10),projectContext:z1(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},j=typeof u=="function"?u({editor:n,body:M,messages:O}):u,{accessToken:W,license:D}=Jt,z=ET.NODE_ENV!=="production",I=`${Yu({isDev:z,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!D||["enterprise","business"].includes(((V=D==null?void 0:D.plan)==null?void 0:V.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:I,headers:{...T,...W?{Authorization:`Bearer ${W}`}:{}},credentials:B,body:{...M,...j}}}}),onToolCall:async({toolCall:T})=>{l==null||l({toolCall:T});const O=!!Z1[T.toolName];if(T.dynamic||O)return;const{toolName:L,input:A,toolCallId:$}=T,B=a[L];if(B&&B.execute){const M=new AbortController;o.add(M);try{const{messages:j}=S,W=await Promise.race([B.execute(A||{},{editor:n,messages:j,lastUserMessage:j.findLast(D=>D.role==="user"),toolCallId:$,abortController:M}),new Promise((D,z)=>{M.signal.addEventListener("abort",()=>z(new Error("Aborted")))})]);if(W&&typeof W.error=="string")throw new Error(W.error);S.addToolOutput({tool:L,toolCallId:$,output:W})}catch(j){S.addToolOutput({tool:L,toolCallId:$,state:"output-error",errorText:j instanceof Error?j.message:"Unknown error"})}finally{o.delete(M)}}},onData(T){v==null||v(T),CT({editor:n,data:T,toolStatusProgress:r,tools:a,chatApi:x})},onFinish(T){f==null||f({messages:T.messages,editor:n}),T.isAbort&&(r.forEach(O=>{"toolSetup"in O&&O.toolSetup.cleanUp()}),r.clear()),m==null||m(T)},...b}),C=new Set,x={get messages(){return S.messages},get lastMessage(){return S.lastMessage},get status(){return S.status},get error(){return S.error},sendMessage:(...T)=>E.isMessagesLoaded?S.sendMessage(...T):(y.push(T),Promise.resolve()),setMessages:T=>{S.messages=T},clearError:()=>S.clearError(),stop:()=>S.stop(),setError:T=>{const O=T instanceof Error?T:new Error(String(T));S.setStatus({status:"error",error:O})}},E={chat:S,chatApi:x,isMessagesLoaded:!w,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:T=>(C.add(T),()=>{C.delete(T)}),emitUpdate:()=>{C.forEach(T=>T())}},P=async()=>{if(!E.isMessagesLoaded||y.length===0)return;const T=y.splice(0);for(const O of T)await S.sendMessage(...O)};this.chatStates.set(S.id,E);const _=()=>{S["~registerMessagesCallback"](()=>{S.status==="ready"&&(f==null||f({messages:S.messages,editor:n}))})};return w?g({editor:n}).then(T=>{S.messages=T,_()}).catch(T=>x.setError(T)).finally(()=>{E.isMessagesLoaded=!0,P().catch(T=>x.setError(T)),E.emitUpdate()}):_(),E}}const TT=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],OT=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],aa="gs-cmp-ai-chat-empty",_T=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=N(aa,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=r.t(`${a}.title`),u=r.t(`${a}.subtitle`),d=sa(r)?OT:TT,p=o??d;return c.jsxs(k,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(k,{className:`${aa}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${aa}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${aa}__subtitle`,U.txtLowEmphasis),children:u})]}),c.jsx(k,{col:!0,className:`${aa}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(f=>{const g=r.t(`${a}.suggestions.${f.id}`)||f.label,m=f.prompt??g;return c.jsx(Ke,{className:`${aa}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},f.id)})})]})},si="gs-cmp-ai-chat-error",AT=({className:e,style:t,chatContext:n,editor:r})=>{var i;const o=N(si,e,U.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${si}__message gs-utl-text-sm gs-utl-opacity-75 gs-utl-max-h-24 gs-utl-overflow-auto gs-utl-break-words gs-utl-max-w-full`;return c.jsxs(k,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(k,{className:`${si}__header`,items:"center",gap:"xs",children:[c.jsx(F,{className:`${si}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),c.jsx(Ke,{className:`${si}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(F,{className:s,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},Id="gs-cmp-ai-chat-header",LT=({className:e,chatContext:t,title:n,editor:r,layoutBefore:o,layoutAfter:s,clearButtonProps:a,onClear:i,...l})=>{const[u,d]=h.useState(!1),{messages:p,setMessages:f,status:g}=t,m=N(Id,e,te.bb,U.br,Te.s),v=g==="streaming"||g==="submitted",b="aiChat.header",w=r.runCommand(vr.getChatApi),y={isClearing:u,setIsClearing:d},S=()=>{d(!0),f([])},{className:C,children:x,...E}=a||{},P={chatApi:w,messages:p,state:y},_=o==null?void 0:o(P),T=s==null?void 0:s(P),O=async L=>{if(!u)try{i?await i({...P,clear:S,event:L}):S()}catch(A){t.setError(A instanceof Error?A:new Error(String(A)))}finally{d(!1)}};return c.jsxs(k,{className:m,items:"center",gap:"s",...l,children:[_&&Qt(r,_),c.jsx(F,{className:`${Id}__title`,grow:!0,children:n??r.t(`${b}.title`)}),p.length>0&&c.jsx(Ke,{className:N(`${Id}__btn-clear`,C,Oe.hover,te.none),onClick:O,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...E,children:x??r.t(`${b}.clear`)}),T&&Qt(r,T)]})};function ia(e,t,n){let r=n.initialDeps??[],o;return()=>{var s,a,i,l;let u;n.key&&((s=n.debug)!=null&&s.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return o;r=d;let f;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now()),o=t(...d),n.key&&((i=n.debug)!=null&&i.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-f)*100)/100,v=m/16,b=(w,y)=>{for(w=String(w);w.length<y;)w=" "+w;return w};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
18
+ </h1>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){nc(e)}}}function NT(e,t){const{cmpRoot:n}=e;n.components(t)}function $T(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:fo.ADD_PAGE_CODE,toolSetup:LT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&ec(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;NT(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function kT(e){yT(e);const t=e.getWrapper(),n=X1(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){wT(e)}}}function IT(e,t,n){vT(e,t,n)}function VT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:fo.ADD_PROJECT_PAGE_CODE,toolSetup:kT(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,bT({editor:t,component:i.toolSetup.cmpRoot,content:o.content,isEmail:i.toolSetup.isEmail}));return}if(a==="done"&&i&&o.content){if(i.completed)return;IT(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const nm={[fo.ADD_COMPONENT_CODE]:OT,[fo.EDIT_COMPONENT_CODE]:MT,[fo.ADD_PAGE_CODE]:$T,[fo.ADD_PROJECT_PAGE_CODE]:VT},HT=({editor:e,data:t,toolStatusProgress:n,tools:r,chatApi:o})=>{var u;if(t.type!=="data-tool-status")return;const s=t,a=((u=s.data)==null?void 0:u.name)||"",i=nm[a];i?i({editor:e,toolStatus:s,toolStatusProgress:n}):jT({toolStatus:s,toolStatusProgress:n});const l=r[a];if(!(!(l!=null&&l.onData)||!o))try{l.onData({editor:e,chatApi:o,toolStatus:s,toolStatusProgress:n})}catch(d){o.setError(d)}};function jT({toolStatus:e,toolStatusProgress:t}){const{id:n,data:r}=e;if(!n||!r)return;const{status:o,content:s}=r;let a=t.get(n);a||(a={type:"generic",content:"",completed:!1},t.set(n,a)),o==="streaming"&&s&&(a.content=s),o==="done"&&(s&&(a.content=s),t.delete(n)),o==="error"&&t.delete(n)}var DT={NODE_ENV:"production"};class FT{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=hT(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,createCommandTool:a=>R1(t,a),editor:t}))||r;const{chat:o}=this.createChat();this.currentChatId=o.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const r=this.createChat();this.currentChatId=r.chat.id}}}createChat(t){const n=this.editor,r=new Map,o=new Set,s=new Set,{tools:a}=this,{chatApi:i,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:p={},onMessagesUpdate:f,messages:h}=this.options,{onFinish:m,onData:b,...v}=p,w=typeof h=="function",y=[],S=new on.Chat({id:t,messages:Array.isArray(h)?h:void 0,sendAutomaticallyWhen:cr.lastAssistantMessageIsCompleteWithToolCalls,transport:new cr.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:T,messages:O,body:M,id:A,trigger:$,credentials:j}){var k;const L={...M,id:A,trigger:$,messages:O.slice(-10),projectContext:X1(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},H=typeof u=="function"?u({editor:n,body:L,messages:O}):u,{accessToken:W,license:B}=Bt,G=DT.NODE_ENV!=="production",D=`${Ru({isDev:G,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!B||["enterprise","business"].includes(((k=B==null?void 0:B.plan)==null?void 0:k.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:D,headers:{...T,...W?{Authorization:`Bearer ${W}`}:{}},credentials:j,body:{...L,...H}}}}),onToolCall:async({toolCall:T})=>{l==null||l({toolCall:T});const O=!!nm[T.toolName];if(T.dynamic||O)return;const{toolName:M,input:A,toolCallId:$}=T,j=a[M];if(j&&j.execute){const L=new AbortController;o.add(L);try{const{messages:H}=S,W=await Promise.race([j.execute(A||{},{editor:n,messages:H,lastUserMessage:H.findLast(B=>B.role==="user"),toolCallId:$,abortController:L}),new Promise((B,G)=>{L.signal.addEventListener("abort",()=>G(new Error("Aborted")))})]);if(W&&typeof W.error=="string")throw new Error(W.error);S.addToolOutput({tool:M,toolCallId:$,output:W})}catch(H){S.addToolOutput({tool:M,toolCallId:$,state:"output-error",errorText:H instanceof Error?H.message:"Unknown error"})}finally{o.delete(L)}}},onData(T){b==null||b(T),HT({editor:n,data:T,toolStatusProgress:r,tools:a,chatApi:E})},onFinish(T){f==null||f({messages:T.messages,editor:n}),T.isAbort&&(r.forEach(O=>{"toolSetup"in O&&O.toolSetup.cleanUp()}),r.clear()),m==null||m(T)},...v}),C=new Set,E={get messages(){return S.messages},get lastMessage(){return S.lastMessage},get status(){return S.status},get error(){return S.error},sendMessage:(...T)=>x.isMessagesLoaded?S.sendMessage(...T):(y.push(T),Promise.resolve()),setMessages:T=>{S.messages=T},clearError:()=>S.clearError(),stop:()=>S.stop(),setError:T=>{const O=T instanceof Error?T:new Error(String(T));S.setStatus({status:"error",error:O})}},x={chat:S,chatApi:E,isMessagesLoaded:!w,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:T=>(C.add(T),()=>{C.delete(T)}),emitUpdate:()=>{C.forEach(T=>T())}},P=async()=>{if(!x.isMessagesLoaded||y.length===0)return;const T=y.splice(0);for(const O of T)await S.sendMessage(...O)};this.chatStates.set(S.id,x);const _=()=>{S["~registerMessagesCallback"](()=>{S.status==="ready"&&(f==null||f({messages:S.messages,editor:n}))})};return w?h({editor:n}).then(T=>{S.messages=T,_()}).catch(T=>E.setError(T)).finally(()=>{x.isMessagesLoaded=!0,P().catch(T=>E.setError(T)),x.emitUpdate()}):_(),x}}const BT=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],zT=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],ia="gs-cmp-ai-chat-empty",UT=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=N(ia,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=r.t(`${a}.title`),u=r.t(`${a}.subtitle`),d=aa(r)?zT:BT,p=o??d;return c.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(I,{className:`${ia}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${ia}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${ia}__subtitle`,U.txtLowEmphasis),children:u})]}),c.jsx(I,{col:!0,className:`${ia}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(f=>{const h=r.t(`${a}.suggestions.${f.id}`)||f.label,m=f.prompt??h;return c.jsx(Je,{className:`${ia}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:h},f.id)})})]})},ii="gs-cmp-ai-chat-error";function WT(e){const t=e==null?void 0:e.message;if(!t)return t;try{const n=JSON.parse(t);return n.error||n.message||t}catch{return t}}const GT=({className:e,style:t,chatContext:n,editor:r})=>{var l;const o=N(ii,e,U.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${ii}__message gs-utl-text-sm gs-utl-opacity-75 gs-utl-max-h-24 gs-utl-overflow-auto gs-utl-break-words gs-utl-max-w-full`,a="aiChat.error",i=g.useMemo(()=>WT(n.error),[(l=n.error)==null?void 0:l.message]);return c.jsxs(I,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(I,{className:`${ii}__header`,items:"center",gap:"xs",children:[c.jsx(F,{className:`${ii}__header-title`,grow:!0,children:r.t(`${a}.title`)}),c.jsx(Je,{className:`${ii}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(F,{className:s,grow:!0,children:i})]})},Fd="gs-cmp-ai-chat-header",qT=({className:e,chatContext:t,title:n,editor:r,layoutBefore:o,layoutAfter:s,clearButtonProps:a,onClear:i,...l})=>{const[u,d]=g.useState(!1),{messages:p,setMessages:f,status:h}=t,m=N(Fd,e,re.bb,U.br,Te.s),b=h==="streaming"||h==="submitted",v="aiChat.header",w=r.runCommand(vr.getChatApi),y={isClearing:u,setIsClearing:d},S=()=>{d(!0),f([])},{className:C,children:E,...x}=a||{},P={chatApi:w,messages:p,state:y},_=o==null?void 0:o(P),T=s==null?void 0:s(P),O=async M=>{if(!u)try{i?await i({...P,clear:S,event:M}):S()}catch(A){t.setError(A instanceof Error?A:new Error(String(A)))}finally{d(!1)}};return c.jsxs(I,{className:m,items:"center",gap:"s",...l,children:[_&&Qt(r,_),c.jsx(F,{className:`${Fd}__title`,grow:!0,children:n??r.t(`${v}.title`)}),p.length>0&&c.jsx(Je,{className:N(`${Fd}__btn-clear`,C,Oe.hover,re.none),onClick:O,size:"xs",border:!1,icon:"delete",loading:u,disabled:b,...x,children:E??r.t(`${v}.clear`)}),T&&Qt(r,T)]})};function la(e,t,n){let r=n.initialDeps??[],o;return()=>{var s,a,i,l;let u;n.key&&((s=n.debug)!=null&&s.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((h,m)=>r[m]!==h)))return o;r=d;let f;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now()),o=t(...d),n.key&&((i=n.debug)!=null&&i.call(n))){const h=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-f)*100)/100,b=m/16,v=(w,y)=>{for(w=String(w);w.length<y;)w=" "+w;return w};console.info(`%c⏱ ${v(m,5)} /${v(h,5)} ms`,`
19
19
  font-size: .6rem;
20
20
  font-weight: bold;
21
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,o),o}}function Vd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const MT=(e,t)=>Math.abs(e-t)<1,NT=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var ai={NODE_ENV:"production"};const $T=e=>e,kT=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},IT=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(o(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const l=i.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(n.getBoundingClientRect())});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Y1={passive:!0},VT=typeof window>"u"?!0:"onscrollend"in window,HT=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=VT?()=>{}:NT(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:p}=e.options;o=d?n.scrollLeft*(p&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,Y1),n.addEventListener("scrollend",l,Y1),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},jT=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},DT=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class FT{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$T,rangeExtractor:kT,onChange:()=>{},measureElement:jT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=ia(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(o.has(i.lane))continue;const l=s.get(i.lane);if(l==null||i.end>l.end?s.set(i.lane,i):i.end<l.end&&o.set(i.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=ia(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,o,s,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a}),{key:!1}),this.getMeasurements=ia(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const p=s(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=f?f.end+this.options.gap:r+o,m=i.get(p),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,w=f?f.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:p,lane:w}}return this.measurementsCache=u,u},{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=ia(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?BT({measurements:n,outerSize:r,scrollOffset:o}):null,{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=ia(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,o,s)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:s}),{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const a=s.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=ia(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const i=n[s],l=r[i];o.push(l)}return o},{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Vd(r[X1(0,r.length-1,o=>Vd(r[o]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const o=this.getSize(),s=this.getScrollOffset();r==="auto"&&(n<=s?r="start":n>=s+o?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-o:r==="center"&&(n=n-o/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-o;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const i=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,r),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,i]=s;this._scrollToOffset(a,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=Vd(this.getOffsetForIndex(n,i));MT(u,this.getScrollOffset())||this.scrollToIndex(n,{align:i,behavior:o})}else this.scrollToIndex(n,{align:i,behavior:o})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const X1=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function BT({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=X1(0,r,i=>e[i].start,n);let a=s;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:s,endIndex:a}}const zT=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function UT(e){const t=nt.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?On.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=nt.useState(()=>new FT(n));return r.setOptions(n),nt.useEffect(()=>r._didMount(),[]),zT(()=>r._willUpdate()),r}function WT(e){return UT({observeElementRect:IT,observeElementOffset:HT,scrollToFn:DT,...e})}var GT=Object.defineProperty,qT=(e,t,n)=>t in e?GT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hd=(e,t,n)=>(qT(e,typeof t!="symbol"?t+"":t,n),n);let KT=class{constructor(){Hd(this,"current",this.detect()),Hd(this,"handoffState","pending"),Hd(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},po=new KT,Ze=(e,t)=>{po.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function Dt(e){let t=h.useRef(e);return Ze(()=>{t.current=e},[e]),t}function ii(e,t){let[n,r]=h.useState(e),o=Dt(e);return Ze(()=>r(o.current),[o,r,...t]),n}let oe=function(e){let t=Dt(e);return h.useCallback((...n)=>t.current(...n),[t])};function ec(e,t,n){let[r,o]=h.useState(n),s=e!==void 0,a=h.useRef(s),i=h.useRef(!1),l=h.useRef(!1);return s&&!a.current&&!i.current?(i.current=!0,a.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&a.current&&!l.current&&(l.current=!0,a.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,oe(u=>(s||o(u),t==null?void 0:t(u)))]}function jd(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function kr(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return jd(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=kr();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function br(){let[e]=h.useState(kr);return h.useEffect(()=>()=>e.dispose(),[e]),e}function ZT(){let e=typeof document>"u";return"useSyncExternalStore"in nt?(t=>t.useSyncExternalStore)(nt)(()=>()=>{},()=>!1,()=>!e):!1}function tc(){let e=ZT(),[t,n]=nt.useState(po.isHandoffComplete);return t&&po.isHandoffComplete===!1&&n(!1),nt.useEffect(()=>{t!==!0&&n(!0)},[t]),nt.useEffect(()=>po.handoff(),[]),e?!1:t}var J1;let Et=(J1=h.useId)!=null?J1:function(){let e=tc(),[t,n]=h.useState(e?()=>po.nextId():null);return Ze(()=>{t===null&&n(po.nextId())},[t]),t!=null?""+t:void 0};function ke(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ke),r}function $o(e){return po.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Dd=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var _t=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(_t||{}),Ir=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Ir||{}),YT=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(YT||{});function nc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Dd)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var rc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(rc||{});function Fd(e,t=0){var n;return e===((n=$o(e))==null?void 0:n.body)?!1:ke(t,{0(){return e.matches(Dd)},1(){let r=e;for(;r!==null;){if(r.matches(Dd))return!0;r=r.parentElement}return!1}})}var XT=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(XT||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let JT=["textarea","input"].join(",");function QT(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,JT))!=null?n:!1}function fo(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let a=o.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ln(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?fo(e):e:nc(e);o.length>0&&a.length>1&&(a=a.filter(g=>!o.includes(g))),r=r??s.activeElement;let i=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,p=a.length,f;do{if(d>=p||d+p<=0)return 0;let g=l+d;if(t&16)g=(g+p)%p;else{if(g<0)return 3;if(g>=p)return 1}f=a[g],f==null||f.focus(u),d+=i}while(f!==s.activeElement);return t&6&&QT(f)&&f.select(),2}function RT(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function e5(){return/Android/gi.test(window.navigator.userAgent)}function Q1(){return RT()||e5()}function oc(e,t,n){let r=Dt(t);h.useEffect(()=>{function o(s){r.current(s)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function R1(e,t,n){let r=Dt(t);h.useEffect(()=>{function o(s){r.current(s)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function Bd(e,t,n=!0){let r=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(a,i){if(!r.current||a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(e);for(let d of u){if(d===null)continue;let p=d instanceof HTMLElement?d:d.current;if(p!=null&&p.contains(l)||a.composed&&a.composedPath().includes(p))return}return!Fd(l,rc.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=h.useRef(null);oc("pointerdown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),oc("mousedown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),oc("click",a=>{Q1()||s.current&&(o(a,()=>s.current),s.current=null)},!0),oc("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),R1("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Es(...e){return h.useMemo(()=>$o(...e),[...e])}function em(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function la(e,t){let[n,r]=h.useState(()=>em(e));return Ze(()=>{r(em(e))},[e.type,e.as]),Ze(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let tm=Symbol();function zd(e,t=!0){return Object.assign(e,{[tm]:t})}function Ye(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=oe(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[tm]))?void 0:n}function nm(e){return[e.screenX,e.screenY]}function rm(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=nm(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=nm(t)}}}function om({container:e,accept:t,walk:n,enabled:r=!0}){let o=h.useRef(t),s=h.useRef(n);h.useEffect(()=>{o.current=t,s.current=n},[t,n]),Ze(()=>{if(!e||!r)return;let a=$o(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(p=>i(p),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function sm(e,t){let n=h.useRef([]),r=oe(e);h.useEffect(()=>{let o=[...n.current];for(let[s,a]of t.entries())if(n.current[s]!==a){let i=r(t,o);return n.current=t,i}},[r,...t])}function sc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var yn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(yn||{}),ko=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ko||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??t5;let l=am(t,e);if(s)return ac(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...p}=l;if(d)return ac(p,n,r,a,i)}if(u&1){let{unmount:d=!0,...p}=l;return ke(d?0:1,{0(){return null},1(){return ac({...p,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return ac(l,n,r,a,i)}function ac(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Wd(e,["unmount","static"]),u=e.ref!==void 0?{[i]:e.ref}:{},d=typeof a=="function"?a(t):a;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let p={};if(t){let f=!1,g=[];for(let[m,v]of Object.entries(t))typeof v=="boolean"&&(f=!0),v===!0&&g.push(m);f&&(p["data-headlessui-state"]=g.join(" "))}if(s===h.Fragment&&Object.keys(ca(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(v=>` - ${v}`).join(`
22
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(v=>` - ${v}`).join(`
21
+ color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,o),o}}function Bd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const KT=(e,t)=>Math.abs(e-t)<1,ZT=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var li={NODE_ENV:"production"};const YT=e=>e,XT=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},JT=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(o(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const l=i.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(n.getBoundingClientRect())});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},rm={passive:!0},QT=typeof window>"u"?!0:"onscrollend"in window,RT=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=QT?()=>{}:ZT(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:p}=e.options;o=d?n.scrollLeft*(p&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,rm),n.addEventListener("scrollend",l,rm),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},e5=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},t5=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class n5{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:YT,rangeExtractor:XT,onChange:()=>{},measureElement:e5,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=la(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:li.NODE_ENV!=="production",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(o.has(i.lane))continue;const l=s.get(i.lane);if(l==null||i.end>l.end?s.set(i.lane,i):i.end<l.end&&o.set(i.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=la(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,o,s,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a}),{key:!1}),this.getMeasurements=la(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const p=s(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),h=f?f.end+this.options.gap:r+o,m=i.get(p),b=typeof m=="number"?m:this.options.estimateSize(d),v=h+b,w=f?f.lane:d%this.options.lanes;u[d]={index:d,start:h,size:b,end:v,key:p,lane:w}}return this.measurementsCache=u,u},{key:li.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=la(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?r5({measurements:n,outerSize:r,scrollOffset:o}):null,{key:li.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=la(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,o,s)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:s}),{key:li.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const a=s.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=la(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const i=n[s],l=r[i];o.push(l)}return o},{key:li.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Bd(r[om(0,r.length-1,o=>Bd(r[o]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const o=this.getSize(),s=this.getScrollOffset();r==="auto"&&(n<=s?r="start":n>=s+o?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-o:r==="center"&&(n=n-o/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-o;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const i=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,r),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,i]=s;this._scrollToOffset(a,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=Bd(this.getOffsetForIndex(n,i));KT(u,this.getScrollOffset())||this.scrollToIndex(n,{align:i,behavior:o})}else this.scrollToIndex(n,{align:i,behavior:o})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const om=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function r5({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=om(0,r,i=>e[i].start,n);let a=s;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:s,endIndex:a}}const o5=typeof document<"u"?st.useLayoutEffect:st.useEffect;function s5(e){const t=st.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?On.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=st.useState(()=>new n5(n));return r.setOptions(n),st.useEffect(()=>r._didMount(),[]),o5(()=>r._willUpdate()),r}function a5(e){return s5({observeElementRect:JT,observeElementOffset:RT,scrollToFn:t5,...e})}var i5=Object.defineProperty,l5=(e,t,n)=>t in e?i5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zd=(e,t,n)=>(l5(e,typeof t!="symbol"?t+"":t,n),n);let c5=class{constructor(){zd(this,"current",this.detect()),zd(this,"handoffState","pending"),zd(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},go=new c5,Qe=(e,t)=>{go.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function Dt(e){let t=g.useRef(e);return Qe(()=>{t.current=e},[e]),t}function ci(e,t){let[n,r]=g.useState(e),o=Dt(e);return Qe(()=>r(o.current),[o,r,...t]),n}let oe=function(e){let t=Dt(e);return g.useCallback((...n)=>t.current(...n),[t])};function oc(e,t,n){let[r,o]=g.useState(n),s=e!==void 0,a=g.useRef(s),i=g.useRef(!1),l=g.useRef(!1);return s&&!a.current&&!i.current?(i.current=!0,a.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&a.current&&!l.current&&(l.current=!0,a.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,oe(u=>(s||o(u),t==null?void 0:t(u)))]}function Ud(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Hr(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Ud(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Hr();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function yr(){let[e]=g.useState(Hr);return g.useEffect(()=>()=>e.dispose(),[e]),e}function u5(){let e=typeof document>"u";return"useSyncExternalStore"in st?(t=>t.useSyncExternalStore)(st)(()=>()=>{},()=>!1,()=>!e):!1}function sc(){let e=u5(),[t,n]=st.useState(go.isHandoffComplete);return t&&go.isHandoffComplete===!1&&n(!1),st.useEffect(()=>{t!==!0&&n(!0)},[t]),st.useEffect(()=>go.handoff(),[]),e?!1:t}var sm;let Pt=(sm=g.useId)!=null?sm:function(){let e=sc(),[t,n]=g.useState(e?()=>go.nextId():null);return Qe(()=>{t===null&&n(go.nextId())},[t]),t!=null?""+t:void 0};function Ie(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ie),r}function Vo(e){return go.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Wd=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var At=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(At||{}),jr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(jr||{}),d5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(d5||{});function ac(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Wd)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ic=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ic||{});function Gd(e,t=0){var n;return e===((n=Vo(e))==null?void 0:n.body)?!1:Ie(t,{0(){return e.matches(Wd)},1(){let r=e;for(;r!==null;){if(r.matches(Wd))return!0;r=r.parentElement}return!1}})}var p5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(p5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let f5=["textarea","input"].join(",");function g5(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,f5))!=null?n:!1}function ho(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let a=o.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ln(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?ho(e):e:ac(e);o.length>0&&a.length>1&&(a=a.filter(h=>!o.includes(h))),r=r??s.activeElement;let i=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,p=a.length,f;do{if(d>=p||d+p<=0)return 0;let h=l+d;if(t&16)h=(h+p)%p;else{if(h<0)return 3;if(h>=p)return 1}f=a[h],f==null||f.focus(u),d+=i}while(f!==s.activeElement);return t&6&&g5(f)&&f.select(),2}function h5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function m5(){return/Android/gi.test(window.navigator.userAgent)}function am(){return h5()||m5()}function lc(e,t,n){let r=Dt(t);g.useEffect(()=>{function o(s){r.current(s)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function im(e,t,n){let r=Dt(t);g.useEffect(()=>{function o(s){r.current(s)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function qd(e,t,n=!0){let r=g.useRef(!1);g.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(a,i){if(!r.current||a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(e);for(let d of u){if(d===null)continue;let p=d instanceof HTMLElement?d:d.current;if(p!=null&&p.contains(l)||a.composed&&a.composedPath().includes(p))return}return!Gd(l,ic.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=g.useRef(null);lc("pointerdown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),lc("mousedown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),lc("click",a=>{am()||s.current&&(o(a,()=>s.current),s.current=null)},!0),lc("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),im("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Ps(...e){return g.useMemo(()=>Vo(...e),[...e])}function lm(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function ca(e,t){let[n,r]=g.useState(()=>lm(e));return Qe(()=>{r(lm(e))},[e.type,e.as]),Qe(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let cm=Symbol();function Kd(e,t=!0){return Object.assign(e,{[cm]:t})}function Re(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=oe(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[cm]))?void 0:n}function um(e){return[e.screenX,e.screenY]}function dm(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=um(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=um(t)}}}function pm({container:e,accept:t,walk:n,enabled:r=!0}){let o=g.useRef(t),s=g.useRef(n);g.useEffect(()=>{o.current=t,s.current=n},[t,n]),Qe(()=>{if(!e||!r)return;let a=Vo(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(p=>i(p),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function fm(e,t){let n=g.useRef([]),r=oe(e);g.useEffect(()=>{let o=[...n.current];for(let[s,a]of t.entries())if(n.current[s]!==a){let i=r(t,o);return n.current=t,i}},[r,...t])}function cc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var yn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(yn||{}),Ho=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ho||{});function We({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??b5;let l=gm(t,e);if(s)return uc(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...p}=l;if(d)return uc(p,n,r,a,i)}if(u&1){let{unmount:d=!0,...p}=l;return Ie(d?0:1,{0(){return null},1(){return uc({...p,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return uc(l,n,r,a,i)}function uc(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Yd(e,["unmount","static"]),u=e.ref!==void 0?{[i]:e.ref}:{},d=typeof a=="function"?a(t):a;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let p={};if(t){let f=!1,h=[];for(let[m,b]of Object.entries(t))typeof b=="boolean"&&(f=!0),b===!0&&h.push(m);f&&(p["data-headlessui-state"]=h.join(" "))}if(s===g.Fragment&&Object.keys(ua(l)).length>0){if(!g.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(b=>` - ${b}`).join(`
22
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
23
23
  `)].join(`
24
- `));let f=d.props,g=typeof(f==null?void 0:f.className)=="function"?(...v)=>sc(f==null?void 0:f.className(...v),l.className):sc(f==null?void 0:f.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},am(d.props,ca(Wd(l,["ref"]))),p,u,{ref:o(d.ref,u.ref)},m))}return h.createElement(s,Object.assign({},Wd(l,["ref"]),s!==h.Fragment&&u,s!==h.Fragment&&p),d)}function Ud(){let e=h.useRef([]),t=h.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function t5(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function am(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...s){let a=n[r];for(let i of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;i(o,...s)}}});return t}function ze(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ca(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Wd(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let n5="div";var yr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(yr||{});function r5(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Be({ourProps:s,theirProps:o,slot:{},defaultTag:n5,name:"Hidden"})}let wr=ze(r5),Gd=h.createContext(null);Gd.displayName="OpenClosedContext";var pt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(pt||{});function Ps(){return h.useContext(Gd)}function li({value:e,children:t}){return h.createElement(Gd.Provider,{value:e},t)}function o5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ts=[];o5(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ts[0]!==t.target&&(Ts.unshift(t.target),Ts=Ts.filter(n=>n!=null&&n.isConnected),Ts.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Io(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&s5(n)?!1:r}function s5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function a5(e){throw new Error("Unexpected object: "+e)}var Je=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Je||{});function qd(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:a5(e)}}function ic(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))lm(n,im(t,r),o);return n}function im(e,t){return e?e+"["+t+"]":t}function lm(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())lm(e,im(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):ic(n,t,e)}function cm(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}var ve=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ve||{}),i5={NODE_ENV:"production"},l5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(l5||{}),c5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(c5||{}),u5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(u5||{}),d5=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(d5||{});function Kd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,i)=>a.dataRef.current.order-i.dataRef.current.order):fo(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let p5={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,s,a;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Je.Specific?t.idx:qd(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var f,g;return(g=(f=e.activeOptionIndex)!=null?f:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),p=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let i=Kd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===Je.Specific?t.idx:qd(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...i,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let s=t.payload,a=Kd(e,l=>(l.push(s),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(s));let i={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Kd(e,o=>{let s=o.findIndex(a=>a.id===t.id);return s!==-1&&o.splice(s,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},Zd=h.createContext(null);Zd.displayName="ComboboxActionsContext";function ci(e){let t=h.useContext(Zd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ci),n}return t}let um=h.createContext(null);function f5(e){var t;let n=Os("VirtualProvider"),[r,o]=h.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),s=WT({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[a,i]=h.useState(0);return Ze(()=>{i(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(um.Provider,{value:s},h.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&i5.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&s.scrollToIndex(n.activeOptionIndex)}}},s.getVirtualItems().map(l=>{var u;return h.createElement(h.Fragment,{key:l.key},h.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${a}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let Yd=h.createContext(null);Yd.displayName="ComboboxDataContext";function Os(e){let t=h.useContext(Yd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Os),n}return t}function h5(e,t){return ke(t.type,p5,e,t)}let g5=h.Fragment;function m5(e,t){let{value:n,defaultValue:r,onChange:o,form:s,name:a,by:i=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:p=!1,immediate:f=!1,virtual:g=null,...m}=e,v=!1,b=null,[w=p?[]:void 0,y]=ec(n,o,r),[S,C]=h.useReducer(h5,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),x=h.useRef(!1),E=h.useRef({static:!1,hold:!1}),P=h.useRef(null),_=h.useRef(null),T=h.useRef(null),O=h.useRef(null),L=oe(typeof i=="string"?(ee,le)=>{let ge=i;return(ee==null?void 0:ee[ge])===(le==null?void 0:le[ge])}:i??((ee,le)=>ee===le)),A=oe(ee=>S.options.findIndex(le=>L(le.dataRef.current.value,ee))),$=h.useCallback(ee=>ke(M.mode,{1:()=>w.some(le=>L(le,ee)),0:()=>L(w,ee)}),[w]),B=oe(ee=>S.activeOptionIndex===A(ee)),M=h.useMemo(()=>({...S,immediate:v,optionsPropsRef:E,labelRef:P,inputRef:_,buttonRef:T,optionsRef:O,value:w,defaultValue:r,disabled:l,mode:p?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let ee=S.options.findIndex(le=>!le.dataRef.current.disabled);if(ee!==-1)return ee}return S.activeOptionIndex},calculateIndex:A,compare:L,isSelected:$,isActive:B,nullable:d,__demoMode:u}),[w,r,l,p,d,u,S,b]);Ze(()=>{},[b,void 0]),Ze(()=>{S.dataRef.current=M},[M]),Bd([M.buttonRef,M.inputRef,M.optionsRef],()=>J.closeCombobox(),M.comboboxState===0);let j=h.useMemo(()=>{var ee,le,ge;return{open:M.comboboxState===0,disabled:l,activeIndex:M.activeOptionIndex,activeOption:M.activeOptionIndex===null?null:M.virtual?M.virtual.options[(ee=M.activeOptionIndex)!=null?ee:0]:(ge=(le=M.options[M.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ge:null,value:w}},[M,l,w]),W=oe(()=>{if(M.activeOptionIndex!==null){if(M.virtual)G(M.virtual.options[M.activeOptionIndex]);else{let{dataRef:ee}=M.options[M.activeOptionIndex];G(ee.current.value)}J.goToOption(Je.Specific,M.activeOptionIndex)}}),D=oe(()=>{C({type:0}),x.current=!0}),z=oe(()=>{C({type:1}),x.current=!1}),I=oe((ee,le,ge)=>(x.current=!1,ee===Je.Specific?C({type:2,focus:Je.Specific,idx:le,trigger:ge}):C({type:2,focus:ee,trigger:ge}))),H=oe((ee,le)=>(C({type:3,payload:{id:ee,dataRef:le}}),()=>{M.isActive(le.current.value)&&(x.current=!0),C({type:4,id:ee})})),V=oe(ee=>(C({type:5,id:ee}),()=>C({type:5,id:null}))),G=oe(ee=>ke(M.mode,{0(){return y==null?void 0:y(ee)},1(){let le=M.value.slice(),ge=le.findIndex(Pe=>L(Pe,ee));return ge===-1?le.push(ee):le.splice(ge,1),y==null?void 0:y(le)}})),Y=oe(ee=>{C({type:6,trigger:ee})}),J=h.useMemo(()=>({onChange:G,registerOption:H,registerLabel:V,goToOption:I,closeCombobox:z,openCombobox:D,setActivationTrigger:Y,selectActiveOption:W}),[]),Q=t===null?{}:{ref:t},R=h.useRef(null),q=br();return h.useEffect(()=>{R.current&&r!==void 0&&q.addEventListener(R.current,"reset",()=>{y==null||y(r)})},[R,y]),h.createElement(Zd.Provider,{value:J},h.createElement(Yd.Provider,{value:M},h.createElement(li,{value:ke(M.comboboxState,{0:pt.Open,1:pt.Closed})},a!=null&&w!=null&&ic({[a]:w}).map(([ee,le],ge)=>h.createElement(wr,{features:yr.Hidden,ref:ge===0?Pe=>{var Ce;R.current=(Ce=Pe==null?void 0:Pe.closest("form"))!=null?Ce:null}:void 0,...ca({key:ee,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:ee,value:le})})),Be({ourProps:Q,theirProps:m,slot:j,defaultTag:g5,name:"Combobox"}))))}let v5="input";function b5(e,t){var n,r,o,s,a;let i=Et(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:p="text",...f}=e,g=Os("Combobox.Input"),m=ci("Combobox.Input"),v=Ye(g.inputRef,t),b=Es(g.inputRef),w=h.useRef(!1),y=br(),S=oe(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),C=function(){var M;return typeof d=="function"&&g.value!==void 0?(M=d(g.value))!=null?M:"":typeof g.value=="string"?g.value:""}();sm(([M,j],[W,D])=>{if(w.current)return;let z=g.inputRef.current;z&&((D===0&&j===1||M!==W)&&(z.value=M),requestAnimationFrame(()=>{if(w.current||!z||(b==null?void 0:b.activeElement)!==z)return;let{selectionStart:I,selectionEnd:H}=z;Math.abs((H??0)-(I??0))===0&&I===0&&z.setSelectionRange(z.value.length,z.value.length)}))},[C,g.comboboxState,b]),sm(([M],[j])=>{if(M===0&&j===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let D=W.value,{selectionStart:z,selectionEnd:I,selectionDirection:H}=W;W.value="",W.value=D,H!==null?W.setSelectionRange(z,I,H):W.setSelectionRange(z,I)}},[g.comboboxState]);let x=h.useRef(!1),E=oe(()=>{x.current=!0}),P=oe(()=>{y.nextFrame(()=>{x.current=!1})}),_=oe(M=>{switch(w.current=!0,M.key){case ve.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if(M.preventDefault(),M.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case ve.ArrowDown:return w.current=!1,M.preventDefault(),M.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case ve.ArrowUp:return w.current=!1,M.preventDefault(),M.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case ve.Home:if(M.shiftKey)break;return w.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(Je.First);case ve.PageUp:return w.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(Je.First);case ve.End:if(M.shiftKey)break;return w.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(Je.Last);case ve.PageDown:return w.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(Je.Last);case ve.Escape:return w.current=!1,g.comboboxState!==0?void 0:(M.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&M.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&S(),m.closeCombobox());case ve.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),T=oe(M=>{u==null||u(M),g.nullable&&g.mode===0&&M.target.value===""&&S(),m.openCombobox()}),O=oe(M=>{var j,W,D;let z=(j=M.relatedTarget)!=null?j:Ts.find(I=>I!==M.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains(z))&&!((D=g.buttonRef.current)!=null&&D.contains(z))&&g.comboboxState===0)return M.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),L=oe(M=>{var j,W,D;let z=(j=M.relatedTarget)!=null?j:Ts.find(I=>I!==M.currentTarget);(W=g.buttonRef.current)!=null&&W.contains(z)||(D=g.optionsRef.current)!=null&&D.contains(z)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),A=ii(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),$=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),B={ref:v,id:l,role:"combobox",type:p,"aria-controls":(n=g.optionsRef.current)==null?void 0:n.id,"aria-expanded":g.comboboxState===0,"aria-activedescendant":g.activeOptionIndex===null?void 0:g.virtual?(r=g.options.find(M=>{var j;return!((j=g.virtual)!=null&&j.disabled(M.dataRef.current.value))&&g.compare(M.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(o=g.options[g.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":A,"aria-autocomplete":"list",defaultValue:(a=(s=e.defaultValue)!=null?s:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?a:g.defaultValue,disabled:g.disabled,onCompositionStart:E,onCompositionEnd:P,onKeyDown:_,onChange:T,onFocus:L,onBlur:O};return Be({ourProps:B,theirProps:f,slot:$,defaultTag:v5,name:"Combobox.Input"})}let y5="button";function w5(e,t){var n;let r=Os("Combobox.Button"),o=ci("Combobox.Button"),s=Ye(r.buttonRef,t),a=Et(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=br(),d=oe(v=>{switch(v.key){case ve.ArrowDown:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&o.openCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.ArrowUp:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),u.nextFrame(()=>{r.value||o.goToOption(Je.Last)})),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.Escape:return r.comboboxState!==0?void 0:(v.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&v.stopPropagation(),o.closeCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),p=oe(v=>{if(Io(v.currentTarget))return v.preventDefault();r.comboboxState===0?o.closeCombobox():(v.preventDefault(),o.openCombobox()),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),f=ii(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),g=h.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),m={ref:s,id:i,type:la(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":f,disabled:r.disabled,onClick:p,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:y5,name:"Combobox.Button"})}let S5="label";function C5(e,t){let n=Et(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=Os("Combobox.Label"),a=ci("Combobox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:S5,name:"Combobox.Label"})}let x5="ul",E5=yn.RenderStrategy|yn.Static;function P5(e,t){let n=Et(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=Os("Combobox.Options"),i=Ye(a.optionsRef,t),l=Ps(),u=l!==null?(l&pt.Open)===pt.Open:a.comboboxState===0;Ze(()=>{var g;a.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[a.optionsPropsRef,e.static]),Ze(()=>{a.optionsPropsRef.current.hold=o},[a.optionsPropsRef,o]),om({container:a.optionsRef.current,enabled:a.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let d=ii(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),p=h.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),f={"aria-labelledby":d,role:"listbox","aria-multiselectable":a.mode===1?!0:void 0,id:r,ref:i};return a.virtual&&a.comboboxState===0&&Object.assign(s,{children:h.createElement(f5,null,s.children)}),Be({ourProps:f,theirProps:s,slot:p,defaultTag:x5,features:E5,visible:u,name:"Combobox.Options"})}let T5="li";function O5(e,t){var n;let r=Et(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=Os("Combobox.Option"),d=ci("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,f=u.isSelected(a),g=h.useRef(null),m=Dt({disabled:s,value:a,domRef:g,order:i}),v=h.useContext(um),b=Ye(t,g,v?v.measureElement:null),w=oe(()=>d.onChange(a));Ze(()=>d.registerOption(o,m),[m,o]);let y=h.useRef(!(u.virtual||u.__demoMode));Ze(()=>{if(!u.virtual||!u.__demoMode)return;let O=kr();return O.requestAnimationFrame(()=>{y.current=!0}),O.dispose},[u.virtual,u.__demoMode]),Ze(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let O=kr();return O.requestAnimationFrame(()=>{var L,A;(A=(L=g.current)==null?void 0:L.scrollIntoView)==null||A.call(L,{block:"nearest"})}),O.dispose},[g,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=oe(O=>{var L;if(s||(L=u.virtual)!=null&&L.disabled(a))return O.preventDefault();w(),Q1()||requestAnimationFrame(()=>{var A;return(A=u.inputRef.current)==null?void 0:A.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=oe(()=>{var O;if(s||(O=u.virtual)!=null&&O.disabled(a))return d.goToOption(Je.Nothing);let L=u.calculateIndex(a);d.goToOption(Je.Specific,L)}),x=rm(),E=oe(O=>x.update(O)),P=oe(O=>{var L;if(!x.wasMoved(O)||s||(L=u.virtual)!=null&&L.disabled(a)||p)return;let A=u.calculateIndex(a);d.goToOption(Je.Specific,A,0)}),_=oe(O=>{var L;x.wasMoved(O)&&(s||(L=u.virtual)!=null&&L.disabled(a)||p&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),T=h.useMemo(()=>({active:p,selected:f,disabled:s}),[p,f,s]);return Be({ourProps:{id:o,ref:b,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:P,onMouseMove:P,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:T,defaultTag:T5,name:"Combobox.Option"})}let _5=ze(m5),A5=ze(w5),L5=ze(b5),M5=ze(C5),N5=ze(P5),$5=ze(O5),ua=Object.assign(_5,{Input:L5,Button:A5,Label:M5,Options:N5,Option:$5});function k5(e,t,n,r){let o=Dt(n);h.useEffect(()=>{e=e??window;function s(a){o.current(a)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function lc(){let e=h.useRef(!1);return Ze(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function I5(e){let t=oe(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,jd(()=>{n.current&&t()})}),[t])}var ho=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ho||{});function dm(){let e=h.useRef(0);return R1("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let V5=h.createContext(!1);function H5(){return h.useContext(V5)}function j5(e){let t=H5(),n=h.useContext(pm),r=Es(e),[o,s]=h.useState(()=>{if(!t&&n!==null||po.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)});return h.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),h.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),o}let D5=h.Fragment;function F5(e,t){let n=e,r=h.useRef(null),o=Ye(zd(d=>{r.current=d}),t),s=Es(r),a=j5(r),[i]=h.useState(()=>{var d;return po.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=h.useContext(Xd),u=tc();return Ze(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Ze(()=>{if(i&&l)return l.register(i)},[l,i]),I5(()=>{var d;!a||!i||(i instanceof Node&&a.contains(i)&&a.removeChild(i),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))}),u?!a||!i?null:On.createPortal(Be({ourProps:{ref:o},theirProps:n,defaultTag:D5,name:"Portal"}),i):null}let B5=h.Fragment,pm=h.createContext(null);function z5(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return h.createElement(pm.Provider,{value:n},Be({ourProps:o,theirProps:r,defaultTag:B5,name:"Popover.Group"}))}let Xd=h.createContext(null);function U5(){let e=h.useContext(Xd),t=h.useRef([]),n=oe(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=oe(s=>{let a=t.current.indexOf(s);a!==-1&&t.current.splice(a,1),e&&e.unregister(s)}),o=h.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,h.useMemo(()=>function({children:s}){return h.createElement(Xd.Provider,{value:o},s)},[o])]}let W5=ze(F5),G5=ze(z5);Object.assign(W5,{Group:G5});function q5({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=h.useRef((r=n==null?void 0:n.current)!=null?r:null),s=Es(o),a=oe(()=>{var i,l,u;let d=[];for(let p of e)p!==null&&(p instanceof HTMLElement?d.push(p):"current"in p&&p.current instanceof HTMLElement&&d.push(p.current));if(t!=null&&t.current)for(let p of t.current)d.push(p);for(let p of(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(o.current)||p.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(f=>p.contains(f))||d.push(p));return d});return{resolveContainers:a,contains:oe(i=>a().some(l=>l.contains(i))),mainTreeNodeRef:o,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(wr,{features:yr.Hidden,ref:o})},[o,n])}}function K5(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(wr,{features:yr.Hidden,ref:e})},[e])}}let fm=h.createContext(null);function hm(){let e=h.useContext(fm);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,hm),t}return e}function Jd(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(fm.Provider,{value:o},n.children)},[t])]}let Z5="p";function Y5(e,t){let n=Et(),{id:r=`headlessui-description-${n}`,...o}=e,s=hm(),a=Ye(t);Ze(()=>s.register(r),[r,s.register]);let i={ref:a,...s.props,id:r};return Be({ourProps:i,theirProps:o,slot:s.slot||{},defaultTag:Z5,name:s.name||"Description"})}let X5=ze(Y5),gm=Object.assign(X5,{});var mm;let J5=(mm=h.startTransition)!=null?mm:function(e){e()};var Q5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Q5||{}),R5=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e))(R5||{});let eO={0:e=>({...e,disclosureState:ke(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Qd=h.createContext(null);Qd.displayName="DisclosureContext";function Rd(e){let t=h.useContext(Qd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Rd),n}return t}let ep=h.createContext(null);ep.displayName="DisclosureAPIContext";function vm(e){let t=h.useContext(ep);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,vm),n}return t}let tp=h.createContext(null);tp.displayName="DisclosurePanelContext";function tO(){return h.useContext(tp)}function nO(e,t){return ke(t.type,eO,e,t)}let rO=h.Fragment;function oO(e,t){let{defaultOpen:n=!1,...r}=e,o=h.useRef(null),s=Ye(t,zd(b=>{o.current=b},e.as===void 0||e.as===h.Fragment)),a=h.useRef(null),i=h.useRef(null),l=h.useReducer(nO,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=l,f=oe(b=>{p({type:1});let w=$o(o);if(!w||!d)return;let y=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:w.getElementById(d):w.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:f}),[f]),m=h.useMemo(()=>({open:u===0,close:f}),[u,f]),v={ref:s};return h.createElement(Qd.Provider,{value:l},h.createElement(ep.Provider,{value:g},h.createElement(li,{value:ke(u,{0:pt.Open,1:pt.Closed})},Be({ourProps:v,theirProps:r,slot:m,defaultTag:rO,name:"Disclosure"}))))}let sO="button";function aO(e,t){let n=Et(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=Rd("Disclosure.Button"),i=tO(),l=i===null?!1:i===s.panelId,u=h.useRef(null),d=Ye(u,t,l?null:s.buttonRef),p=Ud();h.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let f=oe(y=>{var S;if(l){if(s.disclosureState===1)return;switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=s.buttonRef.current)==null||S.focus();break}}else switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),g=oe(y=>{switch(y.key){case ve.Space:y.preventDefault();break}}),m=oe(y=>{var S;Io(y.currentTarget)||e.disabled||(l?(a({type:0}),(S=s.buttonRef.current)==null||S.focus()):a({type:0}))}),v=h.useMemo(()=>({open:s.disclosureState===0}),[s]),b=la(e,u),w=l?{ref:d,type:b,onKeyDown:f,onClick:m}:{ref:d,id:r,type:b,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:f,onKeyUp:g,onClick:m};return Be({mergeRefs:p,ourProps:w,theirProps:o,slot:v,defaultTag:sO,name:"Disclosure.Button"})}let iO="div",lO=yn.RenderStrategy|yn.Static;function cO(e,t){let n=Et(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=Rd("Disclosure.Panel"),{close:i}=vm("Disclosure.Panel"),l=Ud(),u=Ye(t,s.panelRef,m=>{J5(()=>a({type:m?4:5}))});h.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=Ps(),p=d!==null?(d&pt.Open)===pt.Open:s.disclosureState===0,f=h.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),g={ref:u,id:r};return h.createElement(tp.Provider,{value:s.panelId},Be({mergeRefs:l,ourProps:g,theirProps:o,slot:f,defaultTag:iO,features:lO,visible:p,name:"Disclosure.Panel"}))}let uO=ze(oO),dO=ze(aO),pO=ze(cO),np=Object.assign(uO,{Button:dO,Panel:pO}),bm=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ym(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let s=!1;for(let i of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))i.remove(),s=!0;let a=s?(n=o.innerText)!=null?n:"":r;return bm.test(a)&&(a=a.replace(bm,"")),a}function fO(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let a=s.getAttribute("aria-label");return typeof a=="string"?a.trim():ym(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ym(e).trim()}function hO(e){let t=h.useRef(""),n=h.useRef("");return oe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=fO(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var gO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(gO||{}),mO=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(mO||{}),vO=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(vO||{}),bO=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(bO||{});function rp(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=fo(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let yO={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=rp(e),o=qd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(a=>{var i;return!a.dataRef.current.disabled&&((i=a.dataRef.current.textValue)==null?void 0:i.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=rp(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=rp(e,r=>{let o=r.findIndex(s=>s.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},op=h.createContext(null);op.displayName="ListboxActionsContext";function ui(e){let t=h.useContext(op);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ui),n}return t}let sp=h.createContext(null);sp.displayName="ListboxDataContext";function di(e){let t=h.useContext(sp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,di),n}return t}function wO(e,t){return ke(t.type,yO,e,t)}let SO=h.Fragment;function CO(e,t){let{value:n,defaultValue:r,form:o,name:s,onChange:a,by:i=(Y,J)=>Y===J,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const f=u?"horizontal":"vertical";let g=Ye(t),[m=d?[]:void 0,v]=ec(n,a,r),[b,w]=h.useReducer(wO,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),S=h.useRef(null),C=h.useRef(null),x=h.useRef(null),E=oe(typeof i=="string"?(Y,J)=>{let Q=i;return(Y==null?void 0:Y[Q])===(J==null?void 0:J[Q])}:i),P=h.useCallback(Y=>ke(_.mode,{1:()=>m.some(J=>E(J,Y)),0:()=>E(m,Y)}),[m]),_=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:f,compare:E,isSelected:P,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,l,d,b]);Ze(()=>{b.dataRef.current=_},[_]),Bd([_.buttonRef,_.optionsRef],(Y,J)=>{var Q;w({type:1}),Fd(J,rc.Loose)||(Y.preventDefault(),(Q=_.buttonRef.current)==null||Q.focus())},_.listboxState===0);let T=h.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),O=oe(Y=>{let J=_.options.find(Q=>Q.id===Y);J&&W(J.dataRef.current.value)}),L=oe(()=>{if(_.activeOptionIndex!==null){let{dataRef:Y,id:J}=_.options[_.activeOptionIndex];W(Y.current.value),w({type:2,focus:Je.Specific,id:J})}}),A=oe(()=>w({type:0})),$=oe(()=>w({type:1})),B=oe((Y,J,Q)=>Y===Je.Specific?w({type:2,focus:Je.Specific,id:J,trigger:Q}):w({type:2,focus:Y,trigger:Q})),M=oe((Y,J)=>(w({type:5,id:Y,dataRef:J}),()=>w({type:6,id:Y}))),j=oe(Y=>(w({type:7,id:Y}),()=>w({type:7,id:null}))),W=oe(Y=>ke(_.mode,{0(){return v==null?void 0:v(Y)},1(){let J=_.value.slice(),Q=J.findIndex(R=>E(R,Y));return Q===-1?J.push(Y):J.splice(Q,1),v==null?void 0:v(J)}})),D=oe(Y=>w({type:3,value:Y})),z=oe(()=>w({type:4})),I=h.useMemo(()=>({onChange:W,registerOption:M,registerLabel:j,goToOption:B,closeListbox:$,openListbox:A,selectActiveOption:L,selectOption:O,search:D,clearSearch:z}),[]),H={ref:g},V=h.useRef(null),G=br();return h.useEffect(()=>{V.current&&r!==void 0&&G.addEventListener(V.current,"reset",()=>{v==null||v(r)})},[V,v]),h.createElement(op.Provider,{value:I},h.createElement(sp.Provider,{value:_},h.createElement(li,{value:ke(_.listboxState,{0:pt.Open,1:pt.Closed})},s!=null&&m!=null&&ic({[s]:m}).map(([Y,J],Q)=>h.createElement(wr,{features:yr.Hidden,ref:Q===0?R=>{var q;V.current=(q=R==null?void 0:R.closest("form"))!=null?q:null}:void 0,...ca({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Y,value:J})})),Be({ourProps:H,theirProps:p,slot:T,defaultTag:SO,name:"Listbox"}))))}let xO="button";function EO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=di("Listbox.Button"),i=ui("Listbox.Button"),l=Ye(a.buttonRef,t),u=br(),d=oe(b=>{switch(b.key){case ve.Space:case ve.Enter:case ve.ArrowDown:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.First)});break;case ve.ArrowUp:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.Last)});break}}),p=oe(b=>{switch(b.key){case ve.Space:b.preventDefault();break}}),f=oe(b=>{if(Io(b.currentTarget))return b.preventDefault();a.listboxState===0?(i.closeListbox(),u.nextFrame(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(b.preventDefault(),i.openListbox())}),g=ii(()=>{if(a.labelId)return[a.labelId,o].join(" ")},[a.labelId,o]),m=h.useMemo(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]),v={ref:l,id:o,type:la(e,a.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=a.optionsRef.current)==null?void 0:n.id,"aria-expanded":a.listboxState===0,"aria-labelledby":g,disabled:a.disabled,onKeyDown:d,onKeyUp:p,onClick:f};return Be({ourProps:v,theirProps:s,slot:m,defaultTag:xO,name:"Listbox.Button"})}let PO="label";function TO(e,t){let n=Et(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=di("Listbox.Label"),a=ui("Listbox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.listboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:PO,name:"Listbox.Label"})}let OO="ul",_O=yn.RenderStrategy|yn.Static;function AO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=di("Listbox.Options"),i=ui("Listbox.Options"),l=Ye(a.optionsRef,t),u=br(),d=br(),p=Ps(),f=p!==null?(p&pt.Open)===pt.Open:a.listboxState===0;h.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=$o(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let g=oe(w=>{switch(d.dispose(),w.key){case ve.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case ve.Enter:if(w.preventDefault(),w.stopPropagation(),a.activeOptionIndex!==null){let{dataRef:y}=a.options[a.activeOptionIndex];i.onChange(y.current.value)}a.mode===0&&(i.closeListbox(),kr().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case ke(a.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Next);case ke(a.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Previous);case ve.Home:case ve.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.First);case ve.End:case ve.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Last);case ve.Escape:return w.preventDefault(),w.stopPropagation(),i.closeListbox(),u.nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case ve.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=ii(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),v=h.useMemo(()=>({open:a.listboxState===0}),[a]),b={"aria-activedescendant":a.activeOptionIndex===null||(n=a.options[a.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":a.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":a.orientation,id:o,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:b,theirProps:s,slot:v,defaultTag:OO,features:_O,visible:f,name:"Listbox.Options"})}let LO="li";function MO(e,t){let n=Et(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=di("Listbox.Option"),l=ui("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),p=h.useRef(null),f=hO(p),g=Dt({disabled:o,value:s,domRef:p,get textValue(){return f()}}),m=Ye(t,p);Ze(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=kr();return E.requestAnimationFrame(()=>{var P,_;(_=(P=p.current)==null?void 0:P.scrollIntoView)==null||_.call(P,{block:"nearest"})}),E.dispose},[p,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Ze(()=>l.registerOption(r,g),[g,r]);let v=oe(E=>{if(o)return E.preventDefault();l.onChange(s),i.mode===0&&(l.closeListbox(),kr().nextFrame(()=>{var P;return(P=i.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})}))}),b=oe(()=>{if(o)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,r)}),w=rm(),y=oe(E=>w.update(E)),S=oe(E=>{w.wasMoved(E)&&(o||u||l.goToOption(Je.Specific,r,0))}),C=oe(E=>{w.wasMoved(E)&&(o||u&&l.goToOption(Je.Nothing))}),x=h.useMemo(()=>({active:u,selected:d,disabled:o}),[u,d,o]);return Be({ourProps:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:v,onFocus:b,onPointerEnter:y,onMouseEnter:y,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:a,slot:x,defaultTag:LO,name:"Listbox.Option"})}let NO=ze(CO),$O=ze(EO),kO=ze(TO),IO=ze(AO),VO=ze(MO),pi=Object.assign(NO,{Button:$O,Label:kO,Options:IO,Option:VO});var HO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(HO||{}),jO=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(jO||{});let DO={0:e=>{let t={...e,popoverState:ke(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState:1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},ap=h.createContext(null);ap.displayName="PopoverContext";function cc(e){let t=h.useContext(ap);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,cc),n}return t}let ip=h.createContext(null);ip.displayName="PopoverAPIContext";function lp(e){let t=h.useContext(ip);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,lp),n}return t}let cp=h.createContext(null);cp.displayName="PopoverGroupContext";function wm(){return h.useContext(cp)}let uc=h.createContext(null);uc.displayName="PopoverPanelContext";function FO(){return h.useContext(uc)}function BO(e,t){return ke(t.type,DO,e,t)}let zO="div";function UO(e,t){var n;let{__demoMode:r=!1,...o}=e,s=h.useRef(null),a=Ye(t,zd(j=>{s.current=j})),i=h.useRef([]),l=h.useReducer(BO,{__demoMode:r,popoverState:r?0:1,buttons:i,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:h.createRef(),afterPanelSentinel:h.createRef()}),[{popoverState:u,button:d,buttonId:p,panel:f,panelId:g,beforePanelSentinel:m,afterPanelSentinel:v},b]=l,w=Es((n=s.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!f)return!1;for(let V of document.querySelectorAll("body > *"))if(Number(V==null?void 0:V.contains(d))^Number(V==null?void 0:V.contains(f)))return!0;let j=nc(),W=j.indexOf(d),D=(W+j.length-1)%j.length,z=(W+1)%j.length,I=j[D],H=j[z];return!f.contains(I)&&!f.contains(H)},[d,f]),S=Dt(p),C=Dt(g),x=h.useMemo(()=>({buttonId:S,panelId:C,close:()=>b({type:1})}),[S,C,b]),E=wm(),P=E==null?void 0:E.registerPopover,_=oe(()=>{var j;return(j=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?j:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(f==null?void 0:f.contains(w.activeElement)))});h.useEffect(()=>P==null?void 0:P(x),[P,x]);let[T,O]=U5(),L=q5({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:T,defaultContainers:[d,f]});k5(w==null?void 0:w.defaultView,"focus",j=>{var W,D,z,I;j.target!==window&&j.target instanceof HTMLElement&&u===0&&(_()||d&&f&&(L.contains(j.target)||(D=(W=m.current)==null?void 0:W.contains)!=null&&D.call(W,j.target)||(I=(z=v.current)==null?void 0:z.contains)!=null&&I.call(z,j.target)||b({type:1})))},!0),Bd(L.resolveContainers,(j,W)=>{b({type:1}),Fd(W,rc.Loose)||(j.preventDefault(),d==null||d.focus())},u===0);let A=oe(j=>{b({type:1});let W=j?j instanceof HTMLElement?j:"current"in j&&j.current instanceof HTMLElement?j.current:d:d;W==null||W.focus()}),$=h.useMemo(()=>({close:A,isPortalled:y}),[A,y]),B=h.useMemo(()=>({open:u===0,close:A}),[u,A]),M={ref:a};return h.createElement(uc.Provider,{value:null},h.createElement(ap.Provider,{value:l},h.createElement(ip.Provider,{value:$},h.createElement(li,{value:ke(u,{0:pt.Open,1:pt.Closed})},h.createElement(O,null,Be({ourProps:M,theirProps:o,slot:B,defaultTag:zO,name:"Popover"}),h.createElement(L.MainTreeNode,null))))))}let WO="button";function GO(e,t){let n=Et(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=cc("Popover.Button"),{isPortalled:i}=lp("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Et()}`,d=wm(),p=d==null?void 0:d.closeOthers,f=FO()!==null;h.useEffect(()=>{if(!f)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[f,r,a]);let[g]=h.useState(()=>Symbol()),m=Ye(l,t,f?null:L=>{if(L)s.buttons.current.push(g);else{let A=s.buttons.current.indexOf(g);A!==-1&&s.buttons.current.splice(A,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),L&&a({type:2,button:L})}),v=Ye(l,t),b=Es(l),w=oe(L=>{var A,$,B;if(f){if(s.popoverState===1)return;switch(L.key){case ve.Space:case ve.Enter:L.preventDefault(),($=(A=L.target).click)==null||$.call(A),a({type:1}),(B=s.button)==null||B.focus();break}}else switch(L.key){case ve.Space:case ve.Enter:L.preventDefault(),L.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0});break;case ve.Escape:if(s.popoverState!==0)return p==null?void 0:p(s.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;L.preventDefault(),L.stopPropagation(),a({type:1});break}}),y=oe(L=>{f||L.key===ve.Space&&L.preventDefault()}),S=oe(L=>{var A,$;Io(L.currentTarget)||e.disabled||(f?(a({type:1}),(A=s.button)==null||A.focus()):(L.preventDefault(),L.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0}),($=s.button)==null||$.focus()))}),C=oe(L=>{L.preventDefault(),L.stopPropagation()}),x=s.popoverState===0,E=h.useMemo(()=>({open:x}),[x]),P=la(e,l),_=f?{ref:v,type:P,onKeyDown:w,onClick:S}:{ref:m,id:s.buttonId,type:P,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},T=dm(),O=oe(()=>{let L=s.panel;if(!L)return;function A(){ke(T.current,{[ho.Forwards]:()=>ln(L,_t.First),[ho.Backwards]:()=>ln(L,_t.Last)})===Ir.Error&&ln(nc().filter($=>$.dataset.headlessuiFocusGuard!=="true"),ke(T.current,{[ho.Forwards]:_t.Next,[ho.Backwards]:_t.Previous}),{relativeTo:s.button})}A()});return h.createElement(h.Fragment,null,Be({ourProps:_,theirProps:o,slot:E,defaultTag:WO,name:"Popover.Button"}),x&&!f&&i&&h.createElement(wr,{id:u,features:yr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:O}))}let qO="div",KO=yn.RenderStrategy|yn.Static;function ZO(e,t){let n=Et(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=cc("Popover.Overlay"),i=Ye(t),l=Ps(),u=l!==null?(l&pt.Open)===pt.Open:s===0,d=oe(f=>{if(Io(f.currentTarget))return f.preventDefault();a({type:1})}),p=h.useMemo(()=>({open:s===0}),[s]);return Be({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:p,defaultTag:qO,features:KO,visible:u,name:"Popover.Overlay"})}let YO="div",XO=yn.RenderStrategy|yn.Static;function JO(e,t){let n=Et(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=cc("Popover.Panel"),{close:l,isPortalled:u}=lp("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Et()}`,p=`headlessui-focus-sentinel-after-${Et()}`,f=h.useRef(null),g=Ye(f,t,_=>{i({type:4,panel:_})}),m=Es(f),v=Ud();Ze(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let b=Ps(),w=b!==null?(b&pt.Open)===pt.Open:a.popoverState===0,y=oe(_=>{var T;switch(_.key){case ve.Escape:if(a.popoverState!==0||!f.current||m!=null&&m.activeElement&&!f.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1}),(T=a.button)==null||T.focus();break}});h.useEffect(()=>{var _;e.static||a.popoverState===1&&((_=e.unmount)==null||_)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),h.useEffect(()=>{if(a.__demoMode||!o||a.popoverState!==0||!f.current)return;let _=m==null?void 0:m.activeElement;f.current.contains(_)||ln(f.current,_t.First)},[a.__demoMode,o,f,a.popoverState]);let S=h.useMemo(()=>({open:a.popoverState===0,close:l}),[a,l]),C={ref:g,id:r,onKeyDown:y,onBlur:o&&a.popoverState===0?_=>{var T,O,L,A,$;let B=_.relatedTarget;B&&f.current&&((T=f.current)!=null&&T.contains(B)||(i({type:1}),((L=(O=a.beforePanelSentinel.current)==null?void 0:O.contains)!=null&&L.call(O,B)||($=(A=a.afterPanelSentinel.current)==null?void 0:A.contains)!=null&&$.call(A,B))&&B.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=dm(),E=oe(()=>{let _=f.current;if(!_)return;function T(){ke(x.current,{[ho.Forwards]:()=>{var O;ln(_,_t.First)===Ir.Error&&((O=a.afterPanelSentinel.current)==null||O.focus())},[ho.Backwards]:()=>{var O;(O=a.button)==null||O.focus({preventScroll:!0})}})}T()}),P=oe(()=>{let _=f.current;if(!_)return;function T(){ke(x.current,{[ho.Forwards]:()=>{var O;if(!a.button)return;let L=nc(),A=L.indexOf(a.button),$=L.slice(0,A+1),B=[...L.slice(A+1),...$];for(let M of B.slice())if(M.dataset.headlessuiFocusGuard==="true"||(O=a.panel)!=null&&O.contains(M)){let j=B.indexOf(M);j!==-1&&B.splice(j,1)}ln(B,_t.First,{sorted:!1})},[ho.Backwards]:()=>{var O;ln(_,_t.Previous)===Ir.Error&&((O=a.button)==null||O.focus())}})}T()});return h.createElement(uc.Provider,{value:r},w&&u&&h.createElement(wr,{id:d,ref:a.beforePanelSentinel,features:yr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),Be({mergeRefs:v,ourProps:C,theirProps:s,slot:S,defaultTag:YO,features:XO,visible:w,name:"Popover.Panel"}),w&&u&&h.createElement(wr,{id:p,ref:a.afterPanelSentinel,features:yr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let QO="div";function RO(e,t){let n=h.useRef(null),r=Ye(n,t),[o,s]=h.useState([]),a=K5(),i=oe(v=>{s(b=>{let w=b.indexOf(v);if(w!==-1){let y=b.slice();return y.splice(w,1),y}return b})}),l=oe(v=>(s(b=>[...b,v]),()=>i(v))),u=oe(()=>{var v;let b=$o(n);if(!b)return!1;let w=b.activeElement;return(v=n.current)!=null&&v.contains(w)?!0:o.some(y=>{var S,C;return((S=b.getElementById(y.buttonId.current))==null?void 0:S.contains(w))||((C=b.getElementById(y.panelId.current))==null?void 0:C.contains(w))})}),d=oe(v=>{for(let b of o)b.buttonId.current!==v&&b.close()}),p=h.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),f=h.useMemo(()=>({}),[]),g=e,m={ref:r};return h.createElement(cp.Provider,{value:p},Be({ourProps:m,theirProps:g,slot:f,defaultTag:QO,name:"Popover.Group"}),h.createElement(a.MainTreeNode,null))}let e_=ze(UO),t_=ze(GO),n_=ze(ZO),r_=ze(JO),o_=ze(RO),up=Object.assign(e_,{Button:t_,Overlay:n_,Panel:r_,Group:o_}),Sm=h.createContext(null);function Cm(){let e=h.useContext(Sm);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Cm),t}return e}function dp(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(Sm.Provider,{value:o},n.children)},[t])]}let s_="label";function a_(e,t){let n=Et(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=Cm(),i=Ye(t);Ze(()=>a.register(r),[r,a.register]);let l={ref:i,...a.props,id:r};return o&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in s&&delete s.onClick),Be({ourProps:l,theirProps:s,slot:a.slot||{},defaultTag:s_,name:a.name||"Label"})}let i_=ze(a_),xm=Object.assign(i_,{});function Em(e=0){let[t,n]=h.useState(e),r=lc(),o=h.useCallback(l=>{r.current&&n(u=>u|l)},[t,r]),s=h.useCallback(l=>!!(t&l),[t]),a=h.useCallback(l=>{r.current&&n(u=>u&~l)},[n,r]),i=h.useCallback(l=>{r.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:o,hasFlag:s,removeFlag:a,toggleFlag:i}}var l_=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(l_||{});let c_={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:fo(n,r=>r.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(o=>o.id===t.id);return r===-1?e:(n.splice(r,1),{...e,options:n})}},pp=h.createContext(null);pp.displayName="RadioGroupDataContext";function Pm(e){let t=h.useContext(pp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Pm),n}return t}let fp=h.createContext(null);fp.displayName="RadioGroupActionsContext";function Tm(e){let t=h.useContext(fp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tm),n}return t}function u_(e,t){return ke(t.type,c_,e,t)}let d_="div";function p_(e,t){let n=Et(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=(z,I)=>z===I,disabled:d=!1,...p}=e,f=oe(typeof u=="string"?(z,I)=>{let H=u;return(z==null?void 0:z[H])===(I==null?void 0:I[H])}:u),[g,m]=h.useReducer(u_,{options:[]}),v=g.options,[b,w]=dp(),[y,S]=Jd(),C=h.useRef(null),x=Ye(C,t),[E,P]=ec(o,l,s),_=h.useMemo(()=>v.find(z=>!z.propsRef.current.disabled),[v]),T=h.useMemo(()=>v.some(z=>f(z.propsRef.current.value,E)),[v,E]),O=oe(z=>{var I;if(d||f(z,E))return!1;let H=(I=v.find(V=>f(V.propsRef.current.value,z)))==null?void 0:I.propsRef.current;return H!=null&&H.disabled?!1:(P==null||P(z),!0)});om({container:C.current,accept(z){return z.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:z.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(z){z.setAttribute("role","none")}});let L=oe(z=>{let I=C.current;if(!I)return;let H=$o(I),V=v.filter(G=>G.propsRef.current.disabled===!1).map(G=>G.element.current);switch(z.key){case ve.Enter:cm(z.currentTarget);break;case ve.ArrowLeft:case ve.ArrowUp:if(z.preventDefault(),z.stopPropagation(),ln(V,_t.Previous|_t.WrapAround)===Ir.Success){let G=v.find(Y=>Y.element.current===(H==null?void 0:H.activeElement));G&&O(G.propsRef.current.value)}break;case ve.ArrowRight:case ve.ArrowDown:if(z.preventDefault(),z.stopPropagation(),ln(V,_t.Next|_t.WrapAround)===Ir.Success){let G=v.find(Y=>Y.element.current===(H==null?void 0:H.activeElement));G&&O(G.propsRef.current.value)}break;case ve.Space:{z.preventDefault(),z.stopPropagation();let G=v.find(Y=>Y.element.current===(H==null?void 0:H.activeElement));G&&O(G.propsRef.current.value)}break}}),A=oe(z=>(m({type:0,...z}),()=>m({type:1,id:z.id}))),$=h.useMemo(()=>({value:E,firstOption:_,containsCheckedOption:T,disabled:d,compare:f,...g}),[E,_,T,d,f,g]),B=h.useMemo(()=>({registerOption:A,change:O}),[A,O]),M={ref:x,id:r,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:L},j=h.useMemo(()=>({value:E}),[E]),W=h.useRef(null),D=br();return h.useEffect(()=>{W.current&&s!==void 0&&D.addEventListener(W.current,"reset",()=>{O(s)})},[W,O]),h.createElement(S,{name:"RadioGroup.Description"},h.createElement(w,{name:"RadioGroup.Label"},h.createElement(fp.Provider,{value:B},h.createElement(pp.Provider,{value:$},i!=null&&E!=null&&ic({[i]:E}).map(([z,I],H)=>h.createElement(wr,{features:yr.Hidden,ref:H===0?V=>{var G;W.current=(G=V==null?void 0:V.closest("form"))!=null?G:null}:void 0,...ca({key:z,as:"input",type:"radio",checked:I!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:z,value:I})})),Be({ourProps:M,theirProps:p,slot:j,defaultTag:d_,name:"RadioGroup"})))))}var f_=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(f_||{});let h_="div";function g_(e,t){var n;let r=Et(),{id:o=`headlessui-radiogroup-option-${r}`,value:s,disabled:a=!1,...i}=e,l=h.useRef(null),u=Ye(l,t),[d,p]=dp(),[f,g]=Jd(),{addFlag:m,removeFlag:v,hasFlag:b}=Em(1),w=Dt({value:s,disabled:a}),y=Pm("RadioGroup.Option"),S=Tm("RadioGroup.Option");Ze(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=oe(A=>{var $;if(Io(A.currentTarget))return A.preventDefault();S.change(s)&&(m(2),($=l.current)==null||$.focus())}),x=oe(A=>{if(Io(A.currentTarget))return A.preventDefault();m(2)}),E=oe(()=>v(2)),P=((n=y.firstOption)==null?void 0:n.id)===o,_=y.disabled||a,T=y.compare(y.value,s),O={ref:u,id:o,role:"radio","aria-checked":T?"true":"false","aria-labelledby":d,"aria-describedby":f,"aria-disabled":_?!0:void 0,tabIndex:_?-1:T||!y.containsCheckedOption&&P?0:-1,onClick:_?void 0:C,onFocus:_?void 0:x,onBlur:_?void 0:E},L=h.useMemo(()=>({checked:T,disabled:_,active:b(2)}),[T,_,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(p,{name:"RadioGroup.Label"},Be({ourProps:O,theirProps:i,slot:L,defaultTag:h_,name:"RadioGroup.Option"})))}let m_=ze(p_),v_=ze(g_),Om=Object.assign(m_,{Option:v_,Label:xm,Description:gm}),hp=h.createContext(null);hp.displayName="GroupContext";let b_=h.Fragment;function y_(e){var t;let[n,r]=h.useState(null),[o,s]=dp(),[a,i]=Jd(),l=h.useMemo(()=>({switch:n,setSwitch:r,labelledby:o,describedby:a}),[n,r,o,a]),u={},d=e;return h.createElement(i,{name:"Switch.Description"},h.createElement(s,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(p){n&&(p.currentTarget.tagName==="LABEL"&&p.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(hp.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:b_,name:"Switch.Group"}))))}let w_="button";function S_(e,t){var n;let r=Et(),{id:o=`headlessui-switch-${r}`,checked:s,defaultChecked:a=!1,onChange:i,disabled:l=!1,name:u,value:d,form:p,...f}=e,g=h.useContext(hp),m=h.useRef(null),v=Ye(m,t,g===null?null:g.setSwitch),[b,w]=ec(s,i,a),y=oe(()=>w==null?void 0:w(!b)),S=oe(T=>{if(Io(T.currentTarget))return T.preventDefault();T.preventDefault(),y()}),C=oe(T=>{T.key===ve.Space?(T.preventDefault(),y()):T.key===ve.Enter&&cm(T.currentTarget)}),x=oe(T=>T.preventDefault()),E=h.useMemo(()=>({checked:b}),[b]),P={id:o,ref:v,role:"switch",type:la(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":b,"aria-labelledby":g==null?void 0:g.labelledby,"aria-describedby":g==null?void 0:g.describedby,disabled:l,onClick:S,onKeyUp:C,onKeyPress:x},_=br();return h.useEffect(()=>{var T;let O=(T=m.current)==null?void 0:T.closest("form");O&&a!==void 0&&_.addEventListener(O,"reset",()=>{w(a)})},[m,w]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(wr,{features:yr.Hidden,...ca({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:p,checked:b,name:u,value:d})}),Be({ourProps:P,theirProps:f,slot:E,defaultTag:w_,name:"Switch"}))}let C_=ze(S_),x_=y_,gp=Object.assign(C_,{Group:x_,Label:xm,Description:gm});function E_({onFocus:e}){let[t,n]=h.useState(!0),r=lc();return t?h.createElement(wr,{as:"button",type:"button",features:yr.Focusable,onFocus:o=>{o.preventDefault();let s,a=50;function i(){if(a--<=0){s&&cancelAnimationFrame(s);return}if(e()){if(cancelAnimationFrame(s),!r.current)return;n(!1);return}s=requestAnimationFrame(i)}s=requestAnimationFrame(i)}}):null}const _m=nt.createContext(null);function P_(){return{groups:new Map,get(e,t){var n;let r=this.groups.get(e);r||(r=new Map,this.groups.set(e,r));let o=(n=r.get(t))!=null?n:0;r.set(t,o+1);let s=Array.from(r.keys()).indexOf(t);function a(){let i=r.get(t);i>1?r.set(t,i-1):r.delete(t)}return[s,a]}}}function T_({children:e}){let t=nt.useRef(P_());return nt.createElement(_m.Provider,{value:t},e)}function Am(e){let t=nt.useContext(_m);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=O_(),[r,o]=t.current.get(e,n);return nt.useEffect(()=>o,[]),r}function O_(){var e,t,n;let r=(n=(t=(e=nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!r)return Symbol();let o=[],s=r;for(;s;)o.push(s.index),s=s.return;return"$."+o.join(".")}var __=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(__||{}),A_=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(A_||{}),L_=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(L_||{});let M_={0(e,t){var n;let r=fo(e.tabs,d=>d.current),o=fo(e.panels,d=>d.current),s=r.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),a={...e,tabs:r,panels:o};if(t.index<0||t.index>r.length-1){let d=ke(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>ke(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(s.length===0)return a;let p=ke(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:p===-1?e.selectedIndex:p}}let i=r.slice(0,t.index),l=[...r.slice(t.index),...i].find(d=>s.includes(d));if(!l)return a;let u=(n=r.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...a,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],r=fo([...e.tabs,t.tab],s=>s.current),o=e.selectedIndex;return e.info.current.isControlled||(o=r.indexOf(n),o===-1&&(o=e.selectedIndex)),{...e,tabs:r,selectedIndex:o}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:fo([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},mp=h.createContext(null);mp.displayName="TabsDataContext";function da(e){let t=h.useContext(mp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,da),n}return t}let vp=h.createContext(null);vp.displayName="TabsActionsContext";function bp(e){let t=h.useContext(vp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,bp),n}return t}function N_(e,t){return ke(t.type,M_,e,t)}let $_=h.Fragment;function k_(e,t){let{defaultIndex:n=0,vertical:r=!1,manual:o=!1,onChange:s,selectedIndex:a=null,...i}=e;const l=r?"vertical":"horizontal",u=o?"manual":"auto";let d=a!==null,p=Dt({isControlled:d}),f=Ye(t),[g,m]=h.useReducer(N_,{info:p,selectedIndex:a??n,tabs:[],panels:[]}),v=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),b=Dt(s||(()=>{})),w=Dt(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),S=oe(T=>(m({type:1,tab:T}),()=>m({type:2,tab:T}))),C=oe(T=>(m({type:3,panel:T}),()=>m({type:4,panel:T}))),x=oe(T=>{E.current!==T&&b.current(T),d||m({type:0,index:T})}),E=Dt(d?e.selectedIndex:g.selectedIndex),P=h.useMemo(()=>({registerTab:S,registerPanel:C,change:x}),[]);Ze(()=>{m({type:0,index:a??n})},[a]),Ze(()=>{if(E.current===void 0||g.tabs.length<=0)return;let T=fo(g.tabs,O=>O.current);T.some((O,L)=>g.tabs[L]!==O)&&x(T.indexOf(g.tabs[E.current]))});let _={ref:f};return h.createElement(T_,null,h.createElement(vp.Provider,{value:P},h.createElement(mp.Provider,{value:y},y.tabs.length<=0&&h.createElement(E_,{onFocus:()=>{var T,O;for(let L of w.current)if(((T=L.current)==null?void 0:T.tabIndex)===0)return(O=L.current)==null||O.focus(),!0;return!1}}),Be({ourProps:_,theirProps:i,slot:v,defaultTag:$_,name:"Tabs"}))))}let I_="div";function V_(e,t){let{orientation:n,selectedIndex:r}=da("Tab.List"),o=Ye(t);return Be({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:I_,name:"Tabs.List"})}let H_="button";function j_(e,t){var n,r;let o=Et(),{id:s=`headlessui-tabs-tab-${o}`,...a}=e,{orientation:i,activation:l,selectedIndex:u,tabs:d,panels:p}=da("Tab"),f=bp("Tab"),g=da("Tab"),m=h.useRef(null),v=Ye(m,t);Ze(()=>f.registerTab(m),[f,m]);let b=Am("tabs"),w=d.indexOf(m);w===-1&&(w=b);let y=w===u,S=oe(O=>{var L;let A=O();if(A===Ir.Success&&l==="auto"){let $=(L=$o(m))==null?void 0:L.activeElement,B=g.tabs.findIndex(M=>M.current===$);B!==-1&&f.change(B)}return A}),C=oe(O=>{let L=d.map(A=>A.current).filter(Boolean);if(O.key===ve.Space||O.key===ve.Enter){O.preventDefault(),O.stopPropagation(),f.change(w);return}switch(O.key){case ve.Home:case ve.PageUp:return O.preventDefault(),O.stopPropagation(),S(()=>ln(L,_t.First));case ve.End:case ve.PageDown:return O.preventDefault(),O.stopPropagation(),S(()=>ln(L,_t.Last))}if(S(()=>ke(i,{vertical(){return O.key===ve.ArrowUp?ln(L,_t.Previous|_t.WrapAround):O.key===ve.ArrowDown?ln(L,_t.Next|_t.WrapAround):Ir.Error},horizontal(){return O.key===ve.ArrowLeft?ln(L,_t.Previous|_t.WrapAround):O.key===ve.ArrowRight?ln(L,_t.Next|_t.WrapAround):Ir.Error}}))===Ir.Success)return O.preventDefault()}),x=h.useRef(!1),E=oe(()=>{var O;x.current||(x.current=!0,(O=m.current)==null||O.focus({preventScroll:!0}),f.change(w),jd(()=>{x.current=!1}))}),P=oe(O=>{O.preventDefault()}),_=h.useMemo(()=>{var O;return{selected:y,disabled:(O=e.disabled)!=null?O:!1}},[y,e.disabled]),T={ref:v,onKeyDown:C,onMouseDown:P,onClick:E,id:s,role:"tab",type:la(e,m),"aria-controls":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:T,theirProps:a,slot:_,defaultTag:H_,name:"Tabs.Tab"})}let D_="div";function F_(e,t){let{selectedIndex:n}=da("Tab.Panels"),r=Ye(t),o=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:D_,name:"Tabs.Panels"})}let B_="div",z_=yn.RenderStrategy|yn.Static;function U_(e,t){var n,r,o,s;let a=Et(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:p,panels:f}=da("Tab.Panel"),g=bp("Tab.Panel"),m=h.useRef(null),v=Ye(m,t);Ze(()=>g.registerPanel(m),[g,m,i]);let b=Am("panels"),w=f.indexOf(m);w===-1&&(w=b);let y=w===d,S=h.useMemo(()=>({selected:y}),[y]),C={ref:v,id:i,role:"tabpanel","aria-labelledby":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,tabIndex:y?l:-1};return!y&&((o=u.unmount)==null||o)&&!((s=u.static)!=null&&s)?h.createElement(wr,{as:"span","aria-hidden":"true",...C}):Be({ourProps:C,theirProps:u,slot:S,defaultTag:B_,features:z_,visible:y,name:"Tabs.Panel"})}let W_=ze(j_),G_=ze(k_),q_=ze(V_),K_=ze(F_),Z_=ze(U_),fi=Object.assign(W_,{Group:G_,List:q_,Panels:K_,Panel:Z_});function Y_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function yp(e,...t){e&&t.length>0&&e.classList.add(...t)}function wp(e,...t){e&&t.length>0&&e.classList.remove(...t)}function X_(e,t){let n=kr();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[s,a]=[r,o].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return u}),i=s+a;if(i!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},i),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function J_(e,t,n,r){let o=n?"enter":"leave",s=kr(),a=r!==void 0?Y_(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=ke(o,{enter:()=>t.enter,leave:()=>t.leave}),l=ke(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=ke(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return wp(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),yp(e,...t.base,...i,...u),s.nextFrame(()=>{wp(e,...t.base,...i,...u),yp(e,...t.base,...i,...l),X_(e,()=>(wp(e,...t.base,...i),yp(e,...t.base,...t.entered),a()))}),s.dispose}function Q_({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=lc(),i=br(),l=Dt(n);Ze(()=>{e&&(l.current="enter")},[e]),Ze(()=>{let u=kr();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(J_(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function Vo(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let dc=h.createContext(null);dc.displayName="TransitionContext";var R_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(R_||{});function eA(){let e=h.useContext(dc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function tA(){let e=h.useContext(pc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let pc=h.createContext(null);pc.displayName="NestingContext";function fc(e){return"children"in e?fc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Lm(e,t){let n=Dt(e),r=h.useRef([]),o=lc(),s=br(),a=oe((g,m=ko.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===g);v!==-1&&(ke(m,{[ko.Unmount](){r.current.splice(v,1)},[ko.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!fc(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),i=oe(g=>{let m=r.current.find(({el:v})=>v===g);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:g,state:"visible"}),()=>a(g,ko.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),p=oe((g,m,v)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([b])=>b!==g)),t==null||t.chains.current[m].push([g,new Promise(b=>{l.current.push(b)})]),t==null||t.chains.current[m].push([g,new Promise(b=>{Promise.all(d.current[m].map(([w,y])=>y)).then(()=>b())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(m)):v(m)}),f=oe((g,m,v)=>{Promise.all(d.current[m].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=l.current.shift())==null||b()}).then(()=>v(m))});return h.useMemo(()=>({children:r,register:i,unregister:a,onStart:p,onStop:f,wait:u,chains:d}),[i,a,r,p,f,d,u])}function nA(){}let rA=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Mm(e){var t;let n={};for(let r of rA)n[r]=(t=e[r])!=null?t:nA;return n}function oA(e){let t=h.useRef(Mm(e));return h.useEffect(()=>{t.current=Mm(e)},[e]),t}let sA="div",Nm=yn.RenderStrategy;function aA(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),w=Ye(b,t),y=(n=v.unmount)==null||n?ko.Unmount:ko.Hidden,{show:S,appear:C,initial:x}=eA(),[E,P]=h.useState(S?"visible":"hidden"),_=tA(),{register:T,unregister:O}=_;h.useEffect(()=>T(b),[T,b]),h.useEffect(()=>{if(y===ko.Hidden&&b.current){if(S&&E!=="visible"){P("visible");return}return ke(E,{hidden:()=>O(b),visible:()=>T(b)})}},[E,b,T,O,S,y]);let L=Dt({base:Vo(v.className),enter:Vo(l),enterFrom:Vo(u),enterTo:Vo(d),entered:Vo(p),leave:Vo(f),leaveFrom:Vo(g),leaveTo:Vo(m)}),A=oA({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),$=tc();h.useEffect(()=>{if($&&E==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,E,$]);let B=x&&!C,M=C&&S&&x,j=!$||B?"idle":S?"enter":"leave",W=Em(0),D=oe(Y=>ke(Y,{enter:()=>{W.addFlag(pt.Opening),A.current.beforeEnter()},leave:()=>{W.addFlag(pt.Closing),A.current.beforeLeave()},idle:()=>{}})),z=oe(Y=>ke(Y,{enter:()=>{W.removeFlag(pt.Opening),A.current.afterEnter()},leave:()=>{W.removeFlag(pt.Closing),A.current.afterLeave()},idle:()=>{}})),I=Lm(()=>{P("hidden"),O(b)},_),H=h.useRef(!1);Q_({immediate:M,container:b,classes:L,direction:j,onStart:Dt(Y=>{H.current=!0,I.onStart(b,Y,D)}),onStop:Dt(Y=>{H.current=!1,I.onStop(b,Y,z),Y==="leave"&&!fc(I)&&(P("hidden"),O(b))})});let V=v,G={ref:w};return M?V={...V,className:sc(v.className,...L.current.enter,...L.current.enterFrom)}:H.current&&(V.className=sc(v.className,(r=b.current)==null?void 0:r.className),V.className===""&&delete V.className),h.createElement(pc.Provider,{value:I},h.createElement(li,{value:ke(E,{visible:pt.Open,hidden:pt.Closed})|W.flags},Be({ourProps:G,theirProps:V,defaultTag:sA,features:Nm,visible:E==="visible",name:"Transition.Child"})))}function iA(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=h.useRef(null),i=Ye(a,t);tc();let l=Ps();if(n===void 0&&l!==null&&(n=(l&pt.Open)===pt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=h.useState(n?"visible":"hidden"),p=Lm(()=>{d("hidden")}),[f,g]=h.useState(!0),m=h.useRef([n]);Ze(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let v=h.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);h.useEffect(()=>{if(n)d("visible");else if(!fc(p))d("hidden");else{let S=a.current;if(!S)return;let C=S.getBoundingClientRect();C.x===0&&C.y===0&&C.width===0&&C.height===0&&d("hidden")}},[n,p]);let b={unmount:o},w=oe(()=>{var S;f&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=oe(()=>{var S;f&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return h.createElement(pc.Provider,{value:p},h.createElement(dc.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement($m,{ref:i,...b,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:Nm,visible:u==="visible",name:"Transition"})))}function lA(e,t){let n=h.useContext(dc)!==null,r=Ps()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(Sp,{ref:t,...e}):h.createElement($m,{ref:t,...e}))}let Sp=ze(iA),$m=ze(aA),cA=ze(lA),Cp=Object.assign(Sp,{Child:cA,Root:Sp});var km=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},Im=typeof window<"u"&&window.document&&window.document.createElement?nt.useLayoutEffect:nt.useEffect,wn="top",Yn="bottom",Xn="right",Sn="left",xp="auto",hi=[wn,Yn,Xn,Sn],pa="start",gi="end",uA="clippingParents",Vm="viewport",mi="popper",dA="reference",Hm=hi.reduce(function(e,t){return e.concat([t+"-"+pa,t+"-"+gi])},[]),jm=[].concat(hi,[xp]).reduce(function(e,t){return e.concat([t,t+"-"+pa,t+"-"+gi])},[]),pA="beforeRead",fA="read",hA="afterRead",gA="beforeMain",mA="main",vA="afterMain",bA="beforeWrite",yA="write",wA="afterWrite",SA=[pA,fA,hA,gA,mA,vA,bA,yA,wA];function Vr(e){return e?(e.nodeName||"").toLowerCase():null}function Nn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function _s(e){var t=Nn(e).Element;return e instanceof t||e instanceof Element}function Jn(e){var t=Nn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ep(e){if(typeof ShadowRoot>"u")return!1;var t=Nn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function CA(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Jn(s)||!Vr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var i=o[a];i===!1?s.removeAttribute(a):s.setAttribute(a,i===!0?"":i)}))})}function xA(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),i=a.reduce(function(l,u){return l[u]="",l},{});!Jn(o)||!Vr(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const EA={name:"applyStyles",enabled:!0,phase:"write",fn:CA,effect:xA,requires:["computeStyles"]};function Hr(e){return e.split("-")[0]}var As=Math.max,hc=Math.min,fa=Math.round;function Pp(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Dm(){return!/^((?!chrome|android).)*safari/i.test(Pp())}function ha(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Jn(e)&&(o=e.offsetWidth>0&&fa(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&fa(r.height)/e.offsetHeight||1);var a=_s(e)?Nn(e):window,i=a.visualViewport,l=!Dm()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,p=r.width/o,f=r.height/s;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function Tp(e){var t=ha(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Fm(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ep(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function go(e){return Nn(e).getComputedStyle(e)}function PA(e){return["table","td","th"].indexOf(Vr(e))>=0}function Ho(e){return((_s(e)?e.ownerDocument:e.document)||window.document).documentElement}function gc(e){return Vr(e)==="html"?e:e.assignedSlot||e.parentNode||(Ep(e)?e.host:null)||Ho(e)}function Bm(e){return!Jn(e)||go(e).position==="fixed"?null:e.offsetParent}function TA(e){var t=/firefox/i.test(Pp()),n=/Trident/i.test(Pp());if(n&&Jn(e)){var r=go(e);if(r.position==="fixed")return null}var o=gc(e);for(Ep(o)&&(o=o.host);Jn(o)&&["html","body"].indexOf(Vr(o))<0;){var s=go(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function vi(e){for(var t=Nn(e),n=Bm(e);n&&PA(n)&&go(n).position==="static";)n=Bm(n);return n&&(Vr(n)==="html"||Vr(n)==="body"&&go(n).position==="static")?t:n||TA(e)||t}function Op(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function bi(e,t,n){return As(e,hc(t,n))}function OA(e,t,n){var r=bi(e,t,n);return r>n?n:r}function zm(){return{top:0,right:0,bottom:0,left:0}}function Um(e){return Object.assign({},zm(),e)}function Wm(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var _A=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Um(typeof t!="number"?t:Wm(t,hi))};function AA(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=Hr(n.placement),l=Op(i),u=[Sn,Xn].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var p=_A(o.padding,n),f=Tp(s),g=l==="y"?wn:Sn,m=l==="y"?Yn:Xn,v=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],b=a[l]-n.rects.reference[l],w=vi(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=v/2-b/2,C=p[g],x=y-f[d]-p[m],E=y/2-f[d]/2+S,P=bi(C,E,x),_=l;n.modifiersData[r]=(t={},t[_]=P,t.centerOffset=P-E,t)}}function LA(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||Fm(t.elements.popper,o)&&(t.elements.arrow=o))}const MA={name:"arrow",enabled:!0,phase:"main",fn:AA,effect:LA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ga(e){return e.split("-")[1]}var NA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function $A(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:fa(n*o)/o||0,y:fa(r*o)/o||0}}function Gm(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,i=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=a.x,g=f===void 0?0:f,m=a.y,v=m===void 0?0:m,b=typeof d=="function"?d({x:g,y:v}):{x:g,y:v};g=b.x,v=b.y;var w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=Sn,C=wn,x=window;if(u){var E=vi(n),P="clientHeight",_="clientWidth";if(E===Nn(n)&&(E=Ho(n),go(E).position!=="static"&&i==="absolute"&&(P="scrollHeight",_="scrollWidth")),E=E,o===wn||(o===Sn||o===Xn)&&s===gi){C=Yn;var T=p&&E===x&&x.visualViewport?x.visualViewport.height:E[P];v-=T-r.height,v*=l?1:-1}if(o===Sn||(o===wn||o===Yn)&&s===gi){S=Xn;var O=p&&E===x&&x.visualViewport?x.visualViewport.width:E[_];g-=O-r.width,g*=l?1:-1}}var L=Object.assign({position:i},u&&NA),A=d===!0?$A({x:g,y:v},Nn(n)):{x:g,y:v};if(g=A.x,v=A.y,l){var $;return Object.assign({},L,($={},$[C]=y?"0":"",$[S]=w?"0":"",$.transform=(x.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",$))}return Object.assign({},L,(t={},t[C]=y?v+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function kA(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,i=n.roundOffsets,l=i===void 0?!0:i,u={placement:Hr(t.placement),variation:ga(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Gm(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Gm(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const IA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:kA,data:{}};var mc={passive:!0};function VA(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,i=a===void 0?!0:a,l=Nn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,mc)}),i&&l.addEventListener("resize",n.update,mc),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,mc)}),i&&l.removeEventListener("resize",n.update,mc)}}const HA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:VA,data:{}};var jA={left:"right",right:"left",bottom:"top",top:"bottom"};function vc(e){return e.replace(/left|right|bottom|top/g,function(t){return jA[t]})}var DA={start:"end",end:"start"};function qm(e){return e.replace(/start|end/g,function(t){return DA[t]})}function _p(e){var t=Nn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ap(e){return ha(Ho(e)).left+_p(e).scrollLeft}function FA(e,t){var n=Nn(e),r=Ho(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=Dm();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+Ap(e),y:l}}function BA(e){var t,n=Ho(e),r=_p(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=As(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=As(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+Ap(e),l=-r.scrollTop;return go(o||n).direction==="rtl"&&(i+=As(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function Lp(e){var t=go(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Km(e){return["html","body","#document"].indexOf(Vr(e))>=0?e.ownerDocument.body:Jn(e)&&Lp(e)?e:Km(gc(e))}function yi(e,t){var n;t===void 0&&(t=[]);var r=Km(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Nn(r),a=o?[s].concat(s.visualViewport||[],Lp(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(yi(gc(a)))}function Mp(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function zA(e,t){var n=ha(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Zm(e,t,n){return t===Vm?Mp(FA(e,n)):_s(t)?zA(t,n):Mp(BA(Ho(e)))}function UA(e){var t=yi(gc(e)),n=["absolute","fixed"].indexOf(go(e).position)>=0,r=n&&Jn(e)?vi(e):e;return _s(r)?t.filter(function(o){return _s(o)&&Fm(o,r)&&Vr(o)!=="body"}):[]}function WA(e,t,n,r){var o=t==="clippingParents"?UA(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=Zm(e,u,r);return l.top=As(d.top,l.top),l.right=hc(d.right,l.right),l.bottom=hc(d.bottom,l.bottom),l.left=As(d.left,l.left),l},Zm(e,a,r));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}function Ym(e){var t=e.reference,n=e.element,r=e.placement,o=r?Hr(r):null,s=r?ga(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case wn:l={x:a,y:t.y-n.height};break;case Yn:l={x:a,y:t.y+t.height};break;case Xn:l={x:t.x+t.width,y:i};break;case Sn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?Op(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case pa:l[u]=l[u]-(t[d]/2-n[d]/2);break;case gi:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function wi(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,i=n.boundary,l=i===void 0?uA:i,u=n.rootBoundary,d=u===void 0?Vm:u,p=n.elementContext,f=p===void 0?mi:p,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,w=Um(typeof b!="number"?b:Wm(b,hi)),y=f===mi?dA:mi,S=e.rects.popper,C=e.elements[m?y:f],x=WA(_s(C)?C:C.contextElement||Ho(e.elements.popper),l,d,a),E=ha(e.elements.reference),P=Ym({reference:E,element:S,strategy:"absolute",placement:o}),_=Mp(Object.assign({},S,P)),T=f===mi?_:E,O={top:x.top-T.top+w.top,bottom:T.bottom-x.bottom+w.bottom,left:x.left-T.left+w.left,right:T.right-x.right+w.right},L=e.modifiersData.offset;if(f===mi&&L){var A=L[o];Object.keys(O).forEach(function($){var B=[Xn,Yn].indexOf($)>=0?1:-1,M=[wn,Yn].indexOf($)>=0?"y":"x";O[$]+=A[M]*B})}return O}function GA(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,i=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?jm:l,d=ga(r),p=d?i?Hm:Hm.filter(function(m){return ga(m)===d}):hi,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var g=f.reduce(function(m,v){return m[v]=wi(e,{placement:v,boundary:o,rootBoundary:s,padding:a})[Hr(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function qA(e){if(Hr(e)===xp)return[];var t=vc(e);return[qm(e),t,qm(t)]}function KA(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!0:a,l=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,f=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,v=n.allowedAutoPlacements,b=t.options.placement,w=Hr(b),y=w===b,S=l||(y||!m?[vc(b)]:qA(b)),C=[b].concat(S).reduce(function(Y,J){return Y.concat(Hr(J)===xp?GA(t,{placement:J,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:v}):J)},[]),x=t.rects.reference,E=t.rects.popper,P=new Map,_=!0,T=C[0],O=0;O<C.length;O++){var L=C[O],A=Hr(L),$=ga(L)===pa,B=[wn,Yn].indexOf(A)>=0,M=B?"width":"height",j=wi(t,{placement:L,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),W=B?$?Xn:Sn:$?Yn:wn;x[M]>E[M]&&(W=vc(W));var D=vc(W),z=[];if(s&&z.push(j[A]<=0),i&&z.push(j[W]<=0,j[D]<=0),z.every(function(Y){return Y})){T=L,_=!1;break}P.set(L,z)}if(_)for(var I=m?3:1,H=function(J){var Q=C.find(function(R){var q=P.get(R);if(q)return q.slice(0,J).every(function(ee){return ee})});if(Q)return T=Q,"break"},V=I;V>0;V--){var G=H(V);if(G==="break")break}t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}const ZA={name:"flip",enabled:!0,phase:"main",fn:KA,requiresIfExists:["offset"],data:{_skip:!1}};function Xm(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Jm(e){return[wn,Xn,Yn,Sn].some(function(t){return e[t]>=0})}function YA(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=wi(t,{elementContext:"reference"}),i=wi(t,{altBoundary:!0}),l=Xm(a,r),u=Xm(i,o,s),d=Jm(l),p=Jm(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const XA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:YA};function JA(e,t,n){var r=Hr(e),o=[Sn,wn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],i=s[1];return a=a||0,i=(i||0)*o,[Sn,Xn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function QA(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=jm.reduce(function(d,p){return d[p]=JA(p,t.rects,s),d},{}),i=a[t.placement],l=i.x,u=i.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const RA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:QA};function e3(e){var t=e.state,n=e.name;t.modifiersData[n]=Ym({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const t3={name:"popperOffsets",enabled:!0,phase:"read",fn:e3,data:{}};function n3(e){return e==="x"?"y":"x"}function r3(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!1:a,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,g=f===void 0?!0:f,m=n.tetherOffset,v=m===void 0?0:m,b=wi(t,{boundary:l,rootBoundary:u,padding:p,altBoundary:d}),w=Hr(t.placement),y=ga(t.placement),S=!y,C=Op(w),x=n3(C),E=t.modifiersData.popperOffsets,P=t.rects.reference,_=t.rects.popper,T=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,O=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,A={x:0,y:0};if(E){if(s){var $,B=C==="y"?wn:Sn,M=C==="y"?Yn:Xn,j=C==="y"?"height":"width",W=E[C],D=W+b[B],z=W-b[M],I=g?-_[j]/2:0,H=y===pa?P[j]:_[j],V=y===pa?-_[j]:-P[j],G=t.elements.arrow,Y=g&&G?Tp(G):{width:0,height:0},J=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:zm(),Q=J[B],R=J[M],q=bi(0,P[j],Y[j]),ee=S?P[j]/2-I-q-Q-O.mainAxis:H-q-Q-O.mainAxis,le=S?-P[j]/2+I+q+R+O.mainAxis:V+q+R+O.mainAxis,ge=t.elements.arrow&&vi(t.elements.arrow),Pe=ge?C==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ce=($=L==null?void 0:L[C])!=null?$:0,tt=W+ee-Ce-Pe,Qe=W+le-Ce,Ot=bi(g?hc(D,tt):D,W,g?As(z,Qe):z);E[C]=Ot,A[C]=Ot-W}if(i){var ut,Se=C==="x"?wn:Sn,ot=C==="x"?Yn:Xn,st=E[x],wt=x==="y"?"height":"width",Ne=st+b[Se],mt=st-b[ot],dt=[wn,Sn].indexOf(w)!==-1,Ue=(ut=L==null?void 0:L[x])!=null?ut:0,tn=dt?Ne:st-P[wt]-_[wt]-Ue+O.altAxis,he=dt?st+P[wt]+_[wt]-Ue-O.altAxis:mt,De=g&&dt?OA(tn,st,he):bi(g?tn:Ne,st,g?he:mt);E[x]=De,A[x]=De-st}t.modifiersData[r]=A}}const o3={name:"preventOverflow",enabled:!0,phase:"main",fn:r3,requiresIfExists:["offset"]};function s3(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function a3(e){return e===Nn(e)||!Jn(e)?_p(e):s3(e)}function i3(e){var t=e.getBoundingClientRect(),n=fa(t.width)/e.offsetWidth||1,r=fa(t.height)/e.offsetHeight||1;return n!==1||r!==1}function l3(e,t,n){n===void 0&&(n=!1);var r=Jn(t),o=Jn(t)&&i3(t),s=Ho(t),a=ha(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Vr(t)!=="body"||Lp(s))&&(i=a3(t)),Jn(t)?(l=ha(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=Ap(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function c3(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var a=[].concat(s.requires||[],s.requiresIfExists||[]);a.forEach(function(i){if(!n.has(i)){var l=t.get(i);l&&o(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function u3(e){var t=c3(e);return SA.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function d3(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function p3(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Qm={placement:"bottom",modifiers:[],strategy:"absolute"};function Rm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function f3(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?Qm:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Qm,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},p=[],f=!1,g={state:d,setOptions:function(w){var y=typeof w=="function"?w(d.options):w;v(),d.options=Object.assign({},s,d.options,y),d.scrollParents={reference:_s(i)?yi(i):i.contextElement?yi(i.contextElement):[],popper:yi(l)};var S=u3(p3([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!f){var w=d.elements,y=w.reference,S=w.popper;if(Rm(y,S)){d.rects={reference:l3(y,vi(S),d.options.strategy==="fixed"),popper:Tp(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(O){return d.modifiersData[O.name]=Object.assign({},O.data)});for(var C=0;C<d.orderedModifiers.length;C++){if(d.reset===!0){d.reset=!1,C=-1;continue}var x=d.orderedModifiers[C],E=x.fn,P=x.options,_=P===void 0?{}:P,T=x.name;typeof E=="function"&&(d=E({state:d,options:_,name:T,instance:g})||d)}}}},update:d3(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),f=!0}};if(!Rm(i,l))return g;g.setOptions(u).then(function(b){!f&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var w=b.name,y=b.options,S=y===void 0?{}:y,C=b.effect;if(typeof C=="function"){var x=C({state:d,name:w,instance:g,options:S}),E=function(){};p.push(x||E)}})}function v(){p.forEach(function(b){return b()}),p=[]}return g}}var h3=[HA,t3,IA,EA,RA,ZA,o3,MA,XA],g3=f3({defaultModifiers:h3}),m3=typeof Element<"u",v3=typeof Map=="function",b3=typeof Set=="function",y3=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function bc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,o;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!bc(e[r],t[r]))return!1;return!0}var s;if(v3&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;for(s=e.entries();!(r=s.next()).done;)if(!bc(r.value[1],t.get(r.value[0])))return!1;return!0}if(b3&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(y3&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;if(m3&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!bc(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var w3=function(t,n){try{return bc(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const S3=Ju(w3);var C3=[],Si=function(t,n,r){r===void 0&&(r={});var o=nt.useRef(null),s={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||C3},a=nt.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],l=a[1],u=nt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,v=Object.keys(m.elements);JS.flushSync(function(){l({styles:km(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:km(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=nt.useMemo(function(){var f={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return S3(o.current,f)?o.current||f:(o.current=f,f)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),p=nt.useRef();return Im(function(){p.current&&p.current.setOptions(d)},[d]),Im(function(){if(!(t==null||n==null)){var f=r.createPopper||g3,g=f(t,n,d);return p.current=g,function(){g.destroy(),p.current=null}}},[t,n,r.createPopper]),{state:p.current?p.current.state:null,styles:i.styles,attributes:i.attributes,update:p.current?p.current.update:null,forceUpdate:p.current?p.current.forceUpdate:null}};const Qn=qt(function({children:t,title:n,onClose:r,icon:o,skipOverflow:s,shadow:a=!0,padding:i=!0,border:l=!0,round:u=!0,className:d,classNameBody:p,size:f="m",titleClass:g=X("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},w){const y=no(o)?o:{};return c.jsxs("div",{...b,ref:w,style:m,className:X(["gs-utl-card",d,v||Md.bg,te.b,u&&te.rnd,l?U.br:te.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&f==="l"&&"gs-utl-p-5",i&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(k,{className:X("gs-utl-card-title",g),items:"center",children:[c.jsx(F,{className:X("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(F,{onClick:r,className:X("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(re,{icon:(ct(o)?o:"")||K.close,size:"18px",...y})})]}),c.jsx("div",{className:X("gs-utl-card-body",p),children:t})]})});var yc,x3=new Uint8Array(16);function E3(){if(!yc&&(yc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!yc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yc(x3)}const P3=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function T3(e){return typeof e=="string"&&P3.test(e)}for(var Zt=[],Np=0;Np<256;++Np)Zt.push((Np+256).toString(16).substr(1));function O3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Zt[e[t+0]]+Zt[e[t+1]]+Zt[e[t+2]]+Zt[e[t+3]]+"-"+Zt[e[t+4]]+Zt[e[t+5]]+"-"+Zt[e[t+6]]+Zt[e[t+7]]+"-"+Zt[e[t+8]]+Zt[e[t+9]]+"-"+Zt[e[t+10]]+Zt[e[t+11]]+Zt[e[t+12]]+Zt[e[t+13]]+Zt[e[t+14]]+Zt[e[t+15]]).toLowerCase();if(!T3(n))throw TypeError("Stringified UUID is invalid");return n}function ev(e,t,n){e=e||{};var r=e.random||(e.rng||E3)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,O3(r)}class _3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Ci=async(e,{onError:t,onLoading:n,onResult:r,params:o,rawText:s,...a})=>{try{n==null||n(!0);const i=o?new URLSearchParams(o).toString():"",l=i?`?${i}`:"",u=await fetch(`${e}${l}`,a);if(!u.ok){const p=await u.json();throw new _3(p.error||"Request failed!",p.errorData)}let d;if(s)d=await u.text();else try{d=await u.json()}catch{d=void 0}return r==null||r(d),d}catch(i){const l=i instanceof Error?i:new Error(i);if(t==null||t(l),a.throwError)throw l;return l}finally{n==null||n(!1)}};class jr{static async get(t,n){return Ci(t,{...n,method:"GET"})}static async post(t,n){return Ci(t,{...n,method:"POST"})}static async put(t,n){return Ci(t,{...n,method:"PUT"})}static async patch(t,n){return Ci(t,{...n,method:"PATCH"})}static async delete(t,n){return Ci(t,{...n,method:"DELETE"})}}var wc=(e=>(e.Projects="projects",e.Settings="settings",e))(wc||{}),tv=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(tv||{});const nv={},A3=1,L3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?A3:1,s=nv[r];if(s)t(s);else{if(!Un())return n(new Error("window context not found"));const a=window.indexedDB.open(r,o);a.onerror=n,a.onsuccess=()=>{const i=a.result;i.onerror=n,nv[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),$p=async(e,t)=>(await L3(t)).transaction([e],"readwrite").objectStore(e),M3=async(e,t)=>{const n=await $p(e,t);return new Promise((r,o)=>{const s=[],a=n.openCursor();a.onerror=o,a.onsuccess=function(i){const u=i.target.result;if(u){const d=u.primaryKey,p=u.value;s.push({key:d,data:p}),u.continue()}else r(s)}})},N3=async(e,t,n)=>{const r=await $p(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},$3=async(e,t,n)=>{const r=await $p(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var xi=(e=>(e.Existing="existing",e.Templates="templates",e))(xi||{});const k3=e=>{const t=w4();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},I3=(e,t)=>jr.get(k3(e),{...t}),V3=async e=>{try{const t=await I3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},rv=async(e=xt.web)=>typeof window>"u"?[]:(await M3(wc.Projects)).map(({key:r,data:o})=>{var s;return{id:`${r}`,name:`${((s=o.custom)==null?void 0:s.projectName)||r}`,data:o}}).filter(r=>{var o;return((o=r.data.custom)==null?void 0:o.projectType)===e}),ov=new Set,$n=new WeakMap,ma=new WeakMap,Ls=new WeakMap,kp=new WeakMap,H3=new WeakMap,va=new WeakMap,Sc=new WeakMap;let jo;const Ms="__aa_tgt",Ip="__aa_del",j3=e=>{const t=U3(e);t&&t.forEach(n=>W3(n))},D3=e=>{e.forEach(t=>{t.target===jo&&B3(),$n.has(t.target)&&Ns(t.target)})};function F3(e){const t=kp.get(e);t==null||t.disconnect();let n=$n.get(e),r=0;const o=5;n||(n=ya(e),$n.set(e,n));const{offsetWidth:s,offsetHeight:a}=jo,l=[n.top-o,s-(n.left+o+n.width),a-(n.top+o+n.height),n.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++r>1&&Ns(e)},{root:jo,threshold:1,rootMargin:l});u.observe(e),kp.set(e,u)}function Ns(e){clearTimeout(Sc.get(e));const t=Cc(e),n=typeof t=="function"?500:t.duration;Sc.set(e,setTimeout(()=>{const r=Ls.get(e);(!r||r.finished)&&($n.set(e,ya(e)),F3(e))},n))}function B3(){clearTimeout(Sc.get(jo)),Sc.set(jo,setTimeout(()=>{ov.forEach(e=>iv(e,t=>sv(()=>Ns(t))))},100))}function z3(e){setTimeout(()=>{H3.set(e,setInterval(()=>sv(Ns.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function sv(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Vp,ba;typeof window<"u"&&(jo=document.documentElement,Vp=new MutationObserver(j3),ba=new ResizeObserver(D3),ba.observe(jo));function U3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Hp(n.target),!t.has(n.target)){t.add(n.target);for(let r=0;r<n.target.children.length;r++){const o=n.target.children.item(r);if(o){if(Ip in o)return!1;Hp(n.target,o),t.add(o)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const o=n.removedNodes[r];if(Ip in o)return!1;o instanceof Element&&(t.add(o),Hp(n.target,o),ma.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Hp(e,t){!t&&!(Ms in e)?Object.defineProperty(e,Ms,{value:e}):t&&!(Ms in t)&&Object.defineProperty(t,Ms,{value:e})}function W3(e){var t;const n=jo.contains(e),r=$n.has(e);n&&ma.has(e)&&ma.delete(e),Ls.has(e)&&((t=Ls.get(e))===null||t===void 0||t.cancel()),r&&n?G3(e):r&&!n?K3(e):q3(e)}function Dr(e){return Number(e.replace(/[^0-9.\-]/g,""))}function ya(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function av(e,t,n){let r=t.width,o=t.height,s=n.width,a=n.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const u=Dr(i.paddingTop)+Dr(i.paddingBottom)+Dr(i.borderTopWidth)+Dr(i.borderBottomWidth),d=Dr(i.paddingLeft)+Dr(i.paddingRight)+Dr(i.borderRightWidth)+Dr(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function Cc(e){return Ms in e&&va.has(e[Ms])?va.get(e[Ms]):{duration:250,easing:"ease-in-out"}}function iv(e,...t){t.forEach(n=>n(e,va.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,va.has(r)))}}function G3(e){const t=$n.get(e),n=ya(e);let r;if(!t)return;const o=Cc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=av(e,t,n),p={transform:`translate(${s}px, ${a}px)`},f={transform:"translate(0, 0)"};i!==l&&(p.width=`${i}px`,f.width=`${l}px`),u!==d&&(p.height=`${u}px`,f.height=`${d}px`),r=e.animate([p,f],o)}else r=new Animation(o(e,"remain",t,n)),r.play();Ls.set(e,r),$n.set(e,n),r.addEventListener("finish",Ns.bind(null,e))}function q3(e){const t=ya(e);$n.set(e,t);const n=Cc(e);let r;typeof n!="function"?r=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(r=new Animation(n(e,"add",t)),r.play()),Ls.set(e,r),r.addEventListener("finish",Ns.bind(null,e))}function K3(e){if(!ma.has(e)||!$n.has(e))return;const[t,n]=ma.get(e);Object.defineProperty(e,Ip,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[r,o,s,a]=Z3(e),i=Cc(e),l=$n.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${r}px`,left:`${o}px`,width:`${s}px`,height:`${a}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof i!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:i.duration,easing:"ease-out"}):(u=new Animation(i(e,"remove",l)),u.play()),Ls.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),$n.delete(e),ma.delete(e),Ls.delete(e),(d=kp.get(e))===null||d===void 0||d.disconnect()})}function Z3(e){const t=$n.get(e),[n,,r]=av(e,t,ya(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=$n.get(o)||ya(o),i=Math.round(t.top-a.top)-Dr(s.borderTopWidth),l=Math.round(t.left-a.left)-Dr(s.borderLeftWidth);return[i,l,n,r]}function Y3(e,t={}){Vp&&ba&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),iv(e,Ns,z3,n=>ba==null?void 0:ba.observe(n)),typeof t=="function"?va.set(e,t):va.set(e,{duration:250,easing:"ease-in-out",...t}),Vp.observe(e,{childList:!0}),ov.add(e))}function X3(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&Y3(t.current,e)},[t]),t}const J3={[sn.Info]:U.bgA,[sn.Error]:"bg-red-500",[sn.Success]:"bg-green-500",[sn.Warning]:"bg-orange-400"},Q3=qt(function(t,n){const r={[sn.Info]:K.informationVariant,[sn.Error]:K.fire,[sn.Success]:K.checkBold,[sn.Warning]:K.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=sn.Info,autoHideTimeout:d=3e3}=t,p=h.useRef(null),f=h.useRef(),g=r[u],m=J3[u];h.useImperativeHandle(n,()=>p.current,[]);const v=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},b=()=>{d&&(f.current=setTimeout(v,d))},w=()=>f.current&&clearTimeout(f.current);h.useEffect(()=>(b(),w),[]);const y=a||o;return c.jsx(Qn,{className:ae(s,"overflow-hidden relative"),ref:p,onPointerEnter:w,onPointerLeave:b,children:c.jsxs(k,{space:"m",items:"center",className:ae(Te.y),children:[c.jsx(F,{className:ae(m,te.pill,"text-white gjs-p-1"),children:c.jsx(re,{icon:g,size:se.s})}),c.jsx(F,{grow:!0,className:ae("gjs-pr-3"),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(F,{className:ae("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(F,{className:ae(U.txtLowEmphasis),children:y}),!!l.length&&c.jsx(k,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(Ke,{...C},S))})]})}),c.jsx(F,{className:ae("absolute top-1 right-1"),children:c.jsx(Ct,{onClick:v,border:!1,children:c.jsx(re,{icon:K.close,size:se.s})})})]})})});ce(qt(function({className:t,toasts:n,onDismiss:r,...o},s){const a=X3({});return c.jsx("div",{className:ae(t,"w-80 gs-utl-z-30"),...o,ref:a,children:n.map(i=>c.jsx(Q3,{...i,className:ae("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var jp=(e=>(e.self="self",e.cloud="cloud",e))(jp||{}),$s=(e=>(e.image="image",e.video="video",e))($s||{}),Sr=(e=>(e.componentOutline="componentOutline",e.preview="preview",e.fullscreen="fullscreen",e.showCode="showCode",e.showImportCode="showImportCode",e.clearCanvas="clearCanvas",e.store="store",e.undo="undo",e.redo="redo",e))(Sr||{}),Dp=(e=>(e.canvas="canvas",e.layers="layers",e))(Dp||{}),Do=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Do||{}),Bt=(e=>(e.variable="data-variable",e.condition="data-condition",e.conditionTrue="data-condition-true-content",e.conditionFalse="data-condition-false-content",e.collection="data-collection",e.collectionItem="data-collection-item",e))(Bt||{}),Fp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(Fp||{});const Ei=e=>e.replaceAll('"',"").replaceAll("'",""),ks=e=>e.includes(",")?e:/\s/.test(e)?`'${Ei(e)}'`:Ei(e),lv=(e,t,n)=>({family:e,variant:t,...n}),Pi=(e,t)=>{e=ks(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:Ei(e),menuVariant:n&&lv(ks(`menuFont-${Ei(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:lv(e,o,s)})))}},Bp=(e,t)=>{var i;const n=Pi(e.family,e),r=n.menuVariant??((i=Object.values(n.variants))==null?void 0:i[0]);if(!r)return"Arial, Helvetica, sans-serif";const{source:o,descriptors:s}=r,a=Ei(r.family);if(!t){const l=new FontFace(a,`url("${o}")`,s),u=Array.from(document.fonts.values()).filter(d=>d.family===a);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return ks(a)},Fr=", sans-serif",cv=["Arial, Helvetica"+Fr,"Arial Black, Gadget"+Fr,"Brush Script MT"+Fr,"Comic Sans MS, cursive"+Fr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Fr,"Impact, Charcoal"+Fr,"Lucida Sans Unicode, Lucida Grande"+Fr,"Tahoma, Geneva"+Fr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Fr,"Verdana, Geneva"+Fr].map(e=>({id:e,label:e.split(",")[0]})),R3=String.raw,mo=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},e4=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:p}=n??{},f=[mo`font-ascent-override: ${o};`,mo`font-display: ${r};`,mo`font-descent-override: ${s};`,mo`font-feature-settings: ${a};`,mo`font-line-gap-override: ${i};`,mo`font-stretch: ${l};`,mo`font-style: ${u};`,mo`font-unicode-range: ${d};`,mo`font-weight: ${p};`].filter(Boolean);return R3`
24
+ `));let f=d.props,h=typeof(f==null?void 0:f.className)=="function"?(...b)=>cc(f==null?void 0:f.className(...b),l.className):cc(f==null?void 0:f.className,l.className),m=h?{className:h}:{};return g.cloneElement(d,Object.assign({},gm(d.props,ua(Yd(l,["ref"]))),p,u,{ref:o(d.ref,u.ref)},m))}return g.createElement(s,Object.assign({},Yd(l,["ref"]),s!==g.Fragment&&u,s!==g.Fragment&&p),d)}function Zd(){let e=g.useRef([]),t=g.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function b5(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function gm(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...s){let a=n[r];for(let i of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;i(o,...s)}}});return t}function Ge(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ua(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Yd(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let v5="div";var wr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(wr||{});function y5(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return We({ourProps:s,theirProps:o,slot:{},defaultTag:v5,name:"Hidden"})}let Sr=Ge(y5),Xd=g.createContext(null);Xd.displayName="OpenClosedContext";var ft=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ft||{});function Ts(){return g.useContext(Xd)}function ui({value:e,children:t}){return g.createElement(Xd.Provider,{value:e},t)}function w5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Os=[];w5(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Os[0]!==t.target&&(Os.unshift(t.target),Os=Os.filter(n=>n!=null&&n.isConnected),Os.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function jo(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&S5(n)?!1:r}function S5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function C5(e){throw new Error("Unexpected object: "+e)}var nt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(nt||{});function Jd(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:C5(e)}}function dc(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))mm(n,hm(t,r),o);return n}function hm(e,t){return e?e+"["+t+"]":t}function mm(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())mm(e,hm(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):dc(n,t,e)}function bm(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}var ye=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ye||{}),x5={NODE_ENV:"production"},E5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(E5||{}),P5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(P5||{}),T5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(T5||{}),O5=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(O5||{});function Qd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,i)=>a.dataRef.current.order-i.dataRef.current.order):ho(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let _5={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,s,a;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===nt.Specific?t.idx:Jd(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var f,h;return(h=(f=e.activeOptionIndex)!=null?f:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?h:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),p=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let i=Qd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===nt.Specific?t.idx:Jd(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...i,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let s=t.payload,a=Qd(e,l=>(l.push(s),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(s));let i={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Qd(e,o=>{let s=o.findIndex(a=>a.id===t.id);return s!==-1&&o.splice(s,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},Rd=g.createContext(null);Rd.displayName="ComboboxActionsContext";function di(e){let t=g.useContext(Rd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,di),n}return t}let vm=g.createContext(null);function A5(e){var t;let n=_s("VirtualProvider"),[r,o]=g.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),s=a5({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[a,i]=g.useState(0);return Qe(()=>{i(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),g.createElement(vm.Provider,{value:s},g.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&x5.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&s.scrollToIndex(n.activeOptionIndex)}}},s.getVirtualItems().map(l=>{var u;return g.createElement(g.Fragment,{key:l.key},g.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${a}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let ep=g.createContext(null);ep.displayName="ComboboxDataContext";function _s(e){let t=g.useContext(ep);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_s),n}return t}function M5(e,t){return Ie(t.type,_5,e,t)}let L5=g.Fragment;function N5(e,t){let{value:n,defaultValue:r,onChange:o,form:s,name:a,by:i=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:p=!1,immediate:f=!1,virtual:h=null,...m}=e,b=!1,v=null,[w=p?[]:void 0,y]=oc(n,o,r),[S,C]=g.useReducer(M5,{dataRef:g.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),E=g.useRef(!1),x=g.useRef({static:!1,hold:!1}),P=g.useRef(null),_=g.useRef(null),T=g.useRef(null),O=g.useRef(null),M=oe(typeof i=="string"?(R,ae)=>{let le=i;return(R==null?void 0:R[le])===(ae==null?void 0:ae[le])}:i??((R,ae)=>R===ae)),A=oe(R=>S.options.findIndex(ae=>M(ae.dataRef.current.value,R))),$=g.useCallback(R=>Ie(L.mode,{1:()=>w.some(ae=>M(ae,R)),0:()=>M(w,R)}),[w]),j=oe(R=>S.activeOptionIndex===A(R)),L=g.useMemo(()=>({...S,immediate:b,optionsPropsRef:x,labelRef:P,inputRef:_,buttonRef:T,optionsRef:O,value:w,defaultValue:r,disabled:l,mode:p?1:0,virtual:S.virtual,get activeOptionIndex(){if(E.current&&S.activeOptionIndex===null&&S.options.length>0){let R=S.options.findIndex(ae=>!ae.dataRef.current.disabled);if(R!==-1)return R}return S.activeOptionIndex},calculateIndex:A,compare:M,isSelected:$,isActive:j,nullable:d,__demoMode:u}),[w,r,l,p,d,u,S,v]);Qe(()=>{},[v,void 0]),Qe(()=>{S.dataRef.current=L},[L]),qd([L.buttonRef,L.inputRef,L.optionsRef],()=>X.closeCombobox(),L.comboboxState===0);let H=g.useMemo(()=>{var R,ae,le;return{open:L.comboboxState===0,disabled:l,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(R=L.activeOptionIndex)!=null?R:0]:(le=(ae=L.options[L.activeOptionIndex])==null?void 0:ae.dataRef.current.value)!=null?le:null,value:w}},[L,l,w]),W=oe(()=>{if(L.activeOptionIndex!==null){if(L.virtual)z(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:R}=L.options[L.activeOptionIndex];z(R.current.value)}X.goToOption(nt.Specific,L.activeOptionIndex)}}),B=oe(()=>{C({type:0}),E.current=!0}),G=oe(()=>{C({type:1}),E.current=!1}),D=oe((R,ae,le)=>(E.current=!1,R===nt.Specific?C({type:2,focus:nt.Specific,idx:ae,trigger:le}):C({type:2,focus:R,trigger:le}))),V=oe((R,ae)=>(C({type:3,payload:{id:R,dataRef:ae}}),()=>{L.isActive(ae.current.value)&&(E.current=!0),C({type:4,id:R})})),k=oe(R=>(C({type:5,id:R}),()=>C({type:5,id:null}))),z=oe(R=>Ie(L.mode,{0(){return y==null?void 0:y(R)},1(){let ae=L.value.slice(),le=ae.findIndex(me=>M(me,R));return le===-1?ae.push(R):ae.splice(le,1),y==null?void 0:y(ae)}})),Y=oe(R=>{C({type:6,trigger:R})}),X=g.useMemo(()=>({onChange:z,registerOption:V,registerLabel:k,goToOption:D,closeCombobox:G,openCombobox:B,setActivationTrigger:Y,selectActiveOption:W}),[]),ee=t===null?{}:{ref:t},J=g.useRef(null),q=yr();return g.useEffect(()=>{J.current&&r!==void 0&&q.addEventListener(J.current,"reset",()=>{y==null||y(r)})},[J,y]),g.createElement(Rd.Provider,{value:X},g.createElement(ep.Provider,{value:L},g.createElement(ui,{value:Ie(L.comboboxState,{0:ft.Open,1:ft.Closed})},a!=null&&w!=null&&dc({[a]:w}).map(([R,ae],le)=>g.createElement(Sr,{features:wr.Hidden,ref:le===0?me=>{var ve;J.current=(ve=me==null?void 0:me.closest("form"))!=null?ve:null}:void 0,...ua({key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:R,value:ae})})),We({ourProps:ee,theirProps:m,slot:H,defaultTag:L5,name:"Combobox"}))))}let $5="input";function k5(e,t){var n,r,o,s,a;let i=Pt(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:p="text",...f}=e,h=_s("Combobox.Input"),m=di("Combobox.Input"),b=Re(h.inputRef,t),v=Ps(h.inputRef),w=g.useRef(!1),y=yr(),S=oe(()=>{m.onChange(null),h.optionsRef.current&&(h.optionsRef.current.scrollTop=0),m.goToOption(nt.Nothing)}),C=function(){var L;return typeof d=="function"&&h.value!==void 0?(L=d(h.value))!=null?L:"":typeof h.value=="string"?h.value:""}();fm(([L,H],[W,B])=>{if(w.current)return;let G=h.inputRef.current;G&&((B===0&&H===1||L!==W)&&(G.value=L),requestAnimationFrame(()=>{if(w.current||!G||(v==null?void 0:v.activeElement)!==G)return;let{selectionStart:D,selectionEnd:V}=G;Math.abs((V??0)-(D??0))===0&&D===0&&G.setSelectionRange(G.value.length,G.value.length)}))},[C,h.comboboxState,v]),fm(([L],[H])=>{if(L===0&&H===1){if(w.current)return;let W=h.inputRef.current;if(!W)return;let B=W.value,{selectionStart:G,selectionEnd:D,selectionDirection:V}=W;W.value="",W.value=B,V!==null?W.setSelectionRange(G,D,V):W.setSelectionRange(G,D)}},[h.comboboxState]);let E=g.useRef(!1),x=oe(()=>{E.current=!0}),P=oe(()=>{y.nextFrame(()=>{E.current=!1})}),_=oe(L=>{switch(w.current=!0,L.key){case ye.Enter:if(w.current=!1,h.comboboxState!==0||E.current)return;if(L.preventDefault(),L.stopPropagation(),h.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),h.mode===0&&m.closeCombobox();break;case ye.ArrowDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),Ie(h.comboboxState,{0:()=>m.goToOption(nt.Next),1:()=>m.openCombobox()});case ye.ArrowUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),Ie(h.comboboxState,{0:()=>m.goToOption(nt.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{h.value||m.goToOption(nt.Last)})}});case ye.Home:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(nt.First);case ye.PageUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(nt.First);case ye.End:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(nt.Last);case ye.PageDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(nt.Last);case ye.Escape:return w.current=!1,h.comboboxState!==0?void 0:(L.preventDefault(),h.optionsRef.current&&!h.optionsPropsRef.current.static&&L.stopPropagation(),h.nullable&&h.mode===0&&h.value===null&&S(),m.closeCombobox());case ye.Tab:if(w.current=!1,h.comboboxState!==0)return;h.mode===0&&h.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),T=oe(L=>{u==null||u(L),h.nullable&&h.mode===0&&L.target.value===""&&S(),m.openCombobox()}),O=oe(L=>{var H,W,B;let G=(H=L.relatedTarget)!=null?H:Os.find(D=>D!==L.currentTarget);if(w.current=!1,!((W=h.optionsRef.current)!=null&&W.contains(G))&&!((B=h.buttonRef.current)!=null&&B.contains(G))&&h.comboboxState===0)return L.preventDefault(),h.mode===0&&(h.nullable&&h.value===null?S():h.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),M=oe(L=>{var H,W,B;let G=(H=L.relatedTarget)!=null?H:Os.find(D=>D!==L.currentTarget);(W=h.buttonRef.current)!=null&&W.contains(G)||(B=h.optionsRef.current)!=null&&B.contains(G)||h.disabled||h.immediate&&h.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),A=ci(()=>{if(h.labelId)return[h.labelId].join(" ")},[h.labelId]),$=g.useMemo(()=>({open:h.comboboxState===0,disabled:h.disabled}),[h]),j={ref:b,id:l,role:"combobox",type:p,"aria-controls":(n=h.optionsRef.current)==null?void 0:n.id,"aria-expanded":h.comboboxState===0,"aria-activedescendant":h.activeOptionIndex===null?void 0:h.virtual?(r=h.options.find(L=>{var H;return!((H=h.virtual)!=null&&H.disabled(L.dataRef.current.value))&&h.compare(L.dataRef.current.value,h.virtual.options[h.activeOptionIndex])}))==null?void 0:r.id:(o=h.options[h.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":A,"aria-autocomplete":"list",defaultValue:(a=(s=e.defaultValue)!=null?s:h.defaultValue!==void 0?d==null?void 0:d(h.defaultValue):null)!=null?a:h.defaultValue,disabled:h.disabled,onCompositionStart:x,onCompositionEnd:P,onKeyDown:_,onChange:T,onFocus:M,onBlur:O};return We({ourProps:j,theirProps:f,slot:$,defaultTag:$5,name:"Combobox.Input"})}let I5="button";function V5(e,t){var n;let r=_s("Combobox.Button"),o=di("Combobox.Button"),s=Re(r.buttonRef,t),a=Pt(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=yr(),d=oe(b=>{switch(b.key){case ye.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&o.openCombobox(),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case ye.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),u.nextFrame(()=>{r.value||o.goToOption(nt.Last)})),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case ye.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),o.closeCombobox(),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})}));default:return}}),p=oe(b=>{if(jo(b.currentTarget))return b.preventDefault();r.comboboxState===0?o.closeCombobox():(b.preventDefault(),o.openCombobox()),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})})}),f=ci(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),h=g.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),m={ref:s,id:i,type:ca(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":f,disabled:r.disabled,onClick:p,onKeyDown:d};return We({ourProps:m,theirProps:l,slot:h,defaultTag:I5,name:"Combobox.Button"})}let H5="label";function j5(e,t){let n=Pt(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=_s("Combobox.Label"),a=di("Combobox.Label"),i=Re(s.labelRef,t);Qe(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=g.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]);return We({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:H5,name:"Combobox.Label"})}let D5="ul",F5=yn.RenderStrategy|yn.Static;function B5(e,t){let n=Pt(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=_s("Combobox.Options"),i=Re(a.optionsRef,t),l=Ts(),u=l!==null?(l&ft.Open)===ft.Open:a.comboboxState===0;Qe(()=>{var h;a.optionsPropsRef.current.static=(h=e.static)!=null?h:!1},[a.optionsPropsRef,e.static]),Qe(()=>{a.optionsPropsRef.current.hold=o},[a.optionsPropsRef,o]),pm({container:a.optionsRef.current,enabled:a.comboboxState===0,accept(h){return h.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:h.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(h){h.setAttribute("role","none")}});let d=ci(()=>{var h,m;return(m=a.labelId)!=null?m:(h=a.buttonRef.current)==null?void 0:h.id},[a.labelId,a.buttonRef.current]),p=g.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),f={"aria-labelledby":d,role:"listbox","aria-multiselectable":a.mode===1?!0:void 0,id:r,ref:i};return a.virtual&&a.comboboxState===0&&Object.assign(s,{children:g.createElement(A5,null,s.children)}),We({ourProps:f,theirProps:s,slot:p,defaultTag:D5,features:F5,visible:u,name:"Combobox.Options"})}let z5="li";function U5(e,t){var n;let r=Pt(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=_s("Combobox.Option"),d=di("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,f=u.isSelected(a),h=g.useRef(null),m=Dt({disabled:s,value:a,domRef:h,order:i}),b=g.useContext(vm),v=Re(t,h,b?b.measureElement:null),w=oe(()=>d.onChange(a));Qe(()=>d.registerOption(o,m),[m,o]);let y=g.useRef(!(u.virtual||u.__demoMode));Qe(()=>{if(!u.virtual||!u.__demoMode)return;let O=Hr();return O.requestAnimationFrame(()=>{y.current=!0}),O.dispose},[u.virtual,u.__demoMode]),Qe(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let O=Hr();return O.requestAnimationFrame(()=>{var M,A;(A=(M=h.current)==null?void 0:M.scrollIntoView)==null||A.call(M,{block:"nearest"})}),O.dispose},[h,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=oe(O=>{var M;if(s||(M=u.virtual)!=null&&M.disabled(a))return O.preventDefault();w(),am()||requestAnimationFrame(()=>{var A;return(A=u.inputRef.current)==null?void 0:A.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=oe(()=>{var O;if(s||(O=u.virtual)!=null&&O.disabled(a))return d.goToOption(nt.Nothing);let M=u.calculateIndex(a);d.goToOption(nt.Specific,M)}),E=dm(),x=oe(O=>E.update(O)),P=oe(O=>{var M;if(!E.wasMoved(O)||s||(M=u.virtual)!=null&&M.disabled(a)||p)return;let A=u.calculateIndex(a);d.goToOption(nt.Specific,A,0)}),_=oe(O=>{var M;E.wasMoved(O)&&(s||(M=u.virtual)!=null&&M.disabled(a)||p&&(u.optionsPropsRef.current.hold||d.goToOption(nt.Nothing)))}),T=g.useMemo(()=>({active:p,selected:f,disabled:s}),[p,f,s]);return We({ourProps:{id:o,ref:v,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:x,onMouseEnter:x,onPointerMove:P,onMouseMove:P,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:T,defaultTag:z5,name:"Combobox.Option"})}let W5=Ge(N5),G5=Ge(V5),q5=Ge(k5),K5=Ge(j5),Z5=Ge(B5),Y5=Ge(U5),da=Object.assign(W5,{Input:q5,Button:G5,Label:K5,Options:Z5,Option:Y5});function X5(e,t,n,r){let o=Dt(n);g.useEffect(()=>{e=e??window;function s(a){o.current(a)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function pc(){let e=g.useRef(!1);return Qe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function J5(e){let t=oe(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ud(()=>{n.current&&t()})}),[t])}var mo=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(mo||{});function ym(){let e=g.useRef(0);return im("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let Q5=g.createContext(!1);function R5(){return g.useContext(Q5)}function eO(e){let t=R5(),n=g.useContext(wm),r=Ps(e),[o,s]=g.useState(()=>{if(!t&&n!==null||go.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)});return g.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),g.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),o}let tO=g.Fragment;function nO(e,t){let n=e,r=g.useRef(null),o=Re(Kd(d=>{r.current=d}),t),s=Ps(r),a=eO(r),[i]=g.useState(()=>{var d;return go.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=g.useContext(tp),u=sc();return Qe(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Qe(()=>{if(i&&l)return l.register(i)},[l,i]),J5(()=>{var d;!a||!i||(i instanceof Node&&a.contains(i)&&a.removeChild(i),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))}),u?!a||!i?null:On.createPortal(We({ourProps:{ref:o},theirProps:n,defaultTag:tO,name:"Portal"}),i):null}let rO=g.Fragment,wm=g.createContext(null);function oO(e,t){let{target:n,...r}=e,o={ref:Re(t)};return g.createElement(wm.Provider,{value:n},We({ourProps:o,theirProps:r,defaultTag:rO,name:"Popover.Group"}))}let tp=g.createContext(null);function sO(){let e=g.useContext(tp),t=g.useRef([]),n=oe(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=oe(s=>{let a=t.current.indexOf(s);a!==-1&&t.current.splice(a,1),e&&e.unregister(s)}),o=g.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,g.useMemo(()=>function({children:s}){return g.createElement(tp.Provider,{value:o},s)},[o])]}let aO=Ge(nO),iO=Ge(oO);Object.assign(aO,{Group:iO});function lO({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=g.useRef((r=n==null?void 0:n.current)!=null?r:null),s=Ps(o),a=oe(()=>{var i,l,u;let d=[];for(let p of e)p!==null&&(p instanceof HTMLElement?d.push(p):"current"in p&&p.current instanceof HTMLElement&&d.push(p.current));if(t!=null&&t.current)for(let p of t.current)d.push(p);for(let p of(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(o.current)||p.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(f=>p.contains(f))||d.push(p));return d});return{resolveContainers:a,contains:oe(i=>a().some(l=>l.contains(i))),mainTreeNodeRef:o,MainTreeNode:g.useMemo(()=>function(){return n!=null?null:g.createElement(Sr,{features:wr.Hidden,ref:o})},[o,n])}}function cO(){let e=g.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:g.useMemo(()=>function(){return g.createElement(Sr,{features:wr.Hidden,ref:e})},[e])}}let Sm=g.createContext(null);function Cm(){let e=g.useContext(Sm);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Cm),t}return e}function np(){let[e,t]=g.useState([]);return[e.length>0?e.join(" "):void 0,g.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=g.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return g.createElement(Sm.Provider,{value:o},n.children)},[t])]}let uO="p";function dO(e,t){let n=Pt(),{id:r=`headlessui-description-${n}`,...o}=e,s=Cm(),a=Re(t);Qe(()=>s.register(r),[r,s.register]);let i={ref:a,...s.props,id:r};return We({ourProps:i,theirProps:o,slot:s.slot||{},defaultTag:uO,name:s.name||"Description"})}let pO=Ge(dO),xm=Object.assign(pO,{});var Em;let fO=(Em=g.startTransition)!=null?Em:function(e){e()};var gO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(gO||{}),hO=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e))(hO||{});let mO={0:e=>({...e,disclosureState:Ie(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},rp=g.createContext(null);rp.displayName="DisclosureContext";function op(e){let t=g.useContext(rp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,op),n}return t}let sp=g.createContext(null);sp.displayName="DisclosureAPIContext";function Pm(e){let t=g.useContext(sp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Pm),n}return t}let ap=g.createContext(null);ap.displayName="DisclosurePanelContext";function bO(){return g.useContext(ap)}function vO(e,t){return Ie(t.type,mO,e,t)}let yO=g.Fragment;function wO(e,t){let{defaultOpen:n=!1,...r}=e,o=g.useRef(null),s=Re(t,Kd(v=>{o.current=v},e.as===void 0||e.as===g.Fragment)),a=g.useRef(null),i=g.useRef(null),l=g.useReducer(vO,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=l,f=oe(v=>{p({type:1});let w=Vo(o);if(!w||!d)return;let y=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:w.getElementById(d):w.getElementById(d);y==null||y.focus()}),h=g.useMemo(()=>({close:f}),[f]),m=g.useMemo(()=>({open:u===0,close:f}),[u,f]),b={ref:s};return g.createElement(rp.Provider,{value:l},g.createElement(sp.Provider,{value:h},g.createElement(ui,{value:Ie(u,{0:ft.Open,1:ft.Closed})},We({ourProps:b,theirProps:r,slot:m,defaultTag:yO,name:"Disclosure"}))))}let SO="button";function CO(e,t){let n=Pt(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=op("Disclosure.Button"),i=bO(),l=i===null?!1:i===s.panelId,u=g.useRef(null),d=Re(u,t,l?null:s.buttonRef),p=Zd();g.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let f=oe(y=>{var S;if(l){if(s.disclosureState===1)return;switch(y.key){case ye.Space:case ye.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=s.buttonRef.current)==null||S.focus();break}}else switch(y.key){case ye.Space:case ye.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),h=oe(y=>{switch(y.key){case ye.Space:y.preventDefault();break}}),m=oe(y=>{var S;jo(y.currentTarget)||e.disabled||(l?(a({type:0}),(S=s.buttonRef.current)==null||S.focus()):a({type:0}))}),b=g.useMemo(()=>({open:s.disclosureState===0}),[s]),v=ca(e,u),w=l?{ref:d,type:v,onKeyDown:f,onClick:m}:{ref:d,id:r,type:v,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:f,onKeyUp:h,onClick:m};return We({mergeRefs:p,ourProps:w,theirProps:o,slot:b,defaultTag:SO,name:"Disclosure.Button"})}let xO="div",EO=yn.RenderStrategy|yn.Static;function PO(e,t){let n=Pt(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=op("Disclosure.Panel"),{close:i}=Pm("Disclosure.Panel"),l=Zd(),u=Re(t,s.panelRef,m=>{fO(()=>a({type:m?4:5}))});g.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=Ts(),p=d!==null?(d&ft.Open)===ft.Open:s.disclosureState===0,f=g.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),h={ref:u,id:r};return g.createElement(ap.Provider,{value:s.panelId},We({mergeRefs:l,ourProps:h,theirProps:o,slot:f,defaultTag:xO,features:EO,visible:p,name:"Disclosure.Panel"}))}let TO=Ge(wO),OO=Ge(CO),_O=Ge(PO),ip=Object.assign(TO,{Button:OO,Panel:_O}),Tm=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Om(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let s=!1;for(let i of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))i.remove(),s=!0;let a=s?(n=o.innerText)!=null?n:"":r;return Tm.test(a)&&(a=a.replace(Tm,"")),a}function AO(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let a=s.getAttribute("aria-label");return typeof a=="string"?a.trim():Om(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Om(e).trim()}function MO(e){let t=g.useRef(""),n=g.useRef("");return oe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=AO(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var LO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(LO||{}),NO=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(NO||{}),$O=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))($O||{}),kO=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(kO||{});function lp(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=ho(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let IO={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=lp(e),o=Jd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(a=>{var i;return!a.dataRef.current.disabled&&((i=a.dataRef.current.textValue)==null?void 0:i.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=lp(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=lp(e,r=>{let o=r.findIndex(s=>s.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},cp=g.createContext(null);cp.displayName="ListboxActionsContext";function pi(e){let t=g.useContext(cp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pi),n}return t}let up=g.createContext(null);up.displayName="ListboxDataContext";function fi(e){let t=g.useContext(up);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fi),n}return t}function VO(e,t){return Ie(t.type,IO,e,t)}let HO=g.Fragment;function jO(e,t){let{value:n,defaultValue:r,form:o,name:s,onChange:a,by:i=(Y,X)=>Y===X,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const f=u?"horizontal":"vertical";let h=Re(t),[m=d?[]:void 0,b]=oc(n,a,r),[v,w]=g.useReducer(VO,{dataRef:g.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=g.useRef({static:!1,hold:!1}),S=g.useRef(null),C=g.useRef(null),E=g.useRef(null),x=oe(typeof i=="string"?(Y,X)=>{let ee=i;return(Y==null?void 0:Y[ee])===(X==null?void 0:X[ee])}:i),P=g.useCallback(Y=>Ie(_.mode,{1:()=>m.some(X=>x(X,Y)),0:()=>x(m,Y)}),[m]),_=g.useMemo(()=>({...v,value:m,disabled:l,mode:d?1:0,orientation:f,compare:x,isSelected:P,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:E}),[m,l,d,v]);Qe(()=>{v.dataRef.current=_},[_]),qd([_.buttonRef,_.optionsRef],(Y,X)=>{var ee;w({type:1}),Gd(X,ic.Loose)||(Y.preventDefault(),(ee=_.buttonRef.current)==null||ee.focus())},_.listboxState===0);let T=g.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),O=oe(Y=>{let X=_.options.find(ee=>ee.id===Y);X&&W(X.dataRef.current.value)}),M=oe(()=>{if(_.activeOptionIndex!==null){let{dataRef:Y,id:X}=_.options[_.activeOptionIndex];W(Y.current.value),w({type:2,focus:nt.Specific,id:X})}}),A=oe(()=>w({type:0})),$=oe(()=>w({type:1})),j=oe((Y,X,ee)=>Y===nt.Specific?w({type:2,focus:nt.Specific,id:X,trigger:ee}):w({type:2,focus:Y,trigger:ee})),L=oe((Y,X)=>(w({type:5,id:Y,dataRef:X}),()=>w({type:6,id:Y}))),H=oe(Y=>(w({type:7,id:Y}),()=>w({type:7,id:null}))),W=oe(Y=>Ie(_.mode,{0(){return b==null?void 0:b(Y)},1(){let X=_.value.slice(),ee=X.findIndex(J=>x(J,Y));return ee===-1?X.push(Y):X.splice(ee,1),b==null?void 0:b(X)}})),B=oe(Y=>w({type:3,value:Y})),G=oe(()=>w({type:4})),D=g.useMemo(()=>({onChange:W,registerOption:L,registerLabel:H,goToOption:j,closeListbox:$,openListbox:A,selectActiveOption:M,selectOption:O,search:B,clearSearch:G}),[]),V={ref:h},k=g.useRef(null),z=yr();return g.useEffect(()=>{k.current&&r!==void 0&&z.addEventListener(k.current,"reset",()=>{b==null||b(r)})},[k,b]),g.createElement(cp.Provider,{value:D},g.createElement(up.Provider,{value:_},g.createElement(ui,{value:Ie(_.listboxState,{0:ft.Open,1:ft.Closed})},s!=null&&m!=null&&dc({[s]:m}).map(([Y,X],ee)=>g.createElement(Sr,{features:wr.Hidden,ref:ee===0?J=>{var q;k.current=(q=J==null?void 0:J.closest("form"))!=null?q:null}:void 0,...ua({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Y,value:X})})),We({ourProps:V,theirProps:p,slot:T,defaultTag:HO,name:"Listbox"}))))}let DO="button";function FO(e,t){var n;let r=Pt(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=fi("Listbox.Button"),i=pi("Listbox.Button"),l=Re(a.buttonRef,t),u=yr(),d=oe(v=>{switch(v.key){case ye.Space:case ye.Enter:case ye.ArrowDown:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(nt.First)});break;case ye.ArrowUp:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(nt.Last)});break}}),p=oe(v=>{switch(v.key){case ye.Space:v.preventDefault();break}}),f=oe(v=>{if(jo(v.currentTarget))return v.preventDefault();a.listboxState===0?(i.closeListbox(),u.nextFrame(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(v.preventDefault(),i.openListbox())}),h=ci(()=>{if(a.labelId)return[a.labelId,o].join(" ")},[a.labelId,o]),m=g.useMemo(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]),b={ref:l,id:o,type:ca(e,a.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=a.optionsRef.current)==null?void 0:n.id,"aria-expanded":a.listboxState===0,"aria-labelledby":h,disabled:a.disabled,onKeyDown:d,onKeyUp:p,onClick:f};return We({ourProps:b,theirProps:s,slot:m,defaultTag:DO,name:"Listbox.Button"})}let BO="label";function zO(e,t){let n=Pt(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=fi("Listbox.Label"),a=pi("Listbox.Label"),i=Re(s.labelRef,t);Qe(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=g.useMemo(()=>({open:s.listboxState===0,disabled:s.disabled}),[s]);return We({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:BO,name:"Listbox.Label"})}let UO="ul",WO=yn.RenderStrategy|yn.Static;function GO(e,t){var n;let r=Pt(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=fi("Listbox.Options"),i=pi("Listbox.Options"),l=Re(a.optionsRef,t),u=yr(),d=yr(),p=Ts(),f=p!==null?(p&ft.Open)===ft.Open:a.listboxState===0;g.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=Vo(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let h=oe(w=>{switch(d.dispose(),w.key){case ye.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case ye.Enter:if(w.preventDefault(),w.stopPropagation(),a.activeOptionIndex!==null){let{dataRef:y}=a.options[a.activeOptionIndex];i.onChange(y.current.value)}a.mode===0&&(i.closeListbox(),Hr().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Ie(a.orientation,{vertical:ye.ArrowDown,horizontal:ye.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(nt.Next);case Ie(a.orientation,{vertical:ye.ArrowUp,horizontal:ye.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(nt.Previous);case ye.Home:case ye.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(nt.First);case ye.End:case ye.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(nt.Last);case ye.Escape:return w.preventDefault(),w.stopPropagation(),i.closeListbox(),u.nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case ye.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=ci(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),b=g.useMemo(()=>({open:a.listboxState===0}),[a]),v={"aria-activedescendant":a.activeOptionIndex===null||(n=a.options[a.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":a.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":a.orientation,id:o,onKeyDown:h,role:"listbox",tabIndex:0,ref:l};return We({ourProps:v,theirProps:s,slot:b,defaultTag:UO,features:WO,visible:f,name:"Listbox.Options"})}let qO="li";function KO(e,t){let n=Pt(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=fi("Listbox.Option"),l=pi("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),p=g.useRef(null),f=MO(p),h=Dt({disabled:o,value:s,domRef:p,get textValue(){return f()}}),m=Re(t,p);Qe(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let x=Hr();return x.requestAnimationFrame(()=>{var P,_;(_=(P=p.current)==null?void 0:P.scrollIntoView)==null||_.call(P,{block:"nearest"})}),x.dispose},[p,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Qe(()=>l.registerOption(r,h),[h,r]);let b=oe(x=>{if(o)return x.preventDefault();l.onChange(s),i.mode===0&&(l.closeListbox(),Hr().nextFrame(()=>{var P;return(P=i.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})}))}),v=oe(()=>{if(o)return l.goToOption(nt.Nothing);l.goToOption(nt.Specific,r)}),w=dm(),y=oe(x=>w.update(x)),S=oe(x=>{w.wasMoved(x)&&(o||u||l.goToOption(nt.Specific,r,0))}),C=oe(x=>{w.wasMoved(x)&&(o||u&&l.goToOption(nt.Nothing))}),E=g.useMemo(()=>({active:u,selected:d,disabled:o}),[u,d,o]);return We({ourProps:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:b,onFocus:v,onPointerEnter:y,onMouseEnter:y,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:a,slot:E,defaultTag:qO,name:"Listbox.Option"})}let ZO=Ge(jO),YO=Ge(FO),XO=Ge(zO),JO=Ge(GO),QO=Ge(KO),gi=Object.assign(ZO,{Button:YO,Label:XO,Options:JO,Option:QO});var RO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(RO||{}),e_=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(e_||{});let t_={0:e=>{let t={...e,popoverState:Ie(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState:1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},dp=g.createContext(null);dp.displayName="PopoverContext";function fc(e){let t=g.useContext(dp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fc),n}return t}let pp=g.createContext(null);pp.displayName="PopoverAPIContext";function fp(e){let t=g.useContext(pp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fp),n}return t}let gp=g.createContext(null);gp.displayName="PopoverGroupContext";function _m(){return g.useContext(gp)}let gc=g.createContext(null);gc.displayName="PopoverPanelContext";function n_(){return g.useContext(gc)}function r_(e,t){return Ie(t.type,t_,e,t)}let o_="div";function s_(e,t){var n;let{__demoMode:r=!1,...o}=e,s=g.useRef(null),a=Re(t,Kd(H=>{s.current=H})),i=g.useRef([]),l=g.useReducer(r_,{__demoMode:r,popoverState:r?0:1,buttons:i,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:g.createRef(),afterPanelSentinel:g.createRef()}),[{popoverState:u,button:d,buttonId:p,panel:f,panelId:h,beforePanelSentinel:m,afterPanelSentinel:b},v]=l,w=Ps((n=s.current)!=null?n:d),y=g.useMemo(()=>{if(!d||!f)return!1;for(let k of document.querySelectorAll("body > *"))if(Number(k==null?void 0:k.contains(d))^Number(k==null?void 0:k.contains(f)))return!0;let H=ac(),W=H.indexOf(d),B=(W+H.length-1)%H.length,G=(W+1)%H.length,D=H[B],V=H[G];return!f.contains(D)&&!f.contains(V)},[d,f]),S=Dt(p),C=Dt(h),E=g.useMemo(()=>({buttonId:S,panelId:C,close:()=>v({type:1})}),[S,C,v]),x=_m(),P=x==null?void 0:x.registerPopover,_=oe(()=>{var H;return(H=x==null?void 0:x.isFocusWithinPopoverGroup())!=null?H:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(f==null?void 0:f.contains(w.activeElement)))});g.useEffect(()=>P==null?void 0:P(E),[P,E]);let[T,O]=sO(),M=lO({mainTreeNodeRef:x==null?void 0:x.mainTreeNodeRef,portals:T,defaultContainers:[d,f]});X5(w==null?void 0:w.defaultView,"focus",H=>{var W,B,G,D;H.target!==window&&H.target instanceof HTMLElement&&u===0&&(_()||d&&f&&(M.contains(H.target)||(B=(W=m.current)==null?void 0:W.contains)!=null&&B.call(W,H.target)||(D=(G=b.current)==null?void 0:G.contains)!=null&&D.call(G,H.target)||v({type:1})))},!0),qd(M.resolveContainers,(H,W)=>{v({type:1}),Gd(W,ic.Loose)||(H.preventDefault(),d==null||d.focus())},u===0);let A=oe(H=>{v({type:1});let W=H?H instanceof HTMLElement?H:"current"in H&&H.current instanceof HTMLElement?H.current:d:d;W==null||W.focus()}),$=g.useMemo(()=>({close:A,isPortalled:y}),[A,y]),j=g.useMemo(()=>({open:u===0,close:A}),[u,A]),L={ref:a};return g.createElement(gc.Provider,{value:null},g.createElement(dp.Provider,{value:l},g.createElement(pp.Provider,{value:$},g.createElement(ui,{value:Ie(u,{0:ft.Open,1:ft.Closed})},g.createElement(O,null,We({ourProps:L,theirProps:o,slot:j,defaultTag:o_,name:"Popover"}),g.createElement(M.MainTreeNode,null))))))}let a_="button";function i_(e,t){let n=Pt(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=fc("Popover.Button"),{isPortalled:i}=fp("Popover.Button"),l=g.useRef(null),u=`headlessui-focus-sentinel-${Pt()}`,d=_m(),p=d==null?void 0:d.closeOthers,f=n_()!==null;g.useEffect(()=>{if(!f)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[f,r,a]);let[h]=g.useState(()=>Symbol()),m=Re(l,t,f?null:M=>{if(M)s.buttons.current.push(h);else{let A=s.buttons.current.indexOf(h);A!==-1&&s.buttons.current.splice(A,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),M&&a({type:2,button:M})}),b=Re(l,t),v=Ps(l),w=oe(M=>{var A,$,j;if(f){if(s.popoverState===1)return;switch(M.key){case ye.Space:case ye.Enter:M.preventDefault(),($=(A=M.target).click)==null||$.call(A),a({type:1}),(j=s.button)==null||j.focus();break}}else switch(M.key){case ye.Space:case ye.Enter:M.preventDefault(),M.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0});break;case ye.Escape:if(s.popoverState!==0)return p==null?void 0:p(s.buttonId);if(!l.current||v!=null&&v.activeElement&&!l.current.contains(v.activeElement))return;M.preventDefault(),M.stopPropagation(),a({type:1});break}}),y=oe(M=>{f||M.key===ye.Space&&M.preventDefault()}),S=oe(M=>{var A,$;jo(M.currentTarget)||e.disabled||(f?(a({type:1}),(A=s.button)==null||A.focus()):(M.preventDefault(),M.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0}),($=s.button)==null||$.focus()))}),C=oe(M=>{M.preventDefault(),M.stopPropagation()}),E=s.popoverState===0,x=g.useMemo(()=>({open:E}),[E]),P=ca(e,l),_=f?{ref:b,type:P,onKeyDown:w,onClick:S}:{ref:m,id:s.buttonId,type:P,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},T=ym(),O=oe(()=>{let M=s.panel;if(!M)return;function A(){Ie(T.current,{[mo.Forwards]:()=>ln(M,At.First),[mo.Backwards]:()=>ln(M,At.Last)})===jr.Error&&ln(ac().filter($=>$.dataset.headlessuiFocusGuard!=="true"),Ie(T.current,{[mo.Forwards]:At.Next,[mo.Backwards]:At.Previous}),{relativeTo:s.button})}A()});return g.createElement(g.Fragment,null,We({ourProps:_,theirProps:o,slot:x,defaultTag:a_,name:"Popover.Button"}),E&&!f&&i&&g.createElement(Sr,{id:u,features:wr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:O}))}let l_="div",c_=yn.RenderStrategy|yn.Static;function u_(e,t){let n=Pt(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=fc("Popover.Overlay"),i=Re(t),l=Ts(),u=l!==null?(l&ft.Open)===ft.Open:s===0,d=oe(f=>{if(jo(f.currentTarget))return f.preventDefault();a({type:1})}),p=g.useMemo(()=>({open:s===0}),[s]);return We({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:p,defaultTag:l_,features:c_,visible:u,name:"Popover.Overlay"})}let d_="div",p_=yn.RenderStrategy|yn.Static;function f_(e,t){let n=Pt(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=fc("Popover.Panel"),{close:l,isPortalled:u}=fp("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Pt()}`,p=`headlessui-focus-sentinel-after-${Pt()}`,f=g.useRef(null),h=Re(f,t,_=>{i({type:4,panel:_})}),m=Ps(f),b=Zd();Qe(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let v=Ts(),w=v!==null?(v&ft.Open)===ft.Open:a.popoverState===0,y=oe(_=>{var T;switch(_.key){case ye.Escape:if(a.popoverState!==0||!f.current||m!=null&&m.activeElement&&!f.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1}),(T=a.button)==null||T.focus();break}});g.useEffect(()=>{var _;e.static||a.popoverState===1&&((_=e.unmount)==null||_)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),g.useEffect(()=>{if(a.__demoMode||!o||a.popoverState!==0||!f.current)return;let _=m==null?void 0:m.activeElement;f.current.contains(_)||ln(f.current,At.First)},[a.__demoMode,o,f,a.popoverState]);let S=g.useMemo(()=>({open:a.popoverState===0,close:l}),[a,l]),C={ref:h,id:r,onKeyDown:y,onBlur:o&&a.popoverState===0?_=>{var T,O,M,A,$;let j=_.relatedTarget;j&&f.current&&((T=f.current)!=null&&T.contains(j)||(i({type:1}),((M=(O=a.beforePanelSentinel.current)==null?void 0:O.contains)!=null&&M.call(O,j)||($=(A=a.afterPanelSentinel.current)==null?void 0:A.contains)!=null&&$.call(A,j))&&j.focus({preventScroll:!0})))}:void 0,tabIndex:-1},E=ym(),x=oe(()=>{let _=f.current;if(!_)return;function T(){Ie(E.current,{[mo.Forwards]:()=>{var O;ln(_,At.First)===jr.Error&&((O=a.afterPanelSentinel.current)==null||O.focus())},[mo.Backwards]:()=>{var O;(O=a.button)==null||O.focus({preventScroll:!0})}})}T()}),P=oe(()=>{let _=f.current;if(!_)return;function T(){Ie(E.current,{[mo.Forwards]:()=>{var O;if(!a.button)return;let M=ac(),A=M.indexOf(a.button),$=M.slice(0,A+1),j=[...M.slice(A+1),...$];for(let L of j.slice())if(L.dataset.headlessuiFocusGuard==="true"||(O=a.panel)!=null&&O.contains(L)){let H=j.indexOf(L);H!==-1&&j.splice(H,1)}ln(j,At.First,{sorted:!1})},[mo.Backwards]:()=>{var O;ln(_,At.Previous)===jr.Error&&((O=a.button)==null||O.focus())}})}T()});return g.createElement(gc.Provider,{value:r},w&&u&&g.createElement(Sr,{id:d,ref:a.beforePanelSentinel,features:wr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:x}),We({mergeRefs:b,ourProps:C,theirProps:s,slot:S,defaultTag:d_,features:p_,visible:w,name:"Popover.Panel"}),w&&u&&g.createElement(Sr,{id:p,ref:a.afterPanelSentinel,features:wr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let g_="div";function h_(e,t){let n=g.useRef(null),r=Re(n,t),[o,s]=g.useState([]),a=cO(),i=oe(b=>{s(v=>{let w=v.indexOf(b);if(w!==-1){let y=v.slice();return y.splice(w,1),y}return v})}),l=oe(b=>(s(v=>[...v,b]),()=>i(b))),u=oe(()=>{var b;let v=Vo(n);if(!v)return!1;let w=v.activeElement;return(b=n.current)!=null&&b.contains(w)?!0:o.some(y=>{var S,C;return((S=v.getElementById(y.buttonId.current))==null?void 0:S.contains(w))||((C=v.getElementById(y.panelId.current))==null?void 0:C.contains(w))})}),d=oe(b=>{for(let v of o)v.buttonId.current!==b&&v.close()}),p=g.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),f=g.useMemo(()=>({}),[]),h=e,m={ref:r};return g.createElement(gp.Provider,{value:p},We({ourProps:m,theirProps:h,slot:f,defaultTag:g_,name:"Popover.Group"}),g.createElement(a.MainTreeNode,null))}let m_=Ge(s_),b_=Ge(i_),v_=Ge(u_),y_=Ge(f_),w_=Ge(h_),hp=Object.assign(m_,{Button:b_,Overlay:v_,Panel:y_,Group:w_}),Am=g.createContext(null);function Mm(){let e=g.useContext(Am);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Mm),t}return e}function mp(){let[e,t]=g.useState([]);return[e.length>0?e.join(" "):void 0,g.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=g.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return g.createElement(Am.Provider,{value:o},n.children)},[t])]}let S_="label";function C_(e,t){let n=Pt(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=Mm(),i=Re(t);Qe(()=>a.register(r),[r,a.register]);let l={ref:i,...a.props,id:r};return o&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in s&&delete s.onClick),We({ourProps:l,theirProps:s,slot:a.slot||{},defaultTag:S_,name:a.name||"Label"})}let x_=Ge(C_),Lm=Object.assign(x_,{});function Nm(e=0){let[t,n]=g.useState(e),r=pc(),o=g.useCallback(l=>{r.current&&n(u=>u|l)},[t,r]),s=g.useCallback(l=>!!(t&l),[t]),a=g.useCallback(l=>{r.current&&n(u=>u&~l)},[n,r]),i=g.useCallback(l=>{r.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:o,hasFlag:s,removeFlag:a,toggleFlag:i}}var E_=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(E_||{});let P_={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:ho(n,r=>r.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(o=>o.id===t.id);return r===-1?e:(n.splice(r,1),{...e,options:n})}},bp=g.createContext(null);bp.displayName="RadioGroupDataContext";function $m(e){let t=g.useContext(bp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,$m),n}return t}let vp=g.createContext(null);vp.displayName="RadioGroupActionsContext";function km(e){let t=g.useContext(vp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,km),n}return t}function T_(e,t){return Ie(t.type,P_,e,t)}let O_="div";function __(e,t){let n=Pt(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=(G,D)=>G===D,disabled:d=!1,...p}=e,f=oe(typeof u=="string"?(G,D)=>{let V=u;return(G==null?void 0:G[V])===(D==null?void 0:D[V])}:u),[h,m]=g.useReducer(T_,{options:[]}),b=h.options,[v,w]=mp(),[y,S]=np(),C=g.useRef(null),E=Re(C,t),[x,P]=oc(o,l,s),_=g.useMemo(()=>b.find(G=>!G.propsRef.current.disabled),[b]),T=g.useMemo(()=>b.some(G=>f(G.propsRef.current.value,x)),[b,x]),O=oe(G=>{var D;if(d||f(G,x))return!1;let V=(D=b.find(k=>f(k.propsRef.current.value,G)))==null?void 0:D.propsRef.current;return V!=null&&V.disabled?!1:(P==null||P(G),!0)});pm({container:C.current,accept(G){return G.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:G.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(G){G.setAttribute("role","none")}});let M=oe(G=>{let D=C.current;if(!D)return;let V=Vo(D),k=b.filter(z=>z.propsRef.current.disabled===!1).map(z=>z.element.current);switch(G.key){case ye.Enter:bm(G.currentTarget);break;case ye.ArrowLeft:case ye.ArrowUp:if(G.preventDefault(),G.stopPropagation(),ln(k,At.Previous|At.WrapAround)===jr.Success){let z=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));z&&O(z.propsRef.current.value)}break;case ye.ArrowRight:case ye.ArrowDown:if(G.preventDefault(),G.stopPropagation(),ln(k,At.Next|At.WrapAround)===jr.Success){let z=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));z&&O(z.propsRef.current.value)}break;case ye.Space:{G.preventDefault(),G.stopPropagation();let z=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));z&&O(z.propsRef.current.value)}break}}),A=oe(G=>(m({type:0,...G}),()=>m({type:1,id:G.id}))),$=g.useMemo(()=>({value:x,firstOption:_,containsCheckedOption:T,disabled:d,compare:f,...h}),[x,_,T,d,f,h]),j=g.useMemo(()=>({registerOption:A,change:O}),[A,O]),L={ref:E,id:r,role:"radiogroup","aria-labelledby":v,"aria-describedby":y,onKeyDown:M},H=g.useMemo(()=>({value:x}),[x]),W=g.useRef(null),B=yr();return g.useEffect(()=>{W.current&&s!==void 0&&B.addEventListener(W.current,"reset",()=>{O(s)})},[W,O]),g.createElement(S,{name:"RadioGroup.Description"},g.createElement(w,{name:"RadioGroup.Label"},g.createElement(vp.Provider,{value:j},g.createElement(bp.Provider,{value:$},i!=null&&x!=null&&dc({[i]:x}).map(([G,D],V)=>g.createElement(Sr,{features:wr.Hidden,ref:V===0?k=>{var z;W.current=(z=k==null?void 0:k.closest("form"))!=null?z:null}:void 0,...ua({key:G,as:"input",type:"radio",checked:D!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:G,value:D})})),We({ourProps:L,theirProps:p,slot:H,defaultTag:O_,name:"RadioGroup"})))))}var A_=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(A_||{});let M_="div";function L_(e,t){var n;let r=Pt(),{id:o=`headlessui-radiogroup-option-${r}`,value:s,disabled:a=!1,...i}=e,l=g.useRef(null),u=Re(l,t),[d,p]=mp(),[f,h]=np(),{addFlag:m,removeFlag:b,hasFlag:v}=Nm(1),w=Dt({value:s,disabled:a}),y=$m("RadioGroup.Option"),S=km("RadioGroup.Option");Qe(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=oe(A=>{var $;if(jo(A.currentTarget))return A.preventDefault();S.change(s)&&(m(2),($=l.current)==null||$.focus())}),E=oe(A=>{if(jo(A.currentTarget))return A.preventDefault();m(2)}),x=oe(()=>b(2)),P=((n=y.firstOption)==null?void 0:n.id)===o,_=y.disabled||a,T=y.compare(y.value,s),O={ref:u,id:o,role:"radio","aria-checked":T?"true":"false","aria-labelledby":d,"aria-describedby":f,"aria-disabled":_?!0:void 0,tabIndex:_?-1:T||!y.containsCheckedOption&&P?0:-1,onClick:_?void 0:C,onFocus:_?void 0:E,onBlur:_?void 0:x},M=g.useMemo(()=>({checked:T,disabled:_,active:v(2)}),[T,_,v]);return g.createElement(h,{name:"RadioGroup.Description"},g.createElement(p,{name:"RadioGroup.Label"},We({ourProps:O,theirProps:i,slot:M,defaultTag:M_,name:"RadioGroup.Option"})))}let N_=Ge(__),$_=Ge(L_),Im=Object.assign(N_,{Option:$_,Label:Lm,Description:xm}),yp=g.createContext(null);yp.displayName="GroupContext";let k_=g.Fragment;function I_(e){var t;let[n,r]=g.useState(null),[o,s]=mp(),[a,i]=np(),l=g.useMemo(()=>({switch:n,setSwitch:r,labelledby:o,describedby:a}),[n,r,o,a]),u={},d=e;return g.createElement(i,{name:"Switch.Description"},g.createElement(s,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(p){n&&(p.currentTarget.tagName==="LABEL"&&p.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},g.createElement(yp.Provider,{value:l},We({ourProps:u,theirProps:d,defaultTag:k_,name:"Switch.Group"}))))}let V_="button";function H_(e,t){var n;let r=Pt(),{id:o=`headlessui-switch-${r}`,checked:s,defaultChecked:a=!1,onChange:i,disabled:l=!1,name:u,value:d,form:p,...f}=e,h=g.useContext(yp),m=g.useRef(null),b=Re(m,t,h===null?null:h.setSwitch),[v,w]=oc(s,i,a),y=oe(()=>w==null?void 0:w(!v)),S=oe(T=>{if(jo(T.currentTarget))return T.preventDefault();T.preventDefault(),y()}),C=oe(T=>{T.key===ye.Space?(T.preventDefault(),y()):T.key===ye.Enter&&bm(T.currentTarget)}),E=oe(T=>T.preventDefault()),x=g.useMemo(()=>({checked:v}),[v]),P={id:o,ref:b,role:"switch",type:ca(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":v,"aria-labelledby":h==null?void 0:h.labelledby,"aria-describedby":h==null?void 0:h.describedby,disabled:l,onClick:S,onKeyUp:C,onKeyPress:E},_=yr();return g.useEffect(()=>{var T;let O=(T=m.current)==null?void 0:T.closest("form");O&&a!==void 0&&_.addEventListener(O,"reset",()=>{w(a)})},[m,w]),g.createElement(g.Fragment,null,u!=null&&v&&g.createElement(Sr,{features:wr.Hidden,...ua({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:p,checked:v,name:u,value:d})}),We({ourProps:P,theirProps:f,slot:x,defaultTag:V_,name:"Switch"}))}let j_=Ge(H_),D_=I_,wp=Object.assign(j_,{Group:D_,Label:Lm,Description:xm});function F_({onFocus:e}){let[t,n]=g.useState(!0),r=pc();return t?g.createElement(Sr,{as:"button",type:"button",features:wr.Focusable,onFocus:o=>{o.preventDefault();let s,a=50;function i(){if(a--<=0){s&&cancelAnimationFrame(s);return}if(e()){if(cancelAnimationFrame(s),!r.current)return;n(!1);return}s=requestAnimationFrame(i)}s=requestAnimationFrame(i)}}):null}const Vm=st.createContext(null);function B_(){return{groups:new Map,get(e,t){var n;let r=this.groups.get(e);r||(r=new Map,this.groups.set(e,r));let o=(n=r.get(t))!=null?n:0;r.set(t,o+1);let s=Array.from(r.keys()).indexOf(t);function a(){let i=r.get(t);i>1?r.set(t,i-1):r.delete(t)}return[s,a]}}}function z_({children:e}){let t=st.useRef(B_());return st.createElement(Vm.Provider,{value:t},e)}function Hm(e){let t=st.useContext(Vm);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=U_(),[r,o]=t.current.get(e,n);return st.useEffect(()=>o,[]),r}function U_(){var e,t,n;let r=(n=(t=(e=st.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!r)return Symbol();let o=[],s=r;for(;s;)o.push(s.index),s=s.return;return"$."+o.join(".")}var W_=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(W_||{}),G_=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(G_||{}),q_=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(q_||{});let K_={0(e,t){var n;let r=ho(e.tabs,d=>d.current),o=ho(e.panels,d=>d.current),s=r.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),a={...e,tabs:r,panels:o};if(t.index<0||t.index>r.length-1){let d=Ie(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Ie(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(s.length===0)return a;let p=Ie(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:p===-1?e.selectedIndex:p}}let i=r.slice(0,t.index),l=[...r.slice(t.index),...i].find(d=>s.includes(d));if(!l)return a;let u=(n=r.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...a,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],r=ho([...e.tabs,t.tab],s=>s.current),o=e.selectedIndex;return e.info.current.isControlled||(o=r.indexOf(n),o===-1&&(o=e.selectedIndex)),{...e,tabs:r,selectedIndex:o}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:ho([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},Sp=g.createContext(null);Sp.displayName="TabsDataContext";function pa(e){let t=g.useContext(Sp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pa),n}return t}let Cp=g.createContext(null);Cp.displayName="TabsActionsContext";function xp(e){let t=g.useContext(Cp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xp),n}return t}function Z_(e,t){return Ie(t.type,K_,e,t)}let Y_=g.Fragment;function X_(e,t){let{defaultIndex:n=0,vertical:r=!1,manual:o=!1,onChange:s,selectedIndex:a=null,...i}=e;const l=r?"vertical":"horizontal",u=o?"manual":"auto";let d=a!==null,p=Dt({isControlled:d}),f=Re(t),[h,m]=g.useReducer(Z_,{info:p,selectedIndex:a??n,tabs:[],panels:[]}),b=g.useMemo(()=>({selectedIndex:h.selectedIndex}),[h.selectedIndex]),v=Dt(s||(()=>{})),w=Dt(h.tabs),y=g.useMemo(()=>({orientation:l,activation:u,...h}),[l,u,h]),S=oe(T=>(m({type:1,tab:T}),()=>m({type:2,tab:T}))),C=oe(T=>(m({type:3,panel:T}),()=>m({type:4,panel:T}))),E=oe(T=>{x.current!==T&&v.current(T),d||m({type:0,index:T})}),x=Dt(d?e.selectedIndex:h.selectedIndex),P=g.useMemo(()=>({registerTab:S,registerPanel:C,change:E}),[]);Qe(()=>{m({type:0,index:a??n})},[a]),Qe(()=>{if(x.current===void 0||h.tabs.length<=0)return;let T=ho(h.tabs,O=>O.current);T.some((O,M)=>h.tabs[M]!==O)&&E(T.indexOf(h.tabs[x.current]))});let _={ref:f};return g.createElement(z_,null,g.createElement(Cp.Provider,{value:P},g.createElement(Sp.Provider,{value:y},y.tabs.length<=0&&g.createElement(F_,{onFocus:()=>{var T,O;for(let M of w.current)if(((T=M.current)==null?void 0:T.tabIndex)===0)return(O=M.current)==null||O.focus(),!0;return!1}}),We({ourProps:_,theirProps:i,slot:b,defaultTag:Y_,name:"Tabs"}))))}let J_="div";function Q_(e,t){let{orientation:n,selectedIndex:r}=pa("Tab.List"),o=Re(t);return We({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:J_,name:"Tabs.List"})}let R_="button";function eA(e,t){var n,r;let o=Pt(),{id:s=`headlessui-tabs-tab-${o}`,...a}=e,{orientation:i,activation:l,selectedIndex:u,tabs:d,panels:p}=pa("Tab"),f=xp("Tab"),h=pa("Tab"),m=g.useRef(null),b=Re(m,t);Qe(()=>f.registerTab(m),[f,m]);let v=Hm("tabs"),w=d.indexOf(m);w===-1&&(w=v);let y=w===u,S=oe(O=>{var M;let A=O();if(A===jr.Success&&l==="auto"){let $=(M=Vo(m))==null?void 0:M.activeElement,j=h.tabs.findIndex(L=>L.current===$);j!==-1&&f.change(j)}return A}),C=oe(O=>{let M=d.map(A=>A.current).filter(Boolean);if(O.key===ye.Space||O.key===ye.Enter){O.preventDefault(),O.stopPropagation(),f.change(w);return}switch(O.key){case ye.Home:case ye.PageUp:return O.preventDefault(),O.stopPropagation(),S(()=>ln(M,At.First));case ye.End:case ye.PageDown:return O.preventDefault(),O.stopPropagation(),S(()=>ln(M,At.Last))}if(S(()=>Ie(i,{vertical(){return O.key===ye.ArrowUp?ln(M,At.Previous|At.WrapAround):O.key===ye.ArrowDown?ln(M,At.Next|At.WrapAround):jr.Error},horizontal(){return O.key===ye.ArrowLeft?ln(M,At.Previous|At.WrapAround):O.key===ye.ArrowRight?ln(M,At.Next|At.WrapAround):jr.Error}}))===jr.Success)return O.preventDefault()}),E=g.useRef(!1),x=oe(()=>{var O;E.current||(E.current=!0,(O=m.current)==null||O.focus({preventScroll:!0}),f.change(w),Ud(()=>{E.current=!1}))}),P=oe(O=>{O.preventDefault()}),_=g.useMemo(()=>{var O;return{selected:y,disabled:(O=e.disabled)!=null?O:!1}},[y,e.disabled]),T={ref:b,onKeyDown:C,onMouseDown:P,onClick:x,id:s,role:"tab",type:ca(e,m),"aria-controls":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return We({ourProps:T,theirProps:a,slot:_,defaultTag:R_,name:"Tabs.Tab"})}let tA="div";function nA(e,t){let{selectedIndex:n}=pa("Tab.Panels"),r=Re(t),o=g.useMemo(()=>({selectedIndex:n}),[n]);return We({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:tA,name:"Tabs.Panels"})}let rA="div",oA=yn.RenderStrategy|yn.Static;function sA(e,t){var n,r,o,s;let a=Pt(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:p,panels:f}=pa("Tab.Panel"),h=xp("Tab.Panel"),m=g.useRef(null),b=Re(m,t);Qe(()=>h.registerPanel(m),[h,m,i]);let v=Hm("panels"),w=f.indexOf(m);w===-1&&(w=v);let y=w===d,S=g.useMemo(()=>({selected:y}),[y]),C={ref:b,id:i,role:"tabpanel","aria-labelledby":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,tabIndex:y?l:-1};return!y&&((o=u.unmount)==null||o)&&!((s=u.static)!=null&&s)?g.createElement(Sr,{as:"span","aria-hidden":"true",...C}):We({ourProps:C,theirProps:u,slot:S,defaultTag:rA,features:oA,visible:y,name:"Tabs.Panel"})}let aA=Ge(eA),iA=Ge(X_),lA=Ge(Q_),cA=Ge(nA),uA=Ge(sA),hi=Object.assign(aA,{Group:iA,List:lA,Panels:cA,Panel:uA});function dA(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Ep(e,...t){e&&t.length>0&&e.classList.add(...t)}function Pp(e,...t){e&&t.length>0&&e.classList.remove(...t)}function pA(e,t){let n=Hr();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[s,a]=[r,o].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return u}),i=s+a;if(i!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},i),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function fA(e,t,n,r){let o=n?"enter":"leave",s=Hr(),a=r!==void 0?dA(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=Ie(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Ie(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Ie(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Pp(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Ep(e,...t.base,...i,...u),s.nextFrame(()=>{Pp(e,...t.base,...i,...u),Ep(e,...t.base,...i,...l),pA(e,()=>(Pp(e,...t.base,...i),Ep(e,...t.base,...t.entered),a()))}),s.dispose}function gA({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=pc(),i=yr(),l=Dt(n);Qe(()=>{e&&(l.current="enter")},[e]),Qe(()=>{let u=Hr();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(fA(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function Do(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let hc=g.createContext(null);hc.displayName="TransitionContext";var hA=(e=>(e.Visible="visible",e.Hidden="hidden",e))(hA||{});function mA(){let e=g.useContext(hc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function bA(){let e=g.useContext(mc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let mc=g.createContext(null);mc.displayName="NestingContext";function bc(e){return"children"in e?bc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function jm(e,t){let n=Dt(e),r=g.useRef([]),o=pc(),s=yr(),a=oe((h,m=Ho.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===h);b!==-1&&(Ie(m,{[Ho.Unmount](){r.current.splice(b,1)},[Ho.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var v;!bc(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),i=oe(h=>{let m=r.current.find(({el:b})=>b===h);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:h,state:"visible"}),()=>a(h,Ho.Unmount)}),l=g.useRef([]),u=g.useRef(Promise.resolve()),d=g.useRef({enter:[],leave:[],idle:[]}),p=oe((h,m,b)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==h)),t==null||t.chains.current[m].push([h,new Promise(v=>{l.current.push(v)})]),t==null||t.chains.current[m].push([h,new Promise(v=>{Promise.all(d.current[m].map(([w,y])=>y)).then(()=>v())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),f=oe((h,m,b)=>{Promise.all(d.current[m].splice(0).map(([v,w])=>w)).then(()=>{var v;(v=l.current.shift())==null||v()}).then(()=>b(m))});return g.useMemo(()=>({children:r,register:i,unregister:a,onStart:p,onStop:f,wait:u,chains:d}),[i,a,r,p,f,d,u])}function vA(){}let yA=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Dm(e){var t;let n={};for(let r of yA)n[r]=(t=e[r])!=null?t:vA;return n}function wA(e){let t=g.useRef(Dm(e));return g.useEffect(()=>{t.current=Dm(e)},[e]),t}let SA="div",Fm=yn.RenderStrategy;function CA(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:h,leaveTo:m,...b}=e,v=g.useRef(null),w=Re(v,t),y=(n=b.unmount)==null||n?Ho.Unmount:Ho.Hidden,{show:S,appear:C,initial:E}=mA(),[x,P]=g.useState(S?"visible":"hidden"),_=bA(),{register:T,unregister:O}=_;g.useEffect(()=>T(v),[T,v]),g.useEffect(()=>{if(y===Ho.Hidden&&v.current){if(S&&x!=="visible"){P("visible");return}return Ie(x,{hidden:()=>O(v),visible:()=>T(v)})}},[x,v,T,O,S,y]);let M=Dt({base:Do(b.className),enter:Do(l),enterFrom:Do(u),enterTo:Do(d),entered:Do(p),leave:Do(f),leaveFrom:Do(h),leaveTo:Do(m)}),A=wA({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),$=sc();g.useEffect(()=>{if($&&x==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,x,$]);let j=E&&!C,L=C&&S&&E,H=!$||j?"idle":S?"enter":"leave",W=Nm(0),B=oe(Y=>Ie(Y,{enter:()=>{W.addFlag(ft.Opening),A.current.beforeEnter()},leave:()=>{W.addFlag(ft.Closing),A.current.beforeLeave()},idle:()=>{}})),G=oe(Y=>Ie(Y,{enter:()=>{W.removeFlag(ft.Opening),A.current.afterEnter()},leave:()=>{W.removeFlag(ft.Closing),A.current.afterLeave()},idle:()=>{}})),D=jm(()=>{P("hidden"),O(v)},_),V=g.useRef(!1);gA({immediate:L,container:v,classes:M,direction:H,onStart:Dt(Y=>{V.current=!0,D.onStart(v,Y,B)}),onStop:Dt(Y=>{V.current=!1,D.onStop(v,Y,G),Y==="leave"&&!bc(D)&&(P("hidden"),O(v))})});let k=b,z={ref:w};return L?k={...k,className:cc(b.className,...M.current.enter,...M.current.enterFrom)}:V.current&&(k.className=cc(b.className,(r=v.current)==null?void 0:r.className),k.className===""&&delete k.className),g.createElement(mc.Provider,{value:D},g.createElement(ui,{value:Ie(x,{visible:ft.Open,hidden:ft.Closed})|W.flags},We({ourProps:z,theirProps:k,defaultTag:SA,features:Fm,visible:x==="visible",name:"Transition.Child"})))}function xA(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=g.useRef(null),i=Re(a,t);sc();let l=Ts();if(n===void 0&&l!==null&&(n=(l&ft.Open)===ft.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=g.useState(n?"visible":"hidden"),p=jm(()=>{d("hidden")}),[f,h]=g.useState(!0),m=g.useRef([n]);Qe(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let b=g.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);g.useEffect(()=>{if(n)d("visible");else if(!bc(p))d("hidden");else{let S=a.current;if(!S)return;let C=S.getBoundingClientRect();C.x===0&&C.y===0&&C.width===0&&C.height===0&&d("hidden")}},[n,p]);let v={unmount:o},w=oe(()=>{var S;f&&h(!1),(S=e.beforeEnter)==null||S.call(e)}),y=oe(()=>{var S;f&&h(!1),(S=e.beforeLeave)==null||S.call(e)});return g.createElement(mc.Provider,{value:p},g.createElement(hc.Provider,{value:b},We({ourProps:{...v,as:g.Fragment,children:g.createElement(Bm,{ref:i,...v,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:g.Fragment,features:Fm,visible:u==="visible",name:"Transition"})))}function EA(e,t){let n=g.useContext(hc)!==null,r=Ts()!==null;return g.createElement(g.Fragment,null,!n&&r?g.createElement(Tp,{ref:t,...e}):g.createElement(Bm,{ref:t,...e}))}let Tp=Ge(xA),Bm=Ge(CA),PA=Ge(EA),Op=Object.assign(Tp,{Child:PA,Root:Tp});var zm=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},Um=typeof window<"u"&&window.document&&window.document.createElement?st.useLayoutEffect:st.useEffect,wn="top",Xn="bottom",Jn="right",Sn="left",_p="auto",mi=[wn,Xn,Jn,Sn],fa="start",bi="end",TA="clippingParents",Wm="viewport",vi="popper",OA="reference",Gm=mi.reduce(function(e,t){return e.concat([t+"-"+fa,t+"-"+bi])},[]),qm=[].concat(mi,[_p]).reduce(function(e,t){return e.concat([t,t+"-"+fa,t+"-"+bi])},[]),_A="beforeRead",AA="read",MA="afterRead",LA="beforeMain",NA="main",$A="afterMain",kA="beforeWrite",IA="write",VA="afterWrite",HA=[_A,AA,MA,LA,NA,$A,kA,IA,VA];function Dr(e){return e?(e.nodeName||"").toLowerCase():null}function Nn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function As(e){var t=Nn(e).Element;return e instanceof t||e instanceof Element}function Qn(e){var t=Nn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ap(e){if(typeof ShadowRoot>"u")return!1;var t=Nn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function jA(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Qn(s)||!Dr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var i=o[a];i===!1?s.removeAttribute(a):s.setAttribute(a,i===!0?"":i)}))})}function DA(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),i=a.reduce(function(l,u){return l[u]="",l},{});!Qn(o)||!Dr(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const FA={name:"applyStyles",enabled:!0,phase:"write",fn:jA,effect:DA,requires:["computeStyles"]};function Fr(e){return e.split("-")[0]}var Ms=Math.max,vc=Math.min,ga=Math.round;function Mp(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Km(){return!/^((?!chrome|android).)*safari/i.test(Mp())}function ha(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Qn(e)&&(o=e.offsetWidth>0&&ga(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&ga(r.height)/e.offsetHeight||1);var a=As(e)?Nn(e):window,i=a.visualViewport,l=!Km()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,p=r.width/o,f=r.height/s;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function Lp(e){var t=ha(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Zm(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ap(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function bo(e){return Nn(e).getComputedStyle(e)}function BA(e){return["table","td","th"].indexOf(Dr(e))>=0}function Fo(e){return((As(e)?e.ownerDocument:e.document)||window.document).documentElement}function yc(e){return Dr(e)==="html"?e:e.assignedSlot||e.parentNode||(Ap(e)?e.host:null)||Fo(e)}function Ym(e){return!Qn(e)||bo(e).position==="fixed"?null:e.offsetParent}function zA(e){var t=/firefox/i.test(Mp()),n=/Trident/i.test(Mp());if(n&&Qn(e)){var r=bo(e);if(r.position==="fixed")return null}var o=yc(e);for(Ap(o)&&(o=o.host);Qn(o)&&["html","body"].indexOf(Dr(o))<0;){var s=bo(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function yi(e){for(var t=Nn(e),n=Ym(e);n&&BA(n)&&bo(n).position==="static";)n=Ym(n);return n&&(Dr(n)==="html"||Dr(n)==="body"&&bo(n).position==="static")?t:n||zA(e)||t}function Np(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function wi(e,t,n){return Ms(e,vc(t,n))}function UA(e,t,n){var r=wi(e,t,n);return r>n?n:r}function Xm(){return{top:0,right:0,bottom:0,left:0}}function Jm(e){return Object.assign({},Xm(),e)}function Qm(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var WA=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Jm(typeof t!="number"?t:Qm(t,mi))};function GA(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=Fr(n.placement),l=Np(i),u=[Sn,Jn].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var p=WA(o.padding,n),f=Lp(s),h=l==="y"?wn:Sn,m=l==="y"?Xn:Jn,b=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],v=a[l]-n.rects.reference[l],w=yi(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=b/2-v/2,C=p[h],E=y-f[d]-p[m],x=y/2-f[d]/2+S,P=wi(C,x,E),_=l;n.modifiersData[r]=(t={},t[_]=P,t.centerOffset=P-x,t)}}function qA(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||Zm(t.elements.popper,o)&&(t.elements.arrow=o))}const KA={name:"arrow",enabled:!0,phase:"main",fn:GA,effect:qA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ma(e){return e.split("-")[1]}var ZA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function YA(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:ga(n*o)/o||0,y:ga(r*o)/o||0}}function Rm(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,i=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=a.x,h=f===void 0?0:f,m=a.y,b=m===void 0?0:m,v=typeof d=="function"?d({x:h,y:b}):{x:h,y:b};h=v.x,b=v.y;var w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=Sn,C=wn,E=window;if(u){var x=yi(n),P="clientHeight",_="clientWidth";if(x===Nn(n)&&(x=Fo(n),bo(x).position!=="static"&&i==="absolute"&&(P="scrollHeight",_="scrollWidth")),x=x,o===wn||(o===Sn||o===Jn)&&s===bi){C=Xn;var T=p&&x===E&&E.visualViewport?E.visualViewport.height:x[P];b-=T-r.height,b*=l?1:-1}if(o===Sn||(o===wn||o===Xn)&&s===bi){S=Jn;var O=p&&x===E&&E.visualViewport?E.visualViewport.width:x[_];h-=O-r.width,h*=l?1:-1}}var M=Object.assign({position:i},u&&ZA),A=d===!0?YA({x:h,y:b},Nn(n)):{x:h,y:b};if(h=A.x,b=A.y,l){var $;return Object.assign({},M,($={},$[C]=y?"0":"",$[S]=w?"0":"",$.transform=(E.devicePixelRatio||1)<=1?"translate("+h+"px, "+b+"px)":"translate3d("+h+"px, "+b+"px, 0)",$))}return Object.assign({},M,(t={},t[C]=y?b+"px":"",t[S]=w?h+"px":"",t.transform="",t))}function XA(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,i=n.roundOffsets,l=i===void 0?!0:i,u={placement:Fr(t.placement),variation:ma(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Rm(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Rm(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const JA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:XA,data:{}};var wc={passive:!0};function QA(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,i=a===void 0?!0:a,l=Nn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,wc)}),i&&l.addEventListener("resize",n.update,wc),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,wc)}),i&&l.removeEventListener("resize",n.update,wc)}}const RA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:QA,data:{}};var e3={left:"right",right:"left",bottom:"top",top:"bottom"};function Sc(e){return e.replace(/left|right|bottom|top/g,function(t){return e3[t]})}var t3={start:"end",end:"start"};function eb(e){return e.replace(/start|end/g,function(t){return t3[t]})}function $p(e){var t=Nn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function kp(e){return ha(Fo(e)).left+$p(e).scrollLeft}function n3(e,t){var n=Nn(e),r=Fo(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=Km();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+kp(e),y:l}}function r3(e){var t,n=Fo(e),r=$p(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Ms(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Ms(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+kp(e),l=-r.scrollTop;return bo(o||n).direction==="rtl"&&(i+=Ms(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function Ip(e){var t=bo(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function tb(e){return["html","body","#document"].indexOf(Dr(e))>=0?e.ownerDocument.body:Qn(e)&&Ip(e)?e:tb(yc(e))}function Si(e,t){var n;t===void 0&&(t=[]);var r=tb(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Nn(r),a=o?[s].concat(s.visualViewport||[],Ip(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(Si(yc(a)))}function Vp(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function o3(e,t){var n=ha(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function nb(e,t,n){return t===Wm?Vp(n3(e,n)):As(t)?o3(t,n):Vp(r3(Fo(e)))}function s3(e){var t=Si(yc(e)),n=["absolute","fixed"].indexOf(bo(e).position)>=0,r=n&&Qn(e)?yi(e):e;return As(r)?t.filter(function(o){return As(o)&&Zm(o,r)&&Dr(o)!=="body"}):[]}function a3(e,t,n,r){var o=t==="clippingParents"?s3(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=nb(e,u,r);return l.top=Ms(d.top,l.top),l.right=vc(d.right,l.right),l.bottom=vc(d.bottom,l.bottom),l.left=Ms(d.left,l.left),l},nb(e,a,r));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}function rb(e){var t=e.reference,n=e.element,r=e.placement,o=r?Fr(r):null,s=r?ma(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case wn:l={x:a,y:t.y-n.height};break;case Xn:l={x:a,y:t.y+t.height};break;case Jn:l={x:t.x+t.width,y:i};break;case Sn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?Np(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case fa:l[u]=l[u]-(t[d]/2-n[d]/2);break;case bi:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function Ci(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,i=n.boundary,l=i===void 0?TA:i,u=n.rootBoundary,d=u===void 0?Wm:u,p=n.elementContext,f=p===void 0?vi:p,h=n.altBoundary,m=h===void 0?!1:h,b=n.padding,v=b===void 0?0:b,w=Jm(typeof v!="number"?v:Qm(v,mi)),y=f===vi?OA:vi,S=e.rects.popper,C=e.elements[m?y:f],E=a3(As(C)?C:C.contextElement||Fo(e.elements.popper),l,d,a),x=ha(e.elements.reference),P=rb({reference:x,element:S,strategy:"absolute",placement:o}),_=Vp(Object.assign({},S,P)),T=f===vi?_:x,O={top:E.top-T.top+w.top,bottom:T.bottom-E.bottom+w.bottom,left:E.left-T.left+w.left,right:T.right-E.right+w.right},M=e.modifiersData.offset;if(f===vi&&M){var A=M[o];Object.keys(O).forEach(function($){var j=[Jn,Xn].indexOf($)>=0?1:-1,L=[wn,Xn].indexOf($)>=0?"y":"x";O[$]+=A[L]*j})}return O}function i3(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,i=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?qm:l,d=ma(r),p=d?i?Gm:Gm.filter(function(m){return ma(m)===d}):mi,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,b){return m[b]=Ci(e,{placement:b,boundary:o,rootBoundary:s,padding:a})[Fr(b)],m},{});return Object.keys(h).sort(function(m,b){return h[m]-h[b]})}function l3(e){if(Fr(e)===_p)return[];var t=Sc(e);return[eb(e),t,eb(t)]}function c3(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!0:a,l=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,b=n.allowedAutoPlacements,v=t.options.placement,w=Fr(v),y=w===v,S=l||(y||!m?[Sc(v)]:l3(v)),C=[v].concat(S).reduce(function(Y,X){return Y.concat(Fr(X)===_p?i3(t,{placement:X,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:b}):X)},[]),E=t.rects.reference,x=t.rects.popper,P=new Map,_=!0,T=C[0],O=0;O<C.length;O++){var M=C[O],A=Fr(M),$=ma(M)===fa,j=[wn,Xn].indexOf(A)>=0,L=j?"width":"height",H=Ci(t,{placement:M,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),W=j?$?Jn:Sn:$?Xn:wn;E[L]>x[L]&&(W=Sc(W));var B=Sc(W),G=[];if(s&&G.push(H[A]<=0),i&&G.push(H[W]<=0,H[B]<=0),G.every(function(Y){return Y})){T=M,_=!1;break}P.set(M,G)}if(_)for(var D=m?3:1,V=function(X){var ee=C.find(function(J){var q=P.get(J);if(q)return q.slice(0,X).every(function(R){return R})});if(ee)return T=ee,"break"},k=D;k>0;k--){var z=V(k);if(z==="break")break}t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}const u3={name:"flip",enabled:!0,phase:"main",fn:c3,requiresIfExists:["offset"],data:{_skip:!1}};function ob(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function sb(e){return[wn,Jn,Xn,Sn].some(function(t){return e[t]>=0})}function d3(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=Ci(t,{elementContext:"reference"}),i=Ci(t,{altBoundary:!0}),l=ob(a,r),u=ob(i,o,s),d=sb(l),p=sb(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const p3={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:d3};function f3(e,t,n){var r=Fr(e),o=[Sn,wn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],i=s[1];return a=a||0,i=(i||0)*o,[Sn,Jn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function g3(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=qm.reduce(function(d,p){return d[p]=f3(p,t.rects,s),d},{}),i=a[t.placement],l=i.x,u=i.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const h3={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:g3};function m3(e){var t=e.state,n=e.name;t.modifiersData[n]=rb({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const b3={name:"popperOffsets",enabled:!0,phase:"read",fn:m3,data:{}};function v3(e){return e==="x"?"y":"x"}function y3(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!1:a,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,b=m===void 0?0:m,v=Ci(t,{boundary:l,rootBoundary:u,padding:p,altBoundary:d}),w=Fr(t.placement),y=ma(t.placement),S=!y,C=Np(w),E=v3(C),x=t.modifiersData.popperOffsets,P=t.rects.reference,_=t.rects.popper,T=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,O=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),M=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,A={x:0,y:0};if(x){if(s){var $,j=C==="y"?wn:Sn,L=C==="y"?Xn:Jn,H=C==="y"?"height":"width",W=x[C],B=W+v[j],G=W-v[L],D=h?-_[H]/2:0,V=y===fa?P[H]:_[H],k=y===fa?-_[H]:-P[H],z=t.elements.arrow,Y=h&&z?Lp(z):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Xm(),ee=X[j],J=X[L],q=wi(0,P[H],Y[H]),R=S?P[H]/2-D-q-ee-O.mainAxis:V-q-ee-O.mainAxis,ae=S?-P[H]/2+D+q+J+O.mainAxis:k+q+J+O.mainAxis,le=t.elements.arrow&&yi(t.elements.arrow),me=le?C==="y"?le.clientTop||0:le.clientLeft||0:0,ve=($=M==null?void 0:M[C])!=null?$:0,He=W+R-ve-me,je=W+ae-ve,it=wi(h?vc(B,He):B,W,h?Ms(G,je):G);x[C]=it,A[C]=it-W}if(i){var qe,Se=C==="x"?wn:Sn,Ue=C==="x"?Xn:Jn,et=x[E],Ct=E==="y"?"height":"width",Ne=et+v[Se],bt=et-v[Ue],pt=[wn,Sn].indexOf(w)!==-1,Ke=(qe=M==null?void 0:M[E])!=null?qe:0,tn=pt?Ne:et-P[Ct]-_[Ct]-Ke+O.altAxis,he=pt?et+P[Ct]+_[Ct]-Ke-O.altAxis:bt,Be=h&&pt?UA(tn,et,he):wi(h?tn:Ne,et,h?he:bt);x[E]=Be,A[E]=Be-et}t.modifiersData[r]=A}}const w3={name:"preventOverflow",enabled:!0,phase:"main",fn:y3,requiresIfExists:["offset"]};function S3(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function C3(e){return e===Nn(e)||!Qn(e)?$p(e):S3(e)}function x3(e){var t=e.getBoundingClientRect(),n=ga(t.width)/e.offsetWidth||1,r=ga(t.height)/e.offsetHeight||1;return n!==1||r!==1}function E3(e,t,n){n===void 0&&(n=!1);var r=Qn(t),o=Qn(t)&&x3(t),s=Fo(t),a=ha(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Dr(t)!=="body"||Ip(s))&&(i=C3(t)),Qn(t)?(l=ha(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=kp(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function P3(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var a=[].concat(s.requires||[],s.requiresIfExists||[]);a.forEach(function(i){if(!n.has(i)){var l=t.get(i);l&&o(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function T3(e){var t=P3(e);return HA.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function O3(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function _3(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var ab={placement:"bottom",modifiers:[],strategy:"absolute"};function ib(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function A3(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?ab:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},ab,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},p=[],f=!1,h={state:d,setOptions:function(w){var y=typeof w=="function"?w(d.options):w;b(),d.options=Object.assign({},s,d.options,y),d.scrollParents={reference:As(i)?Si(i):i.contextElement?Si(i.contextElement):[],popper:Si(l)};var S=T3(_3([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var w=d.elements,y=w.reference,S=w.popper;if(ib(y,S)){d.rects={reference:E3(y,yi(S),d.options.strategy==="fixed"),popper:Lp(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(O){return d.modifiersData[O.name]=Object.assign({},O.data)});for(var C=0;C<d.orderedModifiers.length;C++){if(d.reset===!0){d.reset=!1,C=-1;continue}var E=d.orderedModifiers[C],x=E.fn,P=E.options,_=P===void 0?{}:P,T=E.name;typeof x=="function"&&(d=x({state:d,options:_,name:T,instance:h})||d)}}}},update:O3(function(){return new Promise(function(v){h.forceUpdate(),v(d)})}),destroy:function(){b(),f=!0}};if(!ib(i,l))return h;h.setOptions(u).then(function(v){!f&&u.onFirstUpdate&&u.onFirstUpdate(v)});function m(){d.orderedModifiers.forEach(function(v){var w=v.name,y=v.options,S=y===void 0?{}:y,C=v.effect;if(typeof C=="function"){var E=C({state:d,name:w,instance:h,options:S}),x=function(){};p.push(E||x)}})}function b(){p.forEach(function(v){return v()}),p=[]}return h}}var M3=[RA,b3,JA,FA,h3,u3,w3,KA,p3],L3=A3({defaultModifiers:M3}),N3=typeof Element<"u",$3=typeof Map=="function",k3=typeof Set=="function",I3=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Cc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,o;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Cc(e[r],t[r]))return!1;return!0}var s;if($3&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;for(s=e.entries();!(r=s.next()).done;)if(!Cc(r.value[1],t.get(r.value[0])))return!1;return!0}if(k3&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(I3&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;if(N3&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!Cc(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var V3=function(t,n){try{return Cc(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const H3=td(V3);var j3=[],xi=function(t,n,r){r===void 0&&(r={});var o=st.useRef(null),s={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||j3},a=st.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],l=a[1],u=st.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(h){var m=h.state,b=Object.keys(m.elements);pC.flushSync(function(){l({styles:zm(b.map(function(v){return[v,m.styles[v]||{}]})),attributes:zm(b.map(function(v){return[v,m.attributes[v]]}))})})},requires:["computeStyles"]}},[]),d=st.useMemo(function(){var f={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return H3(o.current,f)?o.current||f:(o.current=f,f)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),p=st.useRef();return Um(function(){p.current&&p.current.setOptions(d)},[d]),Um(function(){if(!(t==null||n==null)){var f=r.createPopper||L3,h=f(t,n,d);return p.current=h,function(){h.destroy(),p.current=null}}},[t,n,r.createPopper]),{state:p.current?p.current.state:null,styles:i.styles,attributes:i.attributes,update:p.current?p.current.update:null,forceUpdate:p.current?p.current.forceUpdate:null}};const Rn=Kt(function({children:t,title:n,onClose:r,icon:o,skipOverflow:s,shadow:a=!0,padding:i=!0,border:l=!0,round:u=!0,className:d,classNameBody:p,size:f="m",titleClass:h=Q("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:b,...v},w){const y=oo(o)?o:{};return c.jsxs("div",{...v,ref:w,style:m,className:Q(["gs-utl-card",d,b||Id.bg,re.b,u&&re.rnd,l?U.br:re.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&f==="l"&&"gs-utl-p-5",i&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(I,{className:Q("gs-utl-card-title",h),items:"center",children:[c.jsx(F,{className:Q("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(F,{onClick:r,className:Q("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(ne,{icon:(dt(o)?o:"")||K.close,size:"18px",...y})})]}),c.jsx("div",{className:Q("gs-utl-card-body",p),children:t})]})});var xc,D3=new Uint8Array(16);function F3(){if(!xc&&(xc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!xc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xc(D3)}const B3=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function z3(e){return typeof e=="string"&&B3.test(e)}for(var Yt=[],Hp=0;Hp<256;++Hp)Yt.push((Hp+256).toString(16).substr(1));function U3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Yt[e[t+0]]+Yt[e[t+1]]+Yt[e[t+2]]+Yt[e[t+3]]+"-"+Yt[e[t+4]]+Yt[e[t+5]]+"-"+Yt[e[t+6]]+Yt[e[t+7]]+"-"+Yt[e[t+8]]+Yt[e[t+9]]+"-"+Yt[e[t+10]]+Yt[e[t+11]]+Yt[e[t+12]]+Yt[e[t+13]]+Yt[e[t+14]]+Yt[e[t+15]]).toLowerCase();if(!z3(n))throw TypeError("Stringified UUID is invalid");return n}function lb(e,t,n){e=e||{};var r=e.random||(e.rng||F3)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,U3(r)}class W3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Ei=async(e,{onError:t,onLoading:n,onResult:r,params:o,rawText:s,...a})=>{try{n==null||n(!0);const i=o?new URLSearchParams(o).toString():"",l=i?`?${i}`:"",u=await fetch(`${e}${l}`,a);if(!u.ok){const p=await u.json();throw new W3(p.error||"Request failed!",p.errorData)}let d;if(s)d=await u.text();else try{d=await u.json()}catch{d=void 0}return r==null||r(d),d}catch(i){const l=i instanceof Error?i:new Error(i);if(t==null||t(l),a.throwError)throw l;return l}finally{n==null||n(!1)}};class Br{static async get(t,n){return Ei(t,{...n,method:"GET"})}static async post(t,n){return Ei(t,{...n,method:"POST"})}static async put(t,n){return Ei(t,{...n,method:"PUT"})}static async patch(t,n){return Ei(t,{...n,method:"PATCH"})}static async delete(t,n){return Ei(t,{...n,method:"DELETE"})}}var Ec=(e=>(e.Projects="projects",e.Settings="settings",e))(Ec||{}),cb=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(cb||{});const ub={},G3=1,q3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?G3:1,s=ub[r];if(s)t(s);else{if(!Wn())return n(new Error("window context not found"));const a=window.indexedDB.open(r,o);a.onerror=n,a.onsuccess=()=>{const i=a.result;i.onerror=n,ub[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),jp=async(e,t)=>(await q3(t)).transaction([e],"readwrite").objectStore(e),K3=async(e,t)=>{const n=await jp(e,t);return new Promise((r,o)=>{const s=[],a=n.openCursor();a.onerror=o,a.onsuccess=function(i){const u=i.target.result;if(u){const d=u.primaryKey,p=u.value;s.push({key:d,data:p}),u.continue()}else r(s)}})},Z3=async(e,t,n)=>{const r=await jp(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},Y3=async(e,t,n)=>{const r=await jp(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var Pi=(e=>(e.Existing="existing",e.Templates="templates",e))(Pi||{});const X3=e=>{const t=I4();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},J3=(e,t)=>Br.get(X3(e),{...t}),Q3=async e=>{try{const t=await J3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},db=async(e=Et.web)=>typeof window>"u"?[]:(await K3(Ec.Projects)).map(({key:r,data:o})=>{var s;return{id:`${r}`,name:`${((s=o.custom)==null?void 0:s.projectName)||r}`,data:o}}).filter(r=>{var o;return((o=r.data.custom)==null?void 0:o.projectType)===e}),pb=new Set,$n=new WeakMap,ba=new WeakMap,Ls=new WeakMap,Dp=new WeakMap,R3=new WeakMap,va=new WeakMap,Pc=new WeakMap;let Bo;const Ns="__aa_tgt",Fp="__aa_del",e4=e=>{const t=s4(e);t&&t.forEach(n=>a4(n))},t4=e=>{e.forEach(t=>{t.target===Bo&&r4(),$n.has(t.target)&&$s(t.target)})};function n4(e){const t=Dp.get(e);t==null||t.disconnect();let n=$n.get(e),r=0;const o=5;n||(n=wa(e),$n.set(e,n));const{offsetWidth:s,offsetHeight:a}=Bo,l=[n.top-o,s-(n.left+o+n.width),a-(n.top+o+n.height),n.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++r>1&&$s(e)},{root:Bo,threshold:1,rootMargin:l});u.observe(e),Dp.set(e,u)}function $s(e){clearTimeout(Pc.get(e));const t=Tc(e),n=typeof t=="function"?500:t.duration;Pc.set(e,setTimeout(()=>{const r=Ls.get(e);(!r||r.finished)&&($n.set(e,wa(e)),n4(e))},n))}function r4(){clearTimeout(Pc.get(Bo)),Pc.set(Bo,setTimeout(()=>{pb.forEach(e=>hb(e,t=>fb(()=>$s(t))))},100))}function o4(e){setTimeout(()=>{R3.set(e,setInterval(()=>fb($s.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function fb(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Bp,ya;typeof window<"u"&&(Bo=document.documentElement,Bp=new MutationObserver(e4),ya=new ResizeObserver(t4),ya.observe(Bo));function s4(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(zp(n.target),!t.has(n.target)){t.add(n.target);for(let r=0;r<n.target.children.length;r++){const o=n.target.children.item(r);if(o){if(Fp in o)return!1;zp(n.target,o),t.add(o)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const o=n.removedNodes[r];if(Fp in o)return!1;o instanceof Element&&(t.add(o),zp(n.target,o),ba.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function zp(e,t){!t&&!(Ns in e)?Object.defineProperty(e,Ns,{value:e}):t&&!(Ns in t)&&Object.defineProperty(t,Ns,{value:e})}function a4(e){var t;const n=Bo.contains(e),r=$n.has(e);n&&ba.has(e)&&ba.delete(e),Ls.has(e)&&((t=Ls.get(e))===null||t===void 0||t.cancel()),r&&n?i4(e):r&&!n?c4(e):l4(e)}function zr(e){return Number(e.replace(/[^0-9.\-]/g,""))}function wa(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function gb(e,t,n){let r=t.width,o=t.height,s=n.width,a=n.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const u=zr(i.paddingTop)+zr(i.paddingBottom)+zr(i.borderTopWidth)+zr(i.borderBottomWidth),d=zr(i.paddingLeft)+zr(i.paddingRight)+zr(i.borderRightWidth)+zr(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function Tc(e){return Ns in e&&va.has(e[Ns])?va.get(e[Ns]):{duration:250,easing:"ease-in-out"}}function hb(e,...t){t.forEach(n=>n(e,va.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,va.has(r)))}}function i4(e){const t=$n.get(e),n=wa(e);let r;if(!t)return;const o=Tc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=gb(e,t,n),p={transform:`translate(${s}px, ${a}px)`},f={transform:"translate(0, 0)"};i!==l&&(p.width=`${i}px`,f.width=`${l}px`),u!==d&&(p.height=`${u}px`,f.height=`${d}px`),r=e.animate([p,f],o)}else r=new Animation(o(e,"remain",t,n)),r.play();Ls.set(e,r),$n.set(e,n),r.addEventListener("finish",$s.bind(null,e))}function l4(e){const t=wa(e);$n.set(e,t);const n=Tc(e);let r;typeof n!="function"?r=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(r=new Animation(n(e,"add",t)),r.play()),Ls.set(e,r),r.addEventListener("finish",$s.bind(null,e))}function c4(e){if(!ba.has(e)||!$n.has(e))return;const[t,n]=ba.get(e);Object.defineProperty(e,Fp,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[r,o,s,a]=u4(e),i=Tc(e),l=$n.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${r}px`,left:`${o}px`,width:`${s}px`,height:`${a}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof i!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:i.duration,easing:"ease-out"}):(u=new Animation(i(e,"remove",l)),u.play()),Ls.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),$n.delete(e),ba.delete(e),Ls.delete(e),(d=Dp.get(e))===null||d===void 0||d.disconnect()})}function u4(e){const t=$n.get(e),[n,,r]=gb(e,t,wa(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=$n.get(o)||wa(o),i=Math.round(t.top-a.top)-zr(s.borderTopWidth),l=Math.round(t.left-a.left)-zr(s.borderLeftWidth);return[i,l,n,r]}function d4(e,t={}){Bp&&ya&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),hb(e,$s,o4,n=>ya==null?void 0:ya.observe(n)),typeof t=="function"?va.set(e,t):va.set(e,{duration:250,easing:"ease-in-out",...t}),Bp.observe(e,{childList:!0}),pb.add(e))}function p4(e){const t=g.useRef(null);return g.useEffect(()=>{t.current instanceof HTMLElement&&d4(t.current,e)},[t]),t}const f4={[sn.Info]:U.bgA,[sn.Error]:"bg-red-500",[sn.Success]:"bg-green-500",[sn.Warning]:"bg-orange-400"},g4=Kt(function(t,n){const r={[sn.Info]:K.informationVariant,[sn.Error]:K.fire,[sn.Success]:K.checkBold,[sn.Warning]:K.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=sn.Info,autoHideTimeout:d=3e3}=t,p=g.useRef(null),f=g.useRef(),h=r[u],m=f4[u];g.useImperativeHandle(n,()=>p.current,[]);const b=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},v=()=>{d&&(f.current=setTimeout(b,d))},w=()=>f.current&&clearTimeout(f.current);g.useEffect(()=>(v(),w),[]);const y=a||o;return c.jsx(Rn,{className:ie(s,"overflow-hidden relative"),ref:p,onPointerEnter:w,onPointerLeave:v,children:c.jsxs(I,{space:"m",items:"center",className:ie(Te.y),children:[c.jsx(F,{className:ie(m,re.pill,"text-white gjs-p-1"),children:c.jsx(ne,{icon:h,size:se.s})}),c.jsx(F,{grow:!0,className:ie("gjs-pr-3"),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(F,{className:ie("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(F,{className:ie(U.txtLowEmphasis),children:y}),!!l.length&&c.jsx(I,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(Je,{...C},S))})]})}),c.jsx(F,{className:ie("absolute top-1 right-1"),children:c.jsx(wt,{onClick:b,border:!1,children:c.jsx(ne,{icon:K.close,size:se.s})})})]})})});ce(Kt(function({className:t,toasts:n,onDismiss:r,...o},s){const a=p4({});return c.jsx("div",{className:ie(t,"w-80 gs-utl-z-30"),...o,ref:a,children:n.map(i=>c.jsx(g4,{...i,className:ie("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Up=(e=>(e.self="self",e.cloud="cloud",e))(Up||{}),ks=(e=>(e.image="image",e.video="video",e))(ks||{}),Cr=(e=>(e.componentOutline="componentOutline",e.preview="preview",e.fullscreen="fullscreen",e.showCode="showCode",e.showImportCode="showImportCode",e.clearCanvas="clearCanvas",e.store="store",e.undo="undo",e.redo="redo",e))(Cr||{}),Wp=(e=>(e.canvas="canvas",e.layers="layers",e))(Wp||{}),zo=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(zo||{}),zt=(e=>(e.variable="data-variable",e.condition="data-condition",e.conditionTrue="data-condition-true-content",e.conditionFalse="data-condition-false-content",e.collection="data-collection",e.collectionItem="data-collection-item",e))(zt||{}),Gp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(Gp||{});const Ti=e=>e.replaceAll('"',"").replaceAll("'",""),Is=e=>e.includes(",")?e:/\s/.test(e)?`'${Ti(e)}'`:Ti(e),mb=(e,t,n)=>({family:e,variant:t,...n}),Oi=(e,t)=>{e=Is(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:Ti(e),menuVariant:n&&mb(Is(`menuFont-${Ti(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:mb(e,o,s)})))}},qp=(e,t)=>{var i;const n=Oi(e.family,e),r=n.menuVariant??((i=Object.values(n.variants))==null?void 0:i[0]);if(!r)return"Arial, Helvetica, sans-serif";const{source:o,descriptors:s}=r,a=Ti(r.family);if(!t){const l=new FontFace(a,`url("${o}")`,s),u=Array.from(document.fonts.values()).filter(d=>d.family===a);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return Is(a)},Ur=", sans-serif",bb=["Arial, Helvetica"+Ur,"Arial Black, Gadget"+Ur,"Brush Script MT"+Ur,"Comic Sans MS, cursive"+Ur,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Ur,"Impact, Charcoal"+Ur,"Lucida Sans Unicode, Lucida Grande"+Ur,"Tahoma, Geneva"+Ur,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Ur,"Verdana, Geneva"+Ur].map(e=>({id:e,label:e.split(",")[0]})),h4=String.raw,vo=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},m4=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:p}=n??{},f=[vo`font-ascent-override: ${o};`,vo`font-display: ${r};`,vo`font-descent-override: ${s};`,vo`font-feature-settings: ${a};`,vo`font-line-gap-override: ${i};`,vo`font-stretch: ${l};`,vo`font-style: ${u};`,vo`font-unicode-range: ${d};`,vo`font-weight: ${p};`].filter(Boolean);return h4`
25
25
  @font-face {
26
26
  font-family: ${e};
27
27
  src: url('${t}');
28
28
  ${f.join(`
29
29
  `)}
30
30
  }
31
- `},uv=(e={})=>{const t=Object.entries(e).map(([r,o])=>Pi(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=e4(o)+`
32
- `;return n.trim()},dv="data-project-fonts",pv="true",t4=`${dv}="${pv}"`,fv=(e={})=>{const t=uv(e);return t?`<style ${t4}>
31
+ `},vb=(e={})=>{const t=Object.entries(e).map(([r,o])=>Oi(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=m4(o)+`
32
+ `;return n.trim()},yb="data-project-fonts",wb="true",b4=`${yb}="${wb}"`,Sb=(e={})=>{const t=vb(e);return t?`<style ${b4}>
33
33
  ${t}
34
- </style>`:""},n4=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),r4=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),hv=e=>!!e.id,wa=e=>t=>(t.tagName||"").toLowerCase()===e,Br=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),o4=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},Sa=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},Fo=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},Ti=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},Oi=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},s4=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),zp=(e,t,n="html")=>{const{Pages:r}=e,o=cn({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":Pl(o||t.getName())}.${n}`},a4=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},xc="custom-html-body",Ec="data-custom-html-body",gv="data-global-custom-html-head",mv="data-global-custom-html-body",vv="global",i4=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Wp(t.appStore);let a=o.querySelector(`[${gv}]`);a||(a=o.createElement("div"),a.setAttribute(gv,"true"),o.head.insertBefore(a,o.head.firstChild));const i=fv(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
35
- `);a.innerHTML=u,cg(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Wp(t.appStore);let a=o.querySelector(`[${mv}]`);if(!a){a=o.createElement("div"),a.setAttribute(mv,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",cg(a)};e.on(e.Canvas.events.frameLoad,o=>{var s;return n((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(e.Canvas.events.frameLoadBody,o=>{var s;return r((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(_n.pageSettingsUpdate,o=>{var a,i;if(o.page)return;const s=(i=(a=e.Canvas.getFrames()[0])==null?void 0:a.view)==null?void 0:i.getDoc();n(s),r(s)}),e.Components.addType(xc,{isComponent:o=>Ti(o,Ec),model:{defaults:{attributes:{[Ec]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:o}=t,{globalPageSettings:s}=o.projectDataCustom;let a=(s==null?void 0:s.customCodeHead)||"",i=(s==null?void 0:s.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),p=[];d.forEach(m=>{m.has(vv)&&p.push(m)}),p.forEach(m=>{const v=m.toHTML();a.includes(v)||(a+=v),m.remove()});const f=[];u.findType(xc).forEach(m=>{m.has(vv)&&f.push(m)}),f.forEach(m=>{const v=m.getInnerHTML();i.includes(v)||(i+=v),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},_i="page://",Pc="href-params__",l4=`data-gjs-${Pc}`,Tc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},Oc=e=>!!Tc(e),bv=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},c4=e=>!!(e!=null&&e.Components.getType("mjml")),yv=e=>Oc(e)?K.database:Up(e)?K.home:"",wv=e=>!!e.getSymbolOverride()?c.jsx(re,{icon:K.rhombusOutline,size:se.s3x}):c.jsx(M1,{className:N("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),Sv=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Up=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},ft={title:({cmp:e})=>e.tagName==="title",favicon:({cmp:e})=>{var t;return e.tagName==="link"&&((t=e.attributes.attributes)==null?void 0:t.rel)==="icon"},description:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="description"},keywords:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="keywords"},socialTitle:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:title"},socialImage:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:image"},socialDescription:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:description"},charset:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.charset)},viewport:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="viewport"},robots:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="robots"},generator:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="generator"}},Cv=e=>{for(const t in ft){const n=t;if(ft[n]({cmp:e}))return n}},xv=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(xc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},u4=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.forEach(u=>{ft.title({cmp:u})?(u.components(t.title),delete n.title):ft.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):ft.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):ft.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):ft.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):ft.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):ft.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):Cv(u)||a.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(i.remove(a),l.head.components&&i.add(l.head.components),delete n.customCodeHead)}const s=xv(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:xc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},d4=(e,t={})=>{var s;const n={...e.get("settings")??{}},r=e.getMainComponent(),{head:o}=r;if(o){const a=[];o.components().forEach(i=>{const{content:l,href:u}=i.getAttributes({noClass:!0,noStyle:!0});ft.title({cmp:i})?n.title=i.getInnerHTML():ft.favicon({cmp:i})?n.favicon=u:ft.description({cmp:i})?n.description=l:ft.keywords({cmp:i})?n.keywords=l:ft.socialTitle({cmp:i})?n.socialTitle=l:ft.socialDescription({cmp:i})?n.socialDescription=l:ft.socialImage({cmp:i})?n.socialImage=l:Cv(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
36
- `))}if(n.customCodeBody=xv(e,n.customCodeBody).html,t.replaceDataSources&&Tc(e)){const{currentItem:a}=((s=r.getCollectionsState)==null?void 0:s.call(r))||{};a&&Object.keys(n).forEach(i=>{const l=i,u=n[l];ct(u)&&(n[l]=Ev(u,a))})}return n},Ev=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const o=t[r.trim()];return o!==void 0?String(o):""}),Pv=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",o=cn({page:e,key:"slug"})??"",s=n?Ev(o,n):o,a=s.lastIndexOf("/"),i=a>=0,l=i?s.substring(a+1):s,u=i?s.substring(0,a):void 0,d=`${Pl(l)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},p4=(e,t)=>e.get(`${Pc}${t}`)||"",f4=(e,t,n)=>{e.set({[`${Pc}${t}`]:n})},h4=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${l4}${n}`]=r})},g4=(e,t)=>{e.getModel().set("customData",{...Ca(e),...t})},Ca=e=>e.getModel().get("customData")??{},Wp=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},cn=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?d4(t,a)[n]??s:Wp(r)[n]??o},Bo=(e,t,n)=>{const r=e.em.getEditor(),s=Ca(r).globalPageSettings||{};return cn({page:e,key:t,opts:n})||s[t]},Tv=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:cn({...r,key:"slug",defPage:Pl(n)}),title:cn({...r,key:"title",defPage:n}),description:cn({...r,key:"description"}),favicon:cn({...r,key:"favicon"}),keywords:cn({...r,key:"keywords"}),socialTitle:cn({...r,key:"socialTitle",defPage:n}),socialImage:cn({...r,key:"socialImage"}),socialDescription:cn({...r,key:"socialDescription"}),customCodeHead:cn({...r,key:"customCodeHead"}),customCodeBody:cn({...r,key:"customCodeBody"})}},_c=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${_n.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(ne.layoutRemove,{id:i,force:o})),a.runCommand(ne.layoutToggle,{...t})}}),Ov={type:"static",layoutId:"leftPanelsContainer"},_v={width:240,overflow:"hidden"};_c({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:_v,placer:Ov}}),_c({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:_v,placer:Ov}}),_c({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),_c({icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,10.11C13.03,10.11 13.87,10.95 13.87,12C13.87,13 13.03,13.85 12,13.85C10.97,13.85 10.13,13 10.13,12C10.13,10.95 10.97,10.11 12,10.11M7.37,20C8,20.38 9.38,19.8 10.97,18.3C10.45,17.71 9.94,17.07 9.46,16.4C8.64,16.32 7.83,16.2 7.06,16.04C6.55,18.18 6.74,19.65 7.37,20M8.08,14.26L7.79,13.75C7.68,14.04 7.57,14.33 7.5,14.61C7.77,14.67 8.07,14.72 8.38,14.77C8.28,14.6 8.18,14.43 8.08,14.26M14.62,13.5L15.43,12L14.62,10.5C14.32,9.97 14,9.5 13.71,9.03C13.17,9 12.6,9 12,9C11.4,9 10.83,9 10.29,9.03C10,9.5 9.68,9.97 9.38,10.5L8.57,12L9.38,13.5C9.68,14.03 10,14.5 10.29,14.97C10.83,15 11.4,15 12,15C12.6,15 13.17,15 13.71,14.97C14,14.5 14.32,14.03 14.62,13.5M12,6.78C11.81,7 11.61,7.23 11.41,7.5C11.61,7.5 11.8,7.5 12,7.5C12.2,7.5 12.39,7.5 12.59,7.5C12.39,7.23 12.19,7 12,6.78M12,17.22C12.19,17 12.39,16.77 12.59,16.5C12.39,16.5 12.2,16.5 12,16.5C11.8,16.5 11.61,16.5 11.41,16.5C11.61,16.77 11.81,17 12,17.22M16.62,4C16,3.62 14.62,4.2 13.03,5.7C13.55,6.29 14.06,6.93 14.54,7.6C15.36,7.68 16.17,7.8 16.94,7.96C17.45,5.82 17.26,4.35 16.62,4M15.92,9.74L16.21,10.25C16.32,9.96 16.43,9.67 16.5,9.39C16.23,9.33 15.93,9.28 15.62,9.23C15.72,9.4 15.82,9.57 15.92,9.74M17.37,2.69C18.84,3.53 19,5.74 18.38,8.32C20.92,9.07 22.75,10.31 22.75,12C22.75,13.69 20.92,14.93 18.38,15.68C19,18.26 18.84,20.47 17.37,21.31C15.91,22.15 13.92,21.19 12,19.36C10.08,21.19 8.09,22.15 6.62,21.31C5.16,20.47 5,18.26 5.62,15.68C3.08,14.93 1.25,13.69 1.25,12C1.25,10.31 3.08,9.07 5.62,8.32C5,5.74 5.16,3.53 6.62,2.69C8.09,1.85 10.08,2.81 12,4.64C13.92,2.81 15.91,1.85 17.37,2.69M17.08,12C17.42,12.75 17.72,13.5 17.97,14.26C20.07,13.63 21.25,12.73 21.25,12C21.25,11.27 20.07,10.37 17.97,9.74C17.72,10.5 17.42,11.25 17.08,12M6.92,12C6.58,11.25 6.28,10.5 6.03,9.74C3.93,10.37 2.75,11.27 2.75,12C2.75,12.73 3.93,13.63 6.03,14.26C6.28,13.5 6.58,12.75 6.92,12M15.92,14.26C15.82,14.43 15.72,14.6 15.62,14.77C15.93,14.72 16.23,14.67 16.5,14.61C16.43,14.33 16.32,14.04 16.21,13.75L15.92,14.26M13.03,18.3C14.62,19.8 16,20.38 16.62,20C17.26,19.65 17.45,18.18 16.94,16.04C16.17,16.2 15.36,16.32 14.54,16.4C14.06,17.07 13.55,17.71 13.03,18.3M8.08,9.74C8.18,9.57 8.28,9.4 8.38,9.23C8.07,9.28 7.77,9.33 7.5,9.39C7.57,9.67 7.68,9.96 7.79,10.25L8.08,9.74M10.97,5.7C9.38,4.2 8,3.62 7.37,4C6.74,4.35 6.55,5.82 7.06,7.96C7.83,7.8 8.64,7.68 9.46,7.6C9.94,6.93 10.45,6.29 10.97,5.7Z" /></svg>',tooltip:"Custom Component",className:"gs-utl-mt-auto",layout:{id:"customLayout",layout:{type:"custom",component:()=>c.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const m4={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var v4={NODE_ENV:"production"};class b4{constructor(t,n){var s,a;this.projectType=xt.web,this.editor=void 0,this.sdkProps={},this.sdkLicenseError="",this.licenseCheckRetry=0,this.showPoweredBy=!1,this.isInPreview=!1,this.isCssPanelActive=!1,this.isLeftSidebarOpen=!0,this.isRightSidebarOpen=!0,this.isTopSidebarOpen=!0,this.isBottomSidebarOpen=!0,this.isSelectingTarget=!1,this.leftSidebarSize=240,this.rightSidebarSize=240,this.transitionTime=152,this.topBarSize=36,this.isDev=!1,this.isStage=!1,this.editorKey=0,this.appInstalled=!1,this.licenseKey="",this.licenseCheckStarted=!1,this.studioSdkVersion=v4.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(i=>{const l=i,u=n[l];u!==void 0&&(this[l]=u)});const r=Un()?window.location.search:"";this.queryParams=vC(r),an(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&kP(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return Yu({isDev:t,isStage:n})}get projectId(){var r,o;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((o=(r=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:r.custom)==null?void 0:o.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:r}=this,{customConfig:o}=r.layoutStore,s=(o==null?void 0:o.responsive)||(t==null?void 0:t.responsive);let a=(o==null?void 0:o.default)||(t==null?void 0:t.default)||m4;if(n&&s){const l=Object.keys(s).map(Number).sort((u,d)=>u-d).find(u=>n<=u);a=l?s[l]:a}return a}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===xt.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,r=this.sdkIdentityId;if(!n||!r)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Fp.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Fp.cloud}get publicStateTheme(){const{theme:t,resolvedTheme:n}=this.store.localSettingsStore;return{theme:t,resolvedTheme:n}}setPublicStateTheme(t){t.theme!==void 0&&(this.store.localSettingsStore.theme=t.theme)}*init(){var p,f;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:o}=t.localSettingsStore,s=(p=n.project)==null?void 0:p.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(f=(yield rv(o)).find(m=>m.id===r))==null?void 0:f.data),i?l=i:a?l=a:s&&(l=s);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:r,data:o,isTemplate:s}=t,a=n.Storage.getConfig().options.local,i=s?`${r}__${bC()}`:r;this._projectId=i,a.key=i,mC(o)||this.loadProjectData({...o,custom:{...o.custom,id:i,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||xt.web,this.editor&&g4(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(y4(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const r=this.editor;r.loadProjectData(t),r.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:r,studioSdkVersion:o}=this;t==null||t.trigger(QS,{baseApiUrl:r});const s=yield jr.post(`${r}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:o}});if(s instanceof Error)throw s;const a=s.result||{},{license:i,error:l,plan:u,info:d}=a;this.licensePlan=u,this.loadsInfo=d,l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Zu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Zu,{}))}}*updateStudio(){const{pluginStore:t}=this.store,{projectType:n}=this.projectDataCustom;yield t.initProjectPlugins(n),this.setEditor(),this.editorKey++}refreshStudio(){var t;this.editorKey&&(this.setNextProjectData((t=this.editor)==null?void 0:t.getProjectData()),this.store.layoutStore.clear(),this.setEditor(),this.editorKey++)}refreshEditorCanvas(){var t;(t=this.editor)==null||t.refresh({tools:!0})}}const y4=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||xt.web},ye=()=>Pn().appEditorStore,Av=()=>Jh().appEditorStore,w4=()=>{try{return Jh().appEditorStore}catch{}},Gp=()=>{const[e,t]=h.useState(0),n=Pn().appEditorStore,{transitionTime:r}=n;return h.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},qp=()=>{const{baseApiUrl:e}=Av();return`${e}/assets/sdk`},S4=e=>`${qp()}/${e}`,C4=async(e,t,n)=>{const r=await jr.get(qp(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((r==null?void 0:r.result)??[]).map(({asset:o,cdnUrl:s})=>({...o,size:parseInt(o.size),src:s}))},x4=async(e,t,n,r)=>{const o=await jr.post(qp(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},E4=async(e,t)=>await jr.put(t,{body:e,rawText:!0}),P4=async(e,t,n,r)=>Promise.all(e.map(o=>x4({name:o.name,size:o.size,type:o.type},t,n,r).then(async s=>{if(!s)throw new Error("No asset");const{asset:a,cdnUrl:i,uploadUrl:l}=s,u=await E4(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:$s.image}}))),T4=async(e,t,n,r)=>{const o=await jr.delete(S4(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},Lv=async(e,t,n,r)=>Promise.all(e.map(o=>T4(o.id||o.src,t,n,r)));function zo(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const p=Date.now()-a;p<l&&p>=0?r=setTimeout(u,l-p):(r=null,i=e.apply(s,o),s=o=null)}const d=function(){return s=this,o=arguments,a=Date.now(),r||(r=setTimeout(u,l)),i};return d.clear=function(){r&&(clearTimeout(r),r=null)},d.flush=function(){r&&(i=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},d}class Mv{constructor(t,n){this.assetsStore=t,this.layoutPanelId=n,this.itemLayout=void 0,this.isLoadingAssets=!1,this.typeFilter=void 0,this.searchValue="",this.customTypes=void 0,this.customProviders=void 0,this.providerFilter=void 0,this.customAssetProps=void 0,this.customPages=void 0,this.totalItems=void 0,this.optionalType=!1,this.optionalProvider=!0,an(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=zo(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(r=>r.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter($s.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var i,l,u,d;const{assetsStore:n}=this,{editor:r}=n;if(!r||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const o=((i=this.customPages)==null?void 0:i.length)??0,s=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,a=await this.provider.onLoad({editor:r,assetTypeFilter:this.typeFilter,pageIndex:o,searchValue:this.searchValue,pageCustomData:s})??[];if(Array.isArray(a)){const p=a.map(n.toAssetProps);this.setCustomAssetProps(p)}else{const p={...a,items:a.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],p])}this.setItemLayout((d=this.provider)==null?void 0:d.itemLayout)}async loadAssets(t=!0){const{assetsStore:n}=this,{toastStore:r}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(o){console.error(o),r.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:r}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&r&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:r}=this,{appEditorStore:o}=n.store,{editor:s}=o;if(!(!s||!r))try{n.setIsLoadingAssets(!0),await r({assets:[n.toAsset(t)],assetProps:[t],editor:s,loadAssets:a=>this.reloadAssets(a)})}catch(a){console.error(a),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:a==null?void 0:a.message})}finally{n.setIsLoadingAssets(!1)}}}const Nv=e=>Pn().assetsStore.assetPanelStores[e];class O4{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${ev()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new Mv(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),an(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===jp.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===jp.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,o=n.options.licenseKey,s=t.sdkProjectId,a=t.sdkIdentityId,i=({files:l})=>P4(l,o,s,a);return this.isUsingAssetCloud?i:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:r}=this;return n?t?async o=>{await t(o),this.deleteFromProjectAssets(o)}:void 0:r?async o=>{var l,u;const{sdkOptions:s}=this.store.appEditorStore,a=(l=s.project)==null?void 0:l.id,i=(u=s.identity)==null?void 0:u.id;await Lv(o.assetProps,s.licenseKey,a,i),this.deleteFromProjectAssets(o)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var i,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,r=(i=n.project)==null?void 0:i.id,o=(l=n.identity)==null?void 0:l.id,s=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:$s.image,onLoad:()=>C4(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await Lv(d,s,r,o),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=zo(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const r=n.Assets.events.all;n.on(r,t),this.loadProjectAssets()}addSdkProviders(){var r;const t=((r=this.sdkAssetConfig)==null?void 0:r.providers)??[],n=et(t)?t({providers:pr(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const r=[...this.allProviders];let o=this.allProviders.findIndex(a=>a.id===t.id);const s=o!==-1;r.splice(n,0,t),s&&(o>=n&&(o+=1),r.splice(o,1)),this.setAllProviders(r)}hasType(t){return!!this.allProviders.find(n=>ct(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new Mv(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:r,customOnLoad:o}=this,{toastStore:s}=this.store;let a;if(t){try{if(this.setIsLoadingAssets(!0),n&&o)if(r)a=r;else{const i=await o({editor:t});this.cachedOnLoadAssetProps=i.map(this.toAssetProps),a=this.cachedOnLoadAssetProps}else a=t.Assets.getAll().map(this.toAssetProps)}catch(i){console.error(i),s.addError("assets-error-load",{header:this.t("errorLoad"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}a&&this.setProjectAssetProps(a)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:r}){const{cachedOnLoadAssetProps:o,customOnLoad:s}=this;if(s){if(o){const a=r.map(i=>i.id);this.cachedOnLoadAssetProps=o.filter(({id:i})=>!a.includes(i)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(a=>n.Assets.remove(a)),bv(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:r,customOnLoad:o}=this;o?r&&(this.cachedOnLoadAssetProps=[...t,...r],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),bv(n))}async handleUpload(t){var s,a;const{editor:n,onCloudOrCustomUpload:r}=this,{toastStore:o}=this.store;if(!(!n||!r))try{this.setIsLoadingAssets(!0);const i=((s=t.dataTransfer)==null?void 0:s.files)||((a=t.target)==null?void 0:a.files)||[],l=Array.from(i),u=await r({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(i){console.error(i),o.addError("assets-error-upload",{header:this.t("errorUpload"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const r=t;return{...r.attributes,id:r.attributes.id||r.getSrc(),src:r.getSrc(),name:r.attributes.name??r.getFilename(),type:r.attributes.type??r.getType()??$s.image,asset:r}}return{...t,type:t.type||$s.image,id:t.id||t.src}}toAsset(t){const{editor:n}=this.store.appEditorStore;if(n)return t.asset??new n.AssetManager.Asset(t)}setProjectAssetProps(t){this.projectAssetProps=t}setIsLoadingAssets(t){this.isLoadingAssets=t}setAllProviders(t){this.allProviders=t}}const Ai=()=>Pn().assetsStore;class _4{constructor(t){var r;this.store=t,this.fonts={},an(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=et(n)?n({baseDefault:cv}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>ct(t)?{id:t,label:t}:hv(t)?t:null).filter(t=>!!t):cv}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!ct(n)&&!hv(n)).map(n=>Pi(n.family,n)):[]}get sortedFonts(){return n4(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return r4([...this.staticFonts,...Object.values(this.fonts).map(t)])}get sdkFontOptions(){return this.store.appEditorStore.sdkOptions.fonts}get enableFontManager(){var t;return(t=this.sdkFontOptions)==null?void 0:t.enableFontManager}get sdkShowProjectFonts(){const{showProjectFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ht(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ht(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=Ca(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=Pi(o,s);this.addFont(a,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=ks(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=Pi(t.family,t),{editor:s}=this.store.appEditorStore;if(!s)return;const{family:a}=o;!r&&this.fonts[a]||(this.fonts[a]=o,n||this.updateProjectFonts(s))}removeFont(t){t=ks(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...Ca(t).globalPageSettings,fonts:pr(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),Sv(t),t.trigger(_n.pageSettingsUpdate,{data:r})}}const Li=()=>Pn().fontsStore;class A4{constructor(t){this.store=t,an(this,{},{autoBind:!0})}t(t,n={}){var o;const{editor:r}=this.store.appEditorStore;return((o=r==null?void 0:r.I18n)==null?void 0:o.t(t,n))||""}tScoped(t){return(n,r)=>this.t(`${t}.${n}`,r)}}const Ie=()=>Pn().i18nStore,Rn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),$v="gs-custom-layout",L4=qt(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=ye(),d=h.useRef(null),p=n,f=p&&u?c.jsx(p,{...a,editor:u}):null,g=N($v,o&&`${$v}__${o}`,t),m=r&&!s;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const v=d.current;if(!s||!v)return;const b=S=>v.appendChild(S),w=S=>v.removeChild(S),y=s({editor:u,addEl:b,removeEl:w});if(ct(y))v.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{w(y)};if(et(y))return()=>{y()}}},[s,u,d.current]),m?f:c.jsx("div",{className:g,ref:d,...i,children:f})}),Kp=ce(L4),M4=(e,t,n)=>{const r=e==null?void 0:e[t];return r&&r({props:n.props,editor:n.editor})||n.props};class N4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,an(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}get layoutOverrides(){var r,o;const t=(r=this.store.appEditorStore.sdkLayoutConfig)==null?void 0:r.overrides,n=(o=this.customConfig)==null?void 0:o.overrides;return{...t,...n}}getOverrideProps(t,n){return M4(this.layoutOverrides,t,{props:n.props,editor:n.editor??this.editor})}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${_n.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var o;const r=n==null?void 0:n.layout;r&&this.layouts.forEach(s=>{s.id===t&&Object.assign(s,r)}),this.layouts=n!=null&&n.force?this.layouts.filter(s=>s.id!==t):this.layouts.map(s=>s.id===t?{...s,toRemove:!0}:s),(o=this.editor)==null||o.trigger(`${_n.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var r;const{children:t}=this.store.appEditorStore.sdkProps,n=((r=Rn(t,Kp))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const Ac=()=>Pn().layoutStore,$4=()=>Jh().layoutStore;class k4{constructor(t){this.isActive=!1,this.content="",this.store=t,an(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class I4{constructor(t){this.store=t,this._projectSourceFilter=xi.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,an(this,{},{autoBind:!0})}get projectTypeFilter(){return this._projectTypeFilter}get projectSourceFilter(){return this._projectSourceFilter}get templates(){return this._loadedTemplates}get projects(){return this._loadedProjects}get filteredTemplates(){return this.projectSourceFilter===xi.Existing?this.projects:this.templates}async loadProjects(){const t=await rv(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var o;const t=(o=this.store.appEditorStore.sdkOptions.templates)==null?void 0:o.onLoad,n=async()=>await V3(this.projectTypeFilter);let r;if(t){const s=this.store.appEditorStore.editor;r=await t({editor:s,fetchCommunityTemplates:n})}else r=await n();this.setTemplates(r)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){$3(wc.Projects,t)}async setProjectTypeFilter(t){this._projectTypeFilter=t,this.setProjects(void 0),this.setTemplates(void 0)}setProjectSourceFilter(t){this._projectSourceFilter=t}setTemplates(t){this._loadedTemplates=t}setProjects(t){this._loadedProjects=t}}const kv=()=>Pn().templatesStore;class V4{constructor(t){this.toasts=[],this.store=t,an(this,{},{autoBind:!0})}add(t,n){this.toasts.find(r=>r.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Error})}addWarning(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Warning})}addSuccess(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Success})}addInfo(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class H4{constructor(t){this.isOpen=!1,this.store=t,an(this,{},{autoBind:!0})}setOpen(t){this.isOpen=t,this.triggerEvent()}toggleOpen(){this.isOpen=!this.isOpen,this.triggerEvent()}triggerEvent(){var t;(t=this.store.appEditorStore.editor)==null||t.trigger(_n.toggleBlocksPanel,{isOpen:this.isOpen})}}const j4=()=>Pn().blockManagerStore,Iv=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",D4=Iv+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F4="["+Iv+"]["+D4+"]*",B4=new RegExp("^"+F4+"$");function Vv(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let a=0;a<s;a++)o.push(r[a]);n.push(o),r=t.exec(e)}return n}const Lc=function(e){const t=B4.exec(e);return!(t===null||typeof t>"u")};function z4(e){return typeof e<"u"}const U4={allowBooleanAttributes:!1,unpairedTags:[]};function W4(e,t){t=Object.assign({},U4,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let s=0;s<e.length;s++)if(e[s]==="<"&&e[s+1]==="?"){if(s+=2,s=jv(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=Dv(e,s);continue}else{let i=!1;e[s]==="/"&&(i=!0,s++);let l="";for(;s<e.length&&e[s]!==">"&&e[s]!==" "&&e[s]!==" "&&e[s]!==`
37
- `&&e[s]!=="\r";s++)l+=e[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!Q4(l)){let p;return l.trim().length===0?p="Invalid space after '<'.":p="Tag '"+l+"' is an invalid name.",$t("InvalidTag",p,un(e,s))}const u=K4(e,s);if(u===!1)return $t("InvalidAttr","Attributes for '"+l+"' have open quote.",un(e,s));let d=u.value;if(s=u.index,d[d.length-1]==="/"){const p=s-d.length;d=d.substring(0,d.length-1);const f=Fv(d,t);if(f===!0)r=!0;else return $t(f.err.code,f.err.msg,un(e,p+f.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return $t("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",un(e,a));if(n.length===0)return $t("InvalidTag","Closing tag '"+l+"' has not been opened.",un(e,a));{const p=n.pop();if(l!==p.tagName){let f=un(e,p.tagStartPos);return $t("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+l+"'.",un(e,a))}n.length==0&&(o=!0)}}else return $t("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",un(e,s));else{const p=Fv(d,t);if(p!==!0)return $t(p.err.code,p.err.msg,un(e,s-d.length+p.err.line));if(o===!0)return $t("InvalidXml","Multiple possible root nodes found.",un(e,s));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="!"){s++,s=Dv(e,s);continue}else if(e[s+1]==="?"){if(s=jv(e,++s),s.err)return s}else break;else if(e[s]==="&"){const p=X4(e,s);if(p==-1)return $t("InvalidChar","char '&' is not expected.",un(e,s));s=p}else if(o===!0&&!Hv(e[s]))return $t("InvalidXml","Extra text at the end",un(e,s));e[s]==="<"&&s--}}else{if(Hv(e[s]))continue;return $t("InvalidChar","char '"+e[s]+"' is not expected.",un(e,s))}if(r){if(n.length==1)return $t("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",un(e,n[0].tagStartPos));if(n.length>0)return $t("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return $t("InvalidXml","Start tag expected.",1);return!0}function Hv(e){return e===" "||e===" "||e===`
38
- `||e==="\r"}function jv(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return $t("InvalidXml","XML declaration allowed only at the start of the document.",un(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Dv(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const G4='"',q4="'";function K4(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===G4||e[t]===q4)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const Z4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Fv(e,t){const n=Vv(e,Z4),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return $t("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",Mi(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return $t("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",Mi(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return $t("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",Mi(n[o]));const s=n[o][2];if(!J4(s))return $t("InvalidAttr","Attribute '"+s+"' is an invalid name.",Mi(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return $t("InvalidAttr","Attribute '"+s+"' is repeated.",Mi(n[o]))}return!0}function Y4(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function X4(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Y4(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function $t(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function J4(e){return Lc(e)}function Q4(e){return Lc(e)}function un(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Mi(e){return e.startIndex+e[1].length}const R4={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},eL=function(e){return Object.assign({},R4,e)};let Mc;typeof Symbol!="function"?Mc="@@xmlMetadata":Mc=Symbol("XML Node Metadata");class Is{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][Mc]={startIndex:n})}static getMetaDataSymbol(){return Mc}}class tL{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,s=!1,a=!1,i="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Vs(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(s&&Vs(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Vs(t,"!ATTLIST",n))n+=8;else if(s&&Vs(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Vs(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");o++,i=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,o--):o--,o===0)break}else t[n]==="["?s=!0:i+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Ni(r),n=Cn(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Ni(r),n=Cn(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=Cn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Cn(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const s=t[n];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(n++;n<t.length&&t[n]!==s;)o+=t[n],n++;if(t[n]!==s)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Lc(r))throw new Error(`Invalid element name: "${r}"`);n=Cn(t,n);let o="";if(t[n]==="E"&&Vs(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Vs(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Ni(r),n=Cn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Ni(o))throw new Error(`Invalid attribute name: "${o}"`);n=Cn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=Cn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let i=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Ni(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=Cn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+i.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=Cn(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:s,defaultValue:a,index:n}}}const Cn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Vs(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Ni(e){if(Lc(e))return e;throw new Error(`Invalid entity name ${e}`)}const nL=/^[-+]?0x[a-fA-F0-9]+$/,rL=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,oL={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function sL(e,t={}){if(t=Object.assign({},oL,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&nL.test(n))return cL(n,16);if(n.search(/.+[eE].+/)!==-1)return iL(e,n,t);{const r=rL.exec(n);if(r){const o=r[1]||"",s=r[2];let a=lL(r[3]);const i=o?e[s.length+1]===".":e[s.length]===".";if(!t.leadingZeros&&(s.length>1||s.length===1&&!i))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===a||u===`${o}${a}`?l:e;let d=s?a:n;return s?d===u||o+d===u?l:e:d===u||d===o+u?l:e}}else return e}}const aL=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function iL(e,t,n){if(!n.eNotation)return e;const r=t.match(aL);if(r){let o=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&i?e:a.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(t):n.leadingZeros&&!i?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function lL(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function cL(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Bv(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class uL{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=dL,this.parseXml=mL,this.parseTextData=pL,this.resolveNameSpace=fL,this.buildAttributesMap=gL,this.isItStopNode=wL,this.replaceEntitiesValue=bL,this.readStopNodeData=CL,this.saveTextToParentTag=yL,this.addChild=vL,this.ignoreAttributesFn=Bv(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function dL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function pL(e,t,n,r,o,s,a){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return i==null?e:typeof i!=typeof e||i!==e?i:this.options.trimValues?Yp(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Yp(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function fL(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const hL=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function gL(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Vv(e,hL),o=r.length,s={};for(let a=0;a<o;a++){const i=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(i,t))continue;let l=r[a][4],u=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(i,l,t);d==null?s[u]=l:typeof d!=typeof l||d!==l?s[u]=d:s[u]=Yp(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const mL=function(e){e=e.replace(/\r\n?/g,`
39
- `);const t=new Is("!xml");let n=t,r="",o="";const s=new tL(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=Hs(e,">",a,"Closing Tag is not closed.");let u=e.substring(a+2,l).trim();if(this.options.removeNSPrefix){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,o));const d=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),n=this.tagsNodeStack.pop(),r="",a=l}else if(e[a+1]==="?"){let l=Zp(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new Is(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(n,u,o,a)}a=l.closeIndex+1}else if(e.substr(a+1,3)==="!--"){const l=Hs(e,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(a+4,l-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}a=l}else if(e.substr(a+1,2)==="!D"){const l=s.readDocType(e,a);this.docTypeEntities=l.entities,a=l.i}else if(e.substr(a+1,2)==="!["){const l=Hs(e,"]]>",a,"CDATA is not closed.")-2,u=e.substring(a+9,l);r=this.saveTextToParentTag(r,n,o);let d=this.parseTextData(u,n.tagname,o,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),a=l+2}else{let l=Zp(e,a,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,f=l.attrExpPresent,g=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==t.tagname&&(o+=o?"."+u:u);const v=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let b="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),a=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)a=l.closeIndex;else{const y=this.readStopNodeData(e,d,g+1);if(!y)throw new Error(`Unexpected end of ${d}`);a=y.i,b=y.tagContent}const w=new Is(u);u!==p&&f&&(w[":@"]=this.buildAttributesMap(p,o,u)),b&&(b=this.parseTextData(b,u,o,!0,f,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,b),this.addChild(n,w,o,v)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new Is(u);u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,b,o,v),o=o.substr(0,o.lastIndexOf("."))}else{const b=new Is(u);this.tagsNodeStack.push(n),u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,b,o,v),n=b}r="",a=g}}else r+=e[a];return t.child};function vL(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const bL=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function yL(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function wL(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function SL(e,t,n=">"){let r,o="";for(let s=t;s<e.length;s++){let a=e[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(e[s+1]===n[1])return{data:o,index:s}}else return{data:o,index:s};else a===" "&&(a=" ");o+=a}}function Hs(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Zp(e,t,n,r=">"){const o=SL(e,t+1,r);if(!o)return;let s=o.data;const a=o.index,i=s.search(/\s/);let l=s,u=!0;i!==-1&&(l=s.substring(0,i),s=s.substring(i+1).trimStart());const d=l;if(n){const p=l.indexOf(":");p!==-1&&(l=l.substr(p+1),u=l!==o.data.substr(p+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function CL(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=Hs(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i:s};n=s}else if(e[n+1]==="?")n=Hs(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Hs(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Hs(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Zp(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function Yp(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:sL(e,n)}else return z4(e)?e:""}const Xp=Is.getMetaDataSymbol();function xL(e,t){return zv(e,t)}function zv(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=EL(a);let l="";if(n===void 0?l=i:l=n+"."+i,i===t.textNodeName)r===void 0?r=a[i]:r+=""+a[i];else{if(i===void 0)continue;if(a[i]){let u=zv(a[i],t,l);const d=TL(u,t);a[Xp]!==void 0&&(u[Xp]=a[Xp]),a[":@"]?PL(u,a[":@"],l,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),o[i]!==void 0&&o.hasOwnProperty(i)?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(u)):t.isArray(i,l,d)?o[i]=[u]:o[i]=u}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function EL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function PL(e,t,n,r){if(t){const o=Object.keys(t),s=o.length;for(let a=0;a<s;a++){const i=o[a];r.isArray(i,n+"."+i,!0,!0)?e[i]=[t[i]]:e[i]=t[i]}}}function TL(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class OL{constructor(t){this.externalEntities={},this.options=eL(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const s=W4(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new uL(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:xL(o,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Is.getMetaDataSymbol()}}const _L=`
40
- `;function AL(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=_L),Uv(e,t,"",n)}function Uv(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=LL(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];ML(u,t)||(m=t.tagValueProcessor(l,m),m=Gv(m,t)),s&&(o+=r),o+=m,s=!1;continue}else if(l===t.cdataPropName){s&&(o+=r),o+=`<![CDATA[${i[l][0][t.textNodeName]}]]>`,s=!1;continue}else if(l===t.commentPropName){o+=r+`<!--${i[l][0][t.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const m=Wv(i[":@"],t),v=l==="?xml"?"":r;let b=i[l][0][t.textNodeName];b=b.length!==0?" "+b:"",o+=v+`<${l}${b}${m}?>`,s=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const p=Wv(i[":@"],t),f=r+`<${l}${p}`,g=Uv(i[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!g||g.length===0)&&t.suppressEmptyNode?o+=f+"/>":g&&g.endsWith(">")?o+=f+`>${g}${r}</${l}>`:(o+=f+">",g&&r!==""&&(g.includes("/>")||g.includes("</"))?o+=r+t.indentBy+g+r:o+=g,o+=`</${l}>`),s=!0}return o}function LL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function Wv(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=Gv(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function ML(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Gv(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const NL={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Uo(e){this.options=Object.assign({},NL,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Bv(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=IL),this.processTextOrObjNode=$L,this.options.format?(this.indentate=kL,this.tagEndChar=`>
34
+ </style>`:""},v4=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),y4=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),Cb=e=>!!e.id,Sa=e=>t=>(t.tagName||"").toLowerCase()===e,Wr=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),w4=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},Ca=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},Uo=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},_i=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},Ai=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},S4=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),Kp=(e,t,n="html")=>{const{Pages:r}=e,o=cn({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":Al(o||t.getName())}.${n}`},C4=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},Oc="custom-html-body",_c="data-custom-html-body",xb="data-global-custom-html-head",Eb="data-global-custom-html-body",Pb="global",x4=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Yp(t.appStore);let a=o.querySelector(`[${xb}]`);a||(a=o.createElement("div"),a.setAttribute(xb,"true"),o.head.insertBefore(a,o.head.firstChild));const i=Sb(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
35
+ `);a.innerHTML=u,mh(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Yp(t.appStore);let a=o.querySelector(`[${Eb}]`);if(!a){a=o.createElement("div"),a.setAttribute(Eb,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",mh(a)};e.on(e.Canvas.events.frameLoad,o=>{var s;return n((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(e.Canvas.events.frameLoadBody,o=>{var s;return r((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(_n.pageSettingsUpdate,o=>{var a,i;if(o.page)return;const s=(i=(a=e.Canvas.getFrames()[0])==null?void 0:a.view)==null?void 0:i.getDoc();n(s),r(s)}),e.Components.addType(Oc,{isComponent:o=>_i(o,_c),model:{defaults:{attributes:{[_c]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:o}=t,{globalPageSettings:s}=o.projectDataCustom;let a=(s==null?void 0:s.customCodeHead)||"",i=(s==null?void 0:s.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),p=[];d.forEach(m=>{m.has(Pb)&&p.push(m)}),p.forEach(m=>{const b=m.toHTML();a.includes(b)||(a+=b),m.remove()});const f=[];u.findType(Oc).forEach(m=>{m.has(Pb)&&f.push(m)}),f.forEach(m=>{const b=m.getInnerHTML();i.includes(b)||(i+=b),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},Mi="page://",Ac="href-params__",E4=`data-gjs-${Ac}`,Mc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},Lc=e=>!!Mc(e),Tb=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},Ob=e=>!!(e!=null&&e.Components.getType("mjml")),_b=e=>Lc(e)?K.database:Zp(e)?K.home:"",Ab=e=>!!e.getSymbolOverride()?c.jsx(ne,{icon:K.rhombusOutline,size:se.s3x}):c.jsx(D1,{className:N("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),Mb=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Zp=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},gt={title:({cmp:e})=>e.tagName==="title",favicon:({cmp:e})=>{var t;return e.tagName==="link"&&((t=e.attributes.attributes)==null?void 0:t.rel)==="icon"},description:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="description"},keywords:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="keywords"},socialTitle:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:title"},socialImage:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:image"},socialDescription:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:description"},charset:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.charset)},viewport:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="viewport"},robots:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="robots"},generator:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="generator"}},Lb=e=>{for(const t in gt){const n=t;if(gt[n]({cmp:e}))return n}},Nb=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(Oc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},P4=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.forEach(u=>{gt.title({cmp:u})?(u.components(t.title),delete n.title):gt.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):gt.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):gt.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):gt.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):gt.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):gt.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):Lb(u)||a.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(i.remove(a),l.head.components&&i.add(l.head.components),delete n.customCodeHead)}const s=Nb(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:Oc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},T4=(e,t={})=>{var s;const n={...e.get("settings")??{}},r=e.getMainComponent(),{head:o}=r;if(o){const a=[];o.components().forEach(i=>{const{content:l,href:u}=i.getAttributes({noClass:!0,noStyle:!0});gt.title({cmp:i})?n.title=i.getInnerHTML():gt.favicon({cmp:i})?n.favicon=u:gt.description({cmp:i})?n.description=l:gt.keywords({cmp:i})?n.keywords=l:gt.socialTitle({cmp:i})?n.socialTitle=l:gt.socialDescription({cmp:i})?n.socialDescription=l:gt.socialImage({cmp:i})?n.socialImage=l:Lb(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
36
+ `))}if(n.customCodeBody=Nb(e,n.customCodeBody).html,t.replaceDataSources&&Mc(e)){const{currentItem:a}=((s=r.getCollectionsState)==null?void 0:s.call(r))||{};a&&Object.keys(n).forEach(i=>{const l=i,u=n[l];dt(u)&&(n[l]=$b(u,a))})}return n},$b=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const o=t[r.trim()];return o!==void 0?String(o):""}),kb=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",o=cn({page:e,key:"slug"})??"",s=n?$b(o,n):o,a=s.lastIndexOf("/"),i=a>=0,l=i?s.substring(a+1):s,u=i?s.substring(0,a):void 0,d=`${Al(l)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},O4=(e,t)=>e.get(`${Ac}${t}`)||"",_4=(e,t,n)=>{e.set({[`${Ac}${t}`]:n})},A4=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${E4}${n}`]=r})},M4=(e,t)=>{e.getModel().set("customData",{...xa(e),...t})},xa=e=>e.getModel().get("customData")??{},Yp=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},cn=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?T4(t,a)[n]??s:Yp(r)[n]??o},Wo=(e,t,n)=>{const r=e.em.getEditor(),s=xa(r).globalPageSettings||{};return cn({page:e,key:t,opts:n})||s[t]},Ib=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:cn({...r,key:"slug",defPage:Al(n)}),title:cn({...r,key:"title",defPage:n}),description:cn({...r,key:"description"}),favicon:cn({...r,key:"favicon"}),keywords:cn({...r,key:"keywords"}),socialTitle:cn({...r,key:"socialTitle",defPage:n}),socialImage:cn({...r,key:"socialImage"}),socialDescription:cn({...r,key:"socialDescription"}),customCodeHead:cn({...r,key:"customCodeHead"}),customCodeBody:cn({...r,key:"customCodeBody"})}},Nc=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${_n.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(te.layoutRemove,{id:i,force:o})),a.runCommand(te.layoutToggle,{...t})}}),Vb={type:"static",layoutId:"leftPanelsContainer"},Hb={width:240,overflow:"hidden"};Nc({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:Hb,placer:Vb}}),Nc({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:Hb,placer:Vb}}),Nc({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Nc({icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,10.11C13.03,10.11 13.87,10.95 13.87,12C13.87,13 13.03,13.85 12,13.85C10.97,13.85 10.13,13 10.13,12C10.13,10.95 10.97,10.11 12,10.11M7.37,20C8,20.38 9.38,19.8 10.97,18.3C10.45,17.71 9.94,17.07 9.46,16.4C8.64,16.32 7.83,16.2 7.06,16.04C6.55,18.18 6.74,19.65 7.37,20M8.08,14.26L7.79,13.75C7.68,14.04 7.57,14.33 7.5,14.61C7.77,14.67 8.07,14.72 8.38,14.77C8.28,14.6 8.18,14.43 8.08,14.26M14.62,13.5L15.43,12L14.62,10.5C14.32,9.97 14,9.5 13.71,9.03C13.17,9 12.6,9 12,9C11.4,9 10.83,9 10.29,9.03C10,9.5 9.68,9.97 9.38,10.5L8.57,12L9.38,13.5C9.68,14.03 10,14.5 10.29,14.97C10.83,15 11.4,15 12,15C12.6,15 13.17,15 13.71,14.97C14,14.5 14.32,14.03 14.62,13.5M12,6.78C11.81,7 11.61,7.23 11.41,7.5C11.61,7.5 11.8,7.5 12,7.5C12.2,7.5 12.39,7.5 12.59,7.5C12.39,7.23 12.19,7 12,6.78M12,17.22C12.19,17 12.39,16.77 12.59,16.5C12.39,16.5 12.2,16.5 12,16.5C11.8,16.5 11.61,16.5 11.41,16.5C11.61,16.77 11.81,17 12,17.22M16.62,4C16,3.62 14.62,4.2 13.03,5.7C13.55,6.29 14.06,6.93 14.54,7.6C15.36,7.68 16.17,7.8 16.94,7.96C17.45,5.82 17.26,4.35 16.62,4M15.92,9.74L16.21,10.25C16.32,9.96 16.43,9.67 16.5,9.39C16.23,9.33 15.93,9.28 15.62,9.23C15.72,9.4 15.82,9.57 15.92,9.74M17.37,2.69C18.84,3.53 19,5.74 18.38,8.32C20.92,9.07 22.75,10.31 22.75,12C22.75,13.69 20.92,14.93 18.38,15.68C19,18.26 18.84,20.47 17.37,21.31C15.91,22.15 13.92,21.19 12,19.36C10.08,21.19 8.09,22.15 6.62,21.31C5.16,20.47 5,18.26 5.62,15.68C3.08,14.93 1.25,13.69 1.25,12C1.25,10.31 3.08,9.07 5.62,8.32C5,5.74 5.16,3.53 6.62,2.69C8.09,1.85 10.08,2.81 12,4.64C13.92,2.81 15.91,1.85 17.37,2.69M17.08,12C17.42,12.75 17.72,13.5 17.97,14.26C20.07,13.63 21.25,12.73 21.25,12C21.25,11.27 20.07,10.37 17.97,9.74C17.72,10.5 17.42,11.25 17.08,12M6.92,12C6.58,11.25 6.28,10.5 6.03,9.74C3.93,10.37 2.75,11.27 2.75,12C2.75,12.73 3.93,13.63 6.03,14.26C6.28,13.5 6.58,12.75 6.92,12M15.92,14.26C15.82,14.43 15.72,14.6 15.62,14.77C15.93,14.72 16.23,14.67 16.5,14.61C16.43,14.33 16.32,14.04 16.21,13.75L15.92,14.26M13.03,18.3C14.62,19.8 16,20.38 16.62,20C17.26,19.65 17.45,18.18 16.94,16.04C16.17,16.2 15.36,16.32 14.54,16.4C14.06,17.07 13.55,17.71 13.03,18.3M8.08,9.74C8.18,9.57 8.28,9.4 8.38,9.23C8.07,9.28 7.77,9.33 7.5,9.39C7.57,9.67 7.68,9.96 7.79,10.25L8.08,9.74M10.97,5.7C9.38,4.2 8,3.62 7.37,4C6.74,4.35 6.55,5.82 7.06,7.96C7.83,7.8 8.64,7.68 9.46,7.6C9.94,6.93 10.45,6.29 10.97,5.7Z" /></svg>',tooltip:"Custom Component",className:"gs-utl-mt-auto",layout:{id:"customLayout",layout:{type:"custom",component:()=>c.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const L4={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var N4={NODE_ENV:"production"};class $4{constructor(t,n){var s,a;this.projectType=Et.web,this.editor=void 0,this.sdkProps={},this.sdkLicenseError="",this.licenseCheckRetry=0,this.showPoweredBy=!1,this.isInPreview=!1,this.isCssPanelActive=!1,this.isLeftSidebarOpen=!0,this.isRightSidebarOpen=!0,this.isTopSidebarOpen=!0,this.isBottomSidebarOpen=!0,this.isSelectingTarget=!1,this.leftSidebarSize=240,this.rightSidebarSize=240,this.transitionTime=152,this.topBarSize=36,this.isDev=!1,this.isStage=!1,this.editorKey=0,this.appInstalled=!1,this.licenseKey="",this.licenseCheckStarted=!1,this.studioSdkVersion=N4.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(i=>{const l=i,u=n[l];u!==void 0&&(this[l]=u)});const r=Wn()?window.location.search:"";this.queryParams=LC(r),an(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&ZP(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return Ru({isDev:t,isStage:n})}get projectId(){var r,o;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((o=(r=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:r.custom)==null?void 0:o.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:r}=this,{customConfig:o}=r.layoutStore,s=(o==null?void 0:o.responsive)||(t==null?void 0:t.responsive);let a=(o==null?void 0:o.default)||(t==null?void 0:t.default)||L4;if(n&&s){const l=Object.keys(s).map(Number).sort((u,d)=>u-d).find(u=>n<=u);a=l?s[l]:a}return a}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===Et.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,r=this.sdkIdentityId;if(!n||!r)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Gp.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Gp.cloud}get publicStateTheme(){const{theme:t,resolvedTheme:n}=this.store.localSettingsStore;return{theme:t,resolvedTheme:n}}setPublicStateTheme(t){t.theme!==void 0&&(this.store.localSettingsStore.theme=t.theme)}*init(){var p,f;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:o}=t.localSettingsStore,s=(p=n.project)==null?void 0:p.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(f=(yield db(o)).find(m=>m.id===r))==null?void 0:f.data),i?l=i:a?l=a:s&&(l=s);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:r,data:o,isTemplate:s}=t,a=n.Storage.getConfig().options.local,i=s?`${r}__${NC()}`:r;this._projectId=i,a.key=i,yh(o)||this.loadProjectData({...o,custom:{...o.custom,id:i,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||Et.web,this.editor&&M4(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(k4(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const r=this.editor;r.loadProjectData(t),r.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:r,studioSdkVersion:o}=this;t==null||t.trigger(fC,{baseApiUrl:r});const s=yield Br.post(`${r}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:o}});if(s instanceof Error)throw s;const a=s.result||{},{license:i,error:l,plan:u,info:d}=a;this.licensePlan=u,this.loadsInfo=d,l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Qu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Qu,{}))}}*updateStudio(){const{pluginStore:t}=this.store,{projectType:n}=this.projectDataCustom;yield t.initProjectPlugins(n),this.setEditor(),this.editorKey++}refreshStudio(){var t;this.editorKey&&(this.setNextProjectData((t=this.editor)==null?void 0:t.getProjectData()),this.store.layoutStore.clear(),this.setEditor(),this.editorKey++)}refreshEditorCanvas(){var t;(t=this.editor)==null||t.refresh({tools:!0})}}const k4=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||Et.web},Ce=()=>Pn().appEditorStore,jb=()=>nh().appEditorStore,I4=()=>{try{return nh().appEditorStore}catch{}},Xp=()=>{const[e,t]=g.useState(0),n=Pn().appEditorStore,{transitionTime:r}=n;return g.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},Jp=()=>{const{baseApiUrl:e}=jb();return`${e}/assets/sdk`},V4=e=>`${Jp()}/${e}`,H4=async(e,t,n)=>{const r=await Br.get(Jp(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((r==null?void 0:r.result)??[]).map(({asset:o,cdnUrl:s})=>({...o,size:parseInt(o.size),src:s}))},j4=async(e,t,n,r)=>{const o=await Br.post(Jp(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},D4=async(e,t)=>await Br.put(t,{body:e,rawText:!0}),F4=async(e,t,n,r)=>Promise.all(e.map(o=>j4({name:o.name,size:o.size,type:o.type},t,n,r).then(async s=>{if(!s)throw new Error("No asset");const{asset:a,cdnUrl:i,uploadUrl:l}=s,u=await D4(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:ks.image}}))),B4=async(e,t,n,r)=>{const o=await Br.delete(V4(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},Db=async(e,t,n,r)=>Promise.all(e.map(o=>B4(o.id||o.src,t,n,r)));function Go(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const p=Date.now()-a;p<l&&p>=0?r=setTimeout(u,l-p):(r=null,i=e.apply(s,o),s=o=null)}const d=function(){return s=this,o=arguments,a=Date.now(),r||(r=setTimeout(u,l)),i};return d.clear=function(){r&&(clearTimeout(r),r=null)},d.flush=function(){r&&(i=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},d}class Fb{constructor(t,n){this.assetsStore=t,this.layoutPanelId=n,this.itemLayout=void 0,this.isLoadingAssets=!1,this.typeFilter=void 0,this.searchValue="",this.customTypes=void 0,this.customProviders=void 0,this.providerFilter=void 0,this.customAssetProps=void 0,this.customPages=void 0,this.totalItems=void 0,this.optionalType=!1,this.optionalProvider=!0,an(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Go(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(r=>r.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter(ks.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var i,l,u,d;const{assetsStore:n}=this,{editor:r}=n;if(!r||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const o=((i=this.customPages)==null?void 0:i.length)??0,s=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,a=await this.provider.onLoad({editor:r,assetTypeFilter:this.typeFilter,pageIndex:o,searchValue:this.searchValue,pageCustomData:s})??[];if(Array.isArray(a)){const p=a.map(n.toAssetProps);this.setCustomAssetProps(p)}else{const p={...a,items:a.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],p])}this.setItemLayout((d=this.provider)==null?void 0:d.itemLayout)}async loadAssets(t=!0){const{assetsStore:n}=this,{toastStore:r}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(o){console.error(o),r.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:r}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&r&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:r}=this,{appEditorStore:o}=n.store,{editor:s}=o;if(!(!s||!r))try{n.setIsLoadingAssets(!0),await r({assets:[n.toAsset(t)],assetProps:[t],editor:s,loadAssets:a=>this.reloadAssets(a)})}catch(a){console.error(a),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:a==null?void 0:a.message})}finally{n.setIsLoadingAssets(!1)}}}const Bb=e=>Pn().assetsStore.assetPanelStores[e];class z4{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${lb()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new Fb(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),an(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Up.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Up.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,o=n.options.licenseKey,s=t.sdkProjectId,a=t.sdkIdentityId,i=({files:l})=>F4(l,o,s,a);return this.isUsingAssetCloud?i:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:r}=this;return n?t?async o=>{await t(o),this.deleteFromProjectAssets(o)}:void 0:r?async o=>{var l,u;const{sdkOptions:s}=this.store.appEditorStore,a=(l=s.project)==null?void 0:l.id,i=(u=s.identity)==null?void 0:u.id;await Db(o.assetProps,s.licenseKey,a,i),this.deleteFromProjectAssets(o)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var i,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,r=(i=n.project)==null?void 0:i.id,o=(l=n.identity)==null?void 0:l.id,s=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:ks.image,onLoad:()=>H4(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await Db(d,s,r,o),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=Go(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const r=n.Assets.events.all;n.on(r,t),this.loadProjectAssets()}addSdkProviders(){var r;const t=((r=this.sdkAssetConfig)==null?void 0:r.providers)??[],n=ot(t)?t({providers:fr(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const r=[...this.allProviders];let o=this.allProviders.findIndex(a=>a.id===t.id);const s=o!==-1;r.splice(n,0,t),s&&(o>=n&&(o+=1),r.splice(o,1)),this.setAllProviders(r)}hasType(t){return!!this.allProviders.find(n=>dt(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new Fb(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:r,customOnLoad:o}=this,{toastStore:s}=this.store;let a;if(t){try{if(this.setIsLoadingAssets(!0),n&&o)if(r)a=r;else{const i=await o({editor:t});this.cachedOnLoadAssetProps=i.map(this.toAssetProps),a=this.cachedOnLoadAssetProps}else a=t.Assets.getAll().map(this.toAssetProps)}catch(i){console.error(i),s.addError("assets-error-load",{header:this.t("errorLoad"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}a&&this.setProjectAssetProps(a)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:r}){const{cachedOnLoadAssetProps:o,customOnLoad:s}=this;if(s){if(o){const a=r.map(i=>i.id);this.cachedOnLoadAssetProps=o.filter(({id:i})=>!a.includes(i)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(a=>n.Assets.remove(a)),Tb(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:r,customOnLoad:o}=this;o?r&&(this.cachedOnLoadAssetProps=[...t,...r],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),Tb(n))}async handleUpload(t){var s,a;const{editor:n,onCloudOrCustomUpload:r}=this,{toastStore:o}=this.store;if(!(!n||!r))try{this.setIsLoadingAssets(!0);const i=((s=t.dataTransfer)==null?void 0:s.files)||((a=t.target)==null?void 0:a.files)||[],l=Array.from(i),u=await r({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(i){console.error(i),o.addError("assets-error-upload",{header:this.t("errorUpload"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const r=t;return{...r.attributes,id:r.attributes.id||r.getSrc(),src:r.getSrc(),name:r.attributes.name??r.getFilename(),type:r.attributes.type??r.getType()??ks.image,asset:r}}return{...t,type:t.type||ks.image,id:t.id||t.src}}toAsset(t){const{editor:n}=this.store.appEditorStore;if(n)return t.asset??new n.AssetManager.Asset(t)}setProjectAssetProps(t){this.projectAssetProps=t}setIsLoadingAssets(t){this.isLoadingAssets=t}setAllProviders(t){this.allProviders=t}}const Li=()=>Pn().assetsStore;class U4{constructor(t){var r;this.store=t,this.fonts={},an(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=ot(n)?n({baseDefault:bb}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>dt(t)?{id:t,label:t}:Cb(t)?t:null).filter(t=>!!t):bb}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!dt(n)&&!Cb(n)).map(n=>Oi(n.family,n)):[]}get sortedFonts(){return v4(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return y4([...this.staticFonts,...Object.values(this.fonts).map(t)])}get sdkFontOptions(){return this.store.appEditorStore.sdkOptions.fonts}get enableFontManager(){var t;return(t=this.sdkFontOptions)==null?void 0:t.enableFontManager}get sdkShowProjectFonts(){const{showProjectFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ht(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ht(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=xa(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=Oi(o,s);this.addFont(a,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=Is(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=Oi(t.family,t),{editor:s}=this.store.appEditorStore;if(!s)return;const{family:a}=o;!r&&this.fonts[a]||(this.fonts[a]=o,n||this.updateProjectFonts(s))}removeFont(t){t=Is(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...xa(t).globalPageSettings,fonts:fr(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),Mb(t),t.trigger(_n.pageSettingsUpdate,{data:r})}}const Ni=()=>Pn().fontsStore;class W4{constructor(t){this.store=t,an(this,{},{autoBind:!0})}t(t,n={}){var o;const{editor:r}=this.store.appEditorStore;return((o=r==null?void 0:r.I18n)==null?void 0:o.t(t,n))||""}tScoped(t){return(n,r)=>this.t(`${t}.${n}`,r)}}const $e=()=>Pn().i18nStore,er=(e,t)=>g.Children.map(e,n=>n&&n.type===t?n:null),zb="gs-custom-layout",G4=Kt(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=Ce(),d=g.useRef(null),p=n,f=p&&u?c.jsx(p,{...a,editor:u}):null,h=N(zb,o&&`${zb}__${o}`,t),m=r&&!s;return g.useImperativeHandle(l,()=>d.current,[]),g.useEffect(()=>{const b=d.current;if(!s||!b)return;const v=S=>b.appendChild(S),w=S=>b.removeChild(S),y=s({editor:u,addEl:v,removeEl:w});if(dt(y))b.innerHTML=y;else{if(y instanceof HTMLElement)return v(y),()=>{w(y)};if(ot(y))return()=>{y()}}},[s,u,d.current]),m?f:c.jsx("div",{className:h,ref:d,...i,children:f})}),Qp=ce(G4),q4=(e,t,n)=>{const r=e==null?void 0:e[t];return r&&r({props:n.props,editor:n.editor})||n.props};class K4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,an(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}get layoutOverrides(){var r,o;const t=(r=this.store.appEditorStore.sdkLayoutConfig)==null?void 0:r.overrides,n=(o=this.customConfig)==null?void 0:o.overrides;return{...t,...n}}getOverrideProps(t,n){return q4(this.layoutOverrides,t,{props:n.props,editor:n.editor??this.editor})}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${_n.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var o;const r=n==null?void 0:n.layout;r&&this.layouts.forEach(s=>{s.id===t&&Object.assign(s,r)}),this.layouts=n!=null&&n.force?this.layouts.filter(s=>s.id!==t):this.layouts.map(s=>s.id===t?{...s,toRemove:!0}:s),(o=this.editor)==null||o.trigger(`${_n.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var r;const{children:t}=this.store.appEditorStore.sdkProps,n=((r=er(t,Qp))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const $c=()=>Pn().layoutStore,Z4=()=>nh().layoutStore;class Y4{constructor(t){this.isActive=!1,this.content="",this.store=t,an(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class X4{constructor(t){this.store=t,this._projectSourceFilter=Pi.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,an(this,{},{autoBind:!0})}get projectTypeFilter(){return this._projectTypeFilter}get projectSourceFilter(){return this._projectSourceFilter}get templates(){return this._loadedTemplates}get projects(){return this._loadedProjects}get filteredTemplates(){return this.projectSourceFilter===Pi.Existing?this.projects:this.templates}async loadProjects(){const t=await db(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var o;const t=(o=this.store.appEditorStore.sdkOptions.templates)==null?void 0:o.onLoad,n=async()=>await Q3(this.projectTypeFilter);let r;if(t){const s=this.store.appEditorStore.editor;r=await t({editor:s,fetchCommunityTemplates:n})}else r=await n();this.setTemplates(r)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){Y3(Ec.Projects,t)}async setProjectTypeFilter(t){this._projectTypeFilter=t,this.setProjects(void 0),this.setTemplates(void 0)}setProjectSourceFilter(t){this._projectSourceFilter=t}setTemplates(t){this._loadedTemplates=t}setProjects(t){this._loadedProjects=t}}const Ub=()=>Pn().templatesStore;class J4{constructor(t){this.toasts=[],this.store=t,an(this,{},{autoBind:!0})}add(t,n){this.toasts.find(r=>r.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:sn.Error})}addWarning(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:sn.Warning})}addSuccess(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:sn.Success})}addInfo(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:sn.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class Q4{constructor(t){this.isOpen=!1,this.store=t,an(this,{},{autoBind:!0})}setOpen(t){this.isOpen=t,this.triggerEvent()}toggleOpen(){this.isOpen=!this.isOpen,this.triggerEvent()}triggerEvent(){var t;(t=this.store.appEditorStore.editor)==null||t.trigger(_n.toggleBlocksPanel,{isOpen:this.isOpen})}}const R4=()=>Pn().blockManagerStore,Wb=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",eM=Wb+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",tM="["+Wb+"]["+eM+"]*",nM=new RegExp("^"+tM+"$");function Gb(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let a=0;a<s;a++)o.push(r[a]);n.push(o),r=t.exec(e)}return n}const kc=function(e){const t=nM.exec(e);return!(t===null||typeof t>"u")};function rM(e){return typeof e<"u"}const oM={allowBooleanAttributes:!1,unpairedTags:[]};function sM(e,t){t=Object.assign({},oM,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let s=0;s<e.length;s++)if(e[s]==="<"&&e[s+1]==="?"){if(s+=2,s=Kb(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=Zb(e,s);continue}else{let i=!1;e[s]==="/"&&(i=!0,s++);let l="";for(;s<e.length&&e[s]!==">"&&e[s]!==" "&&e[s]!==" "&&e[s]!==`
37
+ `&&e[s]!=="\r";s++)l+=e[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!fM(l)){let p;return l.trim().length===0?p="Invalid space after '<'.":p="Tag '"+l+"' is an invalid name.",kt("InvalidTag",p,un(e,s))}const u=lM(e,s);if(u===!1)return kt("InvalidAttr","Attributes for '"+l+"' have open quote.",un(e,s));let d=u.value;if(s=u.index,d[d.length-1]==="/"){const p=s-d.length;d=d.substring(0,d.length-1);const f=Yb(d,t);if(f===!0)r=!0;else return kt(f.err.code,f.err.msg,un(e,p+f.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return kt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",un(e,a));if(n.length===0)return kt("InvalidTag","Closing tag '"+l+"' has not been opened.",un(e,a));{const p=n.pop();if(l!==p.tagName){let f=un(e,p.tagStartPos);return kt("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+l+"'.",un(e,a))}n.length==0&&(o=!0)}}else return kt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",un(e,s));else{const p=Yb(d,t);if(p!==!0)return kt(p.err.code,p.err.msg,un(e,s-d.length+p.err.line));if(o===!0)return kt("InvalidXml","Multiple possible root nodes found.",un(e,s));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="!"){s++,s=Zb(e,s);continue}else if(e[s+1]==="?"){if(s=Kb(e,++s),s.err)return s}else break;else if(e[s]==="&"){const p=dM(e,s);if(p==-1)return kt("InvalidChar","char '&' is not expected.",un(e,s));s=p}else if(o===!0&&!qb(e[s]))return kt("InvalidXml","Extra text at the end",un(e,s));e[s]==="<"&&s--}}else{if(qb(e[s]))continue;return kt("InvalidChar","char '"+e[s]+"' is not expected.",un(e,s))}if(r){if(n.length==1)return kt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",un(e,n[0].tagStartPos));if(n.length>0)return kt("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return kt("InvalidXml","Start tag expected.",1);return!0}function qb(e){return e===" "||e===" "||e===`
38
+ `||e==="\r"}function Kb(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return kt("InvalidXml","XML declaration allowed only at the start of the document.",un(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Zb(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const aM='"',iM="'";function lM(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===aM||e[t]===iM)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const cM=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Yb(e,t){const n=Gb(e,cM),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return kt("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",$i(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return kt("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",$i(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return kt("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",$i(n[o]));const s=n[o][2];if(!pM(s))return kt("InvalidAttr","Attribute '"+s+"' is an invalid name.",$i(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return kt("InvalidAttr","Attribute '"+s+"' is repeated.",$i(n[o]))}return!0}function uM(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function dM(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,uM(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function kt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function pM(e){return kc(e)}function fM(e){return kc(e)}function un(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function $i(e){return e.startIndex+e[1].length}const gM={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},hM=function(e){return Object.assign({},gM,e)};let Ic;typeof Symbol!="function"?Ic="@@xmlMetadata":Ic=Symbol("XML Node Metadata");class Vs{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][Ic]={startIndex:n})}static getMetaDataSymbol(){return Ic}}class mM{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,s=!1,a=!1,i="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Hs(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(s&&Hs(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Hs(t,"!ATTLIST",n))n+=8;else if(s&&Hs(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Hs(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");o++,i=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,o--):o--,o===0)break}else t[n]==="["?s=!0:i+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(ki(r),n=Cn(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&ki(r),n=Cn(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=Cn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Cn(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const s=t[n];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(n++;n<t.length&&t[n]!==s;)o+=t[n],n++;if(t[n]!==s)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!kc(r))throw new Error(`Invalid element name: "${r}"`);n=Cn(t,n);let o="";if(t[n]==="E"&&Hs(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Hs(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;ki(r),n=Cn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!ki(o))throw new Error(`Invalid attribute name: "${o}"`);n=Cn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=Cn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let i=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!ki(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=Cn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+i.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=Cn(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:s,defaultValue:a,index:n}}}const Cn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Hs(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function ki(e){if(kc(e))return e;throw new Error(`Invalid entity name ${e}`)}const bM=/^[-+]?0x[a-fA-F0-9]+$/,vM=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,yM={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function wM(e,t={}){if(t=Object.assign({},yM,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&bM.test(n))return EM(n,16);if(n.search(/.+[eE].+/)!==-1)return CM(e,n,t);{const r=vM.exec(n);if(r){const o=r[1]||"",s=r[2];let a=xM(r[3]);const i=o?e[s.length+1]===".":e[s.length]===".";if(!t.leadingZeros&&(s.length>1||s.length===1&&!i))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===a||u===`${o}${a}`?l:e;let d=s?a:n;return s?d===u||o+d===u?l:e:d===u||d===o+u?l:e}}else return e}}const SM=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function CM(e,t,n){if(!n.eNotation)return e;const r=t.match(SM);if(r){let o=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&i?e:a.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(t):n.leadingZeros&&!i?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function xM(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function EM(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Xb(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class PM{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=TM,this.parseXml=LM,this.parseTextData=OM,this.resolveNameSpace=_M,this.buildAttributesMap=MM,this.isItStopNode=IM,this.replaceEntitiesValue=$M,this.readStopNodeData=HM,this.saveTextToParentTag=kM,this.addChild=NM,this.ignoreAttributesFn=Xb(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function TM(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function OM(e,t,n,r,o,s,a){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return i==null?e:typeof i!=typeof e||i!==e?i:this.options.trimValues?ef(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?ef(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function _M(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const AM=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function MM(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Gb(e,AM),o=r.length,s={};for(let a=0;a<o;a++){const i=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(i,t))continue;let l=r[a][4],u=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(i,l,t);d==null?s[u]=l:typeof d!=typeof l||d!==l?s[u]=d:s[u]=ef(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const LM=function(e){e=e.replace(/\r\n?/g,`
39
+ `);const t=new Vs("!xml");let n=t,r="",o="";const s=new mM(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=js(e,">",a,"Closing Tag is not closed.");let u=e.substring(a+2,l).trim();if(this.options.removeNSPrefix){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,o));const d=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),n=this.tagsNodeStack.pop(),r="",a=l}else if(e[a+1]==="?"){let l=Rp(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new Vs(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(n,u,o,a)}a=l.closeIndex+1}else if(e.substr(a+1,3)==="!--"){const l=js(e,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(a+4,l-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}a=l}else if(e.substr(a+1,2)==="!D"){const l=s.readDocType(e,a);this.docTypeEntities=l.entities,a=l.i}else if(e.substr(a+1,2)==="!["){const l=js(e,"]]>",a,"CDATA is not closed.")-2,u=e.substring(a+9,l);r=this.saveTextToParentTag(r,n,o);let d=this.parseTextData(u,n.tagname,o,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),a=l+2}else{let l=Rp(e,a,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,f=l.attrExpPresent,h=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==t.tagname&&(o+=o?"."+u:u);const b=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let v="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),a=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)a=l.closeIndex;else{const y=this.readStopNodeData(e,d,h+1);if(!y)throw new Error(`Unexpected end of ${d}`);a=y.i,v=y.tagContent}const w=new Vs(u);u!==p&&f&&(w[":@"]=this.buildAttributesMap(p,o,u)),v&&(v=this.parseTextData(v,u,o,!0,f,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,v),this.addChild(n,w,o,b)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const v=new Vs(u);u!==p&&f&&(v[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,v,o,b),o=o.substr(0,o.lastIndexOf("."))}else{const v=new Vs(u);this.tagsNodeStack.push(n),u!==p&&f&&(v[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,v,o,b),n=v}r="",a=h}}else r+=e[a];return t.child};function NM(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const $M=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function kM(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function IM(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function VM(e,t,n=">"){let r,o="";for(let s=t;s<e.length;s++){let a=e[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(e[s+1]===n[1])return{data:o,index:s}}else return{data:o,index:s};else a===" "&&(a=" ");o+=a}}function js(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Rp(e,t,n,r=">"){const o=VM(e,t+1,r);if(!o)return;let s=o.data;const a=o.index,i=s.search(/\s/);let l=s,u=!0;i!==-1&&(l=s.substring(0,i),s=s.substring(i+1).trimStart());const d=l;if(n){const p=l.indexOf(":");p!==-1&&(l=l.substr(p+1),u=l!==o.data.substr(p+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function HM(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=js(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i:s};n=s}else if(e[n+1]==="?")n=js(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=js(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=js(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Rp(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function ef(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:wM(e,n)}else return rM(e)?e:""}const tf=Vs.getMetaDataSymbol();function jM(e,t){return Jb(e,t)}function Jb(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=DM(a);let l="";if(n===void 0?l=i:l=n+"."+i,i===t.textNodeName)r===void 0?r=a[i]:r+=""+a[i];else{if(i===void 0)continue;if(a[i]){let u=Jb(a[i],t,l);const d=BM(u,t);a[tf]!==void 0&&(u[tf]=a[tf]),a[":@"]?FM(u,a[":@"],l,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),o[i]!==void 0&&o.hasOwnProperty(i)?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(u)):t.isArray(i,l,d)?o[i]=[u]:o[i]=u}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function DM(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function FM(e,t,n,r){if(t){const o=Object.keys(t),s=o.length;for(let a=0;a<s;a++){const i=o[a];r.isArray(i,n+"."+i,!0,!0)?e[i]=[t[i]]:e[i]=t[i]}}}function BM(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class zM{constructor(t){this.externalEntities={},this.options=hM(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const s=sM(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new PM(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:jM(o,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Vs.getMetaDataSymbol()}}const UM=`
40
+ `;function WM(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=UM),Qb(e,t,"",n)}function Qb(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=GM(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];qM(u,t)||(m=t.tagValueProcessor(l,m),m=ev(m,t)),s&&(o+=r),o+=m,s=!1;continue}else if(l===t.cdataPropName){s&&(o+=r),o+=`<![CDATA[${i[l][0][t.textNodeName]}]]>`,s=!1;continue}else if(l===t.commentPropName){o+=r+`<!--${i[l][0][t.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const m=Rb(i[":@"],t),b=l==="?xml"?"":r;let v=i[l][0][t.textNodeName];v=v.length!==0?" "+v:"",o+=b+`<${l}${v}${m}?>`,s=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const p=Rb(i[":@"],t),f=r+`<${l}${p}`,h=Qb(i[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!h||h.length===0)&&t.suppressEmptyNode?o+=f+"/>":h&&h.endsWith(">")?o+=f+`>${h}${r}</${l}>`:(o+=f+">",h&&r!==""&&(h.includes("/>")||h.includes("</"))?o+=r+t.indentBy+h+r:o+=h,o+=`</${l}>`),s=!0}return o}function GM(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function Rb(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=ev(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function qM(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function ev(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const KM={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function qo(e){this.options=Object.assign({},KM,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Xb(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=XM),this.processTextOrObjNode=ZM,this.options.format?(this.indentate=YM,this.tagEndChar=`>
41
41
  `,this.newLine=`
42
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Uo.prototype.build=function(e){return this.options.preserveOrder?AL(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},Uo.prototype.j2x=function(e,t,n){let r="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,s))r+=this.buildAttrPairStr(i,""+e[a]);else if(!i)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(l)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let l="",u="";for(let d=0;d<i;d++){const p=e[a][d];if(!(typeof p>"u"))if(p===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const f=this.j2x(p,t+1,n.concat(a));l+=f.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=f.attrStr)}else l+=this.processTextOrObjNode(p,a,t,n);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(a,p);f=this.replaceEntitiesValue(f),l+=f}else l+=this.buildTextValNode(p,a,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,u,t)),o+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const i=Object.keys(e[a]),l=i.length;for(let u=0;u<l;u++)r+=this.buildAttrPairStr(i[u],""+e[a][i[u]])}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}},Uo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function $L(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}Uo.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,s="";return t[0]==="?"&&(s="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+s+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+o}},Uo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},Uo.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},Uo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function kL(e){return this.options.indentBy.repeat(e)}function IL(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Nc="mjml-code-to-html";function qv(e,t){const n=t==null?void 0:t.sanitizer;if(et(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(E,P)=>P??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),f=["br","hr"],g=new Set(f),m=E=>{const P=[];for(const _ of E){const T=Object.keys(_).find(O=>O!==":@");if(T&&g.has(T)){const O=_[T];Array.isArray(O)&&O.length>0?(P.push({..._,[T]:[]}),P.push(...m(O))):P.push(_)}else T&&Array.isArray(_[T])?P.push({..._,[T]:m(_[T])}):P.push(_)}return P},v={commentPropName:"#comment",unpairedTags:f,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new OL({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new Uo({...v}),S=b.parse(`<root>${p}</root>`)[0].root,C=m(S);return w.build(C)}function r(p){const f=document.createElement("textarea");return f.innerHTML=p,f.value}const o=r(e||""),s=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],a={crossorigin:"anonymous","full-width":"true"},i=new RegExp(`\\s+(${s.join("|")})(?=\\s|\\/?>)`,"gi");return o.replace(/<[^>]+>/g,p=>p.replace(i,(f,g)=>{const m=a[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(p,f,g)=>{const m=g.slice(1,-1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");return`${f}"${m}"`}).replace(/&(?!#?\w+;)/g,(p,f,g)=>f>0&&g[f-1]==="&"?p:"&amp;").replace(/(<[a-zA-Z!/])|</g,(p,f)=>f??"&lt;")}var $i=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))($i||{}),Jp=(e=>(e.attributes="mj-attributes",e.breakpoint="mj-breakpoint",e.font="mj-font",e.htmlAttributes="mj-html-attributes",e.preview="mj-preview",e.style="mj-style",e.title="mj-title",e.class="mj-class",e.all="mj-all",e))(Jp||{}),Wo=(e=>(e.accordion="mj-accordion",e.accordionElement="mj-accordion-element",e.accordionTitle="mj-accordion-title",e.accordionText="mj-accordion-text",e.button="mj-button",e.carousel="mj-carousel",e.carouselImage="mj-carousel-image",e.column="mj-column",e.divider="mj-divider",e.group="mj-group",e.hero="mj-hero",e.image="mj-image",e.navbar="mj-navbar",e.navbarLink="mj-navbar-link",e.raw="mj-raw",e.section="mj-section",e.social="mj-social",e.socialElement="mj-social-element",e.spacer="mj-spacer",e.table="mj-table",e.text="mj-text",e.wrapper="mj-wrapper",e))(Wo||{}),js=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(js||{});function VL(e){const t=new Map,n={items:[]};return e.forEach(o=>{const{category:s,item:a}=o;if(s){const i=t.get(s.id);i?(i.items.push(a),i.category={...i.category,...s}):t.set(s.id,{category:s,items:[a]})}else n.items.push(a)}),[...Array.from(t).map(([,o])=>o),n].filter(o=>o.items.length)}const Kv=e=>(e==null?void 0:e.get("groups"))||[],Zv=(e,t)=>Kv(e).includes(t),HL=(e,t)=>{Zv(e,t)||e.set("groups",[...Kv(e),t])};class jL{constructor(t){this.dataSourceKeyid=js.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,an(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,r=[],o=t.reduce((s,a)=>(s.set(a.get("id"),a),s),new Map);return n.forEach(({id:s})=>{const a=o.get(s);a&&(r.push(a),o.delete(s))}),Array.from(o).map(([,s])=>{s.get("_internal")||r.push(s)}),VL(r.map(s=>({category:s.get("category"),item:s})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(r=>Zv(r,t))}addStyleRule(t,n={}){var p,f;const{editor:r}=this;if(!r)return;const o=t.get("id"),s=t.get("selector")||"",a=t.get("property"),i=t.getPath("value"),l=`${this.dataSourceKeyid}:${o}`,u={[a]:{type:"data-variable",path:i,defaultValue:t.get("defaultValue")}};if(r&&pg(r)&&s.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=$i,{attributes:v}=Jp,b=g.findFirstType($i.root);if(!b)return;const w=b.findFirstType(m)||b.append({type:m},{at:0})[0],y=w.findFirstType(v)||w.append({type:v})[0],S=y.findType(s).pop()||y.append({type:s})[0],C=(S.get("attributes")||{})[a];Ht(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((f=(p=n.selectorToRuleMap)==null?void 0:p.get(s))==null?void 0:f.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&HL(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var s,a;const{sdkOptionStyles:t}=this,n=new Map,r=(s=this.editor)==null?void 0:s.Css;if(!t.length){this.records=[];return}const o=this.getDataSource()||this.createDataSource();t.forEach(i=>{const{id:l,selector:u,label:d,field:p,property:f,category:g}=i,m=o.getRecord(l);if(m){const v={label:d,field:p,category:g};m.set({...v,_undo:!0})}else{const v=n.get(u),b=(v==null?void 0:v.rule)||(r==null?void 0:r.getRule(u)),w=(v==null?void 0:v.styles)||(b==null?void 0:b.getStyle())||{},y=w[f]||i.defaultValue;n.set(u,{rule:b,styles:w}),o.addRecord({value:void 0,...i,defaultValue:y,_internal:!0,_undo:!0})}}),o.getRecords().forEach(i=>{this.addStyleRule(i,{selectorToRuleMap:n})}),o.listenTo(o.records,"add",i=>{this.addStyleRule(i)}),(a=this.editor)==null||a.UndoManager.add(o.records),this.records=o.getRecords()}}const DL=()=>Pn().globalStylesStore,FL=(e,t)=>{let n;try{const r=Un()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},Yv=(e,t)=>{const r={...FL(e),...t};try{Un()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},Xv="gs-utl-dark",BL=()=>Un()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Jv=e=>e==="dark"||e==="auto"&&BL(),Qv=(e,t)=>{if(e&&Un()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Jv(e)?(n.add(Xv),r=!0):n.remove(Xv),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?Eo.dark:Eo.light}};class zL{constructor(t){this.key="",this.theme=Eo.auto,this.resolvedTheme=Eo.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),this.resolvedTheme=this.theme,an(this,{},{autoBind:!0}),this.init()}init(){Qv(this.theme,this)}changeTheme(t){Qv(t,this),Yv(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),Yv(this.key,t)}get isDarkTheme(){return Jv(this.theme)}}const zr=()=>Pn().localSettingsStore;class UL{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,an(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:r,confirmButton:o,...s}){this.isOpen=!0,this.content=t;const a=()=>{r==null||r(),this.close()};this.setModalProps({...s,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:a,size:"m2",variant:"pr",...o}]})}}const xa=()=>Pn().modalStore,Rv="column1",eb="column2",tb="column3",Qp="column3-7",WL=function(e,t={}){const{Components:n,Blocks:r}=e,o="gridRow",s="gridColumn",a="gjs-grid-row",i="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,p=1,f=1;n.addType(o,{isComponent:b=>Fo(b,a),model:{defaults:{emptyState:!0,droppable:Br(s),highlightable:!1,attributes:{class:a},resizable:{...l,keyHeight:"min-height"},icon:`
42
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}qo.prototype.build=function(e){return this.options.preserveOrder?WM(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},qo.prototype.j2x=function(e,t,n){let r="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,s))r+=this.buildAttrPairStr(i,""+e[a]);else if(!i)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(l)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let l="",u="";for(let d=0;d<i;d++){const p=e[a][d];if(!(typeof p>"u"))if(p===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const f=this.j2x(p,t+1,n.concat(a));l+=f.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=f.attrStr)}else l+=this.processTextOrObjNode(p,a,t,n);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(a,p);f=this.replaceEntitiesValue(f),l+=f}else l+=this.buildTextValNode(p,a,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,u,t)),o+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const i=Object.keys(e[a]),l=i.length;for(let u=0;u<l;u++)r+=this.buildAttrPairStr(i[u],""+e[a][i[u]])}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}},qo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function ZM(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}qo.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,s="";return t[0]==="?"&&(s="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+s+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+o}},qo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},qo.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},qo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function YM(e){return this.options.indentBy.repeat(e)}function XM(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Vc="mjml-code-to-html";function tv(e,t){const n=t==null?void 0:t.sanitizer;if(ot(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(x,P)=>P??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),f=["br","hr"],h=new Set(f),m=x=>{const P=[];for(const _ of x){const T=Object.keys(_).find(O=>O!==":@");if(T&&h.has(T)){const O=_[T];Array.isArray(O)&&O.length>0?(P.push({..._,[T]:[]}),P.push(...m(O))):P.push(_)}else T&&Array.isArray(_[T])?P.push({..._,[T]:m(_[T])}):P.push(_)}return P},b={commentPropName:"#comment",unpairedTags:f,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},v=new zM({...b,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new qo({...b}),S=v.parse(`<root>${p}</root>`)[0].root,C=m(S);return w.build(C)}function r(p){const f=document.createElement("textarea");return f.innerHTML=p,f.value}const o=r(e||""),s=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],a={crossorigin:"anonymous","full-width":"true"},i=new RegExp(`\\s+(${s.join("|")})(?=\\s|\\/?>)`,"gi");return o.replace(/<[^>]+>/g,p=>p.replace(i,(f,h)=>{const m=a[h]??h;return` ${h}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(p,f,h)=>{const m=h.slice(1,-1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");return`${f}"${m}"`}).replace(/&(?!#?\w+;)/g,(p,f,h)=>f>0&&h[f-1]==="&"?p:"&amp;").replace(/(<[a-zA-Z!/])|</g,(p,f)=>f??"&lt;")}var Ii=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Ii||{}),nf=(e=>(e.attributes="mj-attributes",e.breakpoint="mj-breakpoint",e.font="mj-font",e.htmlAttributes="mj-html-attributes",e.preview="mj-preview",e.style="mj-style",e.title="mj-title",e.class="mj-class",e.all="mj-all",e))(nf||{}),Ko=(e=>(e.accordion="mj-accordion",e.accordionElement="mj-accordion-element",e.accordionTitle="mj-accordion-title",e.accordionText="mj-accordion-text",e.button="mj-button",e.carousel="mj-carousel",e.carouselImage="mj-carousel-image",e.column="mj-column",e.divider="mj-divider",e.group="mj-group",e.hero="mj-hero",e.image="mj-image",e.navbar="mj-navbar",e.navbarLink="mj-navbar-link",e.raw="mj-raw",e.section="mj-section",e.social="mj-social",e.socialElement="mj-social-element",e.spacer="mj-spacer",e.table="mj-table",e.text="mj-text",e.wrapper="mj-wrapper",e))(Ko||{}),Ds=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Ds||{});function JM(e){const t=new Map,n={items:[]};return e.forEach(o=>{const{category:s,item:a}=o;if(s){const i=t.get(s.id);i?(i.items.push(a),i.category={...i.category,...s}):t.set(s.id,{category:s,items:[a]})}else n.items.push(a)}),[...Array.from(t).map(([,o])=>o),n].filter(o=>o.items.length)}const nv=e=>(e==null?void 0:e.get("groups"))||[],rv=(e,t)=>nv(e).includes(t),QM=(e,t)=>{rv(e,t)||e.set("groups",[...nv(e),t])};class RM{constructor(t){this.dataSourceKeyid=Ds.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,an(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,r=[],o=t.reduce((s,a)=>(s.set(a.get("id"),a),s),new Map);return n.forEach(({id:s})=>{const a=o.get(s);a&&(r.push(a),o.delete(s))}),Array.from(o).map(([,s])=>{s.get("_internal")||r.push(s)}),JM(r.map(s=>({category:s.get("category"),item:s})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(r=>rv(r,t))}addStyleRule(t,n={}){var p,f;const{editor:r}=this;if(!r)return;const o=t.get("id"),s=t.get("selector")||"",a=t.get("property"),i=t.getPath("value"),l=`${this.dataSourceKeyid}:${o}`,u={[a]:{type:"data-variable",path:i,defaultValue:t.get("defaultValue")}};if(r&&wh(r)&&s.startsWith("mj-")){const h=r.Components.getWrapper(),{head:m}=Ii,{attributes:b}=nf,v=h.findFirstType(Ii.root);if(!v)return;const w=v.findFirstType(m)||v.append({type:m},{at:0})[0],y=w.findFirstType(b)||w.append({type:b})[0],S=y.findType(s).pop()||y.append({type:s})[0],C=(S.get("attributes")||{})[a];Ht(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((f=(p=n.selectorToRuleMap)==null?void 0:p.get(s))==null?void 0:f.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&QM(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var s,a;const{sdkOptionStyles:t}=this,n=new Map,r=(s=this.editor)==null?void 0:s.Css;if(!t.length){this.records=[];return}const o=this.getDataSource()||this.createDataSource();t.forEach(i=>{const{id:l,selector:u,label:d,field:p,property:f,category:h}=i,m=o.getRecord(l);if(m){const b={label:d,field:p,category:h};m.set({...b,_undo:!0})}else{const b=n.get(u),v=(b==null?void 0:b.rule)||(r==null?void 0:r.getRule(u)),w=(b==null?void 0:b.styles)||(v==null?void 0:v.getStyle())||{},y=w[f]||i.defaultValue;n.set(u,{rule:v,styles:w}),o.addRecord({value:void 0,...i,defaultValue:y,_internal:!0,_undo:!0})}}),o.getRecords().forEach(i=>{this.addStyleRule(i,{selectorToRuleMap:n})}),o.listenTo(o.records,"add",i=>{this.addStyleRule(i)}),(a=this.editor)==null||a.UndoManager.add(o.records),this.records=o.getRecords()}}const eL=()=>Pn().globalStylesStore,tL=(e,t)=>{let n;try{const r=Wn()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},ov=(e,t)=>{const r={...tL(e),...t};try{Wn()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},nL=()=>Wn()&&window.matchMedia("(prefers-color-scheme: dark)").matches,sv=e=>e==="dark"||e==="auto"&&nL(),av=(e,t)=>{if(e&&Wn()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(sv(e)?(n.add(fh),r=!0):n.remove(fh),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?To.dark:To.light}};class rL{constructor(t){this.key="",this.theme=To.auto,this.resolvedTheme=To.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),this.resolvedTheme=this.theme,an(this,{},{autoBind:!0}),this.init()}init(){av(this.theme,this)}changeTheme(t){av(t,this),ov(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),ov(this.key,t)}get isDarkTheme(){return sv(this.theme)}}const xr=()=>Pn().localSettingsStore;class oL{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,an(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:r,confirmButton:o,...s}){this.isOpen=!0,this.content=t;const a=()=>{r==null||r(),this.close()};this.setModalProps({...s,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:a,size:"m2",variant:"pr",...o}]})}}const Ea=()=>Pn().modalStore,iv="column1",lv="column2",cv="column3",rf="column3-7",sL=function(e,t={}){const{Components:n,Blocks:r}=e,o="gridRow",s="gridColumn",a="gjs-grid-row",i="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,p=1,f=1;n.addType(o,{isComponent:v=>Uo(v,a),model:{defaults:{emptyState:!0,droppable:Wr(s),highlightable:!1,attributes:{class:a},resizable:{...l,keyHeight:"min-height"},icon:`
43
43
  <svg viewBox="0 0 24 24">
44
44
  <path d="M22 14c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4z"></path>
45
45
  </svg>
46
- `,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:b=>{b.getSelected().components().add({type:s})}}],styles:`
46
+ `,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:v=>{v.getSelected().components().add({type:s})}}],styles:`
47
47
  .${a} {
48
48
  display: flex;
49
49
  justify-content: flex-start;
@@ -57,7 +57,7 @@ ${t}
57
57
  flex-direction: column;
58
58
  }
59
59
  }
60
- `}}}),n.addType(s,{isComponent:b=>Fo(b,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Br(o),resizable:{...l,bc:0,keyWidth:u,currentUnit:f,minDim:d,step:p},icon:`
60
+ `}}}),n.addType(s,{isComponent:v=>Uo(v,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Wr(o),resizable:{...l,bc:0,keyWidth:u,currentUnit:f,minDim:d,step:p},icon:`
61
61
  <svg viewBox="0 0 24 24">
62
62
  <path d="M8 2h8c1.1 0 2 .9 2 2v16c0 1.1-.9 2-2 2H8c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8z"></path>
63
63
  </svg>
@@ -66,50 +66,50 @@ ${t}
66
66
  flex: 1 1 0%;
67
67
  padding: 5px 0;
68
68
  }
69
- `},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const b=this.get("center-content");this.addStyle({display:b?"flex":"block","align-items":b?"center":"","justify-content":b?"center":""})}}});const g={label:o,content:{type:o,components:[{type:s},{type:s},{type:s}]},...t.block},m={merge:!0},v=b=>{var w;return((w=r.get(b))==null?void 0:w.category)||g.category};r.add(Rv,{...g,category:v(Rv),content:{type:o,components:[{type:s}]}},m),r.add(eb,{...g,category:v(eb),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(tb,{...g,category:v(tb),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(Qp,{...g,category:v(Qp),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},ki="section",Rp="container",ef="gjs-section",tf="gjs-container",GL=function(e,t={}){const{Components:n,Blocks:r}=e;r.add(ki,{label:ki,media:`
69
+ `},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const v=this.get("center-content");this.addStyle({display:v?"flex":"block","align-items":v?"center":"","justify-content":v?"center":""})}}});const h={label:o,content:{type:o,components:[{type:s},{type:s},{type:s}]},...t.block},m={merge:!0},b=v=>{var w;return((w=r.get(v))==null?void 0:w.category)||h.category};r.add(iv,{...h,category:b(iv),content:{type:o,components:[{type:s}]}},m),r.add(lv,{...h,category:b(lv),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(cv,{...h,category:b(cv),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(rf,{...h,category:b(rf),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},Vi="section",of="container",sf="gjs-section",af="gjs-container",aL=function(e,t={}){const{Components:n,Blocks:r}=e;r.add(Vi,{label:Vi,media:`
70
70
  <svg viewBox="0 0 24 24">
71
71
  <path fill="currentColor" d="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" />
72
72
  </svg>
73
- `,content:{type:ki},...t.block},{at:Oi(e,Qp)+1}),n.addType(ki,{isComponent:o=>Fo(o,ef),model:{defaults:{tagName:"section",emptyState:!0,draggable:Br("wrapper"),droppable:Br(Rp),attributes:{class:ef},components:{type:Rp},styles:`
74
- .${ef} {
73
+ `,content:{type:Vi},...t.block},{at:Ai(e,rf)+1}),n.addType(Vi,{isComponent:o=>Uo(o,sf),model:{defaults:{tagName:"section",emptyState:!0,draggable:Wr("wrapper"),droppable:Wr(of),attributes:{class:sf},components:{type:of},styles:`
74
+ .${sf} {
75
75
  display: flex;
76
76
  padding: 50px 0;
77
77
  }
78
- `}}}),n.addType(Rp,{isComponent:o=>Fo(o,tf),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:tf},styles:`
79
- .${tf} {
78
+ `}}}),n.addType(of,{isComponent:o=>Uo(o,af),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:af},styles:`
79
+ .${af} {
80
80
  width: 90%;
81
81
  margin: 0 auto;
82
82
  max-width: 1200px;
83
83
  }
84
- `}}})},qL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
84
+ `}}})},iL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
85
85
  <svg viewBox="0 0 24 24">
86
86
  <path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
87
87
  </svg>
88
- `,content:{type:o},...t.block},{at:Oi(e,ki)+1}),n.addType(o,{isComponent:a=>Fo(a,s),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:s},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
88
+ `,content:{type:o},...t.block},{at:Ai(e,Vi)+1}),n.addType(o,{isComponent:a=>Uo(a,s),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:s},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
89
89
  .${s} {
90
90
  height: 3px;
91
91
  width: 100%;
92
92
  margin: 10px;
93
93
  background-color: rgba(0, 0, 0, 0.05);
94
94
  }
95
- `}}})},KL=function(e){const{Components:t,Blocks:n}=e,o=t.getType("wrapper").model.getDefaults(),s=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...o.stylable,"padding","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","vertical-align","text-decoration","text-transform","direction","white-space"]}}}),t.addType("head",{model:{components(u,d){return s.prototype.components.call(this,u,{...d,skipDomReset:!0})}},view:{updateContent(){}}}),t.addType("text",{model:{defaults:{highlightable:!1,emptyState:{styleIn:"min-height: auto; font-size: inherit;"}}}}),t.addType("image",{model:{defaults:{traits:[{type:"image",name:"src",label:"Image",changeProp:!0,typeProps:{inputField:!0}},"alt",{type:"checkbox",name:"loading",valueTrue:"lazy"}]}}});const i=t.getType("link").model;i.typeExtends.add("text"),t.addType("link",{model:{defaults:{emptyState:!0,traits:["title",{type:"checkbox",name:"target",valueTrue:"_blank"},{type:"href",name:"href"}]},getAttrToHTML(){const u=i.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(_i)){const p=d.replace(_i,""),f=e.Pages.get(p);if(u.href=f?`./${zp(e,f)}`:"##",f&&Oc(f)){const g={id:p4(this,"id")},m=Pv(f,{currentItem:g});u.href=m.fullPath,h4(u,{...g,page:p})}}return u}}}),n.add("link",{label:"Link",content:{type:"link",content:"Link",style:{color:"#d983a6",padding:"10px"}}},{merge:!0}),t.addType("select",{model:{defaults:{traits:[{name:"name"},{type:"checkbox",name:"required"},{name:"options",type:"stack",getValue({component:u}){return u.components().map(d=>({id:d.getAttributes().value||"",label:d.getInnerHTML()}))},setValue:({component:u,value:d,emitUpdate:p})=>{u.components(d.map(f=>({type:"option",content:f.label,attributes:{value:f.id}}))),p()},properties:[{name:"id"},{name:"label"}]}]}}});const l="contentEditable";t.addType(l,{extend:"text",model:{defaults:{name:"Content",tagName:"span",hoverable:!1,draggable:!1,selectable:!1},toHTML(u){return this.getInnerHTML(u)}},view:{onRender(){this.el.style.display="contents"}}}),t.addType("button",{model:{defaults:{components:[{type:l,components:{type:"textnode",content:"Button"}}],traits:[{type:"select",name:"type",options:[{id:"button",label:"Button"},{id:"submit",label:"Submit"},{id:"reset",label:"Reset"}]}]},init(){var d;const u=[...this.components().models];(u.length>1||!((d=u[0])!=null&&d.is(l)))&&this.append({type:l})[0].append(u)}}})},ZL=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,media:`
95
+ `}}})},lL=function(e){const{Components:t,Blocks:n}=e,o=t.getType("wrapper").model.getDefaults(),s=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...o.stylable,"padding","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","vertical-align","text-decoration","text-transform","direction","white-space"]}}}),t.addType("head",{model:{components(u,d){return s.prototype.components.call(this,u,{...d,skipDomReset:!0})}},view:{updateContent(){}}}),t.addType("text",{model:{defaults:{highlightable:!1,emptyState:{styleIn:"min-height: auto; font-size: inherit;"}}}}),t.addType("image",{model:{defaults:{traits:[{type:"image",name:"src",label:"Image",changeProp:!0,typeProps:{inputField:!0}},"alt",{type:"checkbox",name:"loading",valueTrue:"lazy"}]}}});const i=t.getType("link").model;i.typeExtends.add("text"),t.addType("link",{model:{defaults:{emptyState:!0,traits:["title",{type:"checkbox",name:"target",valueTrue:"_blank"},{type:"href",name:"href"}]},getAttrToHTML(){const u=i.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(Mi)){const p=d.replace(Mi,""),f=e.Pages.get(p);if(u.href=f?`./${Kp(e,f)}`:"##",f&&Lc(f)){const h={id:O4(this,"id")},m=kb(f,{currentItem:h});u.href=m.fullPath,A4(u,{...h,page:p})}}return u}}}),n.add("link",{label:"Link",content:{type:"link",content:"Link",style:{color:"#d983a6",padding:"10px"}}},{merge:!0}),t.addType("select",{model:{defaults:{traits:[{name:"name"},{type:"checkbox",name:"required"},{name:"options",type:"stack",getValue({component:u}){return u.components().map(d=>({id:d.getAttributes().value||"",label:d.getInnerHTML()}))},setValue:({component:u,value:d,emitUpdate:p})=>{u.components(d.map(f=>({type:"option",content:f.label,attributes:{value:f.id}}))),p()},properties:[{name:"id"},{name:"label"}]}]}}});const l="contentEditable";t.addType(l,{extend:"text",model:{defaults:{name:"Content",tagName:"span",hoverable:!1,draggable:!1,selectable:!1},toHTML(u){return this.getInnerHTML(u)}},view:{onRender(){this.el.style.display="contents"}}}),t.addType("button",{model:{defaults:{components:[{type:l,components:{type:"textnode",content:"Button"}}],traits:[{type:"select",name:"type",options:[{id:"button",label:"Button"},{id:"submit",label:"Submit"},{id:"reset",label:"Reset"}]}]},init(){var d;const u=[...this.components().models];(u.length>1||!((d=u[0])!=null&&d.is(l)))&&this.append({type:l})[0].append(u)}}})},cL=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,media:`
96
96
  <svg viewBox="0 0 24 24">
97
97
  <path d="M8.3 11.5h7.4V6.9l-.2-1.6a1 1 0 00-.5-.5c-.3-.2-.7-.3-1-.3h-.6v-.4h6.8v.4h-.6c-.4 0-.7.1-1 .3a1 1 0 00-.6.6L18 6.9v10.3c0 .8 0 1.3.2 1.6 0 .2.2.3.4.5.4.2.7.3 1.1.3h.6v.4h-6.8v-.4h.5c.7 0 1.2-.2 1.5-.6.2-.3.3-.9.3-1.8v-4.9H8.3v4.9l.1 1.6.5.5c.3.2.7.3 1 .3h.7v.4H3.7v-.4h.6c.7 0 1.1-.2 1.4-.6.2-.3.3-.9.3-1.8V6.9L6 5.3a1 1 0 00-.5-.5l-1-.3h-.7v-.4h6.9v.4H10c-.4 0-.8.1-1 .3a1 1 0 00-.6.6l-.1 1.5v4.6z"></path>
98
98
  </svg>
99
- `,content:{type:o,components:"Insert your text here"},...t.block},{at:Oi(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>o4(s,"H1","H2","H3","H4","H5","H6"),model:{defaults:{emptyState:!0,tagName:"h1",traits:[{type:"select",options:[{value:"h1",name:"One (largest)"},{value:"h2",name:"Two"},{value:"h3",name:"Three"},{value:"h4",name:"Four"},{value:"h5",name:"Five"},{value:"h6",name:"Six (smallest)"}],label:"Size",name:"tagName",changeProp:!0}]}}})},YL=function(e,t={}){const{Components:n,Blocks:r}=e,o=e.Components.getType("default").model,s="imageBox",a="gjs-image-box";r.add(s,{label:s,media:`
99
+ `,content:{type:o,components:"Insert your text here"},...t.block},{at:Ai(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>w4(s,"H1","H2","H3","H4","H5","H6"),model:{defaults:{emptyState:!0,tagName:"h1",traits:[{type:"select",options:[{value:"h1",name:"One (largest)"},{value:"h2",name:"Two"},{value:"h3",name:"Three"},{value:"h4",name:"Four"},{value:"h5",name:"Five"},{value:"h6",name:"Six (smallest)"}],label:"Size",name:"tagName",changeProp:!0}]}}})},uL=function(e,t={}){const{Components:n,Blocks:r}=e,o=e.Components.getType("default").model,s="imageBox",a="gjs-image-box";r.add(s,{label:s,media:`
100
100
  <svg viewBox="0 0 24 24">
101
101
  <path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" />
102
102
  </svg>
103
- `,content:{type:s},...t.block},{at:Oi(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>Fo(i,a),model:{defaults:{tagName:"div",void:!1,droppable:!0,emptyState:!1,resizable:{tl:0,tc:0,tr:0,cl:0,cr:0,bl:0,br:0},traits:["title"],attributes:{class:a},styles:`
103
+ `,content:{type:s},...t.block},{at:Ai(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>Uo(i,a),model:{defaults:{tagName:"div",void:!1,droppable:!0,emptyState:!1,resizable:{tl:0,tc:0,tr:0,cl:0,cr:0,bl:0,br:0},traits:["title"],attributes:{class:a},styles:`
104
104
  .${a} {
105
105
  height: 200px;
106
106
  width: 100%;
107
107
  }
108
- `},getAttrToHTML(...i){return o.prototype.getAttrToHTML.apply(this,i)}},view:{tagName:"div",updateSrc(){const{model:i,em:l}=this,u=i.getSrcResult(),d=i.isDefaultSrc(),p=i.getStyle(),f=`url('${u}')`;u&&i.addStyle({"background-image":d&&p["background-image"]||f,"background-size":p["background-size"]||"contain","background-position":p["background-position"]||"center center","background-attachment":p["background-attachment"]||"scroll","background-repeat":p["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},XL=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,media:`
108
+ `},getAttrToHTML(...i){return o.prototype.getAttrToHTML.apply(this,i)}},view:{tagName:"div",updateSrc(){const{model:i,em:l}=this,u=i.getSrcResult(),d=i.isDefaultSrc(),p=i.getStyle(),f=`url('${u}')`;u&&i.addStyle({"background-image":d&&p["background-image"]||f,"background-size":p["background-size"]||"contain","background-position":p["background-position"]||"center center","background-attachment":p["background-attachment"]||"scroll","background-repeat":p["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},dL=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,media:`
109
109
  <svg viewBox="0 0 24 24">
110
110
  <path d="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,19H5V5H19V19M11,16H10C8.39,16 6,14.94 6,12C6,9.07 8.39,8 10,8H11V10H10C9.54,10 8,10.17 8,12C8,13.9 9.67,14 10,14H11V16M14,16H13V14H14C14.46,14 16,13.83 16,12C16,10.1 14.33,10 14,10H13V8H14C15.61,8 18,9.07 18,12C18,14.94 15.61,16 14,16M15,13H9V11H15V13Z" />
111
111
  </svg>
112
- `,content:{type:o},...t.block},{at:Oi(e,"link")+1}),n.addType(o,{isComponent:a=>Fo(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
112
+ `,content:{type:o},...t.block},{at:Ai(e,"link")+1}),n.addType(o,{isComponent:a=>Uo(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
113
113
  .${s} {
114
114
  color: inherit;
115
115
  display: inline-block;
@@ -118,9 +118,9 @@ ${t}
118
118
  max-width: 100%;
119
119
  text-decoration: none;
120
120
  }
121
- `}}})};function JL(e){const t={};if(e.padding){const n=e.padding.split(" ");let r=n[0],o=n[0],s=n[0],a=n[0];n.length===4?(r=n[0],o=n[1],s=n[2],a=n[3]):n.length===3?(r=n[0],o=n[1],a=n[1],s=n[2]):n.length===2&&(r=n[0],o=n[1],a=n[1],s=n[0]),t["padding-top"]=e["padding-top"]||r,t["padding-right"]=e["padding-right"]||o,t["padding-bottom"]=e["padding-bottom"]||s,t["padding-left"]=e["padding-left"]||a,delete e.padding}return{...e,...t}}const QL={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},nb=`<svg viewBox="0 0 24 24">
121
+ `}}})};function pL(e){const t={};if(e.padding){const n=e.padding.split(" ");let r=n[0],o=n[0],s=n[0],a=n[0];n.length===4?(r=n[0],o=n[1],s=n[2],a=n[3]):n.length===3?(r=n[0],o=n[1],a=n[1],s=n[2]):n.length===2&&(r=n[0],o=n[1],a=n[1],s=n[0]),t["padding-top"]=e["padding-top"]||r,t["padding-right"]=e["padding-right"]||o,t["padding-bottom"]=e["padding-bottom"]||s,t["padding-left"]=e["padding-left"]||a,delete e.padding}return{...e,...t}}const fL={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},uv=`<svg viewBox="0 0 24 24">
122
122
  <path d="M16 9h3l-5 7m-4-7h4l-2 8M5 9h3l2 7m5-12h2l2 3h-3m-5-3h2l1 3h-4M7 4h2L8 7H5m1-5L2 8l10 14L22 8l-4-6H6z"></path>
123
- </svg>`,RL=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:nb,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>Fo(i,s)||Ti(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:QL,components:nb,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:zo(({editor:i,component:l,value:u})=>{const d=i.Parser.parseHtml(u).html,p=Array.isArray(d)?d[0]:d;p&&p.tagName==="svg"&&l.components(p)},500)}],styles:`
123
+ </svg>`,gL=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:uv,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>Uo(i,s)||_i(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:fL,components:uv,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:Go(({editor:i,component:l,value:u})=>{const d=i.Parser.parseHtml(u).html,p=Array.isArray(d)?d[0]:d;p&&p.tagName==="svg"&&l.components(p)},500)}],styles:`
124
124
  .${s} {
125
125
  display: inline-block;
126
126
  text-decoration: none;
@@ -130,9 +130,9 @@ ${t}
130
130
  width: 50px;
131
131
  height: 50px;
132
132
  }
133
- `},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(i=>i.set("layerable",!1))}},view:{init(){const{model:i}=this;this.listenTo(i.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(i=>{var u;const l=(u=i.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},nf="__nc",eM=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const r=n.getName();n.get("changeProp")||delete t[r]}),delete t.id,delete t.__p,t};function tM(e){const{Components:t}=e,n=r=>{const{model:o,id:s}=r,a=o.getDefaults();t.addType(s,{model:{defaults:{traits:[...a.traits,{name:"customAttributes",type:"stack",getValue({component:i}){const l=eM(i);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:i,value:l,options:u,emitUpdate:d})=>{const p=u.removed,f=u.previous,g=u.item;if(p)i.removeAttributes(p.id);else{f&&g&&f.id!==g.id&&i.removeAttributes(f.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});i.addAttributes(m)}d()},addItem:()=>({id:nf,value:!1}),labelItem:i=>i.id===nf||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===nf?"":i,setValue:(i,l)=>i.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:i=>typeof i=="boolean"?"":i}]}]}}})};t.getTypes().forEach(n)}const nM="Basic";function rf(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=JL;const r=e.Parser.getConfig().optionsHtml;r.htmlType="text/html";const o=n.sdkOptions.pages||{};(Ht(o.allowDocuments)?o.allowDocuments:!0)&&(r.detectDocument=!0,r.allowScripts=!0),e.Components.addType("trait-check",{model:{defaults:{traits:["id","title",{type:"select",name:"select-type",options:[{id:"value1",label:"Value 1"},{id:"value2",label:"Value 2"},{id:"value3",label:"Value 3"}]},{type:"number",name:"number-type",units:["px","rem","%"]},{type:"checkbox",name:"checkbox-type"},{type:"color",name:"color-type"},{type:"button",name:"button-type",label:"Delete",command:"core:component-delete"}]}}});const a={category:nM,select:!0,activate:!0};i4(e,t),KL(e),WL(e,{block:a}),ZL(e,{block:a}),GL(e,{block:a}),qL(e,{block:a}),YL(e,{block:a}),XL(e,{block:a}),RL(e,{block:a}),tM(e)}function rb(e){const{code:t,appStore:n,showToastError:r}=e,{appEditorStore:o,toastStore:s,i18nStore:a}=n.store,{isProjectTypeEmail:i,editor:l}=o,u=(t||"").trim(),d=new DOMParser,p={input:t,output:"",error:""};let f="";try{if(i){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=qv(u,{sanitizer:m});if(g.htmlType==="text/xml"){const w=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");p.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(Nc,{mjml:v})),f=v}else{const g=d.parseFromString(u,"text/html");ob(g.documentElement);const m=g.querySelectorAll("style"),v=[];m.forEach(w=>v.push(w.innerHTML));const b=v.filter(Boolean).join(`
134
- `).trim();b&&(l==null||l.Parser.parserCss.parse(b,{throwOnError:!0}))}}catch(g){p.error=g.message}return p.error?r&&s.addError("error-parser",{header:a.t("actions.importCode.parseError"),content:p.error}):p.output=f||u,p}function ob(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const r of t)e.setAttribute(r.name,r.value);for(const r of n)ob(r)}function rM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ab(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sb(Object(n),!0).forEach(function(r){rM(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oM(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function sM(e,t){if(e==null)return{};var n=oM(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aM(e,t){return iM(e)||lM(e,t)||cM(e,t)||uM()}function iM(e){if(Array.isArray(e))return e}function lM(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,s=void 0;try{for(var a=e[Symbol.iterator](),i;!(r=(i=a.next()).done)&&(n.push(i.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,s=l}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw s}}return n}}function cM(e,t){if(e){if(typeof e=="string")return ib(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ib(e,t)}}function ib(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function uM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
135
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lb(Object(n),!0).forEach(function(r){dM(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,s){return s(o)},r)}}function Ii(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function $c(e){return{}.toString.call(e).includes("Object")}function fM(e){return!Object.keys(e).length}function Vi(e){return typeof e=="function"}function hM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gM(e,t){return $c(t)||Go("changeType"),Object.keys(t).some(function(n){return!hM(e,n)})&&Go("changeField"),t}function mM(e){Vi(e)||Go("selectorType")}function vM(e){Vi(e)||$c(e)||Go("handlerType"),$c(e)&&Object.values(e).some(function(t){return!Vi(t)})&&Go("handlersType")}function bM(e){e||Go("initialIsRequired"),$c(e)||Go("initialType"),fM(e)&&Go("initialContent")}function yM(e,t){throw new Error(e[t]||e.default)}var wM={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Go=Ii(yM)(wM),kc={changes:gM,selector:mM,handler:vM,initial:bM};function SM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};kc.initial(e),kc.handler(t);var n={current:e},r=Ii(EM)(n,t),o=Ii(xM)(n),s=Ii(kc.changes)(e),a=Ii(CM)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return kc.selector(u),u(n.current)}function l(u){pM(r,o,s,a)(u)}return[i,l]}function CM(e,t){return Vi(t)?t(e.current):t}function xM(e,t){return e.current=cb(cb({},e.current),t),t}function EM(e,t,n){return Vi(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var PM={create:SM},TM={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function OM(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function _M(e){return{}.toString.call(e).includes("Object")}function AM(e){return e||db("configIsRequired"),_M(e)||db("configType"),e.urls?(LM(),{paths:{vs:e.urls.monacoBase}}):e}function LM(){console.warn(ub.deprecation)}function MM(e,t){throw new Error(e[t]||e.default)}var ub={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
133
+ `},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(i=>i.set("layerable",!1))}},view:{init(){const{model:i}=this;this.listenTo(i.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(i=>{var u;const l=(u=i.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},lf="__nc",hL=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const r=n.getName();n.get("changeProp")||delete t[r]}),delete t.id,delete t.__p,t};function mL(e){const{Components:t}=e,n=r=>{const{model:o,id:s}=r,a=o.getDefaults();t.addType(s,{model:{defaults:{traits:[...a.traits,{name:"customAttributes",type:"stack",getValue({component:i}){const l=hL(i);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:i,value:l,options:u,emitUpdate:d})=>{const p=u.removed,f=u.previous,h=u.item;if(p)i.removeAttributes(p.id);else{f&&h&&f.id!==h.id&&i.removeAttributes(f.id);const m=l.reduce((b,v)=>(b[v.id]=v.value||"",b),{});i.addAttributes(m)}d()},addItem:()=>({id:lf,value:!1}),labelItem:i=>i.id===lf||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===lf?"":i,setValue:(i,l)=>i.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:i=>typeof i=="boolean"?"":i}]}]}}})};t.getTypes().forEach(n)}const bL="Basic";function cf(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=pL;const r=e.Parser.getConfig().optionsHtml;r.htmlType="text/html";const o=n.sdkOptions.pages||{};(Ht(o.allowDocuments)?o.allowDocuments:!0)&&(r.detectDocument=!0,r.allowScripts=!0),e.Components.addType("trait-check",{model:{defaults:{traits:["id","title",{type:"select",name:"select-type",options:[{id:"value1",label:"Value 1"},{id:"value2",label:"Value 2"},{id:"value3",label:"Value 3"}]},{type:"number",name:"number-type",units:["px","rem","%"]},{type:"checkbox",name:"checkbox-type"},{type:"color",name:"color-type"},{type:"button",name:"button-type",label:"Delete",command:"core:component-delete"}]}}});const a={category:bL,select:!0,activate:!0};x4(e,t),lL(e),sL(e,{block:a}),cL(e,{block:a}),aL(e,{block:a}),iL(e,{block:a}),uL(e,{block:a}),dL(e,{block:a}),gL(e,{block:a}),mL(e)}function dv(e){const{code:t,appStore:n,showToastError:r}=e,{appEditorStore:o,toastStore:s,i18nStore:a}=n.store,{isProjectTypeEmail:i,editor:l}=o,u=(t||"").trim(),d=new DOMParser,p={input:t,output:"",error:""};let f="";try{if(i){const h=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=h.codeSanitizer,b=tv(u,{sanitizer:m});if(h.htmlType==="text/xml"){const w=d.parseFromString(`<div>${b}</div>`,"text/xml").querySelector("parsererror div");p.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(Vc,{mjml:b})),f=b}else{const h=d.parseFromString(u,"text/html");pv(h.documentElement);const m=h.querySelectorAll("style"),b=[];m.forEach(w=>b.push(w.innerHTML));const v=b.filter(Boolean).join(`
134
+ `).trim();v&&(l==null||l.Parser.parserCss.parse(v,{throwOnError:!0}))}}catch(h){p.error=h.message}return p.error?r&&s.addError("error-parser",{header:a.t("actions.importCode.parseError"),content:p.error}):p.output=f||u,p}function pv(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const r of t)e.setAttribute(r.name,r.value);for(const r of n)pv(r)}function vL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function gv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fv(Object(n),!0).forEach(function(r){vL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yL(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function wL(e,t){if(e==null)return{};var n=yL(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function SL(e,t){return CL(e)||xL(e,t)||EL(e,t)||PL()}function CL(e){if(Array.isArray(e))return e}function xL(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,s=void 0;try{for(var a=e[Symbol.iterator](),i;!(r=(i=a.next()).done)&&(n.push(i.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,s=l}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw s}}return n}}function EL(e,t){if(e){if(typeof e=="string")return hv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hv(e,t)}}function hv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function PL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
135
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function bv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mv(Object(n),!0).forEach(function(r){TL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function OL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,s){return s(o)},r)}}function Hi(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function Hc(e){return{}.toString.call(e).includes("Object")}function _L(e){return!Object.keys(e).length}function ji(e){return typeof e=="function"}function AL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ML(e,t){return Hc(t)||Zo("changeType"),Object.keys(t).some(function(n){return!AL(e,n)})&&Zo("changeField"),t}function LL(e){ji(e)||Zo("selectorType")}function NL(e){ji(e)||Hc(e)||Zo("handlerType"),Hc(e)&&Object.values(e).some(function(t){return!ji(t)})&&Zo("handlersType")}function $L(e){e||Zo("initialIsRequired"),Hc(e)||Zo("initialType"),_L(e)&&Zo("initialContent")}function kL(e,t){throw new Error(e[t]||e.default)}var IL={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Zo=Hi(kL)(IL),jc={changes:ML,selector:LL,handler:NL,initial:$L};function VL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jc.initial(e),jc.handler(t);var n={current:e},r=Hi(DL)(n,t),o=Hi(jL)(n),s=Hi(jc.changes)(e),a=Hi(HL)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return jc.selector(u),u(n.current)}function l(u){OL(r,o,s,a)(u)}return[i,l]}function HL(e,t){return ji(t)?t(e.current):t}function jL(e,t){return e.current=bv(bv({},e.current),t),t}function DL(e,t,n){return ji(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var FL={create:VL},BL={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function zL(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function UL(e){return{}.toString.call(e).includes("Object")}function WL(e){return e||yv("configIsRequired"),UL(e)||yv("configType"),e.urls?(GL(),{paths:{vs:e.urls.monacoBase}}):e}function GL(){console.warn(vv.deprecation)}function qL(e,t){throw new Error(e[t]||e.default)}var vv={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
136
136
  You are using deprecated way of configuration.
137
137
 
138
138
  Instead of using
@@ -141,7 +141,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
141
141
  monaco.config({ paths: { vs: '...' } })
142
142
 
143
143
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
144
- `},db=OM(MM)(ub),NM={config:AM},$M=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(s,a){return a(s)},o)}};function pb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],pb(e[n],t[n]))}),ab(ab({},e),t)}var kM={type:"cancelation",msg:"operation is manually canceled"};function of(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(kM):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var IM=PM.create({config:TM,isInitialized:!1,resolve:null,reject:null,monaco:null}),fb=aM(IM,2),Hi=fb[0],Ic=fb[1];function VM(e){var t=NM.config(e),n=t.monaco,r=sM(t,["monaco"]);Ic(function(o){return{config:pb(o.config,r),monaco:n}})}function HM(){var e=Hi(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Ic({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),of(sf);if(window.monaco&&window.monaco.editor)return hb(window.monaco),e.resolve(window.monaco),of(sf);$M(jM,FM)(BM)}return of(sf)}function jM(e){return document.body.appendChild(e)}function DM(e){var t=document.createElement("script");return e&&(t.src=e),t}function FM(e){var t=Hi(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=DM("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function BM(){var e=Hi(function(n){var r=n.config,o=n.resolve,s=n.reject;return{config:r,resolve:o,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){hb(n),e.resolve(n)},function(n){e.reject(n)})}function hb(e){Hi().monaco||Ic({monaco:e})}function zM(){return Hi(function(e){var t=e.monaco;return t})}var sf=new Promise(function(e,t){return Ic({resolve:e,reject:t})}),gb={config:VM,init:HM,__getMonacoInstance:zM},UM={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},af=UM,WM={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},GM=WM;function qM({children:e}){return h.createElement("div",{style:GM.container},e)}var KM=qM,ZM=KM;function YM({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return h.createElement("section",{style:{...af.wrapper,width:e,height:t},...a},!n&&h.createElement(ZM,null,r),h.createElement("div",{ref:o,style:{...af.fullWidth,...!n&&af.hide},className:s}))}var XM=YM,mb=h.memo(XM);function JM(e){h.useEffect(e,[])}var vb=JM;function QM(e,t,n=!0){let r=h.useRef(!0);h.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var kn=QM;function ji(){}function Ea(e,t,n,r){return RM(e,r)||eN(e,t,n,r)}function RM(e,t){return e.editor.getModel(bb(e,t))}function eN(e,t,n,r){return e.editor.createModel(t,n,r?bb(e,r):void 0)}function bb(e,t){return e.Uri.parse(t)}function tN({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:p={},height:f="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=ji,onMount:w=ji}){let[y,S]=h.useState(!1),[C,x]=h.useState(!0),E=h.useRef(null),P=h.useRef(null),_=h.useRef(null),T=h.useRef(w),O=h.useRef(b),L=h.useRef(!1);vb(()=>{let M=gb.init();return M.then(j=>(P.current=j)&&x(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>E.current?B():M.cancel()}),kn(()=>{if(E.current&&P.current){let M=E.current.getOriginalEditor(),j=Ea(P.current,e||"",r||n||"text",s||"");j!==M.getModel()&&M.setModel(j)}},[s],y),kn(()=>{if(E.current&&P.current){let M=E.current.getModifiedEditor(),j=Ea(P.current,t||"",o||n||"text",a||"");j!==M.getModel()&&M.setModel(j)}},[a],y),kn(()=>{let M=E.current.getModifiedEditor();M.getOption(P.current.editor.EditorOption.readOnly)?M.setValue(t||""):t!==M.getValue()&&(M.executeEdits("",[{range:M.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),M.pushUndoStop())},[t],y),kn(()=>{var M,j;(j=(M=E.current)==null?void 0:M.getModel())==null||j.original.setValue(e||"")},[e],y),kn(()=>{let{original:M,modified:j}=E.current.getModel();P.current.editor.setModelLanguage(M,r||n||"text"),P.current.editor.setModelLanguage(j,o||n||"text")},[n,r,o],y),kn(()=>{var M;(M=P.current)==null||M.editor.setTheme(u)},[u],y),kn(()=>{var M;(M=E.current)==null||M.updateOptions(p)},[p],y);let A=h.useCallback(()=>{var W;if(!P.current)return;O.current(P.current);let M=Ea(P.current,e||"",r||n||"text",s||""),j=Ea(P.current,t||"",o||n||"text",a||"");(W=E.current)==null||W.setModel({original:M,modified:j})},[n,t,o,e,r,s,a]),$=h.useCallback(()=>{var M;!L.current&&_.current&&(E.current=P.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...p}),A(),(M=P.current)==null||M.editor.setTheme(u),S(!0),L.current=!0)},[p,u,A]);h.useEffect(()=>{y&&T.current(E.current,P.current)},[y]),h.useEffect(()=>{!C&&!y&&$()},[C,y,$]);function B(){var j,W,D,z;let M=(j=E.current)==null?void 0:j.getModel();i||((W=M==null?void 0:M.original)==null||W.dispose()),l||((D=M==null?void 0:M.modified)==null||D.dispose()),(z=E.current)==null||z.dispose()}return h.createElement(mb,{width:g,height:f,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:v})}var nN=tN;h.memo(nN);function rN(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var oN=rN,Vc=new Map;function sN({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:s,theme:a="light",line:i,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:w=ji,onMount:y=ji,onChange:S,onValidate:C=ji}){let[x,E]=h.useState(!1),[P,_]=h.useState(!0),T=h.useRef(null),O=h.useRef(null),L=h.useRef(null),A=h.useRef(y),$=h.useRef(w),B=h.useRef(),M=h.useRef(r),j=oN(s),W=h.useRef(!1),D=h.useRef(!1);vb(()=>{let H=gb.init();return H.then(V=>(T.current=V)&&_(!1)).catch(V=>(V==null?void 0:V.type)!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>O.current?I():H.cancel()}),kn(()=>{var V,G,Y,J;let H=Ea(T.current,e||r||"",t||o||"",s||n||"");H!==((V=O.current)==null?void 0:V.getModel())&&(p&&Vc.set(j,(G=O.current)==null?void 0:G.saveViewState()),(Y=O.current)==null||Y.setModel(H),p&&((J=O.current)==null||J.restoreViewState(Vc.get(s))))},[s],x),kn(()=>{var H;(H=O.current)==null||H.updateOptions(u)},[u],x),kn(()=>{!O.current||r===void 0||(O.current.getOption(T.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(D.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),D.current=!1))},[r],x),kn(()=>{var V,G;let H=(V=O.current)==null?void 0:V.getModel();H&&o&&((G=T.current)==null||G.editor.setModelLanguage(H,o))},[o],x),kn(()=>{var H;i!==void 0&&((H=O.current)==null||H.revealLine(i))},[i],x),kn(()=>{var H;(H=T.current)==null||H.editor.setTheme(a)},[a],x);let z=h.useCallback(()=>{var H;if(!(!L.current||!T.current)&&!W.current){$.current(T.current);let V=s||n,G=Ea(T.current,r||e||"",t||o||"",V||"");O.current=(H=T.current)==null?void 0:H.editor.create(L.current,{model:G,automaticLayout:!0,...u},d),p&&O.current.restoreViewState(Vc.get(V)),T.current.editor.setTheme(a),i!==void 0&&O.current.revealLine(i),E(!0),W.current=!0}},[e,t,n,r,o,s,u,d,p,a,i]);h.useEffect(()=>{x&&A.current(O.current,T.current)},[x]),h.useEffect(()=>{!P&&!x&&z()},[P,x,z]),M.current=r,h.useEffect(()=>{var H,V;x&&S&&((H=B.current)==null||H.dispose(),B.current=(V=O.current)==null?void 0:V.onDidChangeModelContent(G=>{D.current||S(O.current.getValue(),G)}))},[x,S]),h.useEffect(()=>{if(x){let H=T.current.editor.onDidChangeMarkers(V=>{var Y;let G=(Y=O.current.getModel())==null?void 0:Y.uri;if(G&&V.find(J=>J.path===G.path)){let J=T.current.editor.getModelMarkers({resource:G});C==null||C(J)}});return()=>{H==null||H.dispose()}}return()=>{}},[x,C]);function I(){var H,V;(H=B.current)==null||H.dispose(),f?p&&Vc.set(s,O.current.saveViewState()):(V=O.current.getModel())==null||V.dispose(),O.current.dispose()}return h.createElement(mb,{width:g,height:m,isEditorReady:x,loading:l,_ref:L,className:v,wrapperProps:b})}var aN=sN,iN=h.memo(aN),lN=iN;function qo({className:e,as:t="label",bold:n,m:r="gjs-mb-1",size:o="m",capitalize:s=!0,children:a,tip:i,onClear:l,...u}){const d=t,p=!!l;return c.jsxs(d,{className:N(e,r,p&&U.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||p?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...p&&{htmlFor:""},...u,children:[!!i&&c.jsx(Wt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:c.jsx(re,{icon:K.information,size:se.s2x})}),a,p&&c.jsx(Ct,{title:"Clear value",onClick:l,icon:{icon:K.close,size:se.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var yb=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(yb||{}),wb=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(wb||{});const cN="gs-cmp-button",Hc=h.memo(ce(function({classNameBtn:t,className:n,children:r,tooltip:o,variant:s,onClick:a,editorEvents:i,label:l,size:u,icon:d,active:p,buttonType:f,disabled:g,...m}){const{editor:v}=ye(),[b,w]=h.useState(()=>({disabled:g,variant:s,active:p,className:n,classNameBtn:t,tooltip:o,icon:d,size:u,label:l})),y=b.variant,S=y==="outline",C=y==="secondary",E=y==="primary"?"pr":y==="danger"?"danger":S||C?"out-clear":void 0,P=b.label,_=O=>{v&&(a==null||a({event:O,editor:v,state:b,setState:L=>w(A=>({...A,...L}))}))};h.useEffect(()=>{if(!i||!v)return;const O=Object.keys(i).reduce((A,$)=>(A[$]=(B={})=>{i[$]({fromEvent:B,editor:v,state:b,setState:M=>w(j=>({...j,...M}))})},A),{}),L=Object.keys(O);return L.forEach(A=>v.on(A,O[A])),()=>{L.forEach(A=>v.off(A,O[A]))}},[v,b]);const T=b.tooltip;return c.jsx(Ct,{className:N(cN,b.classNameBtn),classNameWrp:b.className,variant:E,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:_,border:S||C,type:f,withBg:C,block:!0,...ct(T)?{title:T}:{tooltipProps:T},...m,children:P?et(P)?P({editor:v}):P:r})}));var lf=(e=>(e.m="m",e.s="s",e))(lf||{});const Sb="gs-input-field",jc=e=>Ht(e)?e:"",Di=(e={})=>N("gs-utl-w-full",U.bgTr,Mo.inputText,e.disabled&&U.txtLowEmphasis),cf=({size:e="m"}={})=>N("gs-input-container gs-utl-w-full",U.bg,te.b,te.rnd,U.br,e==="m"&&Te.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),Ko=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${Sb}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),Cr=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,p=!!r,f=!!o,g=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!p&&!(d!=null&&d.length)&&!f)return null;const m=c.jsx(c.Fragment,{children:p&&c.jsx(qo,{as:t,className:"gs-utl-w-full",size:n,tip:f?void 0:i,onClear:g,m:"",children:r})}),v=u||d!=null&&d.length?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,w)=>c.jsx(Hc,{...b},b.id??w))]}):null;return c.jsxs(k,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,f&&c.jsx(qo,{size:n,tip:i,as:"span",className:N(U.txtLowEmphasis),capitalize:!1,children:o})]})},rt=qt(function(t,n){const{className:r,pattern:o,value:s,type:a,placeholder:i,required:l,disabled:u,readOnly:d,name:p,autoFocus:f,onInput:g,onChange:m,onBlur:v,onKeyDown:b,labelAs:w}=t,[y,S]=h.useState(jc(s)),C=Di(t),x=h.useRef(null);h.useImperativeHandle(n,()=>x.current,[]),h.useEffect(()=>{S(jc(s))},[s]),h.useEffect(()=>{const L=x.current;if(L&&f){const A=L.querySelector("input"),$=setTimeout(()=>A==null?void 0:A.focus(),Ld);return()=>clearTimeout($)}},[x.current,f]);const E=(L,A)=>{m==null||m(L,A)},P=L=>{const{key:A}=L;switch(b==null||b(L),A){case"Escape":return S(s);case"Enter":return E(y)}},_=()=>{E(y),v==null||v()},T=L=>{const A=L.target.value;S(A),g==null||g(A)},O=Ko({...t,className:N(Sb,r)});return c.jsxs("div",{...O,ref:x,children:[c.jsx(Cr,{...t,as:w}),c.jsxs(k,{className:cf(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(F,{grow:!0,children:c.jsx("input",{className:C,name:p,pattern:o,value:y,onChange:T,placeholder:i,required:l,onBlur:_,onKeyDown:P,readOnly:d,disabled:u,type:a,minLength:t.minLength,maxLength:t.maxLength})}),t.afterInput]})]})}),Cb=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},uN="gs-field-code",dN={minimap:{enabled:!1},lineNumbers:"off",scrollBeyondLastLine:!1,contextmenu:!1,fixedOverflowWidgets:!0,showFoldingControls:"always",suggestOnTriggerCharacters:!1,lineDecorationsWidth:0,renderLineHighlight:"none",wordWrapOverride1:"off",tabSize:2,scrollbar:{verticalScrollbarSize:8,horizontal:"hidden",alwaysConsumeMouseWheel:!1}};function vo(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:f,name:g,required:m,disabled:v,formatOnMount:b=!0,monacoOptions:w,labelAs:y}=e,S=n!==void 0,C=r,x=S?n:t,E=typeof x=="string"?x:JSON.stringify(x??"",null,2),P=Ko({...e,className:N(uN,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),_=N("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...P,children:[c.jsx(Cr,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[g&&c.jsx("input",{className:Oe.hiddenVisually,name:g,value:E,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",v&&Oe.disabled),children:c.jsx(lN,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:N(te.b,te.rnd,U.br,l),options:{...dN,readOnly:f,...s&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Ht(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:o,onMount:(T,O)=>{if(b){let L=!1;const A=()=>Cb(T);T.onDidChangeModelLanguageConfiguration(A),T.onDidScrollChange(()=>{L||(L=!0,A())}),setTimeout(A,10)}p==null||p(T,O)}})})]})]})}const xb=ce(function({buttonProps:t,content:n,code:r,onAction:o}){const s=xa(),a=Ie(),i=ye(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=zr(),[p,f]=h.useState(),g=()=>{let v=(p||"").trim();const b=rb({code:v,appStore:i,showToastError:!0});if(!b.error)v=b.output;else return;o?o(v):l?u.loadProjectData({pages:[{component:v}]}):u.setComponents(v),s.close()};h.useEffect(()=>{r?f(r):(async()=>{var C,x;const b=await u.runCommand(ne.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=b.find(E=>E.mimeType==="text/html"))==null?void 0:C.content,y=(x=b.find(E=>E.mimeType==="text/mjml"))==null?void 0:x.content,S=l?y:w;S&&f(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(k,{gap:"m",col:!0,full:!0,children:[c.jsx(F,{children:n??a.t("actions.importCode.content")}),c.jsx(F,{grow:!0,children:p!==void 0&&c.jsx(vo,{defaultValue:p,onChange:v=>f(v||""),isDarkTheme:d,language:"html"})}),c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),uf="data-type-empty",Eb=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${uf}]`));for(const s of o)s.disabled=!t})},pN=(e,t,n="Empty",r={})=>{const o=`[${uf}="${t}"]`;if(!e.frameView.getDoc())return;const s=e.frameView.getHead(),{midSelector:a="",styleOut:i="",styleIn:l=""}=r;if(!s.querySelector(`style${o}`)){const u=document.createElement("style");u.setAttribute(uf,t),u.innerHTML=`
144
+ `},yv=zL(qL)(vv),KL={config:WL},ZL=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(s,a){return a(s)},o)}};function wv(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],wv(e[n],t[n]))}),gv(gv({},e),t)}var YL={type:"cancelation",msg:"operation is manually canceled"};function uf(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(YL):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var XL=FL.create({config:BL,isInitialized:!1,resolve:null,reject:null,monaco:null}),Sv=SL(XL,2),Di=Sv[0],Dc=Sv[1];function JL(e){var t=KL.config(e),n=t.monaco,r=wL(t,["monaco"]);Dc(function(o){return{config:wv(o.config,r),monaco:n}})}function QL(){var e=Di(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Dc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),uf(df);if(window.monaco&&window.monaco.editor)return Cv(window.monaco),e.resolve(window.monaco),uf(df);ZL(RL,tN)(nN)}return uf(df)}function RL(e){return document.body.appendChild(e)}function eN(e){var t=document.createElement("script");return e&&(t.src=e),t}function tN(e){var t=Di(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=eN("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function nN(){var e=Di(function(n){var r=n.config,o=n.resolve,s=n.reject;return{config:r,resolve:o,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){Cv(n),e.resolve(n)},function(n){e.reject(n)})}function Cv(e){Di().monaco||Dc({monaco:e})}function rN(){return Di(function(e){var t=e.monaco;return t})}var df=new Promise(function(e,t){return Dc({resolve:e,reject:t})}),xv={config:JL,init:QL,__getMonacoInstance:rN},oN={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},pf=oN,sN={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},aN=sN;function iN({children:e}){return g.createElement("div",{style:aN.container},e)}var lN=iN,cN=lN;function uN({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return g.createElement("section",{style:{...pf.wrapper,width:e,height:t},...a},!n&&g.createElement(cN,null,r),g.createElement("div",{ref:o,style:{...pf.fullWidth,...!n&&pf.hide},className:s}))}var dN=uN,Ev=g.memo(dN);function pN(e){g.useEffect(e,[])}var Pv=pN;function fN(e,t,n=!0){let r=g.useRef(!0);g.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var kn=fN;function Fi(){}function Pa(e,t,n,r){return gN(e,r)||hN(e,t,n,r)}function gN(e,t){return e.editor.getModel(Tv(e,t))}function hN(e,t,n,r){return e.editor.createModel(t,n,r?Tv(e,r):void 0)}function Tv(e,t){return e.Uri.parse(t)}function mN({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:p={},height:f="100%",width:h="100%",className:m,wrapperProps:b={},beforeMount:v=Fi,onMount:w=Fi}){let[y,S]=g.useState(!1),[C,E]=g.useState(!0),x=g.useRef(null),P=g.useRef(null),_=g.useRef(null),T=g.useRef(w),O=g.useRef(v),M=g.useRef(!1);Pv(()=>{let L=xv.init();return L.then(H=>(P.current=H)&&E(!1)).catch(H=>(H==null?void 0:H.type)!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>x.current?j():L.cancel()}),kn(()=>{if(x.current&&P.current){let L=x.current.getOriginalEditor(),H=Pa(P.current,e||"",r||n||"text",s||"");H!==L.getModel()&&L.setModel(H)}},[s],y),kn(()=>{if(x.current&&P.current){let L=x.current.getModifiedEditor(),H=Pa(P.current,t||"",o||n||"text",a||"");H!==L.getModel()&&L.setModel(H)}},[a],y),kn(()=>{let L=x.current.getModifiedEditor();L.getOption(P.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),kn(()=>{var L,H;(H=(L=x.current)==null?void 0:L.getModel())==null||H.original.setValue(e||"")},[e],y),kn(()=>{let{original:L,modified:H}=x.current.getModel();P.current.editor.setModelLanguage(L,r||n||"text"),P.current.editor.setModelLanguage(H,o||n||"text")},[n,r,o],y),kn(()=>{var L;(L=P.current)==null||L.editor.setTheme(u)},[u],y),kn(()=>{var L;(L=x.current)==null||L.updateOptions(p)},[p],y);let A=g.useCallback(()=>{var W;if(!P.current)return;O.current(P.current);let L=Pa(P.current,e||"",r||n||"text",s||""),H=Pa(P.current,t||"",o||n||"text",a||"");(W=x.current)==null||W.setModel({original:L,modified:H})},[n,t,o,e,r,s,a]),$=g.useCallback(()=>{var L;!M.current&&_.current&&(x.current=P.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...p}),A(),(L=P.current)==null||L.editor.setTheme(u),S(!0),M.current=!0)},[p,u,A]);g.useEffect(()=>{y&&T.current(x.current,P.current)},[y]),g.useEffect(()=>{!C&&!y&&$()},[C,y,$]);function j(){var H,W,B,G;let L=(H=x.current)==null?void 0:H.getModel();i||((W=L==null?void 0:L.original)==null||W.dispose()),l||((B=L==null?void 0:L.modified)==null||B.dispose()),(G=x.current)==null||G.dispose()}return g.createElement(Ev,{width:h,height:f,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:b})}var bN=mN;g.memo(bN);function vN(e){let t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}var yN=vN,Fc=new Map;function wN({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:s,theme:a="light",line:i,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:f=!1,width:h="100%",height:m="100%",className:b,wrapperProps:v={},beforeMount:w=Fi,onMount:y=Fi,onChange:S,onValidate:C=Fi}){let[E,x]=g.useState(!1),[P,_]=g.useState(!0),T=g.useRef(null),O=g.useRef(null),M=g.useRef(null),A=g.useRef(y),$=g.useRef(w),j=g.useRef(),L=g.useRef(r),H=yN(s),W=g.useRef(!1),B=g.useRef(!1);Pv(()=>{let V=xv.init();return V.then(k=>(T.current=k)&&_(!1)).catch(k=>(k==null?void 0:k.type)!=="cancelation"&&console.error("Monaco initialization: error:",k)),()=>O.current?D():V.cancel()}),kn(()=>{var k,z,Y,X;let V=Pa(T.current,e||r||"",t||o||"",s||n||"");V!==((k=O.current)==null?void 0:k.getModel())&&(p&&Fc.set(H,(z=O.current)==null?void 0:z.saveViewState()),(Y=O.current)==null||Y.setModel(V),p&&((X=O.current)==null||X.restoreViewState(Fc.get(s))))},[s],E),kn(()=>{var V;(V=O.current)==null||V.updateOptions(u)},[u],E),kn(()=>{!O.current||r===void 0||(O.current.getOption(T.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(B.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),B.current=!1))},[r],E),kn(()=>{var k,z;let V=(k=O.current)==null?void 0:k.getModel();V&&o&&((z=T.current)==null||z.editor.setModelLanguage(V,o))},[o],E),kn(()=>{var V;i!==void 0&&((V=O.current)==null||V.revealLine(i))},[i],E),kn(()=>{var V;(V=T.current)==null||V.editor.setTheme(a)},[a],E);let G=g.useCallback(()=>{var V;if(!(!M.current||!T.current)&&!W.current){$.current(T.current);let k=s||n,z=Pa(T.current,r||e||"",t||o||"",k||"");O.current=(V=T.current)==null?void 0:V.editor.create(M.current,{model:z,automaticLayout:!0,...u},d),p&&O.current.restoreViewState(Fc.get(k)),T.current.editor.setTheme(a),i!==void 0&&O.current.revealLine(i),x(!0),W.current=!0}},[e,t,n,r,o,s,u,d,p,a,i]);g.useEffect(()=>{E&&A.current(O.current,T.current)},[E]),g.useEffect(()=>{!P&&!E&&G()},[P,E,G]),L.current=r,g.useEffect(()=>{var V,k;E&&S&&((V=j.current)==null||V.dispose(),j.current=(k=O.current)==null?void 0:k.onDidChangeModelContent(z=>{B.current||S(O.current.getValue(),z)}))},[E,S]),g.useEffect(()=>{if(E){let V=T.current.editor.onDidChangeMarkers(k=>{var Y;let z=(Y=O.current.getModel())==null?void 0:Y.uri;if(z&&k.find(X=>X.path===z.path)){let X=T.current.editor.getModelMarkers({resource:z});C==null||C(X)}});return()=>{V==null||V.dispose()}}return()=>{}},[E,C]);function D(){var V,k;(V=j.current)==null||V.dispose(),f?p&&Fc.set(s,O.current.saveViewState()):(k=O.current.getModel())==null||k.dispose(),O.current.dispose()}return g.createElement(Ev,{width:h,height:m,isEditorReady:E,loading:l,_ref:M,className:b,wrapperProps:v})}var SN=wN,CN=g.memo(SN),xN=CN;function Yo({className:e,as:t="label",bold:n,m:r="gjs-mb-1",size:o="m",capitalize:s=!0,children:a,tip:i,onClear:l,...u}){const d=t,p=!!l;return c.jsxs(d,{className:N(e,r,p&&U.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||p?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...p&&{htmlFor:""},...u,children:[!!i&&c.jsx(Gt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:c.jsx(ne,{icon:K.information,size:se.s2x})}),a,p&&c.jsx(wt,{title:"Clear value",onClick:l,icon:{icon:K.close,size:se.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var Ov=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(Ov||{}),_v=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(_v||{});const EN="gs-cmp-button",Bc=g.memo(ce(function({classNameBtn:t,className:n,children:r,tooltip:o,variant:s,onClick:a,editorEvents:i,label:l,size:u,icon:d,active:p,buttonType:f,disabled:h,...m}){const{editor:b}=Ce(),[v,w]=g.useState(()=>({disabled:h,variant:s,active:p,className:n,classNameBtn:t,tooltip:o,icon:d,size:u,label:l})),y=v.variant,S=y==="outline",C=y==="secondary",x=y==="primary"?"pr":y==="danger"?"danger":S||C?"out-clear":void 0,P=v.label,_=O=>{b&&(a==null||a({event:O,editor:b,state:v,setState:M=>w(A=>({...A,...M}))}))};g.useEffect(()=>{if(!i||!b)return;const O=Object.keys(i).reduce((A,$)=>(A[$]=(j={})=>{i[$]({fromEvent:j,editor:b,state:v,setState:L=>w(H=>({...H,...L}))})},A),{}),M=Object.keys(O);return M.forEach(A=>b.on(A,O[A])),()=>{M.forEach(A=>b.off(A,O[A]))}},[b,v]);const T=v.tooltip;return c.jsx(wt,{className:N(EN,v.classNameBtn),classNameWrp:v.className,variant:x,icon:v.icon,active:v.active,size:v.size,disabled:v.disabled,onClick:_,border:S||C,type:f,withBg:C,block:!0,...dt(T)?{title:T}:{tooltipProps:T},...m,children:P?ot(P)?P({editor:b}):P:r})}));var ff=(e=>(e.m="m",e.s="s",e))(ff||{});const Av="gs-input-field",zc=e=>Ht(e)?e:"",Bi=(e={})=>N("gs-utl-w-full",U.bgTr,$o.inputText,e.disabled&&U.txtLowEmphasis),gf=({size:e="m"}={})=>N("gs-input-container gs-utl-w-full",U.bg,re.b,re.rnd,U.br,e==="m"&&Te.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),Xo=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${Av}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),Er=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,p=!!r,f=!!o,h=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!p&&!(d!=null&&d.length)&&!f)return null;const m=c.jsx(c.Fragment,{children:p&&c.jsx(Yo,{as:t,className:"gs-utl-w-full",size:n,tip:f?void 0:i,onClear:h,m:"",children:r})}),b=u||d!=null&&d.length?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((v,w)=>c.jsx(Bc,{...v},v.id??w))]}):null;return c.jsxs(I,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[b?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[m,b]}):m,f&&c.jsx(Yo,{size:n,tip:i,as:"span",className:N(U.txtLowEmphasis),capitalize:!1,children:o})]})},at=Kt(function(t,n){const{className:r,pattern:o,value:s,type:a,placeholder:i,required:l,disabled:u,readOnly:d,name:p,autoFocus:f,onInput:h,onChange:m,onBlur:b,onKeyDown:v,labelAs:w}=t,[y,S]=g.useState(zc(s)),C=Bi(t),E=g.useRef(null);g.useImperativeHandle(n,()=>E.current,[]),g.useEffect(()=>{S(zc(s))},[s]),g.useEffect(()=>{const M=E.current;if(M&&f){const A=M.querySelector("input"),$=setTimeout(()=>A==null?void 0:A.focus(),kd);return()=>clearTimeout($)}},[E.current,f]);const x=(M,A)=>{m==null||m(M,A)},P=M=>{const{key:A}=M;switch(v==null||v(M),A){case"Escape":return S(s);case"Enter":return x(y)}},_=()=>{x(y),b==null||b()},T=M=>{const A=M.target.value;S(A),h==null||h(A)},O=Xo({...t,className:N(Av,r)});return c.jsxs("div",{...O,ref:E,children:[c.jsx(Er,{...t,as:w}),c.jsxs(I,{className:gf(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(F,{grow:!0,children:c.jsx("input",{className:C,name:p,pattern:o,value:y,onChange:T,placeholder:i,required:l,onBlur:_,onKeyDown:P,readOnly:d,disabled:u,type:a,minLength:t.minLength,maxLength:t.maxLength})}),t.afterInput]})]})}),Mv=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},Uc=(e,t)=>{var r;const n=(r=e==null?void 0:e.getModel())==null?void 0:r.getFullModelRange();e==null||e.executeEdits("update-value",[{range:n,text:t,forceMoveMarkers:!0}])},PN="gs-field-code",TN={minimap:{enabled:!1},lineNumbers:"off",scrollBeyondLastLine:!1,contextmenu:!1,fixedOverflowWidgets:!0,showFoldingControls:"always",suggestOnTriggerCharacters:!1,lineDecorationsWidth:0,renderLineHighlight:"none",wordWrapOverride1:"off",tabSize:2,scrollbar:{verticalScrollbarSize:8,horizontal:"hidden",alwaysConsumeMouseWheel:!1}};function Pr(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:f,name:h,required:m,disabled:b,formatOnMount:v=!0,monacoOptions:w,labelAs:y}=e,S=n!==void 0,C=r,E=S?n:t,x=typeof E=="string"?E:JSON.stringify(E??"",null,2),P=Xo({...e,className:N(PN,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),_=N("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...P,children:[c.jsx(Er,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[h&&c.jsx("input",{className:Oe.hiddenVisually,name:h,value:x,disabled:b,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",b&&Oe.disabled),children:c.jsx(xN,{...S?{language:C,value:x}:{defaultLanguage:C,defaultValue:x},theme:i?"vs-dark":"light",className:N(re.b,re.rnd,U.br,l),options:{...TN,readOnly:f,...s&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Ht(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:o,onMount:(T,O)=>{if(v){let M=!1;const A=()=>Mv(T);T.onDidChangeModelLanguageConfiguration(A),T.onDidScrollChange(()=>{M||(M=!0,A())}),setTimeout(A,10)}p==null||p(T,O)}})})]})]})}const Lv=ce(function({buttonProps:t,content:n,code:r,onAction:o}){const s=Ea(),a=$e(),i=Ce(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=xr(),[p,f]=g.useState(),h=()=>{let b=(p||"").trim();const v=dv({code:b,appStore:i,showToastError:!0});if(!v.error)b=v.output;else return;o?o(b):l?u.loadProjectData({pages:[{component:b}]}):u.setComponents(b),s.close()};g.useEffect(()=>{r?f(r):(async()=>{var C,E;const v=await u.runCommand(te.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=v.find(x=>x.mimeType==="text/html"))==null?void 0:C.content,y=(E=v.find(x=>x.mimeType==="text/mjml"))==null?void 0:E.content,S=l?y:w;S&&f(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(I,{gap:"m",col:!0,full:!0,nowrap:!0,children:[c.jsx(F,{children:n??a.t("actions.importCode.content")}),c.jsx(F,{grow:!0,children:p!==void 0&&c.jsx(Pr,{defaultValue:p,onChange:b=>f(b||""),isDarkTheme:d,language:"html"})}),c.jsx(I,{justify:"end",children:c.jsx(Je,{size:"m2",variant:"pr",onClick:h,...t,children:m})})]})}),hf="data-type-empty",Nv=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${hf}]`));for(const s of o)s.disabled=!t})},ON=(e,t,n="Empty",r={})=>{const o=`[${hf}="${t}"]`;if(!e.frameView.getDoc())return;const s=e.frameView.getHead(),{midSelector:a="",styleOut:i="",styleIn:l=""}=r;if(!s.querySelector(`style${o}`)){const u=document.createElement("style");u.setAttribute(hf,t),u.innerHTML=`
145
145
  [data-gjs-type="${t}"]${a}:empty {
146
146
  text-decoration: none;
147
147
  padding: 5px;
@@ -169,18 +169,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
169
169
  ${r.limitH?"height: auto;":""}
170
170
  ${r.smallH?"min-height: 30px;":""}
171
171
  ${l}
172
- }`,s.appendChild(u)}},Pb=(e,t)=>{const{model:n}=t,r=n.constructor.getDefaults(),o=r.emptyState,s=n.get("type");if(!o||r.void===!0||s!==e)return;const a=o===!0?{}:o;pN(t,s,n.getName({noCustom:!0}),a)},fN=function(t){const{Components:n}=t,r=({id:o})=>{n.addType(o,{extendFnView:["onRender"],view:{onRender(){Pb(o,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)},df=e=>`<${e}></${e}>`,hN=(e={})=>Object.entries(e).filter(([,t])=>t!==""&&t!==void 0&&t!==null).map(([t,n])=>` ${t}="${n}"`).join("");function gN(e=[],t=-1){if(!e.length)return{before:"",after:""};if(t<0||t>=e.length)return{before:"",after:e.map(df).join("")};const n=e.slice(0,t).map(df).join(""),r=e.slice(t+1).map(df).join("");return{before:n,after:r}}function mN({rootTag:e,head:t="",parentNodes:n,withSiblings:r,siblingTags:o=[],currentSiblingIndex:s=-1,beforeRootEnd:a=""}){const i=n.map(f=>`<${f.tagName}${hN(f.attributes)}>`).reverse().join(""),l=n.map(f=>`</${f.tagName}>`).join(""),u=r?gN(o,s):void 0,d=(u==null?void 0:u.before)||"",p=(u==null?void 0:u.after)||"";return{start:`<${e}>${t}${i}${d}`,end:`${p}${l}${a}</${e}>`}}function vN(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=$i,{attributes:d,class:p,font:f,all:g,preview:m,title:v,style:b,breakpoint:w}=Jp,{wrapper:y,section:S,column:C,text:x,button:E,image:P,divider:_,group:T,social:O,socialElement:L,spacer:A,navbar:$,navbarLink:B,table:M,raw:j}=Wo,{model:W}=n.getType("default"),{model:D}=n.getType(i),{model:z}=n.getType(u),{model:I}=n.getType(f),{model:H,view:V}=n.getType(l),{model:G,view:Y}=n.getType($),{model:J,view:Q}=n.getType(B),{model:R,view:q}=n.getType(y),{model:ee,view:le}=n.getType(S),{model:ge,view:Pe}=n.getType(C),{model:Ce,view:tt}=n.getType(x),{model:Qe,view:Ot}=n.getType(E),{model:ut}=n.getType(P),{model:Se,view:ot}=n.getType(_),{model:st,view:wt}=n.getType(A),{view:Ne,model:mt}=n.getType(O),{view:dt,model:Ue}=n.getType(L),{view:tn,model:he}=n.getType(T),De=js.globalStyles,Fe="css-class",He={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Mt={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Gt={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},xo={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},Ks={label:"Content",getValue:({component:Z})=>Z.getInnerHTML(),setValue:({component:Z,value:ue})=>Z.components(ue)},Re=Z=>{o.open({title:Z.getName({noCustom:!0}),content:()=>c.jsx(xb,{content:"",code:Z.getInnerHTML(),onAction:ue=>Z.components(ue),buttonProps:{children:s.t("save")}})})},St=Z=>{var de;const ue=Z.getChildrenContainer();((de=ue==null?void 0:ue.innerHTML)==null?void 0:de.trim())===""&&(ue.innerHTML="")},nn=Z=>Z.set({void:!1},{silent:!0});function Bn(Z={}){return W.prototype.toHTML.call(this,Z)}function Yt(Z){const ue=Z.closestType(i),de=ue==null?void 0:ue.findType(l)[0];return(de==null?void 0:de.toHTML())||""}function Zs(Z){const ue=Z.toHTML(),de=e.runCommand(Nc,{mjml:ue}),Nt=new DOMParser().parseFromString(de.html,"text/html");return{mjml:ue,mjmlToHtml:de,document:Nt}}const Tn=function(Z){const ue=Z.model,de=zo(()=>{var xe;return(xe=ue.closestType(i))==null?void 0:xe.trigger("rerender")});Z.listenTo(ue.components(),"add remove reset change",de)},cs=(Z,ue)=>Z.replace(`<${i}>`,`<${i}>${Yt(ue)}`),us=Z=>`cls-${Z.tagName}-${Z.getId()}`,ds=(Z,ue)=>{const de={...Z.get("attributes")||{}};return delete de.style,{...de,[Fe]:`${de[Fe]||""} ${us(Z)}`.trim()}},ps=(Z,ue)=>{const de=Z.closestType(i),xe=(de==null?void 0:de.findFirstType(l))||(de==null?void 0:de.append({type:l})[0]);xe==null||xe.trigger(ue?"rerenderHeadImmediate":"rerenderHead")},fs=Z=>function(){return ds(this)},mn=(Z,ue)=>function(de){const xe=de.querySelector(`.${us(this.model)}`);return(ue?xe:xe==null?void 0:xe.outerHTML)||Z.prototype.getTemplateFromEl.call(this,de)},_r=Z=>function(...ue){const de=Z.prototype.toJSON.apply(this,ue),xe=de.attributes||{};return delete de.style,delete xe.style,delete xe.__p,de},Ku=Z=>function(...ue){const de=Z.prototype.getAttrToHTML.apply(this,ue);delete de.__p;for(const xe in de)de[xe]===""&&delete de[xe];return de};function Ba(){return{start:`<mjml>${Yt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function rg(){var de;const Z=(de=this.model.parent())==null?void 0:de.is(d),ue=WS(this.model,{withSiblings:!Z,withHead:!Z,beforeRootEnd:Z?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:ue.start,end:ue.end}}function Uj(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const WS=(Z,ue={})=>{var ir;const de=Z.parents().filter(Ar=>Ar.tagName.startsWith("mj-")),xe=ue.withHead?Yt(Z):"",Nt=(ir=Z.parent())==null?void 0:ir.components(),Vt=(Nt==null?void 0:Nt.map(({tagName:Ar})=>Ar))||[],zn=(Nt==null?void 0:Nt.indexOf(Z))??-1;return mN({rootTag:i,head:xe,parentNodes:de.map(Ar=>{var El;return{tagName:Ar.tagName,attributes:(El=Ar.getMjmlAttributes)==null?void 0:El.call(Ar)}}),withSiblings:ue.withSiblings,siblingTags:Vt,currentSiblingIndex:zn,beforeRootEnd:ue.beforeRootEnd})},rn=({model:Z,noVoid:ue})=>({init(){const de={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",de),this.set("style",de),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),ue&&nn(this)},handleStyleChange(de,xe,Nt){if(Nt.fromAttr||Nt.fromSync)return;const Vt=this.getStylesToAttributes();this.set("attributes",Vt,{...Nt,fromStyle:!0,fromSync:!0})},handleAttributeChange(de,xe,Nt){if(Nt.fromStyle||Nt.fromSync)return;const Vt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(Vt,{...Nt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const de=this.getStyle({skipResolve:!0})||{};return delete de.__p,de},toHTML:Bn,getAttrToHTML:Ku(Z),getMjmlAttributes:fs(),toJSON:_r(Z)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:Z=>Z.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...rn({model:D}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:Bn},view:{reset(){this.render()}}}),n.addType(l,{model:{defaults:{tagName:l,name:"Head",copyable:!1,stylable:!1,traits:[],icon:'<svg viewBox="0 0 24 24"><path d="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /></svg>'},toJSON:_r(H)},view:{init(){this.renderHeadDebounced=zo(this.renderHead,30);const{em:Z,el:ue,model:de}=this,xe=de.components(),Nt="core:preview",Vt=Z.Commands.events;this.listenTo(Z,`${Vt.runCommand}${Nt}`,()=>{ue.style.display="none"}),this.listenTo(Z,`${Vt.stopCommand}${Nt}`,()=>{ue.style.display=""}),this.listenTo(xe,"change",this.onComponentsChange),this.listenTo(xe,"add remove reset",this.renderHead),this.listenTo(de,"rerenderHead",this.renderHeadDebounced),this.listenTo(de,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(Z){const ue=Object.keys(Z.changedAttributes());ue.length===1&&ue[0]==="status"||this.renderHead()},renderHead(){var Ar;const{model:Z,el:ue,em:de}=this,xe=ue.ownerDocument;if(!(xe&&xe!==document)||de.destroyed)return;const Vt=Z.closestType(i),zn=Vt&&Zs(Vt),ir=(Ar=zn==null?void 0:zn.document)==null?void 0:Ar.head;if(ir){const El="mjml-head-result",og=xe.querySelector(El)||xe.createElement(El);og.innerHTML=ir.innerHTML,!xe.head.contains(og)&&xe.head.prepend(og)}},render(...Z){const ue=V.prototype.render.apply(this,Z);return this.renderHeadDebounced(),ue}}}),n.addType(d,{isComponent:wa(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Br(l),traits:[]},toJSON:_r(W)},view:{onRender(){this.el.style.display="none"},init(){Tn(this)}}}),n.addType(p,{isComponent:wa(p),model:{defaults:{tagName:p,name:"Class",stylable:!1,draggable:Br(d),traits:[]},toJSON:_r(W)}}),n.addType(f,{model:{...rn({model:I}),defaults:{tagName:f,name:"Font",stylable:!1,draggable:Br(l),icon:'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1-3.5 7H18V9M5 3h5a2 2 0 0 1 2 2v11H9v-5H6v5H3V5a2 2 0 0 1 2-2m1 2v4h3V5H6Z"/></svg>',traits:[{name:"name",placeholder:"Name of the font"},{name:"href",placeholder:"URL of a hosted CSS file"}]}},view:{tagName:()=>"div",render(){return this.el.style.cssText="",this}}}),n.addType(w,{extend:i,isComponent:wa(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Br(l),icon:'<svg viewBox="0 0 24 24"><path d="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z" /></svg>',traits:[]}},view:{attributes:{},render(){return this.el.style.cssText="",this}}}),n.addType(g,{isComponent:wa(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Br(d),traits:[]},toHTML(...Z){return D.prototype.toHTML.apply(this,Z)},toJSON:_r(W)}}),n.addType(m,{isComponent:wa(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Br(l),traits:[Ks],icon:`<svg viewBox="0 0 24 24">
172
+ }`,s.appendChild(u)}},$v=(e,t)=>{const{model:n}=t,r=n.constructor.getDefaults(),o=r.emptyState,s=n.get("type");if(!o||r.void===!0||s!==e)return;const a=o===!0?{}:o;ON(t,s,n.getName({noCustom:!0}),a)},_N=function(t){const{Components:n}=t,r=({id:o})=>{n.addType(o,{extendFnView:["onRender"],view:{onRender(){$v(o,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)},mf=e=>`<${e}></${e}>`,AN=(e={})=>Object.entries(e).filter(([,t])=>t!==""&&t!==void 0&&t!==null).map(([t,n])=>` ${t}="${n}"`).join("");function MN(e=[],t=-1){if(!e.length)return{before:"",after:""};if(t<0||t>=e.length)return{before:"",after:e.map(mf).join("")};const n=e.slice(0,t).map(mf).join(""),r=e.slice(t+1).map(mf).join("");return{before:n,after:r}}function LN({rootTag:e,head:t="",parentNodes:n,withSiblings:r,siblingTags:o=[],currentSiblingIndex:s=-1,beforeRootEnd:a=""}){const i=n.map(f=>`<${f.tagName}${AN(f.attributes)}>`).reverse().join(""),l=n.map(f=>`</${f.tagName}>`).join(""),u=r?MN(o,s):void 0,d=(u==null?void 0:u.before)||"",p=(u==null?void 0:u.after)||"";return{start:`<${e}>${t}${i}${d}`,end:`${p}${l}${a}</${e}>`}}function NN(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=Ii,{attributes:d,class:p,font:f,all:h,preview:m,title:b,style:v,breakpoint:w}=nf,{wrapper:y,section:S,column:C,text:E,button:x,image:P,divider:_,group:T,social:O,socialElement:M,spacer:A,navbar:$,navbarLink:j,table:L,raw:H}=Ko,{model:W}=n.getType("default"),{model:B}=n.getType(i),{model:G}=n.getType(u),{model:D}=n.getType(f),{model:V,view:k}=n.getType(l),{model:z,view:Y}=n.getType($),{model:X,view:ee}=n.getType(j),{model:J,view:q}=n.getType(y),{model:R,view:ae}=n.getType(S),{model:le,view:me}=n.getType(C),{model:ve,view:He}=n.getType(E),{model:je,view:it}=n.getType(x),{model:qe}=n.getType(P),{model:Se,view:Ue}=n.getType(_),{model:et,view:Ct}=n.getType(A),{view:Ne,model:bt}=n.getType(O),{view:pt,model:Ke}=n.getType(M),{view:tn,model:he}=n.getType(T),Be=Ds.globalStyles,ze="css-class",De={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Nt={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},qt={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},Po={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},Zs={label:"Content",getValue:({component:Z})=>Z.getInnerHTML(),setValue:({component:Z,value:de})=>Z.components(de)},rt=Z=>{o.open({title:Z.getName({noCustom:!0}),content:()=>c.jsx(Lv,{content:"",code:Z.getInnerHTML(),onAction:de=>Z.components(de),buttonProps:{children:s.t("save")}})})},xt=Z=>{var pe;const de=Z.getChildrenContainer();((pe=de==null?void 0:de.innerHTML)==null?void 0:pe.trim())===""&&(de.innerHTML="")},nn=Z=>Z.set({void:!1},{silent:!0});function zn(Z={}){return W.prototype.toHTML.call(this,Z)}function Xt(Z){const de=Z.closestType(i),pe=de==null?void 0:de.findType(l)[0];return(pe==null?void 0:pe.toHTML())||""}function Ys(Z){const de=Z.toHTML(),pe=e.runCommand(Vc,{mjml:de}),$t=new DOMParser().parseFromString(pe.html,"text/html");return{mjml:de,mjmlToHtml:pe,document:$t}}const Tn=function(Z){const de=Z.model,pe=Go(()=>{var Ee;return(Ee=de.closestType(i))==null?void 0:Ee.trigger("rerender")});Z.listenTo(de.components(),"add remove reset change",pe)},ds=(Z,de)=>Z.replace(`<${i}>`,`<${i}>${Xt(de)}`),ps=Z=>`cls-${Z.tagName}-${Z.getId()}`,fs=(Z,de)=>{const pe={...Z.get("attributes")||{}};return delete pe.style,{...pe,[ze]:`${pe[ze]||""} ${ps(Z)}`.trim()}},gs=(Z,de)=>{const pe=Z.closestType(i),Ee=(pe==null?void 0:pe.findFirstType(l))||(pe==null?void 0:pe.append({type:l})[0]);Ee==null||Ee.trigger(de?"rerenderHeadImmediate":"rerenderHead")},hs=Z=>function(){return fs(this)},mn=(Z,de)=>function(pe){const Ee=pe.querySelector(`.${ps(this.model)}`);return(de?Ee:Ee==null?void 0:Ee.outerHTML)||Z.prototype.getTemplateFromEl.call(this,pe)},Lr=Z=>function(...de){const pe=Z.prototype.toJSON.apply(this,de),Ee=pe.attributes||{};return delete pe.style,delete Ee.style,delete Ee.__p,pe},Ju=Z=>function(...de){const pe=Z.prototype.getAttrToHTML.apply(this,de);delete pe.__p;for(const Ee in pe)pe[Ee]===""&&delete pe[Ee];return pe};function Ua(){return{start:`<mjml>${Xt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function lh(){var pe;const Z=(pe=this.model.parent())==null?void 0:pe.is(d),de=sC(this.model,{withSiblings:!Z,withHead:!Z,beforeRootEnd:Z?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}}function gD(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const sC=(Z,de={})=>{var lr;const pe=Z.parents().filter(Nr=>Nr.tagName.startsWith("mj-")),Ee=de.withHead?Xt(Z):"",$t=(lr=Z.parent())==null?void 0:lr.components(),Vt=($t==null?void 0:$t.map(({tagName:Nr})=>Nr))||[],Un=($t==null?void 0:$t.indexOf(Z))??-1;return LN({rootTag:i,head:Ee,parentNodes:pe.map(Nr=>{var _l;return{tagName:Nr.tagName,attributes:(_l=Nr.getMjmlAttributes)==null?void 0:_l.call(Nr)}}),withSiblings:de.withSiblings,siblingTags:Vt,currentSiblingIndex:Un,beforeRootEnd:de.beforeRootEnd})},rn=({model:Z,noVoid:de})=>({init(){const pe={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",pe),this.set("style",pe),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),de&&nn(this)},handleStyleChange(pe,Ee,$t){if($t.fromAttr||$t.fromSync)return;const Vt=this.getStylesToAttributes();this.set("attributes",Vt,{...$t,fromStyle:!0,fromSync:!0})},handleAttributeChange(pe,Ee,$t){if($t.fromStyle||$t.fromSync)return;const Vt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(Vt,{...$t,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const pe=this.getStyle({skipResolve:!0})||{};return delete pe.__p,pe},toHTML:zn,getAttrToHTML:Ju(Z),getMjmlAttributes:hs(),toJSON:Lr(Z)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:Z=>Z.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...rn({model:B}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:zn},view:{reset(){this.render()}}}),n.addType(l,{model:{defaults:{tagName:l,name:"Head",copyable:!1,stylable:!1,traits:[],icon:'<svg viewBox="0 0 24 24"><path d="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /></svg>'},toJSON:Lr(V)},view:{init(){this.renderHeadDebounced=Go(this.renderHead,30);const{em:Z,el:de,model:pe}=this,Ee=pe.components(),$t="core:preview",Vt=Z.Commands.events;this.listenTo(Z,`${Vt.runCommand}${$t}`,()=>{de.style.display="none"}),this.listenTo(Z,`${Vt.stopCommand}${$t}`,()=>{de.style.display=""}),this.listenTo(Ee,"change",this.onComponentsChange),this.listenTo(Ee,"add remove reset",this.renderHead),this.listenTo(pe,"rerenderHead",this.renderHeadDebounced),this.listenTo(pe,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(Z){const de=Object.keys(Z.changedAttributes());de.length===1&&de[0]==="status"||this.renderHead()},renderHead(){var Nr;const{model:Z,el:de,em:pe}=this,Ee=de.ownerDocument;if(!(Ee&&Ee!==document)||pe.destroyed)return;const Vt=Z.closestType(i),Un=Vt&&Ys(Vt),lr=(Nr=Un==null?void 0:Un.document)==null?void 0:Nr.head;if(lr){const _l="mjml-head-result",ch=Ee.querySelector(_l)||Ee.createElement(_l);ch.innerHTML=lr.innerHTML,!Ee.head.contains(ch)&&Ee.head.prepend(ch)}},render(...Z){const de=k.prototype.render.apply(this,Z);return this.renderHeadDebounced(),de}}}),n.addType(d,{isComponent:Sa(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Wr(l),traits:[]},toJSON:Lr(W)},view:{onRender(){this.el.style.display="none"},init(){Tn(this)}}}),n.addType(p,{isComponent:Sa(p),model:{defaults:{tagName:p,name:"Class",stylable:!1,draggable:Wr(d),traits:[]},toJSON:Lr(W)}}),n.addType(f,{model:{...rn({model:D}),defaults:{tagName:f,name:"Font",stylable:!1,draggable:Wr(l),icon:'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1-3.5 7H18V9M5 3h5a2 2 0 0 1 2 2v11H9v-5H6v5H3V5a2 2 0 0 1 2-2m1 2v4h3V5H6Z"/></svg>',traits:[{name:"name",placeholder:"Name of the font"},{name:"href",placeholder:"URL of a hosted CSS file"}]}},view:{tagName:()=>"div",render(){return this.el.style.cssText="",this}}}),n.addType(w,{extend:i,isComponent:Sa(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Wr(l),icon:'<svg viewBox="0 0 24 24"><path d="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z" /></svg>',traits:[]}},view:{attributes:{},render(){return this.el.style.cssText="",this}}}),n.addType(h,{isComponent:Sa(h),model:{defaults:{tagName:h,name:"All",stylable:!1,void:!0,draggable:Wr(d),traits:[]},toHTML(...Z){return B.prototype.toHTML.apply(this,Z)},toJSON:Lr(W)}}),n.addType(m,{isComponent:Sa(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Wr(l),traits:[Zs],icon:`<svg viewBox="0 0 24 24">
173
173
  <path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
174
- </svg>`},toJSON:_r(W)},view:{tagName:()=>"div",init(){const Z=this.model.components();this.onRender=zo(this.onRender,1),this.listenTo(Z,"add remove reset change",this.onRender)},onRender(){const{model:Z,el:ue}=this,de=Z.getName({noCustom:!0}),xe=Z.getInnerHTML();ue.innerHTML=`<b>${de}</b>: ${xe}`,ue.style.padding="5px 10px",ue.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:wa(v),extend:m,model:{defaults:{tagName:v,name:"Title",icon:'<svg viewBox="0 0 24 24"><path d="M5,4V7H10.5V19H13.5V7H19V4H5Z" /></svg>'}}}),n.addType(b,{model:{defaults:{tagName:b,name:"Style",droppable:!1,layerable:!1,stylable:!1,traits:[]},toJSON:_r(W)},view:{render(){return this}}}),n.addType(u,{model:{...rn({model:z,noVoid:!0}),defaults:{tagName:u,icon:'<svg viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M6,8V16H18V8H6Z" /></svg>',traits:[],emptyState:{midSelector:">div",styleOut:"height: 100vh;"}}}}),n.addType(y,{model:{...rn({model:R,noVoid:!0}),defaults:{tagName:y,icon:'<svg viewBox="0 0 24 24"><path d="M19 16H5V8h14m0-5H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>',stylable:["background-position","padding","padding-top","padding-left","padding-right","padding-bottom","border","border-width","border-style","border-color","background-color","background-url","background-repeat","background-size","text-align","border-radius","gap"],traits:[Gt]}},view:{attributes:{},getMjmlTemplate:rg,getTemplateFromEl:mn(q),init(){Uj.bind(this)();const{model:Z}=this;this.listenTo(Z,"change:attributes:gap",this.render),this.listenTo(Z.components(),"add remove reset",this.render)}}}),n.addType(S,{model:{...rn({model:ee,noVoid:!0}),defaults:{tagName:S,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[xo,Gt],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:mn(le),getMjmlTemplate:rg,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return St(this),this}}}),n.addType(T,{model:{...rn({model:he,noVoid:!0}),defaults:{tagName:T,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[xo]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:mn(tn,!0),getChildrenContainer(){return this.el},getMjmlTemplate:rg,render(){const Z=this.getTemplateFromMjml(),ue=RS(Z);return this.renderAttributes(),this.$el.attr(ue),this.el.innerHTML=Z.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const Wj=[x,P,E,_,A,O,L,j,M,T,$,B,Wo.carousel,Wo.carouselImage,Wo.accordion,Wo.accordionElement,Wo.accordionTitle,Wo.accordionText];n.addType(C,{model:{...rn({model:ge,noVoid:!0}),defaults:{tagName:C,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[],stylable:[...ge.getDefaults().stylable,"inner-background-color"],droppable:Z=>Wj.includes(Z.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var de;const Z=(de=this.model.parent())==null?void 0:de.is(d),ue=WS(this.model,{withSiblings:!Z,withHead:!Z,beforeRootEnd:Z?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:ue.start,end:ue.end}},getTemplateFromEl:mn(Pe,!0),getChildrenContainer(){const{el:Z}=this;return Z.querySelector("td > table tbody")||Z.querySelector("table tbody")||Z},render(){this.renderAttributes();const Z=this.getTemplateFromMjml();return this.el.innerHTML=Z.content,this.$el.attr(Z.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),ps(this.model,!0),this}}}),n.addType(x,{model:{...rn({model:Ce}),defaults:{tagName:x,emptyState:{midSelector:' [contenteditable="false"]:not([data-type-data-variable])',styleIn:"min-height: 20px;",styleOut:"padding: 0 5px;"},traits:[],"style-default":{padding:"10px 25px"}}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(tt),attributes:{style:"display: table; width: 100%"}}}),n.addType(E,{model:{...rn({model:Qe,noVoid:!0}),defaults:{tagName:E,traits:[He],stylable:[...Qe.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Ot)}}),n.addType(P,{model:{...rn({model:ut}),defaults:{tagName:P,"style-default":{align:"center"},traits:[Mt,{id:"altText",name:"alt",placeholder:"Image description"},"title",He,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const Z=ut.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete Z.src,Z},getMjmlAttributes(){const Z=ds(this);return this.isDefaultSrc()&&delete Z.src,Z}},view:{updateSrc(){const{model:Z}=this,ue=Z.get("src",{skipResolve:!0})||Z.getSrcResult();Z.addAttributes({src:ue}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Yt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(Z){var ue,de,xe;return(xe=(de=(ue=Z.querySelector("img"))==null?void 0:ue.closest("table"))==null?void 0:de.closest("tr"))==null?void 0:xe.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(_,{model:{...rn({model:Se}),defaults:{tagName:_,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(re,{icon:K.alignHorizontalLeft,size:se.sx})},{id:"center",title:"Center",labelReact:c.jsx(re,{icon:K.alignHorizontalCenter,size:se.sx})},{id:"right",title:"Right",labelReact:c.jsx(re,{icon:K.alignHorizontalRight,size:se.sx})}]}]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(ot)}}),n.addType(O,{model:{...rn({model:mt}),defaults:{tagName:O,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...mt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Ne)}}),n.addType(L,{model:{...rn({model:Ue,noVoid:!0}),defaults:{tagName:L,"style-default":{align:"center"},traits:[{type:"select",label:"Icon",name:"name",options:[{id:"custom",name:"Custom"},{id:"facebook",name:"Facebook"},{id:"twitter",name:"Twitter/X"},{id:"google",name:"Google"},{id:"instagram",name:"Instagram"},{id:"web",name:"Web"},{id:"youtube",name:"YouTube"},{id:"pinterest",name:"Pinterest"},{id:"linkedin",name:"Linkedin"},{id:"snapchat",name:"Snapchat"},{id:"vimeo",name:"Vimeo"},{id:"tumblr",name:"Tumblr"},{id:"github",name:"Github"},{id:"soundcloud",name:"SoundCloud"},{id:"medium",name:"Medium"},{id:"dribbble",name:"Dribbble"},{id:"xing",name:"Xing"}]},Mt,He,Ks]},getMjmlAttributes(){const Z=ds(this);return{...this.getDefaultIconProps()[Z.name],...Z}},getAttrToHTML(){const Z=Ue.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[Z.name],...Z}},getDefaultIconProps(){return{twitter:{src:"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png","background-color":"black"}}}},extendFnView:["init"],view:{init(){this.listenTo(this.model,"component:update:components",this.rerender)},getMjmlTemplate(){const{start:Z,end:ue}=dt.prototype.getMjmlTemplate.call(this);return{start:cs(Z,this.model),end:ue}},getInnerMjmlTemplate(){var xe;const{start:Z,end:ue}=dt.prototype.getInnerMjmlTemplate.call(this),de=((xe=this.model.getInnerHTML())==null?void 0:xe.trim())||"";return{start:`${Z}${de}`,end:ue}},getChildrenContainer(){var xe;const{el:Z}=this,ue=(xe=Z.querySelector("tbody > tr > td"))==null?void 0:xe.nextElementSibling;return(ue==null?void 0:ue.firstElementChild)||Z.querySelector("img")||Z}}}),n.addType(A,{model:{...rn({model:st}),defaults:{tagName:A,traits:[]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(wt)}}),n.addType($,{model:{...rn({model:G}),defaults:{tagName:$,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Y,!0),render(){this.renderAttributes();const Z=this.getTemplateFromMjml();return this.el.innerHTML=Z.content,this.$el.attr(Z.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),ps(this.model),this}}}),n.addType(B,{model:{...rn({model:J}),defaults:{tagName:B,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:Z,end:ue}=Q.prototype.getMjmlTemplate.call(this);return{start:cs(Z,this.model),end:ue}},getTemplateFromEl(Z){return Z.querySelector(".mj-inline-links").innerHTML}}}),n.addType(j,{extendFn:["initToolbar"],model:{defaults:{tagName:j,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){a4(this,{id:"edit",command:()=>Re(this),label:`<svg viewBox="0 0 24 24">
174
+ </svg>`},toJSON:Lr(W)},view:{tagName:()=>"div",init(){const Z=this.model.components();this.onRender=Go(this.onRender,1),this.listenTo(Z,"add remove reset change",this.onRender)},onRender(){const{model:Z,el:de}=this,pe=Z.getName({noCustom:!0}),Ee=Z.getInnerHTML();de.innerHTML=`<b>${pe}</b>: ${Ee}`,de.style.padding="5px 10px",de.style.fontFamily="system-ui"}}}),n.addType(b,{isComponent:Sa(b),extend:m,model:{defaults:{tagName:b,name:"Title",icon:'<svg viewBox="0 0 24 24"><path d="M5,4V7H10.5V19H13.5V7H19V4H5Z" /></svg>'}}}),n.addType(v,{model:{defaults:{tagName:v,name:"Style",droppable:!1,layerable:!1,stylable:!1,traits:[]},toJSON:Lr(W)},view:{render(){return this}}}),n.addType(u,{model:{...rn({model:G,noVoid:!0}),defaults:{tagName:u,icon:'<svg viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M6,8V16H18V8H6Z" /></svg>',traits:[],emptyState:{midSelector:">div",styleOut:"height: 100vh;"}}}}),n.addType(y,{model:{...rn({model:J,noVoid:!0}),defaults:{tagName:y,icon:'<svg viewBox="0 0 24 24"><path d="M19 16H5V8h14m0-5H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>',stylable:["background-position","padding","padding-top","padding-left","padding-right","padding-bottom","border","border-width","border-style","border-color","background-color","background-url","background-repeat","background-size","text-align","border-radius","gap"],traits:[qt]}},view:{attributes:{},getMjmlTemplate:lh,getTemplateFromEl:mn(q),init(){gD.bind(this)();const{model:Z}=this;this.listenTo(Z,"change:attributes:gap",this.render),this.listenTo(Z.components(),"add remove reset",this.render)}}}),n.addType(S,{model:{...rn({model:R,noVoid:!0}),defaults:{tagName:S,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[Po,qt],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:mn(ae),getMjmlTemplate:lh,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return xt(this),this}}}),n.addType(T,{model:{...rn({model:he,noVoid:!0}),defaults:{tagName:T,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[Po]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:mn(tn,!0),getChildrenContainer(){return this.el},getMjmlTemplate:lh,render(){const Z=this.getTemplateFromMjml(),de=gC(Z);return this.renderAttributes(),this.$el.attr(de),this.el.innerHTML=Z.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const hD=[E,P,x,_,A,O,M,H,L,T,$,j,Ko.carousel,Ko.carouselImage,Ko.accordion,Ko.accordionElement,Ko.accordionTitle,Ko.accordionText];n.addType(C,{model:{...rn({model:le,noVoid:!0}),defaults:{tagName:C,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[],stylable:[...le.getDefaults().stylable,"inner-background-color"],droppable:Z=>hD.includes(Z.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var pe;const Z=(pe=this.model.parent())==null?void 0:pe.is(d),de=sC(this.model,{withSiblings:!Z,withHead:!Z,beforeRootEnd:Z?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}},getTemplateFromEl:mn(me,!0),getChildrenContainer(){const{el:Z}=this;return Z.querySelector("td > table tbody")||Z.querySelector("table tbody")||Z},render(){this.renderAttributes();const Z=this.getTemplateFromMjml();return this.el.innerHTML=Z.content,this.$el.attr(Z.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),gs(this.model,!0),this}}}),n.addType(E,{model:{...rn({model:ve}),defaults:{tagName:E,emptyState:{midSelector:' [contenteditable="false"]:not([data-type-data-variable])',styleIn:"min-height: 20px;",styleOut:"padding: 0 5px;"},traits:[],"style-default":{padding:"10px 25px"}}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(He),attributes:{style:"display: table; width: 100%"}}}),n.addType(x,{model:{...rn({model:je,noVoid:!0}),defaults:{tagName:x,traits:[De],stylable:[...je.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(it)}}),n.addType(P,{model:{...rn({model:qe}),defaults:{tagName:P,"style-default":{align:"center"},traits:[Nt,{id:"altText",name:"alt",placeholder:"Image description"},"title",De,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const Z=qe.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete Z.src,Z},getMjmlAttributes(){const Z=fs(this);return this.isDefaultSrc()&&delete Z.src,Z}},view:{updateSrc(){const{model:Z}=this,de=Z.get("src",{skipResolve:!0})||Z.getSrcResult();Z.addAttributes({src:de}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Xt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(Z){var de,pe,Ee;return(Ee=(pe=(de=Z.querySelector("img"))==null?void 0:de.closest("table"))==null?void 0:pe.closest("tr"))==null?void 0:Ee.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(_,{model:{...rn({model:Se}),defaults:{tagName:_,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(ne,{icon:K.alignHorizontalLeft,size:se.sx})},{id:"center",title:"Center",labelReact:c.jsx(ne,{icon:K.alignHorizontalCenter,size:se.sx})},{id:"right",title:"Right",labelReact:c.jsx(ne,{icon:K.alignHorizontalRight,size:se.sx})}]}]}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(Ue)}}),n.addType(O,{model:{...rn({model:bt}),defaults:{tagName:O,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...bt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(Ne)}}),n.addType(M,{model:{...rn({model:Ke,noVoid:!0}),defaults:{tagName:M,"style-default":{align:"center"},traits:[{type:"select",label:"Icon",name:"name",options:[{id:"custom",name:"Custom"},{id:"facebook",name:"Facebook"},{id:"twitter",name:"Twitter/X"},{id:"google",name:"Google"},{id:"instagram",name:"Instagram"},{id:"web",name:"Web"},{id:"youtube",name:"YouTube"},{id:"pinterest",name:"Pinterest"},{id:"linkedin",name:"Linkedin"},{id:"snapchat",name:"Snapchat"},{id:"vimeo",name:"Vimeo"},{id:"tumblr",name:"Tumblr"},{id:"github",name:"Github"},{id:"soundcloud",name:"SoundCloud"},{id:"medium",name:"Medium"},{id:"dribbble",name:"Dribbble"},{id:"xing",name:"Xing"}]},Nt,De,Zs]},getMjmlAttributes(){const Z=fs(this);return{...this.getDefaultIconProps()[Z.name],...Z}},getAttrToHTML(){const Z=Ke.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[Z.name],...Z}},getDefaultIconProps(){return{twitter:{src:"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png","background-color":"black"}}}},extendFnView:["init"],view:{init(){this.listenTo(this.model,"component:update:components",this.rerender)},getMjmlTemplate(){const{start:Z,end:de}=pt.prototype.getMjmlTemplate.call(this);return{start:ds(Z,this.model),end:de}},getInnerMjmlTemplate(){var Ee;const{start:Z,end:de}=pt.prototype.getInnerMjmlTemplate.call(this),pe=((Ee=this.model.getInnerHTML())==null?void 0:Ee.trim())||"";return{start:`${Z}${pe}`,end:de}},getChildrenContainer(){var Ee;const{el:Z}=this,de=(Ee=Z.querySelector("tbody > tr > td"))==null?void 0:Ee.nextElementSibling;return(de==null?void 0:de.firstElementChild)||Z.querySelector("img")||Z}}}),n.addType(A,{model:{...rn({model:et}),defaults:{tagName:A,traits:[]}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(Ct)}}),n.addType($,{model:{...rn({model:z}),defaults:{tagName:$,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Ua,getTemplateFromEl:mn(Y,!0),render(){this.renderAttributes();const Z=this.getTemplateFromMjml();return this.el.innerHTML=Z.content,this.$el.attr(Z.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),gs(this.model),this}}}),n.addType(j,{model:{...rn({model:X}),defaults:{tagName:j,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:Z,end:de}=ee.prototype.getMjmlTemplate.call(this);return{start:ds(Z,this.model),end:de}},getTemplateFromEl(Z){return Z.querySelector(".mj-inline-links").innerHTML}}}),n.addType(H,{extendFn:["initToolbar"],model:{defaults:{tagName:H,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){C4(this,{id:"edit",command:()=>rt(this),label:`<svg viewBox="0 0 24 24">
175
175
  <path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path>
176
- </svg>`})},toJSON:_r(W)},view:{events:{dblclick:"onActive"},onActive(){Re(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:Z=>{var ue,de;if(((ue=Z.tagName)==null?void 0:ue.toLowerCase())===b&&((de=Z.getAttribute)==null?void 0:de.call(Z,"css-class"))===De)return{type:"textnode",components:[],content:""}}});const Gj=Z=>{const{id:ue,view:de}=Z,xe=de.prototype;n.addType(ue,{view:{render(){return xe.render.apply(this,arguments),Pb(ue,this),this}}})};[u,S,C,x,$,O,j].forEach(Z=>Gj(n.getType(Z))),n.getTypes().forEach(({id:Z,view:ue})=>{ue.prototype.disableEditing&&n.addType(Z,{view:{onDisable(de={}){this.disableEditing({...de,parserOptions:{htmlType:"text/html"}})}}})});const GS=()=>{const Z="projectFonts",de=e.Components.getWrapper().findFirstType(i);if(!de)return;const xe=de.findFirstType(l)||de.append({type:l})[0];xe.findType(b).filter(ir=>ir.getAttributes()[Fe]===Z||ir.attributes[dv]===pv).forEach(ir=>ir.remove());const Vt=uv(a.fonts);if(!Vt)return;const zn=xe.append({type:b,content:Vt})[0];zn==null||zn.addAttributes({[Fe]:Z})},qS=()=>{const Z=e.Css.rules.filter(Vt=>{const zn=Vt.attributes.groups;return!!(zn!=null&&zn.some(ir=>ir.startsWith(`${De}:`)))}).map(Vt=>Vt.toCSS());if(!Z.length)return;const de=e.Components.getWrapper().findFirstType($i.root);if(!de)return;const xe=de.findFirstType(l)||de.append({type:l})[0];(xe.findType(b).find(Vt=>Vt.getAttributes()[Fe]===De)||xe.append({type:b,attributes:{[Fe]:De}})[0]).set("content",Z.join(`
177
- `))},qj=zo(qS,100);e.on(_n.pageSettingsUpdate,Z=>{Z.page||GS()}),e.on(e.events.projectLoad,({loaded:Z})=>{Z&&(qS(),GS())}),e.on(e.Parser.events.htmlBefore,Z=>{var de;const ue=(de=e.Parser.config.optionsHtml)==null?void 0:de.codeSanitizer;Z.input=qv(Z.input,{sanitizer:ue})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${De}`,qj)})}function bN(e){const{Blocks:t}=e,n="Content",r="Layout",o={className:"gs-block-item__media h-7",full:!0,space:"s",nowrap:!0},s={category:r,full:!0},a="gjs-border-2 gjs-border-current gjs-rounded-sm",i=(l,u)=>{t.add(l,{select:!0,category:n,...u})};i("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
176
+ </svg>`})},toJSON:Lr(W)},view:{events:{dblclick:"onActive"},onActive(){rt(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:Z=>{var de,pe;if(((de=Z.tagName)==null?void 0:de.toLowerCase())===v&&((pe=Z.getAttribute)==null?void 0:pe.call(Z,"css-class"))===Be)return{type:"textnode",components:[],content:""}}});const mD=Z=>{const{id:de,view:pe}=Z,Ee=pe.prototype;n.addType(de,{view:{render(){return Ee.render.apply(this,arguments),$v(de,this),this}}})};[u,S,C,E,$,O,H].forEach(Z=>mD(n.getType(Z))),n.getTypes().forEach(({id:Z,view:de})=>{de.prototype.disableEditing&&n.addType(Z,{view:{onDisable(pe={}){this.disableEditing({...pe,parserOptions:{htmlType:"text/html"}})}}})});const aC=()=>{const Z="projectFonts",pe=e.Components.getWrapper().findFirstType(i);if(!pe)return;const Ee=pe.findFirstType(l)||pe.append({type:l})[0];Ee.findType(v).filter(lr=>lr.getAttributes()[ze]===Z||lr.attributes[yb]===wb).forEach(lr=>lr.remove());const Vt=vb(a.fonts);if(!Vt)return;const Un=Ee.append({type:v,content:Vt})[0];Un==null||Un.addAttributes({[ze]:Z})},iC=()=>{const Z=e.Css.rules.filter(Vt=>{const Un=Vt.attributes.groups;return!!(Un!=null&&Un.some(lr=>lr.startsWith(`${Be}:`)))}).map(Vt=>Vt.toCSS());if(!Z.length)return;const pe=e.Components.getWrapper().findFirstType(Ii.root);if(!pe)return;const Ee=pe.findFirstType(l)||pe.append({type:l})[0];(Ee.findType(v).find(Vt=>Vt.getAttributes()[ze]===Be)||Ee.append({type:v,attributes:{[ze]:Be}})[0]).set("content",Z.join(`
177
+ `))},bD=Go(iC,100);e.on(_n.pageSettingsUpdate,Z=>{Z.page||aC()}),e.on(e.events.projectLoad,({loaded:Z})=>{Z&&(iC(),aC())}),e.on(e.Parser.events.htmlBefore,Z=>{var pe;const de=(pe=e.Parser.config.optionsHtml)==null?void 0:pe.codeSanitizer;Z.input=tv(Z.input,{sanitizer:de})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${Be}`,bD)})}function $N(e){const{Blocks:t}=e,n="Content",r="Layout",o={className:"gs-block-item__media h-7",full:!0,space:"s",nowrap:!0},s={category:r,full:!0},a="gjs-border-2 gjs-border-current gjs-rounded-sm",i=(l,u)=>{t.add(l,{select:!0,category:n,...u})};i("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
178
178
  <path fill="currentColor" d="M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z" />
179
179
  </svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),i("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
180
180
  <path fill="currentColor" d="M20 20.5C20 21.3 19.3 22 18.5 22H13C12.6 22 12.3 21.9 12 21.6L8 17.4L8.7 16.6C8.9 16.4 9.2 16.3 9.5 16.3H9.7L12 18V9C12 8.4 12.4 8 13 8S14 8.4 14 9V13.5L15.2 13.6L19.1 15.8C19.6 16 20 16.6 20 17.1V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.1 2.9 14 4 14H8V12H4V4H20V12H18V14H20C21.1 14 22 13.1 22 12V4C22 2.9 21.1 2 20 2Z" />
181
181
  </svg>`,content:"<mj-button>Button</mj-button>"}),i("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
182
182
  <path fill="currentColor" d="M21,3H3C2,3 1,4 1,5V19A2,2 0 0,0 3,21H21C22,21 23,20 23,19V5C23,4 22,3 21,3M5,17L8.5,12.5L11,15.5L14.5,11L19,17H5Z" />
183
- </svg>`,content:`<mj-image src="${uC}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
183
+ </svg>`,content:`<mj-image src="${PC}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
184
184
  <path fill="currentColor" d="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" />
185
185
  </svg>`,content:"<mj-divider/>"}),i("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
186
186
  <path fill="currentColor" d="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" />
@@ -201,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
201
201
  <mj-navbar-link>BLOG</mj-navbar-link>
202
202
  </mj-navbar>`}),i("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
203
203
  <path fill="currentColor" d="M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4M6,9H18V11H6V9M6,13H16V15H6V13Z" />
204
- </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${dg({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
204
+ </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${vh({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
205
205
  <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
206
206
  Heading title
207
207
  </mj-text>
@@ -215,49 +215,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
215
215
  <path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" />
216
216
  </svg>`,content:`<mj-raw>
217
217
  <span>Insert here you custom HTML</span>
218
- </mj-raw>`}),i("mj-1-column",{...s,label:"1 Column",mediaReact:c.jsx(k,{...o,children:c.jsx(F,{className:a,grow:!0})}),content:`<mj-section>
218
+ </mj-raw>`}),i("mj-1-column",{...s,label:"1 Column",mediaReact:c.jsx(I,{...o,children:c.jsx(F,{className:a,grow:!0})}),content:`<mj-section>
219
219
  <mj-column></mj-column>
220
- </mj-section>`}),i("mj-2-columns-50-50",{...s,label:"2 Columns 50/50",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
220
+ </mj-section>`}),i("mj-2-columns-50-50",{...s,label:"2 Columns 50/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
221
221
  <mj-column></mj-column>
222
222
  <mj-column></mj-column>
223
- </mj-section>`}),i("mj-2-columns-25-75",{...s,label:"2 Columns 25/75",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-3/4")})]}),content:`<mj-section>
223
+ </mj-section>`}),i("mj-2-columns-25-75",{...s,label:"2 Columns 25/75",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-3/4")})]}),content:`<mj-section>
224
224
  <mj-column width="25%"></mj-column>
225
225
  <mj-column width="75%"></mj-column>
226
- </mj-section>`}),i("mj-2-columns-33-67",{...s,label:"2 Columns 33/67",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-1/3")}),c.jsx(F,{className:ae(a,"gs-utl-basis-2/3")})]}),content:`<mj-section>
226
+ </mj-section>`}),i("mj-2-columns-33-67",{...s,label:"2 Columns 33/67",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-1/3")}),c.jsx(F,{className:ie(a,"gs-utl-basis-2/3")})]}),content:`<mj-section>
227
227
  <mj-column width="33%"></mj-column>
228
228
  <mj-column width="67%"></mj-column>
229
- </mj-section>`}),i("mj-2-columns-67-33",{...s,label:"2 Columns 67/33",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-2/3")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/3")})]}),content:`<mj-section>
229
+ </mj-section>`}),i("mj-2-columns-67-33",{...s,label:"2 Columns 67/33",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-2/3")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/3")})]}),content:`<mj-section>
230
230
  <mj-column width="67%"></mj-column>
231
231
  <mj-column width="33%"></mj-column>
232
- </mj-section>`}),i("mj-2-columns-75-25",{...s,label:"2 Columns 75/25",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-3/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
232
+ </mj-section>`}),i("mj-2-columns-75-25",{...s,label:"2 Columns 75/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-3/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
233
233
  <mj-column width="75%"></mj-column>
234
234
  <mj-column width="25%"></mj-column>
235
- </mj-section>`}),i("mj-3-columns",{...s,label:"3 Columns",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
235
+ </mj-section>`}),i("mj-3-columns",{...s,label:"3 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
236
236
  <mj-column></mj-column>
237
237
  <mj-column></mj-column>
238
238
  <mj-column></mj-column>
239
- </mj-section>`}),i("mj-3-columns-25-25-50",{...s,label:"3 Columns 25/25/50",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-2/4")})]}),content:`<mj-section>
239
+ </mj-section>`}),i("mj-3-columns-25-25-50",{...s,label:"3 Columns 25/25/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-2/4")})]}),content:`<mj-section>
240
240
  <mj-column width="25%"></mj-column>
241
241
  <mj-column width="25%"></mj-column>
242
242
  <mj-column width="50%"></mj-column>
243
- </mj-section>`}),i("mj-3-columns-25-50-25",{...s,label:"3 Columns 25/50/25",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
243
+ </mj-section>`}),i("mj-3-columns-25-50-25",{...s,label:"3 Columns 25/50/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
244
244
  <mj-column width="25%"></mj-column>
245
245
  <mj-column width="50%"></mj-column>
246
246
  <mj-column width="25%"></mj-column>
247
- </mj-section>`}),i("mj-3-columns-50-25-25",{...s,label:"3 Columns 50/25/25",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
247
+ </mj-section>`}),i("mj-3-columns-50-25-25",{...s,label:"3 Columns 50/25/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:ie(a,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
248
248
  <mj-column width="50%"></mj-column>
249
249
  <mj-column width="25%"></mj-column>
250
250
  <mj-column width="25%"></mj-column>
251
- </mj-section>`}),i("mj-4-columns",{...s,label:"4 Columns",mediaReact:c.jsxs(k,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
251
+ </mj-section>`}),i("mj-4-columns",{...s,label:"4 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0}),c.jsx(F,{className:a,grow:!0})]}),content:`<mj-section>
252
252
  <mj-column></mj-column>
253
253
  <mj-column></mj-column>
254
254
  <mj-column></mj-column>
255
255
  <mj-column></mj-column>
256
- </mj-section>`})}const yN=(e,t)=>({[xt.web]:r=>rf(r,t),[xt.document]:r=>rf(r,t),[xt.react]:r=>rf(r,t),[xt.email]:r=>vN(r,t)})[e],Pa="https://cdn.jsdelivr.net/npm/",pf={id:"gjs-blocks-basic",src:`${Pa}grapesjs-blocks-basic@1.0.1/dist/index.js`},wN={id:"grapesjs-plugin-forms",src:`${Pa}grapesjs-plugin-forms@2.0.5/dist/index.js`},ff={id:"grapesjs-parser-postcss",src:`${Pa}grapesjs-parser-postcss@1.0.1/dist/index.js`},SN={id:"grapesjs-navbar",src:`${Pa}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},hf={id:"grapesjs-plugin-export",src:`${Pa}grapesjs-plugin-export@1.0.11/dist/index.js`,options:{isBinary:(e,t)=>{const n=t.split(".")[1];return/[\x00-\x08\x0E-\x1F]/.test(e)&&!(n&&["html","css"].indexOf(n)>=0)}}},CN={id:"grapesjs-mjml",src:`${Pa}grapesjs-mjml@1.0.8/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},xN={[xt.email]:[bN,CN],[xt.web]:[pf,wN,hf,ff,SN],[xt.document]:[pf,hf,ff],[xt.react]:[pf,hf,ff]};function EN(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",r=>{const o=-r.canvasOffset.left;r.left<o&&(r.left=o)})}function Tb({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=h.useState(!1),i=()=>{tC((t==null?void 0:t())??n),a(!0),e==null||e()};return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(l)},[s]),c.jsx(Ct,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...o,children:c.jsx(re,{className:ae(s&&U.tA),icon:s?K.check:K.contentCopy,size:se.s})})}const PN=(e,t)=>e.filter(n=>n.id===t)[0]||null,Ob=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),TN=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,_b=X("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),gf={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},Ab=Un()&&document.body,ON=(e={})=>({...gf,modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Ab}},{name:"preventOverflow",options:{boundary:e.boundary??Ab}}]});function Lb(e){var s;const{option:t,active:n,selected:r}=e,o=((s=e.isSelected)==null?void 0:s.call(e))||!0;return c.jsxs(k,{items:"center",className:X([Te.xy,n&&Md.bgH]),children:[c.jsx(F,{className:X("truncate"),grow:!0,children:t.label}),c.jsx(F,{className:X("gjs-pl-2"),children:Ob(t,r)&&o&&c.jsx(re,{className:X(U.tA),icon:K.check,size:se.s})})]})}const _N="gs-select-field";function Mb({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(re,{...ct(e.icon)?{icon:e.icon,size:se.s2x}:e.icon}),c.jsx(F,{className:X("truncate"),grow:!0,children:e.content||e.label})]})}function Le(e){const{value:t,onChange:n,onBlur:r,onFocus:o,handlerSelected:s,label:a,options:i,includeEmpty:l,className:u,search:d,open:p,caret:f=K.chevronDown,size:g="m",border:m,emptyState:v="- Select an option -",name:b,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:x,hideCaret:E}=e,[P,_]=h.useState(null),[T,O]=h.useState(null),[L,A]=h.useState(""),{styles:$,attributes:B}=Si(P,T,ON()),M=typeof d=="object"?d.onChange:void 0,j=[...i].filter(R=>d?M||TN(R,L):R),W=d&&(typeof d=="object"&&d.value||L),D=W&&j.length?j[0]:PN(j,t),z=R=>n(R.id,R),I={id:null,label:v},H=(D==null?void 0:D.content)||(D==null?void 0:D.label),V=D?s?s(D):D.icon?c.jsx(k,{items:"center",gap:"s",children:c.jsx(Mb,{option:D})}):H:s?s(I):v;l&&j.unshift(I);const G=R=>{const{value:q}=R.target,ee=q.trim();switch(R.key){case"Escape":n(null);break;case"Enter":n((j.length?j[0].id:ee)||null,j[0]);break;case" ":hs(R);break}},Y=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,ri.focus),J=()=>{r==null||r()},Q=Ko({...e,className:N(_N,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(pi,{value:D,onChange:z,disabled:y,children:({open:R})=>c.jsxs("div",{...Q,children:[a&&c.jsx(pi.Label,{as:x,className:e.classNameLabel,children:c.jsx(Cr,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(D==null?void 0:D.id)??"",onChange:()=>{},className:X("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(pi.Button,{ref:_,className:Y,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||L,className:N([u,"gs-utl-w-full",te.rnd,ri.focus,Te.xyS]),onChange:q=>{A(q.target.value),M==null||M(q.target.value)},onKeyDown:G,onClick:hs,onBlur:J,onFocus:o}):c.jsx(Qn,{border:m,size:g,title:V,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:f,shadow:!1,className:X(u),titleClass:"",disabled:y})}),c.jsx(pi.Options,{static:p,className:_b,ref:O,style:$.popper,...B.popper,children:c.jsxs(Qn,{padding:!1,className:X("h-full"),style:{minWidth:`${P==null?void 0:P.offsetWidth}px`,maxHeight:200},children:[!j.length&&d&&d!==!0&&c.jsx("div",{className:X(Te.xy),children:d.empty}),j.map((q,ee)=>c.jsx(pi.Option,{value:q,children:({active:le})=>c.jsxs(k,{items:"center",gap:"s",className:X([q.className,Te.xy,le&&Md.bgH]),nowrap:!0,children:[c.jsx(Mb,{option:q}),c.jsx(F,{className:X("gjs-pl-2"),children:Ob(q,D)&&!W&&c.jsx(re,{className:X(U.tA),icon:K.check,size:se.s})})]})},ee))]})})]})})}const Nb=h.createContext(null),AN=({children:e})=>{const[t,n]=h.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(Nb.Provider,{value:t,children:e})},er=()=>{const e=h.useContext(Nb);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Fi=()=>{const{editor:e}=er();if(!e)throw new Error("useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.");return e},LN=()=>er().editor,$b=h.createContext(null),MN=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(r){n(o=>({...o,refCanvas:r}))},setCustomModal(r){n(o=>({...o,customModal:r}))},setCustomAssets(r){n(o=>({...o,customAssets:r}))},setCustomBlocks(r){n(o=>({...o,customBlocks:r}))},setCustomRte(r){n(o=>({...o,customRte:r}))},setCustomStyles(r){n(o=>({...o,customStyles:r}))},setCustomLayers(r){n(o=>({...o,customLayers:r}))},setCustomSelectors(r){n(o=>({...o,customSelectors:r}))},setCustomTraits(r){n(o=>({...o,customTraits:r}))},setReady(r){n(o=>({...o,ready:r}))}}));return c.jsx($b.Provider,{value:t,children:e})},Ur=()=>{const e=h.useContext($b);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function NN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function Zo(e){return typeof e=="function"}function xr(){}const kb=e=>typeof e=="string",$N=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},Ib=e=>{const t=kb(e)?{id:e,src:e}:e;return new Promise((n,r)=>{const o=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);o.src=t.src,o.onload=()=>n(t.id),o.onerror=()=>r(t.id),document.head.appendChild(o)})},kN=e=>{const t=e.map(n=>Ib(n));return Promise.allSettled(t)},Vb=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(kb(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Hb=new WeakMap;function Ta(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Hb.get(e);if(t)return t;const n=function({children:r}){return On.createPortal(h.createElement("div",null,r),e)};return Hb.set(e,n),n}h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(!1),[s,a]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const i=t.Assets.events.custom,l=({open:u,assets:d,types:p,select:f,close:g,container:m})=>{u&&a({assets:d,types:p,select:f,close:g,Container:Ta(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?Zo(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(()=>({blocks:[],dragStart:xr,dragStop:xr,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const s=t.Blocks.events.custom,a=({blocks:i,container:l,dragStart:u,dragStop:d})=>{const p=i.reduce((f,g)=>{const m=g.getCategoryLabel(),v=f.get(m);return v?v.push(g):f.set(m,[g]),f},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:Ta(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?Zo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function IN({children:e,...t}){const n=Ur(),r=h.useRef(null);return h.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const VN=h.memo(function({children:e}){const{editor:t}=er(),[n,r]=h.useState(()=>({devices:[],selected:"",select:xr}));return h.useEffect(()=>{if(!t)return;const{Devices:o}=t,s=o.events.all,a=()=>{var i;r({devices:o.getDevices(),selected:(i=o.getSelected())==null?void 0:i.id,select:l=>o.select(l)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Zo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),HN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function jN(e){const t=e.map(({id:s,src:a})=>({id:s,src:a})),n=e.reduce((s,a)=>(s[a.id]=a,s),{}),r=[],o=[];return(await kN(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const DN=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{HN(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await jN(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},FN=h.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=xr,onReady:l,onUpdate:u,waitReady:d,...p}){const{setEditor:f}=er(),g=Ur(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const P=b.current,_=g.refCanvas;let T,O={},L=[];const A=$=>{const B={height:"100%",...r,plugins:[...L,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...O},modal:{custom:!!g.customModal,...r.modal},assetManager:{custom:!!g.customAssets,...r.assetManager},styleManager:{custom:!!g.customStyles,...r.styleManager},blockManager:{custom:!!g.customBlocks,...r.blockManager},richTextEditor:{custom:!!g.customRte,...r.richTextEditor},layerManager:{custom:!!g.customLayers,...r.layerManager},traitManager:{custom:!!g.customTraits,...r.traitManager},selectorManager:{custom:!!g.customSelectors,...r.selectorManager},container:_||P,customUI:!!_,..._?{panels:{defaults:[]}}:{}};T=$.init(B),f(T),i(T),u&&T.on("update",()=>{u(T.getProjectData(),T)}),T.onReady(()=>{v(!0),l==null||l(T)})};return(async()=>{a&&await $N(a);const $=await DN(o);L=$.plugins,O=$.pluginOptions,typeof s=="string"?(await Ib(s),A(window.grapesjs)):A(s)})(),()=>T==null?void 0:T.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=NN("gjs-editor-wrapper",t),C=d&&!m,x=h.useMemo(()=>({...n,height:w,width:y}),[w,y,n]),E=h.useMemo(()=>({...x,...C?{opacity:0,width:0,height:0}:{}}),[x,C]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:S,style:x,children:d}):null,c.jsx("div",{...p,ref:b,className:S,style:E,children:e})]})}),BN=h.memo(function(){const e=Ur();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(AN,{children:c.jsx(MN,{children:c.jsxs(FN,{...t,children:[e,c.jsx(BN,{})]})})})});const jb=h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:s}=t,a=s.events.custom,i=({container:l})=>{o({root:s.getRoot(),Container:Ta(l)})};return t.on(a,i),s.__trgCustom({}),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?Zo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(!1),[s,a]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:xr});return h.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:p,close:f,attributes:g})=>{u&&a({title:h.createElement(Vb(d)),content:h.createElement(Vb(p)),attributes:g,close:f}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const Db=h.memo(function({children:e}){const{editor:t}=er(),[n,r]=h.useState(()=>({pages:[],selected:void 0,select:xr,add:xr,remove:xr}));return h.useEffect(()=>{if(!t)return;const{Pages:o}=t,s=o.events.all,a=()=>{r({pages:o.getAll(),selected:o.getSelected(),select:(...i)=>o.select(...i),add:(...i)=>o.add(...i),remove:(...i)=>o.remove(...i)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Zo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Fb=h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:xr,removeSelector:xr,setState:xr,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:s}=t,a=s.events.custom,i=({container:l})=>{o({selectors:s.getSelected(),states:s.getStates(),selectedState:s.getState(),targets:s.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>s.addSelected(...u),removeSelector:(...u)=>s.removeSelected(...u),setState:(...u)=>s.setState(...u),Container:Ta(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?Zo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Bb=h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:s}=t,a=s.events.custom,i=({container:l})=>{o({sectors:s.getSectors({visible:!0}),Container:Ta(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?Zo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),mf=h.memo(function({children:e}){const{editor:t}=er(),n=Ur(),[r,o]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:s}=t,a=s.events.custom,i=({container:l})=>{o({traits:s.getCurrent(),Container:Ta(l)})};return t.on(a,i),s.__trgCustom(),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?Zo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Bi=({children:e})=>LN()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function vf(e){return e=e.trimStart(),e=e.replace(/\s*([\{\}\:\;\,])\s*/g,"$1"),e=e.replace(/;\s*;/g,";"),e=e.replace(/\,[\s\.\#\d]*{/g,"{"),e=e.replace(/([^\s])\{([^\s])/g,`$1 {
256
+ </mj-section>`})}const kN=(e,t)=>({[Et.web]:r=>cf(r,t),[Et.document]:r=>cf(r,t),[Et.react]:r=>cf(r,t),[Et.email]:r=>NN(r,t)})[e],Ta="https://cdn.jsdelivr.net/npm/",bf={id:"gjs-blocks-basic",src:`${Ta}grapesjs-blocks-basic@1.0.1/dist/index.js`},IN={id:"grapesjs-plugin-forms",src:`${Ta}grapesjs-plugin-forms@2.0.5/dist/index.js`},vf={id:"grapesjs-parser-postcss",src:`${Ta}grapesjs-parser-postcss@1.0.1/dist/index.js`},VN={id:"grapesjs-navbar",src:`${Ta}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},yf={id:"grapesjs-plugin-export",src:`${Ta}grapesjs-plugin-export@1.0.11/dist/index.js`,options:{isBinary:(e,t)=>{const n=t.split(".")[1];return/[\x00-\x08\x0E-\x1F]/.test(e)&&!(n&&["html","css"].indexOf(n)>=0)}}},HN={id:"grapesjs-mjml",src:`${Ta}grapesjs-mjml@1.0.8/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},jN={[Et.email]:[$N,HN],[Et.web]:[bf,IN,yf,vf,VN],[Et.document]:[bf,yf,vf],[Et.react]:[bf,yf,vf]};function DN(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",r=>{const o=-r.canvasOffset.left;r.left<o&&(r.left=o)})}function kv({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=g.useState(!1),i=()=>{mC((t==null?void 0:t())??n),a(!0),e==null||e()};return g.useEffect(()=>{if(!s)return;const l=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(l)},[s]),c.jsx(wt,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...o,children:c.jsx(ne,{className:ie(s&&U.tA),icon:s?K.check:K.contentCopy,size:se.s})})}const FN=(e,t)=>e.filter(n=>n.id===t)[0]||null,Iv=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),BN=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,Vv=Q("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),wf={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},Hv=Wn()&&document.body,zN=(e={})=>({...wf,modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Hv}},{name:"preventOverflow",options:{boundary:e.boundary??Hv}}]});function jv(e){var s;const{option:t,active:n,selected:r}=e,o=((s=e.isSelected)==null?void 0:s.call(e))||!0;return c.jsxs(I,{items:"center",className:Q([Te.xy,n&&Id.bgH]),children:[c.jsx(F,{className:Q("truncate"),grow:!0,children:t.label}),c.jsx(F,{className:Q("gjs-pl-2"),children:Iv(t,r)&&o&&c.jsx(ne,{className:Q(U.tA),icon:K.check,size:se.s})})]})}const UN="gs-select-field";function Dv({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(ne,{...dt(e.icon)?{icon:e.icon,size:se.s2x}:e.icon}),c.jsx(F,{className:Q("truncate"),grow:!0,children:e.content||e.label})]})}function _e(e){const{value:t,onChange:n,onBlur:r,onFocus:o,handlerSelected:s,label:a,options:i,includeEmpty:l,className:u,search:d,open:p,caret:f=K.chevronDown,size:h="m",border:m,emptyState:b="- Select an option -",name:v,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:E,hideCaret:x}=e,[P,_]=g.useState(null),[T,O]=g.useState(null),[M,A]=g.useState(""),{styles:$,attributes:j}=xi(P,T,zN()),L=typeof d=="object"?d.onChange:void 0,H=[...i].filter(J=>d?L||BN(J,M):J),W=d&&(typeof d=="object"&&d.value||M),B=W&&H.length?H[0]:FN(H,t),G=J=>n(J.id,J),D={id:null,label:b},V=(B==null?void 0:B.content)||(B==null?void 0:B.label),k=B?s?s(B):B.icon?c.jsx(I,{items:"center",gap:"s",children:c.jsx(Dv,{option:B})}):V:s?s(D):b;l&&H.unshift(D);const z=J=>{const{value:q}=J.target,R=q.trim();switch(J.key){case"Escape":n(null);break;case"Enter":n((H.length?H[0].id:R)||null,H[0]);break;case" ":ms(J);break}},Y=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",re.rnd,si.focus),X=()=>{r==null||r()},ee=Xo({...e,className:N(UN,S,"gs-utl-relative",h.includes("s")&&"gs-utl-text-xs")});return c.jsx(gi,{value:B,onChange:G,disabled:y,children:({open:J})=>c.jsxs("div",{...ee,children:[a&&c.jsx(gi.Label,{as:E,className:e.classNameLabel,children:c.jsx(Er,{as:"span",...e})}),v&&c.jsx("input",{type:"input",name:v,value:(B==null?void 0:B.id)??"",onChange:()=>{},className:Q("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(gi.Button,{ref:_,className:Y,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||M,className:N([u,"gs-utl-w-full",re.rnd,si.focus,Te.xyS]),onChange:q=>{A(q.target.value),L==null||L(q.target.value)},onKeyDown:z,onClick:ms,onBlur:X,onFocus:o}):c.jsx(Rn,{border:m,size:h,title:k,icon:x?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:f,shadow:!1,className:Q(u),titleClass:"",disabled:y})}),c.jsx(gi.Options,{static:p,className:Vv,ref:O,style:$.popper,...j.popper,children:c.jsxs(Rn,{padding:!1,className:Q("h-full"),style:{minWidth:`${P==null?void 0:P.offsetWidth}px`,maxHeight:200},children:[!H.length&&d&&d!==!0&&c.jsx("div",{className:Q(Te.xy),children:d.empty}),H.map((q,R)=>c.jsx(gi.Option,{value:q,children:({active:ae})=>c.jsxs(I,{items:"center",gap:"s",className:Q([q.className,Te.xy,ae&&Id.bgH]),nowrap:!0,children:[c.jsx(Dv,{option:q}),c.jsx(F,{className:Q("gjs-pl-2"),children:Iv(q,B)&&!W&&c.jsx(ne,{className:Q(U.tA),icon:K.check,size:se.s})})]})},R))]})})]})})}const Fv=g.createContext(null),WN=({children:e})=>{const[t,n]=g.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(Fv.Provider,{value:t,children:e})},tr=()=>{const e=g.useContext(Fv);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},zi=()=>{const{editor:e}=tr();if(!e)throw new Error("useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.");return e},GN=()=>tr().editor,Bv=g.createContext(null),qN=({children:e})=>{const[t,n]=g.useState(()=>({setRefCanvas(r){n(o=>({...o,refCanvas:r}))},setCustomModal(r){n(o=>({...o,customModal:r}))},setCustomAssets(r){n(o=>({...o,customAssets:r}))},setCustomBlocks(r){n(o=>({...o,customBlocks:r}))},setCustomRte(r){n(o=>({...o,customRte:r}))},setCustomStyles(r){n(o=>({...o,customStyles:r}))},setCustomLayers(r){n(o=>({...o,customLayers:r}))},setCustomSelectors(r){n(o=>({...o,customSelectors:r}))},setCustomTraits(r){n(o=>({...o,customTraits:r}))},setReady(r){n(o=>({...o,ready:r}))}}));return c.jsx(Bv.Provider,{value:t,children:e})},Gr=()=>{const e=g.useContext(Bv);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function KN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function Jo(e){return typeof e=="function"}function Tr(){}const zv=e=>typeof e=="string",ZN=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},Uv=e=>{const t=zv(e)?{id:e,src:e}:e;return new Promise((n,r)=>{const o=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);o.src=t.src,o.onload=()=>n(t.id),o.onerror=()=>r(t.id),document.head.appendChild(o)})},YN=e=>{const t=e.map(n=>Uv(n));return Promise.allSettled(t)},Wv=e=>function(){const t=g.useRef(null);return g.useEffect(()=>{const{current:n}=t;n&&(zv(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Gv=new WeakMap;function Oa(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Gv.get(e);if(t)return t;const n=function({children:r}){return On.createPortal(g.createElement("div",null,r),e)};return Gv.set(e,n),n}g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(!1),[s,a]=g.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return g.useEffect(()=>{if(!t)return;const i=t.Assets.events.custom,l=({open:u,assets:d,types:p,select:f,close:h,container:m})=>{u&&a({assets:d,types:p,select:f,close:h,Container:Oa(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),g.useEffect(()=>n.setCustomAssets(!0),[]),t?Jo(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(()=>({blocks:[],dragStart:Tr,dragStop:Tr,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const s=t.Blocks.events.custom,a=({blocks:i,container:l,dragStart:u,dragStop:d})=>{const p=i.reduce((f,h)=>{const m=h.getCategoryLabel(),b=f.get(m);return b?b.push(h):f.set(m,[h]),f},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:Oa(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),g.useEffect(()=>n.setCustomBlocks(!0),[]),t?Jo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function XN({children:e,...t}){const n=Gr(),r=g.useRef(null);return g.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const JN=g.memo(function({children:e}){const{editor:t}=tr(),[n,r]=g.useState(()=>({devices:[],selected:"",select:Tr}));return g.useEffect(()=>{if(!t)return;const{Devices:o}=t,s=o.events.all,a=()=>{var i;r({devices:o.getDevices(),selected:(i=o.getSelected())==null?void 0:i.id,select:l=>o.select(l)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Jo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),QN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function RN(e){const t=e.map(({id:s,src:a})=>({id:s,src:a})),n=e.reduce((s,a)=>(s[a.id]=a,s),{}),r=[],o=[];return(await YN(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const e$=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{QN(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await RN(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},t$=g.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=Tr,onReady:l,onUpdate:u,waitReady:d,...p}){const{setEditor:f}=tr(),h=Gr(),[m,b]=g.useState(!1),v=g.useRef(null);g.useEffect(()=>{if(!h.ready||!v.current)return;const P=v.current,_=h.refCanvas;let T,O={},M=[];const A=$=>{const j={height:"100%",...r,plugins:[...M,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...O},modal:{custom:!!h.customModal,...r.modal},assetManager:{custom:!!h.customAssets,...r.assetManager},styleManager:{custom:!!h.customStyles,...r.styleManager},blockManager:{custom:!!h.customBlocks,...r.blockManager},richTextEditor:{custom:!!h.customRte,...r.richTextEditor},layerManager:{custom:!!h.customLayers,...r.layerManager},traitManager:{custom:!!h.customTraits,...r.traitManager},selectorManager:{custom:!!h.customSelectors,...r.selectorManager},container:_||P,customUI:!!_,..._?{panels:{defaults:[]}}:{}};T=$.init(j),f(T),i(T),u&&T.on("update",()=>{u(T.getProjectData(),T)}),T.onReady(()=>{b(!0),l==null||l(T)})};return(async()=>{a&&await ZN(a);const $=await e$(o);M=$.plugins,O=$.pluginOptions,typeof s=="string"?(await Uv(s),A(window.grapesjs)):A(s)})(),()=>T==null?void 0:T.destroy()},[h.ready]);const w=r.height??"100%",y=r.width??"100%",S=KN("gjs-editor-wrapper",t),C=d&&!m,E=g.useMemo(()=>({...n,height:w,width:y}),[w,y,n]),x=g.useMemo(()=>({...E,...C?{opacity:0,width:0,height:0}:{}}),[E,C]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:S,style:E,children:d}):null,c.jsx("div",{...p,ref:v,className:S,style:x,children:e})]})}),n$=g.memo(function(){const e=Gr();return g.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});g.memo(function({children:e,...t}){return c.jsx(WN,{children:c.jsx(qN,{children:c.jsxs(t$,{...t,children:[e,c.jsx(n$,{})]})})})});const qv=g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Layers:s}=t,a=s.events.custom,i=({container:l})=>{o({root:s.getRoot(),Container:Oa(l)})};return t.on(a,i),s.__trgCustom({}),()=>{t.off(a,i)}},[t]),g.useEffect(()=>n.setCustomLayers(!0),[]),t?Jo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(!1),[s,a]=g.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:Tr});return g.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:p,close:f,attributes:h})=>{u&&a({title:g.createElement(Wv(d)),content:g.createElement(Wv(p)),attributes:h,close:f}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),g.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const Kv=g.memo(function({children:e}){const{editor:t}=tr(),[n,r]=g.useState(()=>({pages:[],selected:void 0,select:Tr,add:Tr,remove:Tr}));return g.useEffect(()=>{if(!t)return;const{Pages:o}=t,s=o.events.all,a=()=>{r({pages:o.getAll(),selected:o.getSelected(),select:(...i)=>o.select(...i),add:(...i)=>o.add(...i),remove:(...i)=>o.remove(...i)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Jo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Zv=g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:Tr,removeSelector:Tr,setState:Tr,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Selectors:s}=t,a=s.events.custom,i=({container:l})=>{o({selectors:s.getSelected(),states:s.getStates(),selectedState:s.getState(),targets:s.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>s.addSelected(...u),removeSelector:(...u)=>s.removeSelected(...u),setState:(...u)=>s.setState(...u),Container:Oa(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),g.useEffect(()=>n.setCustomSelectors(!0),[]),t?Jo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Yv=g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Styles:s}=t,a=s.events.custom,i=({container:l})=>{o({sectors:s.getSectors({visible:!0}),Container:Oa(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),g.useEffect(()=>n.setCustomStyles(!0),[]),t?Jo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Sf=g.memo(function({children:e}){const{editor:t}=tr(),n=Gr(),[r,o]=g.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Traits:s}=t,a=s.events.custom,i=({container:l})=>{o({traits:s.getCurrent(),Container:Oa(l)})};return t.on(a,i),s.__trgCustom(),()=>{t.off(a,i)}},[t]),g.useEffect(()=>n.setCustomTraits(!0),[]),t?Jo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ui=({children:e})=>GN()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function Cf(e){return e=e.trimStart(),e=e.replace(/\s*([\{\}\:\;\,])\s*/g,"$1"),e=e.replace(/;\s*;/g,";"),e=e.replace(/\,[\s\.\#\d]*{/g,"{"),e=e.replace(/([^\s])\{([^\s])/g,`$1 {
257
257
  $2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
258
258
  }
259
259
  $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
260
- $2`),e}const zb=ce(function(){const t=Fi(),n=Ie(),{Styles:r}=t,{isDarkTheme:o}=zr(),s=r.getSelected(),[a,i]=h.useState(0),l=s?vf(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const f=()=>i(m=>++m),g=r.events.custom;return t.on(g,f),()=>{t.off(g,f)}},[r,t]);const p=()=>{if(u){const f=t.Parser.parseCss(u)[0];f&&(s==null||s.setStyle(f.style))}};return c.jsxs(k,{className:X("relative"),col:!0,full:!0,children:[c.jsx(F,{grow:!0,children:s?c.jsx(vo,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(Ke,{className:X("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),Ub=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],zN=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(ne.projectFiles),r={};for(const o in n){const s=n[o],{filename:a,content:i}=s;if(s.path){const l=s.path.split("/").filter(Boolean);let u=r;for(const d of l)u[d]=u[d]||{},u=u[d];u[a]=i}else r[a]=i}return r}})},UN=ce(function(t){const n=Ie(),r=ye(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=h.useState(Ub[0].id),[l,u]=h.useState(),{isDarkTheme:d}=zr(),[p]=h.useState(()=>vf(s.getCss())),[f,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...o?{export:!1}:{}},b=()=>zN(s);h.useEffect(()=>{(async()=>{var P,_;const S=await s.runCommand(ne.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((P=S.find(T=>T.mimeType==="text/html"))==null?void 0:P.content)??"",x=((_=S.find(T=>T.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(a==="mjml"?x:C)})()},[a]),h.useEffect(()=>{var y;f&&((y=f.getModel())==null||y.setValue(l),Cb(f))},[f,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(k,{gap:"m",col:!0,full:!0,children:[c.jsxs(k,{gap:"m",className:"flex-grow",children:[c.jsxs(F,{className:X("relative"),grow:!0,children:[o&&c.jsxs(k,{className:X("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Le,{value:a,onChange:i,options:Ub,className:X("min-w-24")}),c.jsx(Tb,{getValue:()=>f.getModel().getValue()})]}),l!==void 0&&c.jsx(vo,{defaultValue:l,language:"html",onMount:g,...w})]}),!o&&c.jsx(F,{grow:!0,children:c.jsx(vo,{defaultValue:p,language:"css",...w})})]}),v.export!==!1&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function WN(e,t){h.useEffect(()=>{const n="pointerdown",{current:r}=e;if(!r||!t.enabled)return;function o(s){const a=s.target;r&&a&&!r.contains(a)&&t.onTrigger(a)}return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}},[e.current,t.enabled])}const Wb=e=>{const{ref:t,show:n,node:r,styles:o,update:s,reload:a}=e,i={all:"initial",zIndex:"10",fontFamily:"inherit",...o};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const p=l.attachShadow({mode:"closed"});l.__sh=KS.createRoot(p)}l.__sh.render(r),Object.keys(i).forEach(p=>{l.style.setProperty(pC(p),i[p],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},GN="gs-cmp-popover";function Er({children:e,handler:t,title:n,size:r,padding:o=!0,border:s=!0,overlay:a,clickAway:i,topIcon:l,placement:u="auto",offset:d,open:p,onClose:f,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:w,hideCloseButton:y}){const[S,C]=h.useState(!!p),[x,E]=h.useState(S),[P,_]=h.useState(null),[T,O]=h.useState(null),L=Si(P,T,{...Qh({offset:d}),placement:u}),A=()=>{E(!1),f==null||f()};WN({current:T},{onTrigger:A,enabled:i&&S}),h.useEffect(()=>{E(!!p)},[p]),h.useEffect(()=>{var M;S&&((M=L.update)==null||M.call(L))},[S,L.update]),h.useEffect(()=>{const M=setTimeout(()=>C(x),10);return()=>clearTimeout(M)},[x]);const $=X("w-full transition-colors",w&&"pointer-events-none",...D1({border:!1,size:"",...b})),B=X(["fixed z-20",l&&"gjs-mt-5",r==="s"&&"w-full max-w-64",r==="sm"&&"w-full max-w-sm",r==="md"&&"w-full max-w-md"]);return c.jsxs(up,{className:X(GN,"relative flex",m),children:[c.jsx(up.Button,{ref:_,as:g,className:$,children:c.jsx("div",{onClick:M=>{hs(M),!(Ht(p)||w)&&E(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:A,className:X("z-10 fixed inset-0")}),x&&c.jsx(up.Panel,{static:!0,className:B,ref:O,style:L.styles.popper,...L.attributes.popper,children:c.jsx(Cp,{as:h.Fragment,show:S,unmount:!1,...$1,children:c.jsx(Qn,{classNameBody:v,title:n,onClose:y?void 0:A,padding:o,border:s,children:typeof e=="function"?e({close:A,open:S}):e})})})]})}function Oa(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=h.useRef(null),[d,p]=h.useState(),f=u.current,g=N([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",U.br,Te.xy,te.bb,l.disabled&&Oe.disabled,...t?[U.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=b=>{et(t)&&(t({event:b}),a==null||a({event:b,item:e}))};h.useEffect(()=>{if(!f)return;const b=setTimeout(()=>p(f.getBoundingClientRect()),l.active?0:Ld);return()=>clearTimeout(b)},[f,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs(k,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(F,{children:c.jsx(re,{icon:n,size:se.sx})}),!!r&&c.jsx(F,{className:N(l.classNameLabel,Oe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(F,{children:c.jsx(re,{className:U.tA,icon:K.check,size:se.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(F,{children:c.jsx(re,{icon:K.chevronRight,size:se.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(hj,{items:s,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const Dc=({className:e,grow:t,alignItems:n,justifyContent:r})=>N(e,U.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",r==="start"&&"gs-utl-justify-start",r==="end"&&"gs-utl-justify-end",r==="center"&&"gs-utl-justify-center",r==="between"&&"gs-utl-justify-between",r==="around"&&"gs-utl-justify-around",r==="evenly"&&"gs-utl-justify-evenly"),Fc=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),xn=h.memo(ce(function({id:t,children:n,className:r,style:o,width:s,gap:a,height:i,grow:l,alignItems:u,justifyContent:d,htmlAttrs:p,...f}){const{layoutsById:g}=Ac(),[m,v]=h.useState({}),{className:b,style:w,...y}=p||{},S=r??b,C=o??w,x=h.useMemo(()=>Fc({height:i,gap:a,width:s,style:C}),[C,s,i,a]),E=Dc({className:S,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:v}),()=>{g.delete(t)}},[g,m]);const P=f.as??"div";return c.jsx(P,{style:x,className:E,...f,...y,children:m.children??n})})),Bc="gs-cmp-button-menu",qN=h.memo(ce(function({className:t,style:n,icon:r,label:o,size:s,tooltip:a,value:i,disabled:l,options:u,children:d,editorEvents:p,classNameBtn:f,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:w}=ye(),[y,S]=h.useState(!1),[C,x]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:a,label:o,icon:r,iconMenu:g,size:s,disabled:l,value:i,options:u})),P={editor:w,state:C,setState:D=>x(z=>({...z,...D}))};So({editor:w,editorEvents:p,localState:C,setLocalState:x});const _=D=>{m==null||m({...P,event:D})},T=D=>{b==null||b({...P,option:D}),S(!1)},O=C.tooltip,L=ct(O)?{title:O}:{tooltipProps:O},$=(()=>{var V,G;if(C.label)return et(C.label)?C.label(P):C.label;const D=(V=C.options)==null?void 0:V.find(Y=>Y.id===C.value),z=(G=C.options)==null?void 0:G[0],I=D||z,H=N((D==null?void 0:D.id)===C.value&&U.tA);if(I!=null&&I.icon)return{type:"icon",className:H,icon:I.icon,size:18};if(I!=null&&I.label)return{type:"text",className:H,content:I.label}})(),B=kt($),M=()=>{if(d){const D=et(d)?d(P):d;return kt(D)}return C.options&&C.options.length>0?c.jsx("div",{className:`${Bc}-options`,children:C.options.map(D=>c.jsx(Oa,{label:D.label,icon:D.icon,selected:D.id===C.value,action:()=>T(D)},D.id))}):null},j=D=>{D.stopPropagation(),v?v({...P,event:D}):S(!y)},W=c.jsx(k,{items:"center",onClick:j,className:N(`${Bc}__icon-menu`,U.hBgH2,U.txtHighEmphasisH),children:c.jsx(re,{icon:C.iconMenu,size:"14px"})});return c.jsx(xn,{className:N(Bc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(Er,{handler:c.jsx(Ct,{className:N(`${Bc}__btn`,f),icon:C.icon,size:C.size,disabled:C.disabled,onClick:_,block:!0,...L,children:$?c.jsxs(k,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(k,{items:"center",children:B}),W]}):W}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:M()})})}));function Rt(e){const{className:t,options:n,name:r,value:o,size:s="m",required:a,disabled:i,onChange:l,labelAs:u}=e,d=g=>{const m=n.filter(v=>v.id===g)[0];return n.indexOf(m)===n.length-1},p=(g,m)=>N("gs-utl-cursor-pointer",s==="m"&&Te.xy,s==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",s==="xs"&&"gs-utl-p-1 text-sm",U.br,g&&U.bgO,!d(m)&&te.br),f=Ko({...e,className:"gs-field-buttons"});return c.jsxs(Om,{value:o,onChange:l,disabled:i,...f,children:[c.jsx(Cr,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(k,{className:N(t,te.b,te.rnd,U.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:v,icon:b})=>c.jsx(Wt,{title:v,className:N("gs-utl-w-full"),classNameWrp:N("gs-utl-flex-1"),children:c.jsx(Om.Option,{value:g,className:({checked:w})=>p(w,g),children:c.jsxs(k,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(re,{...ct(b)?{icon:b,size:se.s}:b}),m&&c.jsx(F,{children:m})]})})},g))})]})}const KN="gs-cmp-button-group-field",ZN=h.memo(ce(function({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l,onChange:u,editorEvents:d}){const{editor:p}=ye(),[f,g]=h.useState(()=>({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l})),m=v=>{u({value:v,editor:p,state:f,setState:b=>g(w=>({...w,...b}))})};return So({editor:p,editorEvents:d,localState:f,setLocalState:g}),c.jsx(Rt,{className:N(KN,f.className),label:f.label,name:f.name,value:f.value,options:f.options??[],size:f.size,required:f.required,disabled:f.disabled,onChange:m})}));function zc({colors:e,...t}){return e?c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 79 79",...t,children:[c.jsx("path",{fill:"url(#a)",d:"M39.6 77.1a37.5 37.5 0 1 0 0-75 37.5 37.5 0 0 0 0 75Z"}),c.jsx("path",{stroke:"#fff",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"5",d:"m40 19-14.58 8.79a6.36 6.36 0 0 0-2.82 5.33v14.13a6.14 6.14 0 0 0 3.12 5.13l11.21 5.8a6.12 6.12 0 0 0 6.14 0l11.41-6.3a6.09 6.09 0 0 0 3.12-5.13V33.12c0-1.28-1.4-2.07-2.52-1.48l-15.08 8"}),c.jsx("defs",{children:c.jsxs("linearGradient",{id:"a",x1:"2.1",x2:"77.2",y1:"39.6",y2:"39.6",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#D7709E"}),c.jsx("stop",{offset:"1",stopColor:"#A84A87"})]})})]}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",...t,children:c.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M64.117 64.117a37.5 37.5 0 1 1-53.034-53.034 37.5 37.5 0 0 1 53.034 53.034ZM39.29 19.14a2.5 2.5 0 1 0-2.582-4.282l-14.583 8.79-.05.03-.047.032a8.861 8.861 0 0 0-2.917 3.229 8.729 8.729 0 0 0-1.011 4.203V45.293l.002.047a8.64 8.64 0 0 0 1.25 4.164 8.78 8.78 0 0 0 3.115 3.043l.05.03.053.027 11.165 5.769a8.62 8.62 0 0 0 4.264 1.127c1.507 0 2.99-.394 4.295-1.145l11.394-6.276.006-.004a8.585 8.585 0 0 0 3.178-3.05 8.443 8.443 0 0 0 1.227-4.225V31.123c0-3.265-3.502-5.122-6.19-3.688l-.005.003-15.076 7.995a2.5 2.5 0 0 0 2.342 4.418l13.93-7.387v12.263a3.444 3.444 0 0 1-.502 1.703 3.584 3.584 0 0 1-1.326 1.271l-.003.002-11.409 6.284-.024.014-.023.013a3.619 3.619 0 0 1-1.814.486 3.62 3.62 0 0 1-1.814-.486l-.052-.03-.054-.028-11.155-5.764a3.78 3.78 0 0 1-1.297-1.283 3.642 3.642 0 0 1-.527-1.715V31.081a3.73 3.73 0 0 1 .432-1.806 3.858 3.858 0 0 1 1.23-1.377L39.29 19.14Z",clipRule:"evenodd"})})}const YN=h.memo(ce(function(){const{isStage:e,updateStudio:t}=ye(),{isDarkTheme:n}=zr(),r=h.useRef(null),{bg:o,text:s}=H1(n);return Wb({ref:r,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
260
+ $2`),e}const Xv=ce(function(){const t=zi(),n=$e(),{Styles:r}=t,{isDarkTheme:o}=xr(),s=r.getSelected(),[a,i]=g.useState(0),l=s?Cf(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=g.useState(l);g.useEffect(()=>{const f=()=>i(m=>++m),h=r.events.custom;return t.on(h,f),()=>{t.off(h,f)}},[r,t]);const p=()=>{if(u){const f=t.Parser.parseCss(u)[0];f&&(s==null||s.setStyle(f.style))}};return c.jsxs(I,{className:Q("relative"),col:!0,full:!0,children:[c.jsx(F,{grow:!0,children:s?c.jsx(Pr,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(Je,{className:Q("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),Jv=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],r$=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(te.projectFiles),r={};for(const o in n){const s=n[o],{filename:a,content:i}=s;if(s.path){const l=s.path.split("/").filter(Boolean);let u=r;for(const d of l)u[d]=u[d]||{},u=u[d];u[a]=i}else r[a]=i}return r}})},o$=ce(function(t){const n=$e(),r=Ce(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=g.useState(Jv[0].id),[l,u]=g.useState(),{isDarkTheme:d}=xr(),[p]=g.useState(()=>Cf(s.getCss())),[f,h]=g.useState(),m=y=>n.t(`actions.showCode.${y}`),b={...t.options,...o?{export:!1}:{}},v=()=>r$(s);g.useEffect(()=>{(async()=>{var P,_;const S=await s.runCommand(te.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((P=S.find(T=>T.mimeType==="text/html"))==null?void 0:P.content)??"",E=((_=S.find(T=>T.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(a==="mjml"?E:C)})()},[a]),g.useEffect(()=>{var y;f&&((y=f.getModel())==null||y.setValue(l),Mv(f))},[f,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(I,{gap:"m",col:!0,full:!0,children:[c.jsxs(I,{gap:"m",className:"flex-grow",children:[c.jsxs(F,{className:Q("relative"),grow:!0,children:[o&&c.jsxs(I,{className:Q("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(_e,{value:a,onChange:i,options:Jv,className:Q("min-w-24")}),c.jsx(kv,{getValue:()=>f.getModel().getValue()})]}),l!==void 0&&c.jsx(Pr,{defaultValue:l,language:"html",onMount:h,...w})]}),!o&&c.jsx(F,{grow:!0,children:c.jsx(Pr,{defaultValue:p,language:"css",...w})})]}),b.export!==!1&&c.jsx(I,{justify:"end",children:c.jsx(Je,{size:"m2",variant:"pr",onClick:v,children:m("exportButton")})})]})});function s$(e,t){g.useEffect(()=>{const n="pointerdown",{current:r}=e;if(!r||!t.enabled)return;function o(s){const a=s.target;r&&a&&!r.contains(a)&&t.onTrigger(a)}return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}},[e.current,t.enabled])}const Qv=e=>{const{ref:t,show:n,node:r,styles:o,update:s,reload:a}=e,i={all:"initial",zIndex:"10",fontFamily:"inherit",...o};g.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const p=l.attachShadow({mode:"closed"});l.__sh=lC.createRoot(p)}l.__sh.render(r),Object.keys(i).forEach(p=>{l.style.setProperty(OC(p),i[p],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},a$="gs-cmp-popover";function Or({children:e,handler:t,title:n,size:r,padding:o=!0,border:s=!0,overlay:a,clickAway:i,topIcon:l,placement:u="auto",offset:d,open:p,onClose:f,buttonAs:h,className:m,classNameBody:b,buttonProps:v={},disabled:w,hideCloseButton:y}){const[S,C]=g.useState(!!p),[E,x]=g.useState(S),[P,_]=g.useState(null),[T,O]=g.useState(null),M=xi(P,T,{...rh({offset:d}),placement:u}),A=()=>{x(!1),f==null||f()};s$({current:T},{onTrigger:A,enabled:i&&S}),g.useEffect(()=>{x(!!p)},[p]),g.useEffect(()=>{var L;S&&((L=M.update)==null||L.call(M))},[S,M.update]),g.useEffect(()=>{const L=setTimeout(()=>C(E),10);return()=>clearTimeout(L)},[E]);const $=Q("w-full transition-colors",w&&"pointer-events-none",...K1({border:!1,size:"",...v})),j=Q(["fixed z-20",l&&"gjs-mt-5",r==="s"&&"w-full max-w-64",r==="sm"&&"w-full max-w-sm",r==="md"&&"w-full max-w-md"]);return c.jsxs(hp,{className:Q(a$,"relative flex",m),children:[c.jsx(hp.Button,{ref:_,as:h,className:$,children:c.jsx("div",{onClick:L=>{ms(L),!(Ht(p)||w)&&x(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:A,className:Q("z-10 fixed inset-0")}),E&&c.jsx(hp.Panel,{static:!0,className:j,ref:O,style:M.styles.popper,...M.attributes.popper,children:c.jsx(Op,{as:g.Fragment,show:S,unmount:!1,...B1,children:c.jsx(Rn,{classNameBody:b,title:n,onClose:y?void 0:A,padding:o,border:s,children:typeof e=="function"?e({close:A,open:S}):e})})})]})}function _a(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=g.useRef(null),[d,p]=g.useState(),f=u.current,h=N([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",U.br,Te.xy,re.bb,l.disabled&&Oe.disabled,...t?[U.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=v=>{ot(t)&&(t({event:v}),a==null||a({event:v,item:e}))};g.useEffect(()=>{if(!f)return;const v=setTimeout(()=>p(f.getBoundingClientRect()),l.active?0:kd);return()=>clearTimeout(v)},[f,l.active]);const b=()=>{var v;return(v=l.onActive)==null?void 0:v.call(l)};return c.jsxs(I,{ref:u,items:"center",nowrap:!0,className:h,onClick:m,onPointerEnter:b,children:[n&&c.jsx(F,{children:c.jsx(ne,{icon:n,size:se.sx})}),!!r&&c.jsx(F,{className:N(l.classNameLabel,Oe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(F,{children:c.jsx(ne,{className:U.tA,icon:K.check,size:se.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(F,{children:c.jsx(ne,{icon:K.chevronRight,size:se.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(Dj,{items:s,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const Wc=({className:e,grow:t,alignItems:n,justifyContent:r})=>N(e,U.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",r==="start"&&"gs-utl-justify-start",r==="end"&&"gs-utl-justify-end",r==="center"&&"gs-utl-justify-center",r==="between"&&"gs-utl-justify-between",r==="around"&&"gs-utl-justify-around",r==="evenly"&&"gs-utl-justify-evenly"),Gc=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),xn=g.memo(ce(function({id:t,children:n,className:r,style:o,width:s,gap:a,height:i,grow:l,alignItems:u,justifyContent:d,htmlAttrs:p,...f}){const{layoutsById:h}=$c(),[m,b]=g.useState({}),{className:v,style:w,...y}=p||{},S=r??v,C=o??w,E=g.useMemo(()=>Gc({height:i,gap:a,width:s,style:C}),[C,s,i,a]),x=Wc({className:S,grow:l,alignItems:u,justifyContent:d});g.useEffect(()=>{if(t)return h.set(t,{state:m,setState:b}),()=>{h.delete(t)}},[h,m]);const P=f.as??"div";return c.jsx(P,{style:E,className:x,...f,...y,children:m.children??n})})),qc="gs-cmp-button-menu",i$=g.memo(ce(function({className:t,style:n,icon:r,label:o,size:s,tooltip:a,value:i,disabled:l,options:u,children:d,editorEvents:p,classNameBtn:f,iconMenu:h="chevronDown",onClick:m,onClickMenu:b,onOptionSelect:v}){const{editor:w}=Ce(),[y,S]=g.useState(!1),[C,E]=g.useState(()=>({isOpen:y,className:t,style:n,tooltip:a,label:o,icon:r,iconMenu:h,size:s,disabled:l,value:i,options:u})),P={editor:w,state:C,setState:B=>E(G=>({...G,...B}))};xo({editor:w,editorEvents:p,localState:C,setLocalState:E});const _=B=>{m==null||m({...P,event:B})},T=B=>{v==null||v({...P,option:B}),S(!1)},O=C.tooltip,M=dt(O)?{title:O}:{tooltipProps:O},$=(()=>{var k,z;if(C.label)return ot(C.label)?C.label(P):C.label;const B=(k=C.options)==null?void 0:k.find(Y=>Y.id===C.value),G=(z=C.options)==null?void 0:z[0],D=B||G,V=N((B==null?void 0:B.id)===C.value&&U.tA);if(D!=null&&D.icon)return{type:"icon",className:V,icon:D.icon,size:18};if(D!=null&&D.label)return{type:"text",className:V,content:D.label}})(),j=Lt($),L=()=>{if(d){const B=ot(d)?d(P):d;return Lt(B)}return C.options&&C.options.length>0?c.jsx("div",{className:`${qc}-options`,children:C.options.map(B=>c.jsx(_a,{label:B.label,icon:B.icon,selected:B.id===C.value,action:()=>T(B)},B.id))}):null},H=B=>{B.stopPropagation(),b?b({...P,event:B}):S(!y)},W=c.jsx(I,{items:"center",onClick:H,className:N(`${qc}__icon-menu`,U.hBgH2,U.txtHighEmphasisH),children:c.jsx(ne,{icon:C.iconMenu,size:"14px"})});return c.jsx(xn,{className:N(qc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(Or,{handler:c.jsx(wt,{className:N(`${qc}__btn`,f),icon:C.icon,size:C.size,disabled:C.disabled,onClick:_,block:!0,...M,children:$?c.jsxs(I,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(I,{items:"center",children:j}),W]}):W}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:L()})})}));function Rt(e){const{className:t,options:n,name:r,value:o,size:s="m",required:a,disabled:i,onChange:l,labelAs:u}=e,d=h=>{const m=n.filter(b=>b.id===h)[0];return n.indexOf(m)===n.length-1},p=(h,m)=>N("gs-utl-cursor-pointer",s==="m"&&Te.xy,s==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",s==="xs"&&"gs-utl-p-1 text-sm",U.br,h&&U.bgO,!d(m)&&re.br),f=Xo({...e,className:"gs-field-buttons"});return c.jsxs(Im,{value:o,onChange:l,disabled:i,...f,children:[c.jsx(Er,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(I,{className:N(t,re.b,re.rnd,U.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:h,label:m,title:b,icon:v})=>c.jsx(Gt,{title:b,className:N("gs-utl-w-full"),classNameWrp:N("gs-utl-flex-1"),children:c.jsx(Im.Option,{value:h,className:({checked:w})=>p(w,h),children:c.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!v&&c.jsx(ne,{...dt(v)?{icon:v,size:se.s}:v}),m&&c.jsx(F,{children:m})]})})},h))})]})}const l$="gs-cmp-button-group-field",c$=g.memo(ce(function({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l,onChange:u,editorEvents:d}){const{editor:p}=Ce(),[f,h]=g.useState(()=>({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l})),m=b=>{u({value:b,editor:p,state:f,setState:v=>h(w=>({...w,...v}))})};return xo({editor:p,editorEvents:d,localState:f,setLocalState:h}),c.jsx(Rt,{className:N(l$,f.className),label:f.label,name:f.name,value:f.value,options:f.options??[],size:f.size,required:f.required,disabled:f.disabled,onChange:m})}));function Kc({colors:e,...t}){return e?c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 79 79",...t,children:[c.jsx("path",{fill:"url(#a)",d:"M39.6 77.1a37.5 37.5 0 1 0 0-75 37.5 37.5 0 0 0 0 75Z"}),c.jsx("path",{stroke:"#fff",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"5",d:"m40 19-14.58 8.79a6.36 6.36 0 0 0-2.82 5.33v14.13a6.14 6.14 0 0 0 3.12 5.13l11.21 5.8a6.12 6.12 0 0 0 6.14 0l11.41-6.3a6.09 6.09 0 0 0 3.12-5.13V33.12c0-1.28-1.4-2.07-2.52-1.48l-15.08 8"}),c.jsx("defs",{children:c.jsxs("linearGradient",{id:"a",x1:"2.1",x2:"77.2",y1:"39.6",y2:"39.6",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#D7709E"}),c.jsx("stop",{offset:"1",stopColor:"#A84A87"})]})})]}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",...t,children:c.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M64.117 64.117a37.5 37.5 0 1 1-53.034-53.034 37.5 37.5 0 0 1 53.034 53.034ZM39.29 19.14a2.5 2.5 0 1 0-2.582-4.282l-14.583 8.79-.05.03-.047.032a8.861 8.861 0 0 0-2.917 3.229 8.729 8.729 0 0 0-1.011 4.203V45.293l.002.047a8.64 8.64 0 0 0 1.25 4.164 8.78 8.78 0 0 0 3.115 3.043l.05.03.053.027 11.165 5.769a8.62 8.62 0 0 0 4.264 1.127c1.507 0 2.99-.394 4.295-1.145l11.394-6.276.006-.004a8.585 8.585 0 0 0 3.178-3.05 8.443 8.443 0 0 0 1.227-4.225V31.123c0-3.265-3.502-5.122-6.19-3.688l-.005.003-15.076 7.995a2.5 2.5 0 0 0 2.342 4.418l13.93-7.387v12.263a3.444 3.444 0 0 1-.502 1.703 3.584 3.584 0 0 1-1.326 1.271l-.003.002-11.409 6.284-.024.014-.023.013a3.619 3.619 0 0 1-1.814.486 3.62 3.62 0 0 1-1.814-.486l-.052-.03-.054-.028-11.155-5.764a3.78 3.78 0 0 1-1.297-1.283 3.642 3.642 0 0 1-.527-1.715V31.081a3.73 3.73 0 0 1 .432-1.806 3.858 3.858 0 0 1 1.23-1.377L39.29 19.14Z",clipRule:"evenodd"})})}const u$=g.memo(ce(function(){const{isStage:e,updateStudio:t}=Ce(),{isDarkTheme:n}=xr(),r=g.useRef(null),{bg:o,text:s}=G1(n);return Qv({ref:r,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
261
261
  .gs-banner {
262
262
  box-shadow: 0 0 5px #1c1b1b21;
263
263
  padding: 30px 10px;
@@ -277,7 +277,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
277
277
  .gs-gs-logo {
278
278
  width: 35px;
279
279
  }
280
- `}),c.jsx(Qn,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx(zc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),XN=()=>`https://grapesjs.com?ref=${window.location.host}`,JN=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=ye(),{isDarkTheme:n}=zr(),r=h.useRef(null),{bg:o,text:s,link:a}=H1(n);return Wb({ref:r,show:t,update:n,reload:e,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
280
+ `}),c.jsx(Rn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx(Kc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),d$=()=>`https://grapesjs.com?ref=${window.location.host}`,p$=g.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=Ce(),{isDarkTheme:n}=xr(),r=g.useRef(null),{bg:o,text:s,link:a}=G1(n);return Qv({ref:r,show:t,update:n,reload:e,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
281
281
  .gs-banner {
282
282
  box-shadow: 0 0 5px #1c1b1b21;
283
283
  padding: 5px 10px;
@@ -300,7 +300,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
300
300
  .gs-logo {
301
301
  width: 20px;
302
302
  }
303
- `}),c.jsx(Qn,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:XN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(zc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),Gb="gs-canvas-content",QN=h.memo(ce(function({children:t}){const{isReady:n}=ye(),r=N(`${Gb}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,U.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Gb,children:[c.jsx("div",{className:r}),!n&&c.jsx(No,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&kt(t)]}),c.jsx(YN,{}),c.jsx(JN,{})]})})),RN="gs-canvas",qb=h.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(IN,{style:n,className:N(RN,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Bi,{children:c.jsx(QN,{children:o})})})}),bf=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),e$=bf?Promise.resolve().then(function(){return a$}):Promise.resolve().then(function(){return p$});async function t$(...e){return(await e$).default(...e)}bf?Promise.resolve().then(function(){return l$}):Promise.resolve().then(function(){return h$});const n$=bf?Promise.resolve().then(function(){return u$}):Promise.resolve().then(function(){return m$});async function r$(...e){return(await n$).default(...e)}const o$=async e=>{const t=await e.getFile();return t.handle=e,t};var s$=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((o,s)=>{t[s]={description:o.description||"Files",accept:{}},o.mimeTypes?o.mimeTypes.map(a=>{t[s].accept[a]=o.extensions||[]}):t[s].accept["*/*"]=o.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),r=await Promise.all(n.map(o$));return e[0].multiple?r:r[0]},a$={__proto__:null,default:s$};function Uc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(o){return{value:o,done:r}})}return Uc=function(n){this.s=n,this.n=n.next},Uc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new Uc(e)}const Kb=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!1,l=!1;try{for(var u,d=function(p){var f,g,m,v=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);v--;){if(g&&(f=p[g])!=null)return f.call(p);if(m&&(f=p[m])!=null)return new Uc(f.call(p));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const p=u.value,f=`${n}/${p.name}`;p.kind==="file"?s.push(p.getFile().then(g=>(g.directoryHandle=e,g.handle=p,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>f})))):p.kind!=="directory"||!t||r&&r(p)||o.push(Kb(p,t,f,r))}}catch(p){l=!0,a=p}finally{try{i&&d.return!=null&&await d.return()}finally{if(l)throw a}}return[...(await Promise.all(o)).flat(),...await Promise.all(s)]};var i$=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:Kb(t,e.recursive,void 0,e.skipDirectory)},l$={__proto__:null,default:i$},c$=async(e,t=[{}],n=null,r=!1,o=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const s=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((u,d)=>{s[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&a&&u.mimeTypes.push(a),u.mimeTypes.map(p=>{s[d].accept[p]=u.extensions||[]})):a?s[d].accept[a]=u.extensions||[]:s[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,r)throw u}const i=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:s,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&o&&o(i);const l=await i.createWritable();return"stream"in e?(await e.stream().pipeTo(l),i):"body"in e?(await e.body.pipeTo(l),i):(await l.write(await e),await l.close(),i)},u$={__proto__:null,default:c$},d$=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const o=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=o||"",r.style.display="none",document.body.append(r);const s=l=>{typeof a=="function"&&a(),t(l)},a=e[0].legacySetup&&e[0].legacySetup(s,()=>a(n),r),i=()=>{window.removeEventListener("focus",i),r.remove()};r.addEventListener("click",()=>{window.addEventListener("focus",i)}),r.addEventListener("change",()=>{window.removeEventListener("focus",i),r.remove(),s(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),p$={__proto__:null,default:d$},f$=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0;const o=a=>{typeof s=="function"&&s(),t(a)},s=e[0].legacySetup&&e[0].legacySetup(o,()=>s(n),r);r.addEventListener("change",()=>{let a=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(a=a.filter(i=>i.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):a=a.filter(i=>i.webkitRelativePath.split("/").length===2),o(a)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),h$={__proto__:null,default:f$},g$=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await async function(a,i){const l=a.getReader(),u=new ReadableStream({start:f=>async function g(){return l.read().then(({done:m,value:v})=>{if(!m)return f.enqueue(v),g();f.close()})}()}),d=new Response(u),p=await d.blob();return l.releaseLock(),new Blob([p],{type:i})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const o=()=>{typeof s=="function"&&s()},s=t.legacySetup&&t.legacySetup(o,()=>s(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),o()}),n.click(),null},m$={__proto__:null,default:g$};function Yo({children:e,label:t,s:n="m",pill:r,border:o,nopad:s,className:a,block:i,...l}){return c.jsx("div",{className:N(!i&&"gs-utl-inline-block",a,!s&&Te.xyS2,r?te.pill:te.rnd,o&&`${te.b} ${U.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Zb={NODE_ENV:"production"};const v$=Zb.REACT_APP_VERSION??Zb.NPM_PACKAGE_VERSION,b$=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsxs(F,{className:ae("relative"),children:[c.jsx(zc,{className:ae("w-24 opacity-50")}),t&&c.jsx(Yo,{className:ae(U.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(F,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:ae(Mo.link),href:"https://grapesjs.com",children:"GrapesJS"})," ","library. Beyond pushing the evolution of the core library itself, this application aspires to empower individuals in creating and managing their web projects autonomously, free from subscriptions or dependency on the internet connection."]}),c.jsx("br",{}),c.jsxs("p",{children:["If you like the vision of this project and you're eager to play a role in its continued development, consider becoming a backer or sponsor through"," ",c.jsx("a",{className:ae(Mo.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(F,{className:ae(U.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",v$]})]})}),y$=ce(function(){return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsx(F,{className:X("relative"),children:c.jsx(zc,{className:X("w-24 opacity-50")})})}),c.jsx(F,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:X(Mo.link),href:"/dashboard/sdk/licenses",target:"_blank",children:"Studio SDK license page"}),c.jsx("br",{}),c.jsx("br",{}),"If you have any questions or need assistance with specific use cases, please fill out this"," ",c.jsx("a",{className:X(Mo.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),w$=()=>[{id:xt.web,label:Lr(xt.web),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:K.web,size:se.s}),c.jsx("span",{children:Lr(xt.web)})]})},{id:xt.email,label:Lr(xt.email),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:K.emailOutline,size:se.s}),c.jsx("span",{children:Lr(xt.email)})]})}],Wc="gs-cmp-tabs";function Xo({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=fC,value:i}){const l=o==="pills",u=l?N("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",U.bgH):"",d=v=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?U.bg:""):N("gs-utl-border-b-2",Te.xy),p=v=>{v&&(v.tabIndex=-1)},f=v=>{const b=v.currentTarget;setTimeout(()=>b.blur(),10)},g=Ht(i)?e.findIndex(v=>v.id===i):void 0,m=!e.some(v=>!!v.content);return c.jsxs(fi.Group,{onChange:v=>a(e[v].id),defaultIndex:e.findIndex(v=>v.id===i),selectedIndex:g,children:[c.jsx(fi.List,{as:k,className:N(Wc,t,u),style:s,full:!0,nowrap:!0,children:e.map(v=>c.jsx(fi,{disabled:v.disabled,className:({selected:b})=>N(`${Wc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",ri.focus,d(b),b?`${U.tAo} ${U.bA}`:U.br,r),children:v.label},v.id))}),c.jsx(fi.Panels,{className:N(`${Wc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(v=>c.jsx(fi.Panel,{tabIndex:-1,className:N(`${Wc}__panel`,"gs-utl-h-full"),ref:p,onFocus:f,children:v.content},v.id))})]})}const Gc=0,Jo=1,_a=2,Yb=4;function Xb(e,t){return n=>e(t(n))}function S$(e,t){return t(e)}function Jb(e,t){return n=>e(t,n)}function Qb(e,t){return()=>e(t)}function qc(e,t){return t(e),e}function Pt(...e){return e}function C$(e){e()}function Rb(e){return()=>e}function x$(...e){return()=>{e.map(C$)}}function yf(e){return e!==void 0}function Aa(){}function at(e,t){return e(Jo,t)}function Ve(e,t){e(Gc,t)}function wf(e){e(_a)}function en(e){return e(Yb)}function we(e,t){return at(e,Jb(t,Gc))}function Wr(e,t){const n=e(Jo,r=>{n(),t(r)});return n}function Ge(){const e=[];return(t,n)=>{switch(t){case _a:e.splice(0,e.length);return;case Jo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Gc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function fe(e){let t=e;const n=Ge();return(r,o)=>{switch(r){case Jo:o(t);break;case Gc:t=o;break;case Yb:return t}return n(r,o)}}function E$(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Jo:return s?n===s?void 0:(r(),n=s,t=at(e,s),t):(r(),Aa);case _a:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function In(e){return qc(Ge(),t=>we(e,t))}function dn(e,t){return qc(fe(t),n=>we(e,n))}function P$(...e){return t=>e.reduceRight(S$,t)}function ie(e,...t){const n=P$(...t);return(r,o)=>{switch(r){case Jo:return at(e,n(o));case _a:wf(e);return}}}function e0(e,t){return e===t}function Tt(e=e0){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function _e(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>Xb(t,e)}function Gr(e){return t=>()=>t(e)}function qr(e,t){return n=>r=>n(t=e(t,r))}function La(e){return t=>n=>{e>0?e--:t(n)}}function Qo(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function t0(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function je(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{const u=n;n=n|i,t[a]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>a=>{const i=()=>s([a].concat(t));n===o?i():r=i}}function n0(...e){return function(t,n){switch(t){case Jo:return x$(...e.map(r=>at(r,n)));case _a:return;default:throw new Error(`unrecognized action ${t}`)}}}function Ae(e,t=e0){return ie(e,Tt(t))}function zt(...e){const t=Ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{n[a]=l,r=r|i,r===o&&Ve(t,n)})}),function(s,a){switch(s){case Jo:return r===o&&a(n),at(t,a);case _a:return wf(t);default:throw new Error(`unrecognized action ${s}`)}}}function it(e,t=[],{singleton:n}={singleton:!0}){return{id:T$(),constructor:e,dependencies:t,singleton:n}}const T$=()=>Symbol();function O$(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=o(s.map(l=>n(l)));return a&&t.set(r,i),i};return n(e)}function _$(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}const Kc=typeof document<"u"?h.useLayoutEffect:h.useEffect;function r0(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=h.createContext({});function l(w,y){w.propsReady&&Ve(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];Ve(C,y[S])}for(const S of o)if(S in y){const C=w[t.optional[S]];Ve(C,y[S])}w.propsReady&&Ve(w.propsReady,!0)}function u(w){return s.reduce((y,S)=>(y[S]=C=>{const x=w[t.methods[S]];Ve(x,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=E$(w[t.events[S]]),y),{})}const p=h.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=h.useState(()=>qc(O$(e),_=>l(_,C))),[E]=h.useState(Qb(d,x));Kc(()=>{for(const _ of a)_ in C&&at(E[_],C[_]);return()=>{Object.values(E).map(wf)}},[C,E,x]),Kc(()=>{l(x,C)}),h.useImperativeHandle(y,Rb(u(x)));const P=n;return c.jsx(i.Provider,{value:x,children:n?c.jsx(P,{..._$([...r,...o,...a],C),children:S}):S})}),f=w=>h.useCallback(Jb(Ve,h.useContext(i)[w]),[w]),g=w=>{const S=h.useContext(i)[w],C=h.useCallback(x=>at(S,x),[S]);return h.useSyncExternalStore(C,()=>en(S),()=>en(S))},m=w=>{const S=h.useContext(i)[w],[C,x]=h.useState(Qb(en,S));return Kc(()=>at(S,E=>{E!==C&&x(Rb(E))}),[S,C]),C},v=h.version.startsWith("18")?g:m;return{Component:p,usePublisher:f,useEmitterValue:v,useEmitter:(w,y)=>{const C=h.useContext(i)[w];Kc(()=>at(C,y),[y,C])}}}const o0=typeof document<"u"?h.useLayoutEffect:h.useEffect;var Vn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Vn||{});const A$={0:"debug",1:"log",2:"warn",3:"error"},L$=()=>typeof globalThis>"u"?window:globalThis,Ro=it(()=>{const e=fe(3);return{log:fe((n,r,o=1)=>{var s;const a=(s=L$().VIRTUOSO_LOG_LEVEL)!=null?s:en(e);o>=a&&console[A$[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Sf(e,t,n){const r=h.useRef(null);let o=s=>{};if(typeof ResizeObserver<"u"){const s=h.useMemo(()=>new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};n?i():requestAnimationFrame(i)}),[e]);o=a=>{a&&t?(s.observe(a),r.current=a):(r.current&&s.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function Ds(e,t,n){return Sf(e,t,n).callbackRef}function M$(e,t,n,r,o,s,a,i,l){const u=h.useCallback(d=>{const p=N$(d.children,t,i?"offsetWidth":"offsetHeight",o);let f=d.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const g=f.lastElementChild.dataset.viewportType==="window",m=a?i?a.scrollLeft:a.scrollTop:g?i?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:i?f.scrollLeft:f.scrollTop,v=a?i?a.scrollWidth:a.scrollHeight:g?i?document.documentElement.scrollWidth:document.documentElement.scrollHeight:i?f.scrollWidth:f.scrollHeight,b=a?i?a.offsetWidth:a.offsetHeight:g?i?window.innerWidth:window.innerHeight:i?f.offsetWidth:f.offsetHeight;r({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),s==null||s(i?s0("column-gap",getComputedStyle(d).columnGap,o):s0("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,a,r]);return Sf(u,n,l)}function N$(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let a=0;a<o;a++){const i=e.item(a);if(!i||i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),u=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},Vn.ERROR),d===u)continue;const p=s[s.length-1];s.length===0||p.size!==d||p.endIndex!==l-1?s.push({startIndex:l,endIndex:l,size:d}):s[s.length-1].endIndex++}return s}function s0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}function es(e,t){return Math.round(e.getBoundingClientRect()[t])}function a0(e,t){return Math.abs(e-t)<1.01}function i0(e,t,n,r=Aa,o,s){const a=h.useRef(null),i=h.useRef(null),l=h.useRef(null),u=h.useCallback(f=>{const g=f.target,m=g===window||g===document,v=s?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=s?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,w=s?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(v,0),scrollHeight:b,viewportHeight:w})};f.suppressFlushSync?y():On.flushSync(y),i.current!==null&&(v===i.current||v<=0||v===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const f=o||a.current;return r(o||a.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{r(null),f.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(f){const g=a.current;if(!g||(s?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=f.behavior==="smooth";let v,b,w;g===window?(b=Math.max(es(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),v=s?window.innerWidth:window.innerHeight,w=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(b=g[s?"scrollWidth":"scrollHeight"],v=es(g,s?"width":"height"),w=g[s?"scrollLeft":"scrollTop"]);const y=b-v;if(f.top=Math.ceil(Math.max(Math.min(y,f.top),0)),a0(v,b)||f.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(i.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(f={left:f.top,behavior:f.behavior}),g.scrollTo(f)}function p(f){s&&(f={left:f.top,behavior:f.behavior}),a.current.scrollBy(f)}return{scrollerRef:a,scrollByCallback:p,scrollToCallback:d}}const pn=it(()=>{const e=Ge(),t=Ge(),n=fe(0),r=Ge(),o=fe(0),s=Ge(),a=Ge(),i=fe(0),l=fe(0),u=fe(0),d=fe(0),p=Ge(),f=Ge(),g=fe(!1),m=fe(!1),v=fe(!1);return we(ie(e,me(({scrollTop:b})=>b)),t),we(ie(e,me(({scrollHeight:b})=>b)),a),we(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:a,smoothScrollTargetReached:r,horizontalDirection:m,skipAnimationFrameInResizeObserver:v,scrollTo:p,scrollBy:f,statefulScrollTop:o,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),zi={lvl:0};function l0(e,t,n,r=zi,o=zi){return{k:e,v:t,lvl:n,l:r,r:o}}function ht(e){return e===zi}function Ma(){return zi}function Cf(e,t){if(ht(e))return zi;const{k:n,l:r,r:o}=e;if(t===n){if(ht(r))return o;if(ht(o))return r;{const[s,a]=c0(r);return Zc(Ft(e,{k:s,v:a,l:u0(r)}))}}else return t<n?Zc(Ft(e,{l:Cf(r,t)})):Zc(Ft(e,{r:Cf(o,t)}))}function Ui(e,t){if(!ht(e))return t===e.k?e.v:t<e.k?Ui(e.l,t):Ui(e.r,t)}function Pr(e,t,n="k"){if(ht(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Pr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Pr(e.l,t,n)}function Hn(e,t,n){return ht(e)?l0(t,n,1):t===e.k?Ft(e,{k:t,v:n}):t<e.k?d0(Ft(e,{l:Hn(e.l,t,n)})):d0(Ft(e,{r:Hn(e.r,t,n)}))}function xf(e,t,n){if(ht(e))return[];const{k:r,v:o,l:s,r:a}=e;let i=[];return r>t&&(i=i.concat(xf(s,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(xf(a,t,n))),i}function Fs(e){return ht(e)?[]:[...Fs(e.l),{k:e.k,v:e.v},...Fs(e.r)]}function c0(e){return ht(e.r)?[e.k,e.v]:c0(e.r)}function u0(e){return ht(e.r)?e.l:Zc(Ft(e,{r:u0(e.r)}))}function Ft(e,t){return l0(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Ef(e){return ht(e)||e.lvl>e.r.lvl}function d0(e){return Pf(f0(e))}function Zc(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Ef(t))return f0(Ft(e,{lvl:r-1}));if(!ht(t)&&!ht(t.r))return Ft(t.r,{l:Ft(t,{r:t.r.l}),r:Ft(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Ef(e))return Pf(Ft(e,{lvl:r-1}));if(!ht(n)&&!ht(n.l)){const o=n.l,s=Ef(o)?n.lvl-1:n.lvl;return Ft(o,{l:Ft(e,{r:o.l,lvl:r-1}),r:Pf(Ft(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Yc(e,t,n){if(ht(e))return[];const r=Pr(e,t)[0];return $$(xf(e,r,n))}function p0(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let a=1;a<n;a++){const{index:i,value:l}=t(e[a]);s.push({start:r,end:i-1,value:o}),r=i,o=l}return s.push({start:r,end:1/0,value:o}),s}function $$(e){return p0(e,({k:t,v:n})=>({index:t,value:n}))}function Pf(e){const{r:t,lvl:n}=e;return!ht(t)&&!ht(t.r)&&t.lvl===n&&t.r.lvl===n?Ft(t,{l:Ft(e,{r:t.l}),lvl:n+1}):e}function f0(e){const{l:t}=e;return!ht(t)&&t.lvl===e.lvl?Ft(t,{r:Ft(e,{l:t.r})}):e}function Xc(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),a=e[s],i=n(a,t);if(i===0)return s;if(i===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function h0(e,t,n){return e[Xc(e,t,n)]}function k$(e,t,n,r){const o=Xc(e,t,r),s=Xc(e,n,r,o);return e.slice(o,s+1)}const Tf=it(()=>({recalcInProgress:fe(!1)}),[],{singleton:!0});function I$(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function g0(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function V$(e,t){let n=ht(e)?0:1/0;for(const r of t){const{size:o,startIndex:s,endIndex:a}=r;if(n=Math.min(n,s),ht(e)){e=Hn(e,0,o);continue}const i=Yc(e,s-1,a+1);if(i.some(I$(r)))continue;let l=!1,u=!1;for(const{start:d,end:p,value:f}of i)l?(a>=d||o===f)&&(e=Cf(e,d)):(u=f!==o,l=!0),p>a&&a>=d&&f!==o&&(e=Hn(e,a+1,f));u&&(e=Hn(e,s,o))}return[e,n]}function H$(){return{offsetTree:[],sizeTree:Ma(),groupOffsetTree:Ma(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function Of({index:e},t){return t===e?0:t<e?-1:1}function j$({offset:e},t){return t===e?0:t<e?-1:1}function D$(e){return{index:e.index,value:e}}function F$(e,t,n,r=0){return r>0&&(t=Math.max(t,h0(e,r,Of).offset)),p0(k$(e,t,n,j$),D$)}function _f(e,t,n,r){let o=e,s=0,a=0,i=0,l=0;if(t!==0){l=Xc(o,t-1,Of),i=o[l].offset;const d=Pr(n,t-1);s=d[0],a=d[1],o.length&&o[l].size===Pr(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of Yc(n,t,1/0)){const p=u-s,f=p*a+i+p*r;o.push({offset:f,size:d,index:u}),s=u,i=f,a=d}return{offsetTree:o,lastIndex:s,lastOffset:i,lastSize:a}}function B$(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Vn.DEBUG);const s=e.sizeTree;let a=s,i=0;if(n.length>0&&ht(s)&&t.length===2){const f=t[0].size,g=t[1].size;a=n.reduce((m,v)=>Hn(Hn(m,v,f),v+1,g),a)}else[a,i]=V$(a,t);if(a===s)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:p}=_f(e.offsetTree,i,a,o);return{sizeTree:a,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:d,groupOffsetTree:n.reduce((f,g)=>Hn(f,g,Wi(g,l,o)),Ma()),groupIndices:n}}function Wi(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=h0(t,e,Of),a=e-o,i=s*a+(a-1)*n+r;return i>0?i+n:i}function z$(e){return typeof e.groupIndex<"u"}function m0(e,t,n){if(z$(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=v0(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function v0(e,t){if(!Jc(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Jc(e){return!ht(e.groupOffsetTree)}function U$(e){return Fs(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],a=s?s.k-1:1/0;return{startIndex:t,endIndex:a,size:n}})}const W$={offsetHeight:"height",offsetWidth:"width"},Kr=it(([{log:e},{recalcInProgress:t}])=>{const n=Ge(),r=Ge(),o=dn(r,0),s=Ge(),a=Ge(),i=fe(0),l=fe([]),u=fe(void 0),d=fe(void 0),p=fe((x,E)=>es(x,W$[E])),f=fe(void 0),g=fe(0),m=H$(),v=dn(ie(n,je(l,e,g),qr(B$,m),Tt()),m),b=dn(ie(l,Tt(),qr((x,E)=>({prev:x.current,current:E}),{prev:[],current:[]}),me(({prev:x})=>x)),[]);we(ie(l,_e(x=>x.length>0),je(v,g),me(([x,E,P])=>{const _=x.reduce((T,O,L)=>Hn(T,O,Wi(O,E.offsetTree,P)||L),Ma());return{...E,groupIndices:x,groupOffsetTree:_}})),v),we(ie(r,je(v),_e(([x,{lastIndex:E}])=>x<E),me(([x,{lastIndex:E,lastSize:P}])=>[{startIndex:x,endIndex:E,size:P}])),n),we(u,d);const w=dn(ie(u,me(x=>x===void 0)),!0);we(ie(d,_e(x=>x!==void 0&&ht(en(v).sizeTree)),me(x=>[{startIndex:0,endIndex:0,size:x}])),n);const y=In(ie(n,je(v),qr(({sizes:x},[E,P])=>({changed:P!==x,sizes:P}),{changed:!1,sizes:m}),me(x=>x.changed)));at(ie(i,qr((x,E)=>({diff:x.prev-E,prev:E}),{diff:0,prev:0}),me(x=>x.diff)),x=>{const{groupIndices:E}=en(v);if(x>0)Ve(t,!0),Ve(s,x+g0(x,E));else if(x<0){const P=en(b);P.length>0&&(x-=g0(-x,P)),Ve(a,x)}}),at(ie(i,je(e)),([x,E])=>{x<0&&E("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},Vn.ERROR)});const S=In(s);we(ie(s,je(v),me(([x,E])=>{const P=E.groupIndices.length>0,_=[],T=E.lastSize;if(P){const O=Ui(E.sizeTree,0);let L=0,A=0;for(;L<x;){const M=E.groupIndices[A],j=E.groupIndices.length===A+1?1/0:E.groupIndices[A+1]-M-1;_.push({startIndex:M,endIndex:M,size:O}),_.push({startIndex:M+1,endIndex:M+1+j-1,size:T}),A++,L+=j+1}const $=Fs(E.sizeTree);return L!==x&&$.shift(),$.reduce((M,{k:j,v:W})=>{let D=M.ranges;return M.prevSize!==0&&(D=[...M.ranges,{startIndex:M.prevIndex,endIndex:j+x-1,size:M.prevSize}]),{ranges:D,prevIndex:j+x,prevSize:W}},{ranges:_,prevIndex:x,prevSize:0}).ranges}return Fs(E.sizeTree).reduce((O,{k:L,v:A})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:L+x-1,size:O.prevSize}],prevIndex:L+x,prevSize:A}),{ranges:[],prevIndex:0,prevSize:T}).ranges})),n);const C=In(ie(a,je(v,g),me(([x,{offsetTree:E},P])=>{const _=-x;return Wi(_,E,P)})));return we(ie(a,je(v,g),me(([x,E,P])=>{if(E.groupIndices.length>0){if(ht(E.sizeTree))return E;let T=Ma();const O=en(b);let L=0,A=0,$=0;for(;L<-x;){$=O[A];const M=O[A+1]-$-1;A++,L+=M+1}if(T=Fs(E.sizeTree).reduce((M,{k:j,v:W})=>Hn(M,Math.max(0,j+x),W),T),L!==-x){const M=Ui(E.sizeTree,$);T=Hn(T,0,M);const j=Pr(E.sizeTree,-x+1)[1];T=Hn(T,1,j)}return{...E,sizeTree:T,..._f(E.offsetTree,0,T,P)}}else{const T=Fs(E.sizeTree).reduce((O,{k:L,v:A})=>Hn(O,Math.max(0,L+x),A),Ma());return{...E,sizeTree:T,..._f(E.offsetTree,0,T,P)}}})),v),{data:f,totalCount:r,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:s,shiftWith:a,shiftWithOffset:C,beforeUnshiftWith:S,firstItemIndex:i,gap:g,sizes:v,listRefresh:y,statefulTotalCount:o,trackItemSizes:w,itemSize:p}},Pt(Ro,Tf),{singleton:!0}),G$=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function b0(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!G$)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Gi=it(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:a,smoothScrollTargetReached:i,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p},{log:f}])=>{const g=Ge(),m=Ge(),v=fe(0);let b=null,w=null,y=null;function S(){b&&(b(),b=null),y&&(y(),y=null),w&&(clearTimeout(w),w=null),Ve(o,!1)}return we(ie(g,je(e,s,t,v,l,u,f),je(r,d,p),me(([[C,x,E,P,_,T,O,L],A,$,B])=>{const M=b0(C),{align:j,behavior:W,offset:D}=M,z=P-1,I=m0(M,x,z);let H=Wi(I,x.offsetTree,A)+T;j==="end"?(H+=$+Pr(x.sizeTree,I)[1]-E+B,I===z&&(H+=O)):j==="center"?H+=($+Pr(x.sizeTree,I)[1]-E+B)/2:H-=_,D&&(H+=D);const V=G=>{S(),G?(L("retrying to scroll to",{location:C},Vn.DEBUG),Ve(g,C)):(Ve(m,!0),L("list did not change, scroll successful",{},Vn.DEBUG))};if(S(),W==="smooth"){let G=!1;y=at(n,Y=>{G=G||Y}),b=Wr(i,()=>{V(G)})}else b=Wr(ie(n,q$(150)),V);return w=setTimeout(()=>{S()},1200),Ve(o,!0),L("scrolling from index to",{index:I,top:H,behavior:W},Vn.DEBUG),{top:H,behavior:W}})),a),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Pt(Kr,pn,Ro),{singleton:!0});function q$(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const qi="up",Ki="down",K$="none",Z$={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Y$=0,Zi=it(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=fe(!1),i=fe(!0),l=Ge(),u=Ge(),d=fe(4),p=fe(Y$),f=dn(ie(n0(ie(Ae(t),La(1),Gr(!0)),ie(Ae(t),La(1),Gr(!1),t0(100))),Tt()),!1),g=dn(ie(n0(ie(s,Gr(!0)),ie(s,Gr(!1),t0(200))),Tt()),!1);we(ie(zt(Ae(t),Ae(p)),me(([y,S])=>y<=S),Tt()),i),we(ie(i,Qo(50)),u);const m=In(ie(zt(e,Ae(n),Ae(r),Ae(o),Ae(d)),qr((y,[{scrollTop:S,scrollHeight:C},x,E,P,_])=>{const T=S+x-C>-_,O={viewportHeight:x,scrollTop:S,scrollHeight:C};if(T){let A,$;return S>y.state.scrollTop?(A="SCROLLED_DOWN",$=y.state.scrollTop-S):(A="SIZE_DECREASED",$=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:A,scrollTopDelta:$}}let L;return O.scrollHeight>y.state.scrollHeight?L="SIZE_INCREASED":x<y.state.viewportHeight?L="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?L="SCROLLING_UPWARDS":L="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:L,state:O}},Z$),Tt((y,S)=>y&&y.atBottom===S.atBottom))),v=dn(ie(e,qr((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(a0(y.scrollHeight,C))return{scrollTop:S,scrollHeight:C,jump:0,changed:!1};{const E=C-(S+x)<1;return y.scrollTop!==S&&E?{scrollHeight:C,scrollTop:S,jump:y.scrollTop-S,changed:!0}:{scrollHeight:C,scrollTop:S,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),_e(y=>y.changed),me(y=>y.jump)),0);we(ie(m,me(y=>y.atBottom)),a),we(ie(a,Qo(50)),l);const b=fe(Ki);we(ie(e,me(({scrollTop:y})=>y),Tt(),qr((y,S)=>en(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?qi:Ki,prevScrollTop:S},{direction:Ki,prevScrollTop:0}),me(y=>y.direction)),b),we(ie(e,Qo(50),Gr(K$)),b);const w=fe(0);return we(ie(f,_e(y=>!y),Gr(0)),w),we(ie(t,Qo(100),je(f),_e(([y,S])=>!!S),qr(([y,S],[C])=>[S,C],[0,0]),me(([y,S])=>S-y)),w),{isScrolling:f,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:w,lastJumpDueToItemResize:v}},Pt(pn)),ts=it(([{log:e}])=>{const t=fe(!1),n=In(ie(t,_e(r=>r),Tt()));return at(t,r=>{r&&en(e)("props updated",{},Vn.DEBUG)}),{propsReady:t,didMount:n}},Pt(Ro),{singleton:!0});function Af(e,t){e==0?t():requestAnimationFrame(()=>Af(e-1,t))}function Lf(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yi=it(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:s},{didMount:a}])=>{const i=fe(!0),l=fe(0),u=fe(!0);return we(ie(a,je(l),_e(([d,p])=>!!p),Gr(!1)),i),we(ie(a,je(l),_e(([d,p])=>!!p),Gr(!1)),u),at(ie(zt(t,a),je(i,e,n,u),_e(([[,d],p,{sizeTree:f},g,m])=>d&&(!ht(f)||yf(g))&&!p&&!m),je(l)),([,d])=>{Wr(s,()=>{Ve(u,!0)}),Af(4,()=>{Wr(r,()=>{Ve(i,!0)}),Ve(o,d)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Pt(Kr,pn,Gi,ts),{singleton:!0});function y0(e){return e?e==="smooth"?"smooth":"auto":!1}const X$=(e,t)=>typeof e=="function"?y0(e(t)):t&&y0(e),J$=it(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:a,didMount:i},{log:l},{scrollingInProgress:u}])=>{const d=fe(!1),p=Ge();let f=null;function g(v){Ve(o,{index:"LAST",align:"end",behavior:v})}at(ie(zt(ie(Ae(e),La(1)),i),je(Ae(d),n,s,u),me(([[v,b],w,y,S,C])=>{let x=b&&S,E="auto";return x&&(E=X$(w,y||C),x=x&&!!E),{totalCount:v,shouldFollow:x,followOutputBehavior:E}}),_e(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{f&&(f(),f=null),f=Wr(t,()=>{en(l)("following output to ",{totalCount:v},Vn.DEBUG),g(b),f=null})});function m(v){const b=Wr(r,w=>{v&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(en(l)("scrolling to bottom due to increased size",{},Vn.DEBUG),g("auto"))});setTimeout(b,100)}return at(ie(zt(Ae(d),e,a),_e(([v,,b])=>v&&b),qr(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),_e(({refreshed:v})=>v),je(d,e)),([,v])=>{en(s)&&m(v!==!1)}),at(p,()=>{m(en(d)!==!1)}),at(zt(Ae(d),r),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:p}},Pt(Kr,Zi,Gi,Yi,ts,Ro,pn));function Q$(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const w0=it(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Ge(),a=Ge(),i=In(ie(s,me(Q$)));return we(ie(i,me(l=>l.totalCount)),e),we(ie(i,me(l=>l.groupIndices)),t),we(ie(zt(r,n,o),_e(([l,u])=>Jc(u)),me(([l,u,d])=>Pr(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Tt(),me(l=>[l])),a),{groupCounts:s,topItemsIndexes:a}},Pt(Kr,pn));function Xi(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function S0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Qc="top",Rc="bottom",C0="none";function x0(e,t,n){return typeof e=="number"?n===qi&&t===Qc||n===Ki&&t===Rc?e:0:n===qi?t===Qc?e.main:e.reverse:t===Rc?e.main:e.reverse}function E0(e,t){return typeof e=="number"?e:e[t]||0}const Mf=it(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Ge(),a=fe(0),i=fe(0),l=fe(0),u=dn(ie(zt(Ae(e),Ae(t),Ae(r),Ae(s,Xi),Ae(l),Ae(a),Ae(o),Ae(n),Ae(i)),me(([d,p,f,[g,m],v,b,w,y,S])=>{const C=d-y,x=b+w,E=Math.max(f-C,0);let P=C0;const _=E0(S,Qc),T=E0(S,Rc);return g-=y,g+=f+w,m+=f+w,m-=y,g>d+x-_&&(P=qi),m<d-E+p+T&&(P=Ki),P!==C0?[Math.max(C-f-x0(v,Qc,P)-_,0),C-E-w+p+x0(v,Rc,P)+T]:null}),_e(d=>d!=null),Tt(Xi)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Pt(pn),{singleton:!0});function R$(e,t,n){if(Jc(t)){const r=v0(e,t);return[{index:Pr(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Nf={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function P0(e,t,n){if(e.length===0)return[];if(!Jc(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],a=Yc(t.groupOffsetTree,r,o);let i,l=0;for(const u of e){(!i||i.end<u.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let d;u.index===i.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},s.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return s}function eu(e,t,n,r,o,s){const{lastSize:a,lastOffset:i,lastIndex:l}=o;let u=0,d=0;if(e.length>0){u=e[0].offset;const v=e[e.length-1];d=v.offset+v.size}const p=n-l,f=i+p*a+(p-1)*r,g=u,m=f-d;return{items:P0(e,o,s),topItems:P0(t,o,s),topListHeight:t.reduce((v,b)=>b.size+v,0),offsetTop:u,offsetBottom:m,top:g,bottom:d,totalCount:n,firstItemIndex:s}}function T0(e,t,n,r,o,s){let a=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-a>=e)break;a++}const i=e+a,l=Lf(t,i),u=Array.from({length:i}).map((d,p)=>({index:p+l,size:0,offset:0,data:s[p+l]}));return eu(u,[],i,o,n,r)}const Bs=it(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:a,listBoundary:i,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:p},f,{didMount:g},{recalcInProgress:m}])=>{const v=fe([]),b=fe(0),w=Ge();we(s.topItemsIndexes,v);const y=dn(ie(zt(g,m,Ae(a,Xi),Ae(t),Ae(e),Ae(d),u,Ae(v),Ae(r),Ae(o),n),_e(([E,P,,_,,,,,,,T])=>{const O=T&&T.length!==_;return E&&!P&&!O}),me(([,,[E,P],_,T,O,L,A,$,B,M])=>{const j=T,{sizeTree:W,offsetTree:D}=j,z=en(b);if(_===0)return{...Nf,totalCount:_};if(E===0&&P===0)return z===0?{...Nf,totalCount:_}:T0(z,O,T,$,B,M||[]);if(ht(W))return z>0?null:eu(R$(Lf(O,_),j,M),[],_,B,j,$);const I=[];if(A.length>0){const J=A[0],Q=A[A.length-1];let R=0;for(const q of Yc(W,J,Q)){const ee=q.value,le=Math.max(q.start,J),ge=Math.min(q.end,Q);for(let Pe=le;Pe<=ge;Pe++)I.push({index:Pe,size:ee,offset:R,data:M&&M[Pe]}),R+=ee}}if(!L)return eu([],I,_,B,j,$);const H=A.length>0?A[A.length-1]+1:0,V=F$(D,E,P,H);if(V.length===0)return null;const G=_-1,Y=qc([],J=>{for(const Q of V){const R=Q.value;let q=R.offset,ee=Q.start;const le=R.size;if(R.offset<E){ee+=Math.floor((E-R.offset+B)/(le+B));const Pe=ee-Q.start;q+=Pe*le+Pe*B}ee<H&&(q+=(H-ee)*le,ee=H);const ge=Math.min(Q.end,G);for(let Pe=ee;Pe<=ge&&!(q>=P);Pe++)J.push({index:Pe,size:le,offset:q,data:M&&M[Pe]}),q+=le+B}});return eu(Y,I,_,B,j,$)}),_e(E=>E!==null),Tt()),Nf);we(ie(n,_e(yf),me(E=>E==null?void 0:E.length)),t),we(ie(y,me(E=>E.topListHeight)),p),we(p,l),we(ie(y,me(E=>[E.top,E.bottom])),i),we(ie(y,me(E=>E.items)),w);const S=In(ie(y,_e(({items:E})=>E.length>0),je(t,n),_e(([{items:E},P])=>E[E.length-1].originalIndex===P-1),me(([,E,P])=>[E-1,P]),Tt(Xi),me(([E])=>E))),C=In(ie(y,Qo(200),_e(({items:E,topItems:P})=>E.length>0&&E[0].originalIndex===P.length),me(({items:E})=>E[0].index),Tt())),x=In(ie(y,_e(({items:E})=>E.length>0),me(({items:E})=>{let P=0,_=E.length-1;for(;E[P].type==="group"&&P<_;)P++;for(;E[_].type==="group"&&_>P;)_--;return{startIndex:E[P].index,endIndex:E[_].index}}),Tt(S0)));return{listState:y,topItemsIndexes:v,endReached:S,startReached:C,rangeChanged:x,itemsRendered:w,initialItemCount:b,...f}},Pt(Kr,w0,Mf,Yi,Gi,Zi,ts,Tf),{singleton:!0}),ek=it(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:a},{didMount:i}])=>(we(ie(i,je(s),_e(([,l])=>l!==0),je(o,e,t,r,n),me(([[,l],u,d,p,f,g=[]])=>T0(l,u,d,p,f,g))),a),{}),Pt(Kr,Yi,Bs,ts),{singleton:!0}),O0=it(([{scrollVelocity:e}])=>{const t=fe(!1),n=Ge(),r=fe(!1);return we(ie(e,je(r,t,n),_e(([o,s])=>!!s),me(([o,s,a,i])=>{const{exit:l,enter:u}=s;if(a){if(l(o,i))return!1}else if(u(o,i))return!0;return a}),Tt()),t),at(ie(zt(t,e,n),je(r)),([[o,s,a],i])=>o&&i&&i.change&&i.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Pt(Zi),{singleton:!0}),tk=it(([{topItemsIndexes:e}])=>{const t=fe(0);return we(ie(t,_e(n=>n>0),me(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Pt(Bs)),_0=it(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Ge(),a=dn(ie(zt(e,r,t,n,o),me(([i,l,u,d,p])=>i+l+u+d+p.offsetBottom+p.bottom)),0);return we(Ae(a),s),{totalListHeight:a,totalListHeightChanged:s}},Pt(pn,Bs),{singleton:!0});function A0(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const nk=A0(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),rk=it(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:a,lastJumpDueToItemResize:i},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:p,gap:f},{log:g},{recalcInProgress:m}])=>{const v=In(ie(l,je(i),qr(([,w,y,S],[{items:C,totalCount:x,bottom:E,offsetBottom:P},_])=>{const T=E+P;let O=0;return y===x&&w.length>0&&C.length>0&&(C[0].originalIndex===0&&w[0].originalIndex===0||(O=T-S,O!==0&&(O+=_))),[O,C,x,T]},[0,[],0,0]),_e(([w])=>w!==0),je(t,a,r,s,g,m),_e(([,w,y,S,,,C])=>!C&&!S&&w!==0&&y===qi),me(([[w],,,,,y])=>(y("Upward scrolling compensation",{amount:w},Vn.DEBUG),w))));function b(w){w>0?(Ve(e,{top:-w,behavior:"auto"}),Ve(n,0)):(Ve(n,0),Ve(e,{top:-w,behavior:"auto"}))}return at(ie(v,je(n,o)),([w,y,S])=>{S&&nk()?Ve(n,y-w):b(-w)}),at(ie(zt(dn(o,!1),n,m),_e(([w,y,S])=>!w&&!S&&y!==0),me(([w,y])=>y),Qo(1)),b),we(ie(d,me(w=>({top:-w}))),e),at(ie(u,je(p,f),me(([w,{lastSize:y,groupIndices:S,sizeTree:C},x])=>{function E(P){return P*(y+x)}if(S.length===0)return E(w);{let P=0;const _=Ui(C,0);let T=0,O=0;for(;T<w;){T++,P+=_;let L=S.length===O+1?1/0:S[O+1]-S[O]-1;T+L>w&&(P-=_,L=w-T+1),T+=L,P+=E(L),O++}return P}})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(e,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Pt(pn,Zi,Bs,Kr,Ro,Tf)),ok=it(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=fe(0);return at(ie(e,je(r),_e(([,o])=>o!==0),me(([,o])=>({top:o}))),o=>{Wr(ie(n,La(1),_e(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,o)})})}),{initialScrollTop:r}},Pt(ts,pn,Bs),{singleton:!0}),sk=it(([{viewportHeight:e},{totalListHeight:t}])=>{const n=fe(!1),r=dn(ie(zt(n,e,t),_e(([o])=>o),me(([,o,s])=>Math.max(0,o-s)),Qo(0),Tt()),0);return{alignToBottom:n,paddingTopAddition:r}},Pt(pn,_0),{singleton:!0}),$f=it(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ge(),r=Ge(),o=Ge(),s=fe(!1),a=fe(void 0);return we(ie(zt(n,r),me(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),we(ie(e,je(r),me(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Pt(pn)),ak=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...a}})=>e<n?{...a,behavior:o,align:s??"start"}:t>r?{...a,behavior:o,align:s??"end"}:null,ik=it(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:a,fixedFooterHeight:i,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=Ge();return we(ie(d,je(e,o,t,s,a,i,r),je(n),me(([[p,f,g,m,v,b,w,y],S])=>{const{done:C,behavior:x,align:E,calculateViewLocation:P=ak,..._}=p,T=m0(p,f,m-1),O=Wi(T,f.offsetTree,S)+v+b,L=O+Pr(f.sizeTree,T)[1],A=y+b,$=y+g-w,B=P({itemTop:O,itemBottom:L,viewportTop:A,viewportBottom:$,locationParams:{behavior:x,align:E,..._}});return B?C&&Wr(ie(l,_e(M=>M===!1),La(en(l)?1:2)),C):C&&C(),B}),_e(p=>p!==null)),u),{scrollIntoView:d}},Pt(Kr,pn,Gi,Bs,Ro),{singleton:!0}),lk=it(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Ge(),d=fe(void 0),p=fe(null),f=fe(null);return we(i,p),we(l,f),at(ie(u,je(e,n,a,p,f,r)),([g,m,v,b,w,y,S])=>{const C=U$(m.sizeTree);b&&w!==null&&y!==null&&(v=w.scrollTop-y.offsetTop),v-=S,g({ranges:C,scrollTop:v})}),we(ie(d,_e(yf),me(ck)),o),we(ie(s,je(d),_e(([,g])=>g!==void 0),Tt(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Pt(Kr,pn,Yi,ts,$f));function ck(e){return{offset:e.scrollTop,index:0,align:"start"}}const uk=it(([e,t,n,r,o,s,a,i,l,u])=>({...e,...t,...n,...r,...o,...s,...a,...i,...l,...u}),Pt(Mf,ek,ts,O0,_0,ok,sk,$f,ik,Ro)),dk=it(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:a,firstItemIndex:i,groupIndices:l,statefulTotalCount:u,gap:d,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,w,{listState:y,topItemsIndexes:S,...C},{scrollToIndex:x},E,{topItemCount:P},{groupCounts:_},T])=>(we(C.rangeChanged,T.scrollSeekRangeChanged),we(ie(T.windowViewportRect,me(O=>O.visibleHeight)),v.viewportHeight),{totalCount:e,data:a,firstItemIndex:i,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:S,topItemCount:P,groupCounts:_,fixedItemHeight:n,defaultItemHeight:r,gap:d,...w,statefulTotalCount:u,listState:y,scrollToIndex:x,trackItemSizes:o,itemSize:s,groupIndices:l,...C,...T,...v,sizes:p,...b}),Pt(Kr,Yi,pn,lk,J$,Bs,Gi,rk,tk,w0,uk)),kf="-webkit-sticky",L0="sticky",M0=A0(()=>{if(typeof document>"u")return L0;const e=document.createElement("div");return e.style.position=kf,e.style.position===kf?kf:L0});function N0(e,t,n){const r=h.useRef(null),o=h.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let p,f;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;p=g.height-Math.max(0,m),f=m+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),f=u.top+window.pageYOffset;r.current={offsetTop:f,visibleHeight:p,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=Sf(o,!0,n),i=h.useCallback(()=>{o(a.current)},[o,a]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),s}const $0=h.createContext(void 0),k0=h.createContext(void 0);function I0(e){return e}const pk=it(([e,t])=>({...e,...t}),Pt(dk,it(()=>{const e=fe(l=>`Item ${l}`),t=fe(null),n=fe(l=>`Group ${l}`),r=fe({}),o=fe(I0),s=fe("div"),a=fe(Aa),i=(l,u=null)=>dn(ie(r,me(d=>d[l]),Tt()),u);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,HeaderFooterTag:s,scrollerRef:a,FooterComponent:i("Footer"),HeaderComponent:i("Header"),TopItemListComponent:i("TopItemList"),ListComponent:i("List","div"),ItemComponent:i("Item","div"),GroupComponent:i("Group","div"),ScrollerComponent:i("Scroller","div"),EmptyPlaceholder:i("EmptyPlaceholder"),ScrollSeekPlaceholder:i("ScrollSeekPlaceholder")}}))),fk=({height:e})=>c.jsx("div",{style:{height:e}}),hk={position:M0(),zIndex:1,overflowAnchor:"none"},V0={overflowAnchor:"none"},gk={...V0,display:"inline-block",height:"100%"},H0=h.memo(function({showTopList:t=!1}){const n=Me("listState"),r=tr("sizeRanges"),o=Me("useWindowScroll"),s=Me("customScrollParent"),a=tr("windowScrollContainerState"),i=tr("scrollContainerState"),l=s||o?a:i,u=Me("itemContent"),d=Me("context"),p=Me("groupContent"),f=Me("trackItemSizes"),g=Me("itemSize"),m=Me("log"),v=tr("gap"),b=Me("horizontalDirection"),{callbackRef:w}=M$(r,g,f,t?Aa:l,m,v,s,b,Me("skipAnimationFrameInResizeObserver")),[y,S]=h.useState(0);If("deviation",M=>{y!==M&&S(M)});const C=Me("EmptyPlaceholder"),x=Me("ScrollSeekPlaceholder")||fk,E=Me("ListComponent"),P=Me("ItemComponent"),_=Me("GroupComponent"),T=Me("computeItemKey"),O=Me("isSeeking"),L=Me("groupIndices").length>0,A=Me("alignToBottom"),$=Me("initialItemFinalLocationReached"),B=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:A?"auto":0}:{marginTop:y!==0?y:A?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...$?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&C?c.jsx(C,{...fn(C,d)}):c.jsx(E,{...fn(E,d),ref:w,style:B,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(M=>{const j=M.originalIndex,W=T(j+n.firstItemIndex,M.data,d);return O?h.createElement(x,{...fn(x,d),key:W,index:M.index,height:M.size,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?h.createElement(_,{...fn(_,d),key:W,"data-index":j,"data-known-size":M.size,"data-item-index":M.index,style:hk},p(M.index,d)):h.createElement(P,{...fn(P,d),...yk(P,M.data),key:W,"data-index":j,"data-known-size":M.size,"data-item-index":M.index,"data-item-group-index":M.groupIndex,style:b?gk:V0},L?u(M.index,M.groupIndex,M.data,d):u(M.index,M.data,d))})})}),mk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},vk={outline:"none",overflowX:"auto",position:"relative"},tu=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),bk={width:"100%",position:M0(),top:0,zIndex:1};function fn(e,t){if(typeof e!="string")return{context:t}}function yk(e,t){return{item:typeof e=="string"?void 0:t}}const wk=h.memo(function(){const t=Me("HeaderComponent"),n=tr("headerHeight"),r=Me("HeaderFooterTag"),o=Ds(h.useMemo(()=>a=>n(es(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Sk=h.memo(function(){const t=Me("FooterComponent"),n=tr("footerHeight"),r=Me("HeaderFooterTag"),o=Ds(h.useMemo(()=>a=>n(es(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null});function j0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("scrollerRef"),f=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:v,scrollToCallback:b}=i0(l,d,u,p,void 0,g);t("scrollTo",b),t("scrollBy",v);const w=g?vk:mk;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...fn(u,f),children:a})})}function D0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("totalListHeight"),f=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:v,scrollByCallback:b,scrollToCallback:w}=i0(l,d,u,Aa,g);return o0(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",w),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...s,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...i,...fn(u,m),children:a})})}const Ck=({children:e})=>{const t=h.useContext($0),n=tr("viewportHeight"),r=tr("fixedItemHeight"),o=Me("alignToBottom"),s=Me("horizontalDirection"),a=h.useMemo(()=>Xb(n,l=>es(l,s?"width":"height")),[n,s]),i=Ds(a,!0,Me("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{style:tu(o),ref:i,"data-viewport-type":"element",children:e})},xk=({children:e})=>{const t=h.useContext($0),n=tr("windowViewportRect"),r=tr("fixedItemHeight"),o=Me("customScrollParent"),s=N0(n,o,Me("skipAnimationFrameInResizeObserver")),a=Me("alignToBottom");return h.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),c.jsx("div",{ref:s,style:tu(a),"data-viewport-type":"window",children:e})},Ek=({children:e})=>{const t=Me("TopItemListComponent")||"div",n=Me("headerHeight"),r={...bk,marginTop:`${n}px`},o=Me("context");return c.jsx(t,{style:r,...fn(t,o),children:e})},Pk=h.memo(function(t){const n=Me("useWindowScroll"),r=Me("topItemsIndexes").length>0,o=Me("customScrollParent"),s=o||n?_k:Ok,a=o||n?xk:Ck;return c.jsxs(s,{...t,children:[r&&c.jsx(Ek,{children:c.jsx(H0,{showTopList:!0})}),c.jsxs(a,{children:[c.jsx(wk,{}),c.jsx(H0,{}),c.jsx(Sk,{})]})]})}),{Component:Tk,usePublisher:tr,useEmitterValue:Me,useEmitter:If}=r0(pk,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Pk),Ok=j0({usePublisher:tr,useEmitterValue:Me,useEmitter:If}),_k=D0({usePublisher:tr,useEmitterValue:Me,useEmitter:If}),Ak=Tk,F0={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Lk={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:B0,ceil:z0,floor:nu,min:Vf,max:Ji}=Math;function Mk(e){return{...Lk,items:e}}function U0(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Nk(e,t){return e&&e.column===t.column&&e.row===t.row}function ru(e,t){return e&&e.width===t.width&&e.height===t.height}const $k=it(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:p},f,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=fe(0),P=fe(0),_=fe(F0),T=fe({height:0,width:0}),O=fe({height:0,width:0}),L=Ge(),A=Ge(),$=fe(0),B=fe(null),M=fe({row:0,column:0}),j=Ge(),W=Ge(),D=fe(!1),z=fe(0),I=fe(!0),H=fe(!1),V=fe(!1);at(ie(v,je(z),_e(([q,ee])=>!!ee)),()=>{Ve(I,!1)}),at(ie(zt(v,I,O,T,z,H),_e(([q,ee,le,ge,,Pe])=>q&&!ee&&le.height!==0&&ge.height!==0&&!Pe)),([,,,,q])=>{Ve(H,!0),Af(1,()=>{Ve(L,q)}),Wr(ie(o),()=>{Ve(n,[0,0]),Ve(I,!0)})}),we(ie(W,_e(q=>q!=null&&q.scrollTop>0),Gr(0)),P),at(ie(v,je(W),_e(([,q])=>q!=null)),([,q])=>{q&&(Ve(T,q.viewport),Ve(O,q==null?void 0:q.item),Ve(M,q.gap),q.scrollTop>0&&(Ve(D,!0),Wr(ie(o,La(1)),ee=>{Ve(D,!1)}),Ve(i,{top:q.scrollTop})))}),we(ie(T,me(({height:q})=>q)),s),we(ie(zt(Ae(T,ru),Ae(O,ru),Ae(M,(q,ee)=>q&&q.column===ee.column&&q.row===ee.row),Ae(o)),me(([q,ee,le,ge])=>({viewport:q,item:ee,gap:le,scrollTop:ge}))),j),we(ie(zt(Ae(E),t,Ae(M,Nk),Ae(O,ru),Ae(T,ru),Ae(B),Ae(P),Ae(D),Ae(I),Ae(z)),_e(([,,,,,,,q])=>!q),me(([q,[ee,le],ge,Pe,Ce,tt,Qe,,Ot,ut])=>{const{row:Se,column:ot}=ge,{height:st,width:wt}=Pe,{width:Ne}=Ce;if(Qe===0&&(q===0||Ne===0))return F0;if(wt===0){const Gt=Lf(ut,q),xo=Math.max(Gt+Qe-1,0);return Mk(U0(Gt,xo,tt))}const mt=G0(Ne,wt,ot);let dt,Ue;Ot?ee===0&&le===0&&Qe>0?(dt=0,Ue=Qe-1):(dt=mt*nu((ee+Se)/(st+Se)),Ue=mt*z0((le+Se)/(st+Se))-1,Ue=Vf(q-1,Ji(Ue,mt-1)),dt=Vf(Ue,Ji(0,dt))):(dt=0,Ue=-1);const tn=U0(dt,Ue,tt),{top:he,bottom:De}=W0(Ce,ge,Pe,tn),Fe=z0(q/mt),Mt=Fe*st+(Fe-1)*Se-De;return{items:tn,offsetTop:he,offsetBottom:Mt,top:he,bottom:De,itemHeight:st,itemWidth:wt}})),_),we(ie(B,_e(q=>q!==null),me(q=>q.length)),E),we(ie(zt(T,O,_,M),_e(([q,ee,{items:le}])=>le.length>0&&ee.height!==0&&q.height!==0),me(([q,ee,{items:le},ge])=>{const{top:Pe,bottom:Ce}=W0(q,ge,ee,le);return[Pe,Ce]}),Tt(Xi)),n);const G=fe(!1);we(ie(o,je(G),me(([q,ee])=>ee||q!==0)),G);const Y=In(ie(Ae(_),_e(({items:q})=>q.length>0),je(E,G),_e(([{items:q},ee,le])=>le&&q[q.length-1].index===ee-1),me(([,q])=>q-1),Tt())),J=In(ie(Ae(_),_e(({items:q})=>q.length>0&&q[0].index===0),Gr(0),Tt())),Q=In(ie(Ae(_),je(D),_e(([{items:q},ee])=>q.length>0&&!ee),me(([{items:q}])=>({startIndex:q[0].index,endIndex:q[q.length-1].index})),Tt(S0),Qo(0)));we(Q,g.scrollSeekRangeChanged),we(ie(L,je(T,O,E,M),me(([q,ee,le,ge,Pe])=>{const Ce=b0(q),{align:tt,behavior:Qe,offset:Ot}=Ce;let ut=Ce.index;ut==="LAST"&&(ut=ge-1),ut=Ji(0,ut,Vf(ge-1,ut));let Se=Hf(ee,Pe,le,ut);return tt==="end"?Se=B0(Se-ee.height+le.height):tt==="center"&&(Se=B0(Se-ee.height/2+le.height/2)),Ot&&(Se+=Ot),{top:Se,behavior:Qe}})),i);const R=dn(ie(_,me(q=>q.offsetBottom+q.bottom)),0);return we(ie(b,me(q=>({width:q.visibleWidth,height:q.visibleHeight}))),T),{data:B,totalCount:E,viewportDimensions:T,itemDimensions:O,scrollTop:o,scrollHeight:A,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:L,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:$,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:P,gap:M,restoreStateFrom:W,...g,initialTopMostItemIndex:z,horizontalDirection:V,gridState:_,totalListHeight:R,...f,startReached:J,endReached:Y,rangeChanged:Q,stateChanged:j,propsReady:m,stateRestoreInProgress:D,...x}},Pt(Mf,pn,Zi,O0,ts,$f,Ro));function W0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Hf(e,t,n,r[0].index),a=Hf(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function Hf(e,t,n,r){const o=G0(e.width,n.width,t.column),s=nu(r/o),a=s*n.height+Ji(0,s-1)*t.row;return a>0?a+t.row:a}function G0(e,t,n){return Ji(1,nu((e+n)/(nu(t)+n)))}const kk=it(([e,t])=>({...e,...t}),Pt($k,it(()=>{const e=fe(p=>`Item ${p}`),t=fe({}),n=fe(null),r=fe("virtuoso-grid-item"),o=fe("virtuoso-grid-list"),s=fe(I0),a=fe("div"),i=fe(Aa),l=(p,f=null)=>dn(ie(t,me(g=>g[p]),Tt()),f),u=fe(!1),d=fe(!1);return we(Ae(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:a,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}))),Ik=h.memo(function(){const t=At("gridState"),n=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),s=At("computeItemKey"),a=At("isSeeking"),i=nr("scrollHeight"),l=At("ItemComponent"),u=At("ListComponent"),d=At("ScrollSeekPlaceholder"),p=At("context"),f=nr("itemDimensions"),g=nr("gap"),m=At("log"),v=At("stateRestoreInProgress"),b=nr("reportReadyState"),w=Ds(h.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();f({width:x,height:E})}g({row:K0("row-gap",getComputedStyle(y).rowGap,m),column:K0("column-gap",getComputedStyle(y).columnGap,m)})},[i,f,g,m]),!0,!1);return o0(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:w,className:n,...fn(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,p);return a?c.jsx(d,{...fn(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},S):h.createElement(l,{...fn(l,p),className:r,"data-index":y.index,key:S},o(y.index,y.data,p))})})}),Vk=h.memo(function(){const t=At("HeaderComponent"),n=nr("headerHeight"),r=At("headerFooterTag"),o=Ds(h.useMemo(()=>a=>n(es(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Hk=h.memo(function(){const t=At("FooterComponent"),n=nr("footerHeight"),r=At("headerFooterTag"),o=Ds(h.useMemo(()=>a=>n(es(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),jk=({children:e})=>{const t=h.useContext(k0),n=nr("itemDimensions"),r=nr("viewportDimensions"),o=Ds(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return h.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),c.jsx("div",{style:tu(!1),ref:o,children:e})},Dk=({children:e})=>{const t=h.useContext(k0),n=nr("windowViewportRect"),r=nr("itemDimensions"),o=At("customScrollParent"),s=N0(n,o,!1);return h.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),c.jsx("div",{ref:s,style:tu(!1),children:e})},Fk=h.memo(function({...t}){const n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?Uk:zk,s=r||n?Dk:jk;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(Vk,{}),c.jsx(Ik,{}),c.jsx(Hk,{})]})})}),{Component:Bk,usePublisher:nr,useEmitterValue:At,useEmitter:q0}=r0(kk,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Fk),zk=j0({usePublisher:nr,useEmitterValue:At,useEmitter:q0}),Uk=D0({usePublisher:nr,useEmitterValue:At,useEmitter:q0});function K0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}const ou=Bk,jf=e=>{const t="gs-utl-grid-cols-4",n=parseInt(`${e||4}`,10);return n===1?"gs-utl-grid-cols-1":n===2?"gs-utl-grid-cols-2":n===3?"gs-utl-grid-cols-3":n===4?t:n===5?"gs-utl-grid-cols-5":n===6?"gs-utl-grid-cols-6":n===7?"gs-utl-grid-cols-7":n===8?"gs-utl-grid-cols-8":n===9?"gs-utl-grid-cols-9":n===10?"gs-utl-grid-cols-10":n===11?"gs-utl-grid-cols-11":n===12?"gs-utl-grid-cols-12":t},Wk=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function Gk(e){const t=e.map(({id:a,src:i})=>({id:a,src:i})),n=e.reduce((a,i)=>(a[i.id]=i,a),{}),r=[],o=[];return(await oC(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const qk=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{Wk(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await Gk(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},Kk=(e,t,n,r={})=>{const{skipReplace:o}=r;e.loadData(t);const s=e.getCss()||"",a=o?s:s.replace(/:root\s*{/gi,"[data-body]{");let i=`${e.getHtml()}<style>${a}</style>`;if(n===xt.email)try{i=e.runCommand(Nc).html}catch(l){console.error(l)}return r.removeScripts&&(i=i.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),o?i:i.replace("<body","<div data-body").replace("</body>","</div>")},Zk=async(e,t,n)=>{const r=$S(t,{appStore:n}),o=await qk(r);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...o.plugins,s=>{s.Storage.setCurrent("")}],pluginsOpts:o.pluginOptions,protectedCss:`
303
+ `}),c.jsx(Rn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:d$(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(Kc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),Rv="gs-canvas-content",f$=g.memo(ce(function({children:t}){const{isReady:n}=Ce(),r=N(`${Rv}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,U.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Rv,children:[c.jsx("div",{className:r}),!n&&c.jsx(ko,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&Lt(t)]}),c.jsx(u$,{}),c.jsx(p$,{})]})})),g$="gs-canvas",e0=g.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(XN,{style:n,className:N(g$,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Ui,{children:c.jsx(f$,{children:o})})})}),xf=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),h$=xf?Promise.resolve().then(function(){return S$}):Promise.resolve().then(function(){return O$});async function m$(...e){return(await h$).default(...e)}xf?Promise.resolve().then(function(){return x$}):Promise.resolve().then(function(){return A$});const b$=xf?Promise.resolve().then(function(){return P$}):Promise.resolve().then(function(){return L$});async function v$(...e){return(await b$).default(...e)}const y$=async e=>{const t=await e.getFile();return t.handle=e,t};var w$=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((o,s)=>{t[s]={description:o.description||"Files",accept:{}},o.mimeTypes?o.mimeTypes.map(a=>{t[s].accept[a]=o.extensions||[]}):t[s].accept["*/*"]=o.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),r=await Promise.all(n.map(y$));return e[0].multiple?r:r[0]},S$={__proto__:null,default:w$};function Zc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(o){return{value:o,done:r}})}return Zc=function(n){this.s=n,this.n=n.next},Zc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new Zc(e)}const t0=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!1,l=!1;try{for(var u,d=function(p){var f,h,m,b=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,m=Symbol.iterator);b--;){if(h&&(f=p[h])!=null)return f.call(p);if(m&&(f=p[m])!=null)return new Zc(f.call(p));h="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const p=u.value,f=`${n}/${p.name}`;p.kind==="file"?s.push(p.getFile().then(h=>(h.directoryHandle=e,h.handle=p,Object.defineProperty(h,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>f})))):p.kind!=="directory"||!t||r&&r(p)||o.push(t0(p,t,f,r))}}catch(p){l=!0,a=p}finally{try{i&&d.return!=null&&await d.return()}finally{if(l)throw a}}return[...(await Promise.all(o)).flat(),...await Promise.all(s)]};var C$=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:t0(t,e.recursive,void 0,e.skipDirectory)},x$={__proto__:null,default:C$},E$=async(e,t=[{}],n=null,r=!1,o=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const s=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((u,d)=>{s[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&a&&u.mimeTypes.push(a),u.mimeTypes.map(p=>{s[d].accept[p]=u.extensions||[]})):a?s[d].accept[a]=u.extensions||[]:s[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,r)throw u}const i=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:s,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&o&&o(i);const l=await i.createWritable();return"stream"in e?(await e.stream().pipeTo(l),i):"body"in e?(await e.body.pipeTo(l),i):(await l.write(await e),await l.close(),i)},P$={__proto__:null,default:E$},T$=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const o=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=o||"",r.style.display="none",document.body.append(r);const s=l=>{typeof a=="function"&&a(),t(l)},a=e[0].legacySetup&&e[0].legacySetup(s,()=>a(n),r),i=()=>{window.removeEventListener("focus",i),r.remove()};r.addEventListener("click",()=>{window.addEventListener("focus",i)}),r.addEventListener("change",()=>{window.removeEventListener("focus",i),r.remove(),s(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),O$={__proto__:null,default:T$},_$=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0;const o=a=>{typeof s=="function"&&s(),t(a)},s=e[0].legacySetup&&e[0].legacySetup(o,()=>s(n),r);r.addEventListener("change",()=>{let a=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(a=a.filter(i=>i.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):a=a.filter(i=>i.webkitRelativePath.split("/").length===2),o(a)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),A$={__proto__:null,default:_$},M$=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await async function(a,i){const l=a.getReader(),u=new ReadableStream({start:f=>async function h(){return l.read().then(({done:m,value:b})=>{if(!m)return f.enqueue(b),h();f.close()})}()}),d=new Response(u),p=await d.blob();return l.releaseLock(),new Blob([p],{type:i})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const o=()=>{typeof s=="function"&&s()},s=t.legacySetup&&t.legacySetup(o,()=>s(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),o()}),n.click(),null},L$={__proto__:null,default:M$};function Qo({children:e,label:t,s:n="m",pill:r,border:o,nopad:s,className:a,block:i,...l}){return c.jsx("div",{className:N(!i&&"gs-utl-inline-block",a,!s&&Te.xyS2,r?re.pill:re.rnd,o&&`${re.b} ${U.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var n0={NODE_ENV:"production"};const N$=n0.REACT_APP_VERSION??n0.NPM_PACKAGE_VERSION,$$=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsxs(F,{className:ie("relative"),children:[c.jsx(Kc,{className:ie("w-24 opacity-50")}),t&&c.jsx(Qo,{className:ie(U.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(F,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:ie($o.link),href:"https://grapesjs.com",children:"GrapesJS"})," ","library. Beyond pushing the evolution of the core library itself, this application aspires to empower individuals in creating and managing their web projects autonomously, free from subscriptions or dependency on the internet connection."]}),c.jsx("br",{}),c.jsxs("p",{children:["If you like the vision of this project and you're eager to play a role in its continued development, consider becoming a backer or sponsor through"," ",c.jsx("a",{className:ie($o.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(F,{className:ie(U.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",N$]})]})}),k$=ce(function(){return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsx(F,{className:Q("relative"),children:c.jsx(Kc,{className:Q("w-24 opacity-50")})})}),c.jsx(F,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:Q($o.link),href:"/dashboard/sdk/licenses",target:"_blank",children:"Studio SDK license page"}),c.jsx("br",{}),c.jsx("br",{}),"If you have any questions or need assistance with specific use cases, please fill out this"," ",c.jsx("a",{className:Q($o.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),I$=()=>[{id:Et.web,label:$r(Et.web),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.web,size:se.s}),c.jsx("span",{children:$r(Et.web)})]})},{id:Et.email,label:$r(Et.email),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.emailOutline,size:se.s}),c.jsx("span",{children:$r(Et.email)})]})}],Yc="gs-cmp-tabs";function Ro({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=_C,value:i}){const l=o==="pills",u=l?N("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",U.bgH):"",d=b=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",b?U.bg:""):N("gs-utl-border-b-2",Te.xy),p=b=>{b&&(b.tabIndex=-1)},f=b=>{const v=b.currentTarget;setTimeout(()=>v.blur(),10)},h=Ht(i)?e.findIndex(b=>b.id===i):void 0,m=!e.some(b=>!!b.content);return c.jsxs(hi.Group,{onChange:b=>a(e[b].id),defaultIndex:e.findIndex(b=>b.id===i),selectedIndex:h,children:[c.jsx(hi.List,{as:I,className:N(Yc,t,u),style:s,full:!0,nowrap:!0,children:e.map(b=>c.jsx(hi,{disabled:b.disabled,className:({selected:v})=>N(`${Yc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",b.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",si.focus,d(v),v?`${U.tAo} ${U.bA}`:U.br,r),children:b.label},b.id))}),c.jsx(hi.Panels,{className:N(`${Yc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(b=>c.jsx(hi.Panel,{tabIndex:-1,className:N(`${Yc}__panel`,"gs-utl-h-full"),ref:p,onFocus:f,children:b.content},b.id))})]})}const Xc=0,es=1,Aa=2,r0=4;function o0(e,t){return n=>e(t(n))}function V$(e,t){return t(e)}function s0(e,t){return n=>e(t,n)}function a0(e,t){return()=>e(t)}function Jc(e,t){return t(e),e}function Tt(...e){return e}function H$(e){e()}function i0(e){return()=>e}function j$(...e){return()=>{e.map(H$)}}function Ef(e){return e!==void 0}function Ma(){}function lt(e,t){return e(es,t)}function Ve(e,t){e(Xc,t)}function Pf(e){e(Aa)}function en(e){return e(r0)}function xe(e,t){return lt(e,s0(t,Xc))}function qr(e,t){const n=e(es,r=>{n(),t(r)});return n}function Ye(){const e=[];return(t,n)=>{switch(t){case Aa:e.splice(0,e.length);return;case es:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Xc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function ge(e){let t=e;const n=Ye();return(r,o)=>{switch(r){case es:o(t);break;case Xc:t=o;break;case r0:return t}return n(r,o)}}function D$(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case es:return s?n===s?void 0:(r(),n=s,t=lt(e,s),t):(r(),Ma);case Aa:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function In(e){return Jc(Ye(),t=>xe(e,t))}function dn(e,t){return Jc(ge(t),n=>xe(e,n))}function F$(...e){return t=>e.reduceRight(V$,t)}function ue(e,...t){const n=F$(...t);return(r,o)=>{switch(r){case es:return lt(e,n(o));case Aa:Pf(e);return}}}function l0(e,t){return e===t}function Ot(e=l0){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ae(e){return t=>n=>{e(n)&&t(n)}}function be(e){return t=>o0(t,e)}function Kr(e){return t=>()=>t(e)}function Zr(e,t){return n=>r=>n(t=e(t,r))}function La(e){return t=>n=>{e>0?e--:t(n)}}function ts(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function c0(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Fe(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);lt(s,l=>{const u=n;n=n|i,t[a]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>a=>{const i=()=>s([a].concat(t));n===o?i():r=i}}function u0(...e){return function(t,n){switch(t){case es:return j$(...e.map(r=>lt(r,n)));case Aa:return;default:throw new Error(`unrecognized action ${t}`)}}}function Me(e,t=l0){return ue(e,Ot(t))}function Ut(...e){const t=Ye(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);lt(s,l=>{n[a]=l,r=r|i,r===o&&Ve(t,n)})}),function(s,a){switch(s){case es:return r===o&&a(n),lt(t,a);case Aa:return Pf(t);default:throw new Error(`unrecognized action ${s}`)}}}function ct(e,t=[],{singleton:n}={singleton:!0}){return{id:B$(),constructor:e,dependencies:t,singleton:n}}const B$=()=>Symbol();function z$(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=o(s.map(l=>n(l)));return a&&t.set(r,i),i};return n(e)}function U$(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}const Qc=typeof document<"u"?g.useLayoutEffect:g.useEffect;function d0(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=g.createContext({});function l(w,y){w.propsReady&&Ve(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];Ve(C,y[S])}for(const S of o)if(S in y){const C=w[t.optional[S]];Ve(C,y[S])}w.propsReady&&Ve(w.propsReady,!0)}function u(w){return s.reduce((y,S)=>(y[S]=C=>{const E=w[t.methods[S]];Ve(E,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=D$(w[t.events[S]]),y),{})}const p=g.forwardRef((w,y)=>{const{children:S,...C}=w,[E]=g.useState(()=>Jc(z$(e),_=>l(_,C))),[x]=g.useState(a0(d,E));Qc(()=>{for(const _ of a)_ in C&&lt(x[_],C[_]);return()=>{Object.values(x).map(Pf)}},[C,x,E]),Qc(()=>{l(E,C)}),g.useImperativeHandle(y,i0(u(E)));const P=n;return c.jsx(i.Provider,{value:E,children:n?c.jsx(P,{...U$([...r,...o,...a],C),children:S}):S})}),f=w=>g.useCallback(s0(Ve,g.useContext(i)[w]),[w]),h=w=>{const S=g.useContext(i)[w],C=g.useCallback(E=>lt(S,E),[S]);return g.useSyncExternalStore(C,()=>en(S),()=>en(S))},m=w=>{const S=g.useContext(i)[w],[C,E]=g.useState(a0(en,S));return Qc(()=>lt(S,x=>{x!==C&&E(i0(x))}),[S,C]),C},b=g.version.startsWith("18")?h:m;return{Component:p,usePublisher:f,useEmitterValue:b,useEmitter:(w,y)=>{const C=g.useContext(i)[w];Qc(()=>lt(C,y),[y,C])}}}const p0=typeof document<"u"?g.useLayoutEffect:g.useEffect;var Vn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Vn||{});const W$={0:"debug",1:"log",2:"warn",3:"error"},G$=()=>typeof globalThis>"u"?window:globalThis,ns=ct(()=>{const e=ge(3);return{log:ge((n,r,o=1)=>{var s;const a=(s=G$().VIRTUOSO_LOG_LEVEL)!=null?s:en(e);o>=a&&console[W$[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Tf(e,t,n){const r=g.useRef(null);let o=s=>{};if(typeof ResizeObserver<"u"){const s=g.useMemo(()=>new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};n?i():requestAnimationFrame(i)}),[e]);o=a=>{a&&t?(s.observe(a),r.current=a):(r.current&&s.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function Fs(e,t,n){return Tf(e,t,n).callbackRef}function q$(e,t,n,r,o,s,a,i,l){const u=g.useCallback(d=>{const p=K$(d.children,t,i?"offsetWidth":"offsetHeight",o);let f=d.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const h=f.lastElementChild.dataset.viewportType==="window",m=a?i?a.scrollLeft:a.scrollTop:h?i?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:i?f.scrollLeft:f.scrollTop,b=a?i?a.scrollWidth:a.scrollHeight:h?i?document.documentElement.scrollWidth:document.documentElement.scrollHeight:i?f.scrollWidth:f.scrollHeight,v=a?i?a.offsetWidth:a.offsetHeight:h?i?window.innerWidth:window.innerHeight:i?f.offsetWidth:f.offsetHeight;r({scrollTop:Math.max(m,0),scrollHeight:b,viewportHeight:v}),s==null||s(i?f0("column-gap",getComputedStyle(d).columnGap,o):f0("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,a,r]);return Tf(u,n,l)}function K$(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let a=0;a<o;a++){const i=e.item(a);if(!i||i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),u=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},Vn.ERROR),d===u)continue;const p=s[s.length-1];s.length===0||p.size!==d||p.endIndex!==l-1?s.push({startIndex:l,endIndex:l,size:d}):s[s.length-1].endIndex++}return s}function f0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}function rs(e,t){return Math.round(e.getBoundingClientRect()[t])}function g0(e,t){return Math.abs(e-t)<1.01}function h0(e,t,n,r=Ma,o,s){const a=g.useRef(null),i=g.useRef(null),l=g.useRef(null),u=g.useCallback(f=>{const h=f.target,m=h===window||h===document,b=s?m?window.pageXOffset||document.documentElement.scrollLeft:h.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,v=s?m?document.documentElement.scrollWidth:h.scrollWidth:m?document.documentElement.scrollHeight:h.scrollHeight,w=s?m?window.innerWidth:h.offsetWidth:m?window.innerHeight:h.offsetHeight,y=()=>{e({scrollTop:Math.max(b,0),scrollHeight:v,viewportHeight:w})};f.suppressFlushSync?y():On.flushSync(y),i.current!==null&&(b===i.current||b<=0||b===v-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);g.useEffect(()=>{const f=o||a.current;return r(o||a.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{r(null),f.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(f){const h=a.current;if(!h||(s?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const m=f.behavior==="smooth";let b,v,w;h===window?(v=Math.max(rs(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),b=s?window.innerWidth:window.innerHeight,w=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(v=h[s?"scrollWidth":"scrollHeight"],b=rs(h,s?"width":"height"),w=h[s?"scrollLeft":"scrollTop"]);const y=v-b;if(f.top=Math.ceil(Math.max(Math.min(y,f.top),0)),g0(b,v)||f.top===w){e({scrollTop:w,scrollHeight:v,viewportHeight:b}),m&&t(!0);return}m?(i.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(f={left:f.top,behavior:f.behavior}),h.scrollTo(f)}function p(f){s&&(f={left:f.top,behavior:f.behavior}),a.current.scrollBy(f)}return{scrollerRef:a,scrollByCallback:p,scrollToCallback:d}}const pn=ct(()=>{const e=Ye(),t=Ye(),n=ge(0),r=Ye(),o=ge(0),s=Ye(),a=Ye(),i=ge(0),l=ge(0),u=ge(0),d=ge(0),p=Ye(),f=Ye(),h=ge(!1),m=ge(!1),b=ge(!1);return xe(ue(e,be(({scrollTop:v})=>v)),t),xe(ue(e,be(({scrollHeight:v})=>v)),a),xe(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:a,smoothScrollTargetReached:r,horizontalDirection:m,skipAnimationFrameInResizeObserver:b,scrollTo:p,scrollBy:f,statefulScrollTop:o,deviation:n,scrollingInProgress:h}},[],{singleton:!0}),Wi={lvl:0};function m0(e,t,n,r=Wi,o=Wi){return{k:e,v:t,lvl:n,l:r,r:o}}function ht(e){return e===Wi}function Na(){return Wi}function Of(e,t){if(ht(e))return Wi;const{k:n,l:r,r:o}=e;if(t===n){if(ht(r))return o;if(ht(o))return r;{const[s,a]=b0(r);return Rc(Ft(e,{k:s,v:a,l:v0(r)}))}}else return t<n?Rc(Ft(e,{l:Of(r,t)})):Rc(Ft(e,{r:Of(o,t)}))}function Gi(e,t){if(!ht(e))return t===e.k?e.v:t<e.k?Gi(e.l,t):Gi(e.r,t)}function _r(e,t,n="k"){if(ht(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=_r(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return _r(e.l,t,n)}function Hn(e,t,n){return ht(e)?m0(t,n,1):t===e.k?Ft(e,{k:t,v:n}):t<e.k?y0(Ft(e,{l:Hn(e.l,t,n)})):y0(Ft(e,{r:Hn(e.r,t,n)}))}function _f(e,t,n){if(ht(e))return[];const{k:r,v:o,l:s,r:a}=e;let i=[];return r>t&&(i=i.concat(_f(s,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(_f(a,t,n))),i}function Bs(e){return ht(e)?[]:[...Bs(e.l),{k:e.k,v:e.v},...Bs(e.r)]}function b0(e){return ht(e.r)?[e.k,e.v]:b0(e.r)}function v0(e){return ht(e.r)?e.l:Rc(Ft(e,{r:v0(e.r)}))}function Ft(e,t){return m0(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Af(e){return ht(e)||e.lvl>e.r.lvl}function y0(e){return Mf(S0(e))}function Rc(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Af(t))return S0(Ft(e,{lvl:r-1}));if(!ht(t)&&!ht(t.r))return Ft(t.r,{l:Ft(t,{r:t.r.l}),r:Ft(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Af(e))return Mf(Ft(e,{lvl:r-1}));if(!ht(n)&&!ht(n.l)){const o=n.l,s=Af(o)?n.lvl-1:n.lvl;return Ft(o,{l:Ft(e,{r:o.l,lvl:r-1}),r:Mf(Ft(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function eu(e,t,n){if(ht(e))return[];const r=_r(e,t)[0];return Z$(_f(e,r,n))}function w0(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let a=1;a<n;a++){const{index:i,value:l}=t(e[a]);s.push({start:r,end:i-1,value:o}),r=i,o=l}return s.push({start:r,end:1/0,value:o}),s}function Z$(e){return w0(e,({k:t,v:n})=>({index:t,value:n}))}function Mf(e){const{r:t,lvl:n}=e;return!ht(t)&&!ht(t.r)&&t.lvl===n&&t.r.lvl===n?Ft(t,{l:Ft(e,{r:t.l}),lvl:n+1}):e}function S0(e){const{l:t}=e;return!ht(t)&&t.lvl===e.lvl?Ft(t,{r:Ft(e,{l:t.r})}):e}function tu(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),a=e[s],i=n(a,t);if(i===0)return s;if(i===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function C0(e,t,n){return e[tu(e,t,n)]}function Y$(e,t,n,r){const o=tu(e,t,r),s=tu(e,n,r,o);return e.slice(o,s+1)}const Lf=ct(()=>({recalcInProgress:ge(!1)}),[],{singleton:!0});function X$(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function x0(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function J$(e,t){let n=ht(e)?0:1/0;for(const r of t){const{size:o,startIndex:s,endIndex:a}=r;if(n=Math.min(n,s),ht(e)){e=Hn(e,0,o);continue}const i=eu(e,s-1,a+1);if(i.some(X$(r)))continue;let l=!1,u=!1;for(const{start:d,end:p,value:f}of i)l?(a>=d||o===f)&&(e=Of(e,d)):(u=f!==o,l=!0),p>a&&a>=d&&f!==o&&(e=Hn(e,a+1,f));u&&(e=Hn(e,s,o))}return[e,n]}function Q$(){return{offsetTree:[],sizeTree:Na(),groupOffsetTree:Na(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function Nf({index:e},t){return t===e?0:t<e?-1:1}function R$({offset:e},t){return t===e?0:t<e?-1:1}function ek(e){return{index:e.index,value:e}}function tk(e,t,n,r=0){return r>0&&(t=Math.max(t,C0(e,r,Nf).offset)),w0(Y$(e,t,n,R$),ek)}function $f(e,t,n,r){let o=e,s=0,a=0,i=0,l=0;if(t!==0){l=tu(o,t-1,Nf),i=o[l].offset;const d=_r(n,t-1);s=d[0],a=d[1],o.length&&o[l].size===_r(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of eu(n,t,1/0)){const p=u-s,f=p*a+i+p*r;o.push({offset:f,size:d,index:u}),s=u,i=f,a=d}return{offsetTree:o,lastIndex:s,lastOffset:i,lastSize:a}}function nk(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Vn.DEBUG);const s=e.sizeTree;let a=s,i=0;if(n.length>0&&ht(s)&&t.length===2){const f=t[0].size,h=t[1].size;a=n.reduce((m,b)=>Hn(Hn(m,b,f),b+1,h),a)}else[a,i]=J$(a,t);if(a===s)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:p}=$f(e.offsetTree,i,a,o);return{sizeTree:a,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:d,groupOffsetTree:n.reduce((f,h)=>Hn(f,h,qi(h,l,o)),Na()),groupIndices:n}}function qi(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=C0(t,e,Nf),a=e-o,i=s*a+(a-1)*n+r;return i>0?i+n:i}function rk(e){return typeof e.groupIndex<"u"}function E0(e,t,n){if(rk(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=P0(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function P0(e,t){if(!nu(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function nu(e){return!ht(e.groupOffsetTree)}function ok(e){return Bs(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],a=s?s.k-1:1/0;return{startIndex:t,endIndex:a,size:n}})}const sk={offsetHeight:"height",offsetWidth:"width"},Yr=ct(([{log:e},{recalcInProgress:t}])=>{const n=Ye(),r=Ye(),o=dn(r,0),s=Ye(),a=Ye(),i=ge(0),l=ge([]),u=ge(void 0),d=ge(void 0),p=ge((E,x)=>rs(E,sk[x])),f=ge(void 0),h=ge(0),m=Q$(),b=dn(ue(n,Fe(l,e,h),Zr(nk,m),Ot()),m),v=dn(ue(l,Ot(),Zr((E,x)=>({prev:E.current,current:x}),{prev:[],current:[]}),be(({prev:E})=>E)),[]);xe(ue(l,Ae(E=>E.length>0),Fe(b,h),be(([E,x,P])=>{const _=E.reduce((T,O,M)=>Hn(T,O,qi(O,x.offsetTree,P)||M),Na());return{...x,groupIndices:E,groupOffsetTree:_}})),b),xe(ue(r,Fe(b),Ae(([E,{lastIndex:x}])=>E<x),be(([E,{lastIndex:x,lastSize:P}])=>[{startIndex:E,endIndex:x,size:P}])),n),xe(u,d);const w=dn(ue(u,be(E=>E===void 0)),!0);xe(ue(d,Ae(E=>E!==void 0&&ht(en(b).sizeTree)),be(E=>[{startIndex:0,endIndex:0,size:E}])),n);const y=In(ue(n,Fe(b),Zr(({sizes:E},[x,P])=>({changed:P!==E,sizes:P}),{changed:!1,sizes:m}),be(E=>E.changed)));lt(ue(i,Zr((E,x)=>({diff:E.prev-x,prev:x}),{diff:0,prev:0}),be(E=>E.diff)),E=>{const{groupIndices:x}=en(b);if(E>0)Ve(t,!0),Ve(s,E+x0(E,x));else if(E<0){const P=en(v);P.length>0&&(E-=x0(-E,P)),Ve(a,E)}}),lt(ue(i,Fe(e)),([E,x])=>{E<0&&x("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},Vn.ERROR)});const S=In(s);xe(ue(s,Fe(b),be(([E,x])=>{const P=x.groupIndices.length>0,_=[],T=x.lastSize;if(P){const O=Gi(x.sizeTree,0);let M=0,A=0;for(;M<E;){const L=x.groupIndices[A],H=x.groupIndices.length===A+1?1/0:x.groupIndices[A+1]-L-1;_.push({startIndex:L,endIndex:L,size:O}),_.push({startIndex:L+1,endIndex:L+1+H-1,size:T}),A++,M+=H+1}const $=Bs(x.sizeTree);return M!==E&&$.shift(),$.reduce((L,{k:H,v:W})=>{let B=L.ranges;return L.prevSize!==0&&(B=[...L.ranges,{startIndex:L.prevIndex,endIndex:H+E-1,size:L.prevSize}]),{ranges:B,prevIndex:H+E,prevSize:W}},{ranges:_,prevIndex:E,prevSize:0}).ranges}return Bs(x.sizeTree).reduce((O,{k:M,v:A})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:M+E-1,size:O.prevSize}],prevIndex:M+E,prevSize:A}),{ranges:[],prevIndex:0,prevSize:T}).ranges})),n);const C=In(ue(a,Fe(b,h),be(([E,{offsetTree:x},P])=>{const _=-E;return qi(_,x,P)})));return xe(ue(a,Fe(b,h),be(([E,x,P])=>{if(x.groupIndices.length>0){if(ht(x.sizeTree))return x;let T=Na();const O=en(v);let M=0,A=0,$=0;for(;M<-E;){$=O[A];const L=O[A+1]-$-1;A++,M+=L+1}if(T=Bs(x.sizeTree).reduce((L,{k:H,v:W})=>Hn(L,Math.max(0,H+E),W),T),M!==-E){const L=Gi(x.sizeTree,$);T=Hn(T,0,L);const H=_r(x.sizeTree,-E+1)[1];T=Hn(T,1,H)}return{...x,sizeTree:T,...$f(x.offsetTree,0,T,P)}}else{const T=Bs(x.sizeTree).reduce((O,{k:M,v:A})=>Hn(O,Math.max(0,M+E),A),Na());return{...x,sizeTree:T,...$f(x.offsetTree,0,T,P)}}})),b),{data:f,totalCount:r,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:s,shiftWith:a,shiftWithOffset:C,beforeUnshiftWith:S,firstItemIndex:i,gap:h,sizes:b,listRefresh:y,statefulTotalCount:o,trackItemSizes:w,itemSize:p}},Tt(ns,Lf),{singleton:!0}),ak=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function T0(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ak)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ki=ct(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:a,smoothScrollTargetReached:i,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p},{log:f}])=>{const h=Ye(),m=Ye(),b=ge(0);let v=null,w=null,y=null;function S(){v&&(v(),v=null),y&&(y(),y=null),w&&(clearTimeout(w),w=null),Ve(o,!1)}return xe(ue(h,Fe(e,s,t,b,l,u,f),Fe(r,d,p),be(([[C,E,x,P,_,T,O,M],A,$,j])=>{const L=T0(C),{align:H,behavior:W,offset:B}=L,G=P-1,D=E0(L,E,G);let V=qi(D,E.offsetTree,A)+T;H==="end"?(V+=$+_r(E.sizeTree,D)[1]-x+j,D===G&&(V+=O)):H==="center"?V+=($+_r(E.sizeTree,D)[1]-x+j)/2:V-=_,B&&(V+=B);const k=z=>{S(),z?(M("retrying to scroll to",{location:C},Vn.DEBUG),Ve(h,C)):(Ve(m,!0),M("list did not change, scroll successful",{},Vn.DEBUG))};if(S(),W==="smooth"){let z=!1;y=lt(n,Y=>{z=z||Y}),v=qr(i,()=>{k(z)})}else v=qr(ue(n,ik(150)),k);return w=setTimeout(()=>{S()},1200),Ve(o,!0),M("scrolling from index to",{index:D,top:V,behavior:W},Vn.DEBUG),{top:V,behavior:W}})),a),{scrollToIndex:h,scrollTargetReached:m,topListHeight:b}},Tt(Yr,pn,ns),{singleton:!0});function ik(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const Zi="up",Yi="down",lk="none",ck={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},uk=0,Xi=ct(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=ge(!1),i=ge(!0),l=Ye(),u=Ye(),d=ge(4),p=ge(uk),f=dn(ue(u0(ue(Me(t),La(1),Kr(!0)),ue(Me(t),La(1),Kr(!1),c0(100))),Ot()),!1),h=dn(ue(u0(ue(s,Kr(!0)),ue(s,Kr(!1),c0(200))),Ot()),!1);xe(ue(Ut(Me(t),Me(p)),be(([y,S])=>y<=S),Ot()),i),xe(ue(i,ts(50)),u);const m=In(ue(Ut(e,Me(n),Me(r),Me(o),Me(d)),Zr((y,[{scrollTop:S,scrollHeight:C},E,x,P,_])=>{const T=S+E-C>-_,O={viewportHeight:E,scrollTop:S,scrollHeight:C};if(T){let A,$;return S>y.state.scrollTop?(A="SCROLLED_DOWN",$=y.state.scrollTop-S):(A="SIZE_DECREASED",$=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:A,scrollTopDelta:$}}let M;return O.scrollHeight>y.state.scrollHeight?M="SIZE_INCREASED":E<y.state.viewportHeight?M="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?M="SCROLLING_UPWARDS":M="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:M,state:O}},ck),Ot((y,S)=>y&&y.atBottom===S.atBottom))),b=dn(ue(e,Zr((y,{scrollTop:S,scrollHeight:C,viewportHeight:E})=>{if(g0(y.scrollHeight,C))return{scrollTop:S,scrollHeight:C,jump:0,changed:!1};{const x=C-(S+E)<1;return y.scrollTop!==S&&x?{scrollHeight:C,scrollTop:S,jump:y.scrollTop-S,changed:!0}:{scrollHeight:C,scrollTop:S,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Ae(y=>y.changed),be(y=>y.jump)),0);xe(ue(m,be(y=>y.atBottom)),a),xe(ue(a,ts(50)),l);const v=ge(Yi);xe(ue(e,be(({scrollTop:y})=>y),Ot(),Zr((y,S)=>en(h)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?Zi:Yi,prevScrollTop:S},{direction:Yi,prevScrollTop:0}),be(y=>y.direction)),v),xe(ue(e,ts(50),Kr(lk)),v);const w=ge(0);return xe(ue(f,Ae(y=>!y),Kr(0)),w),xe(ue(t,ts(100),Fe(f),Ae(([y,S])=>!!S),Zr(([y,S],[C])=>[S,C],[0,0]),be(([y,S])=>S-y)),w),{isScrolling:f,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:v,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:w,lastJumpDueToItemResize:b}},Tt(pn)),os=ct(([{log:e}])=>{const t=ge(!1),n=In(ue(t,Ae(r=>r),Ot()));return lt(t,r=>{r&&en(e)("props updated",{},Vn.DEBUG)}),{propsReady:t,didMount:n}},Tt(ns),{singleton:!0});function kf(e,t){e==0?t():requestAnimationFrame(()=>kf(e-1,t))}function If(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Ji=ct(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:s},{didMount:a}])=>{const i=ge(!0),l=ge(0),u=ge(!0);return xe(ue(a,Fe(l),Ae(([d,p])=>!!p),Kr(!1)),i),xe(ue(a,Fe(l),Ae(([d,p])=>!!p),Kr(!1)),u),lt(ue(Ut(t,a),Fe(i,e,n,u),Ae(([[,d],p,{sizeTree:f},h,m])=>d&&(!ht(f)||Ef(h))&&!p&&!m),Fe(l)),([,d])=>{qr(s,()=>{Ve(u,!0)}),kf(4,()=>{qr(r,()=>{Ve(i,!0)}),Ve(o,d)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Tt(Yr,pn,Ki,os),{singleton:!0});function O0(e){return e?e==="smooth"?"smooth":"auto":!1}const dk=(e,t)=>typeof e=="function"?O0(e(t)):t&&O0(e),pk=ct(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:a,didMount:i},{log:l},{scrollingInProgress:u}])=>{const d=ge(!1),p=Ye();let f=null;function h(b){Ve(o,{index:"LAST",align:"end",behavior:b})}lt(ue(Ut(ue(Me(e),La(1)),i),Fe(Me(d),n,s,u),be(([[b,v],w,y,S,C])=>{let E=v&&S,x="auto";return E&&(x=dk(w,y||C),E=E&&!!x),{totalCount:b,shouldFollow:E,followOutputBehavior:x}}),Ae(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:v})=>{f&&(f(),f=null),f=qr(t,()=>{en(l)("following output to ",{totalCount:b},Vn.DEBUG),h(v),f=null})});function m(b){const v=qr(r,w=>{b&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(en(l)("scrolling to bottom due to increased size",{},Vn.DEBUG),h("auto"))});setTimeout(v,100)}return lt(ue(Ut(Me(d),e,a),Ae(([b,,v])=>b&&v),Zr(({value:b},[,v])=>({refreshed:b===v,value:v}),{refreshed:!1,value:0}),Ae(({refreshed:b})=>b),Fe(d,e)),([,b])=>{en(s)&&m(b!==!1)}),lt(p,()=>{m(en(d)!==!1)}),lt(Ut(Me(d),r),([b,v])=>{b&&!v.atBottom&&v.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")}),{followOutput:d,autoscrollToBottom:p}},Tt(Yr,Xi,Ki,Ji,os,ns,pn));function fk(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const _0=ct(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Ye(),a=Ye(),i=In(ue(s,be(fk)));return xe(ue(i,be(l=>l.totalCount)),e),xe(ue(i,be(l=>l.groupIndices)),t),xe(ue(Ut(r,n,o),Ae(([l,u])=>nu(u)),be(([l,u,d])=>_r(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ot(),be(l=>[l])),a),{groupCounts:s,topItemsIndexes:a}},Tt(Yr,pn));function Qi(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function A0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const ru="top",ou="bottom",M0="none";function L0(e,t,n){return typeof e=="number"?n===Zi&&t===ru||n===Yi&&t===ou?e:0:n===Zi?t===ru?e.main:e.reverse:t===ou?e.main:e.reverse}function N0(e,t){return typeof e=="number"?e:e[t]||0}const Vf=ct(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Ye(),a=ge(0),i=ge(0),l=ge(0),u=dn(ue(Ut(Me(e),Me(t),Me(r),Me(s,Qi),Me(l),Me(a),Me(o),Me(n),Me(i)),be(([d,p,f,[h,m],b,v,w,y,S])=>{const C=d-y,E=v+w,x=Math.max(f-C,0);let P=M0;const _=N0(S,ru),T=N0(S,ou);return h-=y,h+=f+w,m+=f+w,m-=y,h>d+E-_&&(P=Zi),m<d-x+p+T&&(P=Yi),P!==M0?[Math.max(C-f-L0(b,ru,P)-_,0),C-x-w+p+L0(b,ou,P)+T]:null}),Ae(d=>d!=null),Ot(Qi)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Tt(pn),{singleton:!0});function gk(e,t,n){if(nu(t)){const r=P0(e,t);return[{index:_r(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Hf={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function $0(e,t,n){if(e.length===0)return[];if(!nu(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],a=eu(t.groupOffsetTree,r,o);let i,l=0;for(const u of e){(!i||i.end<u.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let d;u.index===i.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},s.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return s}function su(e,t,n,r,o,s){const{lastSize:a,lastOffset:i,lastIndex:l}=o;let u=0,d=0;if(e.length>0){u=e[0].offset;const b=e[e.length-1];d=b.offset+b.size}const p=n-l,f=i+p*a+(p-1)*r,h=u,m=f-d;return{items:$0(e,o,s),topItems:$0(t,o,s),topListHeight:t.reduce((b,v)=>v.size+b,0),offsetTop:u,offsetBottom:m,top:h,bottom:d,totalCount:n,firstItemIndex:s}}function k0(e,t,n,r,o,s){let a=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-a>=e)break;a++}const i=e+a,l=If(t,i),u=Array.from({length:i}).map((d,p)=>({index:p+l,size:0,offset:0,data:s[p+l]}));return su(u,[],i,o,n,r)}const zs=ct(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:a,listBoundary:i,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:p},f,{didMount:h},{recalcInProgress:m}])=>{const b=ge([]),v=ge(0),w=Ye();xe(s.topItemsIndexes,b);const y=dn(ue(Ut(h,m,Me(a,Qi),Me(t),Me(e),Me(d),u,Me(b),Me(r),Me(o),n),Ae(([x,P,,_,,,,,,,T])=>{const O=T&&T.length!==_;return x&&!P&&!O}),be(([,,[x,P],_,T,O,M,A,$,j,L])=>{const H=T,{sizeTree:W,offsetTree:B}=H,G=en(v);if(_===0)return{...Hf,totalCount:_};if(x===0&&P===0)return G===0?{...Hf,totalCount:_}:k0(G,O,T,$,j,L||[]);if(ht(W))return G>0?null:su(gk(If(O,_),H,L),[],_,j,H,$);const D=[];if(A.length>0){const X=A[0],ee=A[A.length-1];let J=0;for(const q of eu(W,X,ee)){const R=q.value,ae=Math.max(q.start,X),le=Math.min(q.end,ee);for(let me=ae;me<=le;me++)D.push({index:me,size:R,offset:J,data:L&&L[me]}),J+=R}}if(!M)return su([],D,_,j,H,$);const V=A.length>0?A[A.length-1]+1:0,k=tk(B,x,P,V);if(k.length===0)return null;const z=_-1,Y=Jc([],X=>{for(const ee of k){const J=ee.value;let q=J.offset,R=ee.start;const ae=J.size;if(J.offset<x){R+=Math.floor((x-J.offset+j)/(ae+j));const me=R-ee.start;q+=me*ae+me*j}R<V&&(q+=(V-R)*ae,R=V);const le=Math.min(ee.end,z);for(let me=R;me<=le&&!(q>=P);me++)X.push({index:me,size:ae,offset:q,data:L&&L[me]}),q+=ae+j}});return su(Y,D,_,j,H,$)}),Ae(x=>x!==null),Ot()),Hf);xe(ue(n,Ae(Ef),be(x=>x==null?void 0:x.length)),t),xe(ue(y,be(x=>x.topListHeight)),p),xe(p,l),xe(ue(y,be(x=>[x.top,x.bottom])),i),xe(ue(y,be(x=>x.items)),w);const S=In(ue(y,Ae(({items:x})=>x.length>0),Fe(t,n),Ae(([{items:x},P])=>x[x.length-1].originalIndex===P-1),be(([,x,P])=>[x-1,P]),Ot(Qi),be(([x])=>x))),C=In(ue(y,ts(200),Ae(({items:x,topItems:P})=>x.length>0&&x[0].originalIndex===P.length),be(({items:x})=>x[0].index),Ot())),E=In(ue(y,Ae(({items:x})=>x.length>0),be(({items:x})=>{let P=0,_=x.length-1;for(;x[P].type==="group"&&P<_;)P++;for(;x[_].type==="group"&&_>P;)_--;return{startIndex:x[P].index,endIndex:x[_].index}}),Ot(A0)));return{listState:y,topItemsIndexes:b,endReached:S,startReached:C,rangeChanged:E,itemsRendered:w,initialItemCount:v,...f}},Tt(Yr,_0,Vf,Ji,Ki,Xi,os,Lf),{singleton:!0}),hk=ct(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:a},{didMount:i}])=>(xe(ue(i,Fe(s),Ae(([,l])=>l!==0),Fe(o,e,t,r,n),be(([[,l],u,d,p,f,h=[]])=>k0(l,u,d,p,f,h))),a),{}),Tt(Yr,Ji,zs,os),{singleton:!0}),I0=ct(([{scrollVelocity:e}])=>{const t=ge(!1),n=Ye(),r=ge(!1);return xe(ue(e,Fe(r,t,n),Ae(([o,s])=>!!s),be(([o,s,a,i])=>{const{exit:l,enter:u}=s;if(a){if(l(o,i))return!1}else if(u(o,i))return!0;return a}),Ot()),t),lt(ue(Ut(t,e,n),Fe(r)),([[o,s,a],i])=>o&&i&&i.change&&i.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Tt(Xi),{singleton:!0}),mk=ct(([{topItemsIndexes:e}])=>{const t=ge(0);return xe(ue(t,Ae(n=>n>0),be(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Tt(zs)),V0=ct(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Ye(),a=dn(ue(Ut(e,r,t,n,o),be(([i,l,u,d,p])=>i+l+u+d+p.offsetBottom+p.bottom)),0);return xe(Me(a),s),{totalListHeight:a,totalListHeightChanged:s}},Tt(pn,zs),{singleton:!0});function H0(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const bk=H0(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),vk=ct(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:a,lastJumpDueToItemResize:i},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:p,gap:f},{log:h},{recalcInProgress:m}])=>{const b=In(ue(l,Fe(i),Zr(([,w,y,S],[{items:C,totalCount:E,bottom:x,offsetBottom:P},_])=>{const T=x+P;let O=0;return y===E&&w.length>0&&C.length>0&&(C[0].originalIndex===0&&w[0].originalIndex===0||(O=T-S,O!==0&&(O+=_))),[O,C,E,T]},[0,[],0,0]),Ae(([w])=>w!==0),Fe(t,a,r,s,h,m),Ae(([,w,y,S,,,C])=>!C&&!S&&w!==0&&y===Zi),be(([[w],,,,,y])=>(y("Upward scrolling compensation",{amount:w},Vn.DEBUG),w))));function v(w){w>0?(Ve(e,{top:-w,behavior:"auto"}),Ve(n,0)):(Ve(n,0),Ve(e,{top:-w,behavior:"auto"}))}return lt(ue(b,Fe(n,o)),([w,y,S])=>{S&&bk()?Ve(n,y-w):v(-w)}),lt(ue(Ut(dn(o,!1),n,m),Ae(([w,y,S])=>!w&&!S&&y!==0),be(([w,y])=>y),ts(1)),v),xe(ue(d,be(w=>({top:-w}))),e),lt(ue(u,Fe(p,f),be(([w,{lastSize:y,groupIndices:S,sizeTree:C},E])=>{function x(P){return P*(y+E)}if(S.length===0)return x(w);{let P=0;const _=Gi(C,0);let T=0,O=0;for(;T<w;){T++,P+=_;let M=S.length===O+1?1/0:S[O+1]-S[O]-1;T+M>w&&(P-=_,M=w-T+1),T+=M,P+=x(M),O++}return P}})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(e,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Tt(pn,Xi,zs,Yr,ns,Lf)),yk=ct(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ge(0);return lt(ue(e,Fe(r),Ae(([,o])=>o!==0),be(([,o])=>({top:o}))),o=>{qr(ue(n,La(1),Ae(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,o)})})}),{initialScrollTop:r}},Tt(os,pn,zs),{singleton:!0}),wk=ct(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ge(!1),r=dn(ue(Ut(n,e,t),Ae(([o])=>o),be(([,o,s])=>Math.max(0,o-s)),ts(0),Ot()),0);return{alignToBottom:n,paddingTopAddition:r}},Tt(pn,V0),{singleton:!0}),jf=ct(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ye(),r=Ye(),o=Ye(),s=ge(!1),a=ge(void 0);return xe(ue(Ut(n,r),be(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),xe(ue(e,Fe(r),be(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Tt(pn)),Sk=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...a}})=>e<n?{...a,behavior:o,align:s??"start"}:t>r?{...a,behavior:o,align:s??"end"}:null,Ck=ct(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:a,fixedFooterHeight:i,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=Ye();return xe(ue(d,Fe(e,o,t,s,a,i,r),Fe(n),be(([[p,f,h,m,b,v,w,y],S])=>{const{done:C,behavior:E,align:x,calculateViewLocation:P=Sk,..._}=p,T=E0(p,f,m-1),O=qi(T,f.offsetTree,S)+b+v,M=O+_r(f.sizeTree,T)[1],A=y+v,$=y+h-w,j=P({itemTop:O,itemBottom:M,viewportTop:A,viewportBottom:$,locationParams:{behavior:E,align:x,..._}});return j?C&&qr(ue(l,Ae(L=>L===!1),La(en(l)?1:2)),C):C&&C(),j}),Ae(p=>p!==null)),u),{scrollIntoView:d}},Tt(Yr,pn,Ki,zs,ns),{singleton:!0}),xk=ct(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Ye(),d=ge(void 0),p=ge(null),f=ge(null);return xe(i,p),xe(l,f),lt(ue(u,Fe(e,n,a,p,f,r)),([h,m,b,v,w,y,S])=>{const C=ok(m.sizeTree);v&&w!==null&&y!==null&&(b=w.scrollTop-y.offsetTop),b-=S,h({ranges:C,scrollTop:b})}),xe(ue(d,Ae(Ef),be(Ek)),o),xe(ue(s,Fe(d),Ae(([,h])=>h!==void 0),Ot(),be(([,h])=>h.ranges)),t),{getState:u,restoreStateFrom:d}},Tt(Yr,pn,Ji,os,jf));function Ek(e){return{offset:e.scrollTop,index:0,align:"start"}}const Pk=ct(([e,t,n,r,o,s,a,i,l,u])=>({...e,...t,...n,...r,...o,...s,...a,...i,...l,...u}),Tt(Vf,hk,os,I0,V0,yk,wk,jf,Ck,ns)),Tk=ct(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:a,firstItemIndex:i,groupIndices:l,statefulTotalCount:u,gap:d,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:h,initialItemFinalLocationReached:m},b,v,w,{listState:y,topItemsIndexes:S,...C},{scrollToIndex:E},x,{topItemCount:P},{groupCounts:_},T])=>(xe(C.rangeChanged,T.scrollSeekRangeChanged),xe(ue(T.windowViewportRect,be(O=>O.visibleHeight)),b.viewportHeight),{totalCount:e,data:a,firstItemIndex:i,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:h,initialItemFinalLocationReached:m,topItemsIndexes:S,topItemCount:P,groupCounts:_,fixedItemHeight:n,defaultItemHeight:r,gap:d,...w,statefulTotalCount:u,listState:y,scrollToIndex:E,trackItemSizes:o,itemSize:s,groupIndices:l,...C,...T,...b,sizes:p,...v}),Tt(Yr,Ji,pn,xk,pk,zs,Ki,vk,mk,_0,Pk)),Df="-webkit-sticky",j0="sticky",D0=H0(()=>{if(typeof document>"u")return j0;const e=document.createElement("div");return e.style.position=Df,e.style.position===Df?Df:j0});function F0(e,t,n){const r=g.useRef(null),o=g.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let p,f;if(t){const h=t.getBoundingClientRect(),m=u.top-h.top;p=h.height-Math.max(0,m),f=m+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),f=u.top+window.pageYOffset;r.current={offsetTop:f,visibleHeight:p,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=Tf(o,!0,n),i=g.useCallback(()=>{o(a.current)},[o,a]);return g.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),s}const B0=g.createContext(void 0),z0=g.createContext(void 0);function U0(e){return e}const Ok=ct(([e,t])=>({...e,...t}),Tt(Tk,ct(()=>{const e=ge(l=>`Item ${l}`),t=ge(null),n=ge(l=>`Group ${l}`),r=ge({}),o=ge(U0),s=ge("div"),a=ge(Ma),i=(l,u=null)=>dn(ue(r,be(d=>d[l]),Ot()),u);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,HeaderFooterTag:s,scrollerRef:a,FooterComponent:i("Footer"),HeaderComponent:i("Header"),TopItemListComponent:i("TopItemList"),ListComponent:i("List","div"),ItemComponent:i("Item","div"),GroupComponent:i("Group","div"),ScrollerComponent:i("Scroller","div"),EmptyPlaceholder:i("EmptyPlaceholder"),ScrollSeekPlaceholder:i("ScrollSeekPlaceholder")}}))),_k=({height:e})=>c.jsx("div",{style:{height:e}}),Ak={position:D0(),zIndex:1,overflowAnchor:"none"},W0={overflowAnchor:"none"},Mk={...W0,display:"inline-block",height:"100%"},G0=g.memo(function({showTopList:t=!1}){const n=Le("listState"),r=nr("sizeRanges"),o=Le("useWindowScroll"),s=Le("customScrollParent"),a=nr("windowScrollContainerState"),i=nr("scrollContainerState"),l=s||o?a:i,u=Le("itemContent"),d=Le("context"),p=Le("groupContent"),f=Le("trackItemSizes"),h=Le("itemSize"),m=Le("log"),b=nr("gap"),v=Le("horizontalDirection"),{callbackRef:w}=q$(r,h,f,t?Ma:l,m,b,s,v,Le("skipAnimationFrameInResizeObserver")),[y,S]=g.useState(0);Ff("deviation",L=>{y!==L&&S(L)});const C=Le("EmptyPlaceholder"),E=Le("ScrollSeekPlaceholder")||_k,x=Le("ListComponent"),P=Le("ItemComponent"),_=Le("GroupComponent"),T=Le("computeItemKey"),O=Le("isSeeking"),M=Le("groupIndices").length>0,A=Le("alignToBottom"),$=Le("initialItemFinalLocationReached"),j=t?{}:{boxSizing:"border-box",...v?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:A?"auto":0}:{marginTop:y!==0?y:A?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...$?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&C?c.jsx(C,{...fn(C,d)}):c.jsx(x,{...fn(x,d),ref:w,style:j,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(L=>{const H=L.originalIndex,W=T(H+n.firstItemIndex,L.data,d);return O?g.createElement(E,{...fn(E,d),key:W,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?g.createElement(_,{...fn(_,d),key:W,"data-index":H,"data-known-size":L.size,"data-item-index":L.index,style:Ak},p(L.index,d)):g.createElement(P,{...fn(P,d),...kk(P,L.data),key:W,"data-index":H,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,style:v?Mk:W0},M?u(L.index,L.groupIndex,L.data,d):u(L.index,L.data,d))})})}),Lk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Nk={outline:"none",overflowX:"auto",position:"relative"},au=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),$k={width:"100%",position:D0(),top:0,zIndex:1};function fn(e,t){if(typeof e!="string")return{context:t}}function kk(e,t){return{item:typeof e=="string"?void 0:t}}const Ik=g.memo(function(){const t=Le("HeaderComponent"),n=nr("headerHeight"),r=Le("HeaderFooterTag"),o=Fs(g.useMemo(()=>a=>n(rs(a,"height")),[n]),!0,Le("skipAnimationFrameInResizeObserver")),s=Le("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Vk=g.memo(function(){const t=Le("FooterComponent"),n=nr("footerHeight"),r=Le("HeaderFooterTag"),o=Fs(g.useMemo(()=>a=>n(rs(a,"height")),[n]),!0,Le("skipAnimationFrameInResizeObserver")),s=Le("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null});function q0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return g.memo(function({style:s,children:a,...i}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("scrollerRef"),f=n("context"),h=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:b,scrollToCallback:v}=h0(l,d,u,p,void 0,h);t("scrollTo",v),t("scrollBy",b);const w=h?Nk:Lk;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...fn(u,f),children:a})})}function K0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return g.memo(function({style:s,children:a,...i}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("totalListHeight"),f=n("deviation"),h=n("customScrollParent"),m=n("context"),{scrollerRef:b,scrollByCallback:v,scrollToCallback:w}=h0(l,d,u,Ma,h);return p0(()=>(b.current=h||window,()=>{b.current=null}),[b,h]),t("windowScrollTo",w),t("scrollBy",v),c.jsx(u,{style:{position:"relative",...s,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...i,...fn(u,m),children:a})})}const Hk=({children:e})=>{const t=g.useContext(B0),n=nr("viewportHeight"),r=nr("fixedItemHeight"),o=Le("alignToBottom"),s=Le("horizontalDirection"),a=g.useMemo(()=>o0(n,l=>rs(l,s?"width":"height")),[n,s]),i=Fs(a,!0,Le("skipAnimationFrameInResizeObserver"));return g.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{style:au(o),ref:i,"data-viewport-type":"element",children:e})},jk=({children:e})=>{const t=g.useContext(B0),n=nr("windowViewportRect"),r=nr("fixedItemHeight"),o=Le("customScrollParent"),s=F0(n,o,Le("skipAnimationFrameInResizeObserver")),a=Le("alignToBottom");return g.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),c.jsx("div",{ref:s,style:au(a),"data-viewport-type":"window",children:e})},Dk=({children:e})=>{const t=Le("TopItemListComponent")||"div",n=Le("headerHeight"),r={...$k,marginTop:`${n}px`},o=Le("context");return c.jsx(t,{style:r,...fn(t,o),children:e})},Fk=g.memo(function(t){const n=Le("useWindowScroll"),r=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),s=o||n?Uk:zk,a=o||n?jk:Hk;return c.jsxs(s,{...t,children:[r&&c.jsx(Dk,{children:c.jsx(G0,{showTopList:!0})}),c.jsxs(a,{children:[c.jsx(Ik,{}),c.jsx(G0,{}),c.jsx(Vk,{})]})]})}),{Component:Bk,usePublisher:nr,useEmitterValue:Le,useEmitter:Ff}=d0(Ok,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Fk),zk=q0({usePublisher:nr,useEmitterValue:Le,useEmitter:Ff}),Uk=K0({usePublisher:nr,useEmitterValue:Le,useEmitter:Ff}),Wk=Bk,Z0={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Gk={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Y0,ceil:X0,floor:iu,min:Bf,max:Ri}=Math;function qk(e){return{...Gk,items:e}}function J0(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Kk(e,t){return e&&e.column===t.column&&e.row===t.row}function lu(e,t){return e&&e.width===t.width&&e.height===t.height}const Zk=ct(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:p},f,h,{propsReady:m,didMount:b},{windowViewportRect:v,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},E])=>{const x=ge(0),P=ge(0),_=ge(Z0),T=ge({height:0,width:0}),O=ge({height:0,width:0}),M=Ye(),A=Ye(),$=ge(0),j=ge(null),L=ge({row:0,column:0}),H=Ye(),W=Ye(),B=ge(!1),G=ge(0),D=ge(!0),V=ge(!1),k=ge(!1);lt(ue(b,Fe(G),Ae(([q,R])=>!!R)),()=>{Ve(D,!1)}),lt(ue(Ut(b,D,O,T,G,V),Ae(([q,R,ae,le,,me])=>q&&!R&&ae.height!==0&&le.height!==0&&!me)),([,,,,q])=>{Ve(V,!0),kf(1,()=>{Ve(M,q)}),qr(ue(o),()=>{Ve(n,[0,0]),Ve(D,!0)})}),xe(ue(W,Ae(q=>q!=null&&q.scrollTop>0),Kr(0)),P),lt(ue(b,Fe(W),Ae(([,q])=>q!=null)),([,q])=>{q&&(Ve(T,q.viewport),Ve(O,q==null?void 0:q.item),Ve(L,q.gap),q.scrollTop>0&&(Ve(B,!0),qr(ue(o,La(1)),R=>{Ve(B,!1)}),Ve(i,{top:q.scrollTop})))}),xe(ue(T,be(({height:q})=>q)),s),xe(ue(Ut(Me(T,lu),Me(O,lu),Me(L,(q,R)=>q&&q.column===R.column&&q.row===R.row),Me(o)),be(([q,R,ae,le])=>({viewport:q,item:R,gap:ae,scrollTop:le}))),H),xe(ue(Ut(Me(x),t,Me(L,Kk),Me(O,lu),Me(T,lu),Me(j),Me(P),Me(B),Me(D),Me(G)),Ae(([,,,,,,,q])=>!q),be(([q,[R,ae],le,me,ve,He,je,,it,qe])=>{const{row:Se,column:Ue}=le,{height:et,width:Ct}=me,{width:Ne}=ve;if(je===0&&(q===0||Ne===0))return Z0;if(Ct===0){const qt=If(qe,q),Po=Math.max(qt+je-1,0);return qk(J0(qt,Po,He))}const bt=R0(Ne,Ct,Ue);let pt,Ke;it?R===0&&ae===0&&je>0?(pt=0,Ke=je-1):(pt=bt*iu((R+Se)/(et+Se)),Ke=bt*X0((ae+Se)/(et+Se))-1,Ke=Bf(q-1,Ri(Ke,bt-1)),pt=Bf(Ke,Ri(0,pt))):(pt=0,Ke=-1);const tn=J0(pt,Ke,He),{top:he,bottom:Be}=Q0(ve,le,me,tn),ze=X0(q/bt),Nt=ze*et+(ze-1)*Se-Be;return{items:tn,offsetTop:he,offsetBottom:Nt,top:he,bottom:Be,itemHeight:et,itemWidth:Ct}})),_),xe(ue(j,Ae(q=>q!==null),be(q=>q.length)),x),xe(ue(Ut(T,O,_,L),Ae(([q,R,{items:ae}])=>ae.length>0&&R.height!==0&&q.height!==0),be(([q,R,{items:ae},le])=>{const{top:me,bottom:ve}=Q0(q,le,R,ae);return[me,ve]}),Ot(Qi)),n);const z=ge(!1);xe(ue(o,Fe(z),be(([q,R])=>R||q!==0)),z);const Y=In(ue(Me(_),Ae(({items:q})=>q.length>0),Fe(x,z),Ae(([{items:q},R,ae])=>ae&&q[q.length-1].index===R-1),be(([,q])=>q-1),Ot())),X=In(ue(Me(_),Ae(({items:q})=>q.length>0&&q[0].index===0),Kr(0),Ot())),ee=In(ue(Me(_),Fe(B),Ae(([{items:q},R])=>q.length>0&&!R),be(([{items:q}])=>({startIndex:q[0].index,endIndex:q[q.length-1].index})),Ot(A0),ts(0)));xe(ee,h.scrollSeekRangeChanged),xe(ue(M,Fe(T,O,x,L),be(([q,R,ae,le,me])=>{const ve=T0(q),{align:He,behavior:je,offset:it}=ve;let qe=ve.index;qe==="LAST"&&(qe=le-1),qe=Ri(0,qe,Bf(le-1,qe));let Se=zf(R,me,ae,qe);return He==="end"?Se=Y0(Se-R.height+ae.height):He==="center"&&(Se=Y0(Se-R.height/2+ae.height/2)),it&&(Se+=it),{top:Se,behavior:je}})),i);const J=dn(ue(_,be(q=>q.offsetBottom+q.bottom)),0);return xe(ue(v,be(q=>({width:q.visibleWidth,height:q.visibleHeight}))),T),{data:j,totalCount:x,viewportDimensions:T,itemDimensions:O,scrollTop:o,scrollHeight:A,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:M,smoothScrollTargetReached:l,windowViewportRect:v,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:$,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:P,gap:L,restoreStateFrom:W,...h,initialTopMostItemIndex:G,horizontalDirection:k,gridState:_,totalListHeight:J,...f,startReached:X,endReached:Y,rangeChanged:ee,stateChanged:H,propsReady:m,stateRestoreInProgress:B,...E}},Tt(Vf,pn,Xi,I0,os,jf,ns));function Q0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=zf(e,t,n,r[0].index),a=zf(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function zf(e,t,n,r){const o=R0(e.width,n.width,t.column),s=iu(r/o),a=s*n.height+Ri(0,s-1)*t.row;return a>0?a+t.row:a}function R0(e,t,n){return Ri(1,iu((e+n)/(iu(t)+n)))}const Yk=ct(([e,t])=>({...e,...t}),Tt(Zk,ct(()=>{const e=ge(p=>`Item ${p}`),t=ge({}),n=ge(null),r=ge("virtuoso-grid-item"),o=ge("virtuoso-grid-list"),s=ge(U0),a=ge("div"),i=ge(Ma),l=(p,f=null)=>dn(ue(t,be(h=>h[p]),Ot()),f),u=ge(!1),d=ge(!1);return xe(Me(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:a,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}))),Xk=g.memo(function(){const t=Mt("gridState"),n=Mt("listClassName"),r=Mt("itemClassName"),o=Mt("itemContent"),s=Mt("computeItemKey"),a=Mt("isSeeking"),i=rr("scrollHeight"),l=Mt("ItemComponent"),u=Mt("ListComponent"),d=Mt("ScrollSeekPlaceholder"),p=Mt("context"),f=rr("itemDimensions"),h=rr("gap"),m=Mt("log"),b=Mt("stateRestoreInProgress"),v=rr("reportReadyState"),w=Fs(g.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:E,height:x}=C.getBoundingClientRect();f({width:E,height:x})}h({row:ty("row-gap",getComputedStyle(y).rowGap,m),column:ty("column-gap",getComputedStyle(y).columnGap,m)})},[i,f,h,m]),!0,!1);return p0(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),b?null:c.jsx(u,{ref:w,className:n,...fn(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,p);return a?c.jsx(d,{...fn(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},S):g.createElement(l,{...fn(l,p),className:r,"data-index":y.index,key:S},o(y.index,y.data,p))})})}),Jk=g.memo(function(){const t=Mt("HeaderComponent"),n=rr("headerHeight"),r=Mt("headerFooterTag"),o=Fs(g.useMemo(()=>a=>n(rs(a,"height")),[n]),!0,!1),s=Mt("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Qk=g.memo(function(){const t=Mt("FooterComponent"),n=rr("footerHeight"),r=Mt("headerFooterTag"),o=Fs(g.useMemo(()=>a=>n(rs(a,"height")),[n]),!0,!1),s=Mt("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Rk=({children:e})=>{const t=g.useContext(z0),n=rr("itemDimensions"),r=rr("viewportDimensions"),o=Fs(g.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return g.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),c.jsx("div",{style:au(!1),ref:o,children:e})},eI=({children:e})=>{const t=g.useContext(z0),n=rr("windowViewportRect"),r=rr("itemDimensions"),o=Mt("customScrollParent"),s=F0(n,o,!1);return g.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),c.jsx("div",{ref:s,style:au(!1),children:e})},tI=g.memo(function({...t}){const n=Mt("useWindowScroll"),r=Mt("customScrollParent"),o=r||n?oI:rI,s=r||n?eI:Rk;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(Jk,{}),c.jsx(Xk,{}),c.jsx(Qk,{})]})})}),{Component:nI,usePublisher:rr,useEmitterValue:Mt,useEmitter:ey}=d0(Yk,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},tI),rI=q0({usePublisher:rr,useEmitterValue:Mt,useEmitter:ey}),oI=K0({usePublisher:rr,useEmitterValue:Mt,useEmitter:ey});function ty(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}const cu=nI,Uf=e=>{const t="gs-utl-grid-cols-4",n=parseInt(`${e||4}`,10);return n===1?"gs-utl-grid-cols-1":n===2?"gs-utl-grid-cols-2":n===3?"gs-utl-grid-cols-3":n===4?t:n===5?"gs-utl-grid-cols-5":n===6?"gs-utl-grid-cols-6":n===7?"gs-utl-grid-cols-7":n===8?"gs-utl-grid-cols-8":n===9?"gs-utl-grid-cols-9":n===10?"gs-utl-grid-cols-10":n===11?"gs-utl-grid-cols-11":n===12?"gs-utl-grid-cols-12":t},sI=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function aI(e){const t=e.map(({id:a,src:i})=>({id:a,src:i})),n=e.reduce((a,i)=>(a[i.id]=i,a),{}),r=[],o=[];return(await hh(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const iI=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{sI(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await aI(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},lI=(e,t,n,r={})=>{const{skipReplace:o}=r;e.loadData(t);const s=e.getCss()||"",a=o?s:s.replace(/:root\s*{/gi,"[data-body]{");let i=`${e.getHtml()}<style>${a}</style>`;if(n===Et.email)try{i=e.runCommand(Vc).html}catch(l){console.error(l)}return r.removeScripts&&(i=i.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),o?i:i.replace("<body","<div data-body").replace("</body>","</div>")},cI=async(e,t,n)=>{const r=ZS(t,{appStore:n}),o=await iI(r);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...o.plugins,s=>{s.Storage.setCurrent("")}],pluginsOpts:o.pluginOptions,protectedCss:`
304
304
  * { box-sizing: border-box; }
305
305
  [data-body] {
306
306
  margin: 0;
@@ -318,43 +318,43 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
318
318
  height: 0px;
319
319
  overflow: hidden;
320
320
  }
321
- `})};function su({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=Ie();return c.jsx(Er,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(k,{className:X(o),space:"m",col:!0,children:[c.jsx(F,{grow:!0,className:X("text-center"),children:t||i.t("confirmAction")}),c.jsxs(k,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Ke,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...s,children:s.children||i.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),r==null||r()},children:i.t("cancel")})]})]})})}const Z0=new Map,Y0=new Map,Yk=async({html:e="",el:t})=>{const n=e,r={};if(document.body.attachShadow){const o=t.shadowRoot||t.attachShadow({mode:"open"});o.innerHTML=n}return r},Xk=ce(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var P;const i=Ie(),l=ye(),u=l.editor,[d,p]=h.useState(""),f=h.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((P=t.data.custom)==null?void 0:P.id),v=n===xt.web,b=!t.isTemplate||r,w=()=>{b&&(s==null||s({editor:u,template:t,loadTemplate:y}))},y=l.setProject,S=_=>{_.preventDefault(),s({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const T=setTimeout(async()=>{if(!f.current||!u)return;const O=`${t.isTemplate?"t-":""}${t.id}`;let L=Z0.get(O);if(!L){let $=Y0.get(n);if(!$){const B=new uj({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});$=await Zk(u.config.grapesjs,n,B.appEditorStore),Y0.set(n,$)}L=$?Kk($,t.data,n):"",Z0.set(O,L)}const A=f.current;Yk({el:A,html:L})});return()=>clearTimeout(T)},[f,u,n,t.data]);const{media:C,author:x}=t,E=c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return c.jsx(Qn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(k,{col:!0,children:[c.jsxs(F,{className:ae("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ae("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:C?c.jsx("img",{src:C,alt:t.name,className:ae("max-w-full")}):c.jsx("div",{className:ae("gs-utl-w-[1200px]","gs-utl-flex-shrink-0","gs-utl-flex-grow-0","gs-utl-origin-top","gs-utl-bg-white","gs-utl-scale-[0.232]","gs-utl-h-[431.034%]"),ref:f})}),m&&c.jsx(Yo,{className:ae("absolute top-2 right-2",U.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(k,{justify:"center",items:"center",className:ae(Oe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?E:c.jsx(Er,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(k,{space:"m",col:!0,children:[c.jsx(F,{children:c.jsx(rt,{size:"s",value:d,onChange:p,placeholder:g,required:!0})}),c.jsx(F,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(k,{className:ae("gjs-p-2 max-w-full",te.bt,U.br),col:!0,space:"s",children:[c.jsxs(k,{className:ae("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(F,{className:ae(Oe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&c.jsxs(F,{children:["by"," ",c.jsx("a",{className:ae(Mo.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),c.jsxs(k,{items:"center",children:[v&&c.jsxs(F,{className:ae("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(F,{className:ae("gjs-ml-auto"),children:c.jsx(su,{onConfirm:()=>a(t),className:"",children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(re,{icon:K.delete,size:se.sx})})})})]})]})]})})}),X0=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=Gp(),l=Ie().tScoped("templates"),d=ye().editor,p=jf(n==null?void 0:n.itemsPerRow),f=o??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(k,{justify:"center",children:l("notFound")}):c.jsx(ou,{data:e,listClassName:ae("grid gap-2 gjs-pr-2",p),itemContent:(g,m)=>c.jsx(Xk,{template:m,projectType:t,onSelect:f,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(No,{})})}),Jk=ce(function(){var v;const t=ye(),n=kv(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=Ie(),i=xa(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:b,template:w})=>{b(w),i.close()},p=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},f=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:xi.Existing,label:u("existentProjects")},{id:xi.Templates,label:u("templates")}],[a]),m=((v=l.project)==null?void 0:v.types)&&Xu();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(k,{col:!0,full:!0,space:"m",children:[m&&c.jsx(k,{items:"center",space:"m",children:c.jsx(F,{className:ae("gjs-ml-auto"),children:c.jsx(Le,{value:s,onChange:p,options:w$(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(F,{children:c.jsx(Xo,{tabs:g,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(F,{grow:!0,children:c.jsx(X0,{templates:r,projectType:xt[s],onSelect:d,onRemove:f,content:{itemsPerRow:3}})})]})}),Qk=({items:e,editor:t,customItems:n})=>n===!1?[]:et(n)?n({items:e,editor:t}):n||e,J0=e=>({icon:K.plus,size:se.s,className:X("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),Q0=e=>!e.type||e.type==="button",Rk="gs-cmp-topbar-left",e6=ce(function({buttons:t,className:n,style:r}){const o=ye(),s=Ie(),{isOpen:a,toggleOpen:i}=j4(),l=o.editor,d=s.tScoped("blockManager")("blocks"),p=Qk({items:[{id:`blocks-${d}`,tooltip:d,size:wb.s,icon:J0(a),variant:yb.primary,editorEvents:{[_n.toggleBlocksPanel]:({fromEvent:f,setState:g})=>{g({icon:J0(f.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(k,{gap:"s",items:"center",justify:"start",className:X(Rk,Te.xS,n),style:r,nowrap:!0,children:p.map(({id:f,...g})=>Q0(g)?c.jsx(Hc,{...g},f):kt({id:f,...g}))})}),t6=[{id:Eo.auto,label:"Auto"},{id:Eo.dark,label:"Dark"},{id:Eo.light,label:"Light"}],n6={size:"s"},Df=".grapesjs",r6=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},o6=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const o=r.actions;return o===!1?[]:et(o)?o({actions:e,editor:t}):o||(n?et(n)?n({items:e,editor:t}):n:e)},s6="gs-cmp-topbar-right",a6=ce(function({editor:t,className:n,buttons:r,...o}){const s=ye(),{theme:a,setTheme:i}=zr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:f,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=s,b=xa(),w=Ie(),y=A=>w.t(`actions.${A}`),S=t.Storage.events,C=l.events,x="change:changesCount",E=(A,$)=>()=>{et(A)?A({editor:t}):l.isActive(A)?l.stop(A):l.run(A,$)},P=A=>({[`${C.runCommand}${A}`]:({setState:$})=>$({active:!0}),[`${C.stopCommand}${A}`]:({setState:$})=>$({active:!1})}),_=[{id:Sr.componentOutline,icon:K.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:P("core:component-outline")},{id:Sr.preview,icon:K.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:P("core:preview")},{id:Sr.fullscreen,icon:K.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:P("core:fullscreen")},{id:Sr.showCode,icon:K.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(ne.dialogExportCode)},{id:Sr.showImportCode,icon:K.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(ne.dialogImportCode)},{id:Sr.clearCanvas,icon:K.delete,tooltip:y("clearCanvas.title"),onClick:()=>b.confirm({title:y("clearCanvas.title"),content:y("clearCanvas.content"),confirmButton:{variant:"danger",children:y("clearCanvas.title")},onConfirm:()=>{v?t.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):t.Components.clear()}})},{id:Sr.store,tooltip:y("store.title"),onClick:async()=>{try{if(s.isSaving)return;await t.store()}catch(A){t.getModel()._isStoring=!1,console.error(A)}},editorEvents:{"change:changesCount":({setState:A})=>A({}),[S.startStore]:({setState:A})=>A({disabled:!0}),[S.endStore]:({setState:A})=>A({disabled:!1})},label:()=>c.jsxs("div",{className:X("relative"),children:[c.jsx(re,{icon:K.floppy,size:se.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:X("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",U.bg),children:c.jsx("div",{className:X(Oe.dot,U.bgW)})}),s.isSaving&&c.jsx("div",{className:X("absolute right-0 bottom-0 gjs-rounded-full",U.bg),children:c.jsx(re,{icon:K.refresh,size:"11px",className:X(Oe.spin)})})]})},{id:Sr.undo,icon:K.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:A})=>A({disabled:!u.hasUndo()})}},{id:Sr.redo,icon:K.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:A})=>A({disabled:!u.hasRedo()})}}],T=o6({actions:_,sdkOptions:m,editor:t,buttons:r}),O=[{id:"about",label:y("about.title"),icon:K.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(b$,{})})},{id:"embed",label:y("embed.title"),icon:K.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(y$,{})})},{id:"openProject",label:y("open.title"),icon:K.folder,action:async()=>{let A="";try{A=await(await t$({extensions:[Df]})).text()}catch($){return console.error($)}s.loadProjectData(JSON.parse(A))}},{id:"saveProject",label:y("save.title"),icon:K.contentSave,action:async()=>{const A=t.getProjectData(),$=new Blob([JSON.stringify(A)]),B=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await r$($,{fileName:`${B}${Df}`,extensions:[Df]})}catch(M){return console.error(M)}}},{id:"loadProject",label:y("newProject.title"),icon:K.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(Jk,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:K.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const A=await(d==null?void 0:d.userChoice);(A==null?void 0:A.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(k,{items:"center",space:"m",children:[c.jsx(F,{children:"Theme"}),c.jsx(F,{children:c.jsx(Xo,{tabs:t6,onChange:A=>i(A),value:a,variant:"pills"})})]})}]].filter(({id:A})=>!((!f||!d)&&A==="installApp"||!r6(m,A))),L=(A,$)=>B=>{et(A)&&(A(B),$())};return c.jsxs(k,{space:"s",items:"center",justify:"end",className:X(s6,Te.xS,n),nowrap:!0,...o,children:[T.map(({id:A,...$})=>Q0($)?c.jsx(Hc,{size:"s",...$},A):kt({id:A,...$})),c.jsx(F,{children:m.settingsMenu!==!1&&O.length>0&&c.jsx(Er,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(re,{icon:K.cog,size:se.s}),buttonProps:n6,overlay:!0,children:({close:A})=>c.jsx(c.Fragment,{children:O.map($=>c.jsx(Oa,{action:L($.action,A),icon:$.icon,label:$.label},$.id))})})})]})});function i6({devices:e,selected:t,className:n,style:r,select:o}){const s=e.map(a=>({id:a.id,label:a.getName(),icon:a.attributes.icon}));return s.length?c.jsx(Le,{size:"xs",className:n,style:r,value:t,options:s,onChange:o}):null}const l6="gs-devices",R0=h.memo(function({className:t,style:n}){return c.jsx(VN,{children:r=>c.jsx(i6,{className:N(l6,t),style:n,...r})})}),Qi="gs-cmp-editor-topbar",c6=ce(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:p}=ye(),f=n??l,g=h.useMemo(()=>({...r,minHeight:f,marginTop:u||!p?`-${f}px`:0}),[u,p,r]);return c.jsxs(c.Fragment,{children:[c.jsx(F,{className:N(Qi,"gs-utl-transition-spacing gs-utl-w-full",te.bb,U.br,t),style:g,children:o??c.jsxs(k,{className:N(`${Qi}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(F,{className:N(`${Qi}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(e6,{...s})}),c.jsx(F,{className:N(`${Qi}__wrp-center`),children:i!==!1&&c.jsx(R0,{...i})}),c.jsx(F,{className:N(`${Qi}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(a6,{editor:d,...a})})]})}),c.jsx(F,{className:N("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:c.jsx(Ke,{className:N("gs-cmp-close-preview gs-utl-m-4",U.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(re,{icon:K.eyeOff,size:se.s})})})]})}),u6="gs-sidebar-top",ey=h.memo(ce(function({height:t,children:n,...r}){return c.jsx(c6,{height:t,...r,style:Fc(r),className:N(u6,"gs-utl-flex",Dc(r)),children:n?kt(n):void 0})})),d6="gs-canvas-sidebar-top",p6=h.memo(ce(function({className:t,sidebarTop:n,...r}){return c.jsxs(xn,{className:N(d6,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(ey,{...n}),c.jsx(qb,{grow:!0})]})})),f6="gs-code-field",h6=ce(function(e){const{editor:t}=ye(),{isDarkTheme:n}=zr(),{editorEvents:r,onChange:o}=e,[s,a]=h.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(p=>({...p,...d}))}),l=u=>o==null?void 0:o(i(u||""));return So({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(vo,{className:N(f6,s.className),language:s.language,style:s.style,label:s.label,name:s.name,defaultValue:s.value,size:s.size,required:s.required,disabled:s.disabled,readOnly:s.readOnly,minHeight:s.minHeight,row:s.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});function au(){return(au=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ty(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function Ff(e){var t=h.useRef(e),n=h.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Na=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},Ri=function(e){return"touches"in e},Bf=function(e){return e&&e.ownerDocument.defaultView||self},ny=function(e,t,n){var r=e.getBoundingClientRect(),o=Ri(t)?function(s,a){for(var i=0;i<s.length;i++)if(s[i].identifier===a)return s[i];return s[0]}(t.touches,n):t;return{left:Na((o.pageX-(r.left+Bf(e).pageXOffset))/r.width),top:Na((o.pageY-(r.top+Bf(e).pageYOffset))/r.height)}},ry=function(e){!Ri(e)&&e.preventDefault()},zf=h.memo(function(e){var t=e.onMove,n=e.onKey,r=ty(e,["onMove","onKey"]),o=h.useRef(null),s=Ff(t),a=Ff(n),i=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){ry(b),(Ri(b)?b.touches.length>0:b.buttons>0)&&o.current?s(ny(o.current,b,i.current)):v(!1)},m=function(){return v(!1)};function v(b){var w=l.current,y=Bf(o.current),S=b?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",g),S(w?"touchend":"mouseup",m)}return[function(b){var w=b.nativeEvent,y=o.current;if(y&&(ry(w),!function(C,x){return x&&!Ri(C)}(w,l.current)&&y)){if(Ri(w)){l.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),s(ny(y,w,i.current)),v(!0)}},function(b){var w=b.which||b.keyCode;w<37||w>40||(b.preventDefault(),a({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},v]},[a,s]),d=u[0],p=u[1],f=u[2];return h.useEffect(function(){return f},[f]),h.createElement("div",au({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:p,tabIndex:0,role:"slider"}))}),iu=function(e){return e.filter(Boolean).join(" ")},Uf=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=iu(["react-colorful__pointer",e.className]);return h.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},hn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},oy=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:hn(e.h),s:hn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:hn(o/2),a:hn(r,2)}},Wf=function(e){var t=oy(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Gf=function(e){var t=oy(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},g6=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:hn(255*[r,i,a,a,l,r][u]),g:hn(255*[l,r,r,i,a,a][u]),b:hn(255*[a,a,l,r,r,i][u]),a:hn(o,2)}},m6=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?v6({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},v6=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:hn(60*(i<0?i+6:i)),s:hn(s?a/s*100:0),v:hn(s/255*100),a:o}},b6=h.memo(function(e){var t=e.hue,n=e.onChange,r=iu(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(zf,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Na(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":hn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Uf,{className:"react-colorful__hue-pointer",left:t/360,color:Wf({h:t,s:100,v:100,a:1})})))}),y6=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Wf({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(zf,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Na(t.s+100*o.left,0,100),v:Na(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+hn(t.s)+"%, Brightness "+hn(t.v)+"%"},h.createElement(Uf,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Wf(t)})))}),w6=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},S6=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function C6(e,t,n){var r=Ff(n),o=h.useState(function(){return e.toHsva(t)}),s=o[0],a=o[1],i=h.useRef({color:t,hsva:s});h.useEffect(function(){if(!e.equal(t,i.current.color)){var u=e.toHsva(t);i.current={hsva:u,color:t},a(u)}},[t,e]),h.useEffect(function(){var u;w6(s,i.current.hsva)||e.equal(u=e.fromHsva(s),i.current.color)||(i.current={hsva:s,color:u},r(u))},[s,e,r]);var l=h.useCallback(function(u){a(function(d){return Object.assign({},d,u)})},[]);return[s,l]}var x6=typeof window<"u"?h.useLayoutEffect:h.useEffect,E6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},sy=new Map,P6=function(e){x6(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!sy.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,sy.set(t,n);var r=E6();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},T6=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Gf(Object.assign({},n,{a:0}))+", "+Gf(Object.assign({},n,{a:1}))+")"},s=iu(["react-colorful__alpha",t]),a=hn(100*n.a);return h.createElement("div",{className:s},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(zf,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:Na(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Uf,{className:"react-colorful__alpha-pointer",left:n.a,color:Gf(n)})))},O6=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=ty(e,["className","colorModel","color","onChange"]),i=h.useRef(null);P6(i);var l=C6(n,o,s),u=l[0],d=l[1],p=iu(["react-colorful",t]);return h.createElement("div",au({},a,{ref:i,className:p}),h.createElement(y6,{hsva:u,onChange:d}),h.createElement(b6,{hue:u.h,onChange:d}),h.createElement(T6,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},_6={defaultColor:"rgba(0, 0, 0, 1)",toHsva:m6,fromHsva:function(e){var t=g6(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:S6},A6=function(e){return h.createElement(O6,au({},e,{colorModel:_6}))};function L6(e){if(!Un()||!document.body)return null;const{className:t,onPointerUp:n,onPointerCancel:r}=e,o=N(t,"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50");return On.createPortal(c.jsx("div",{onPointerUp:n,onPointerCancel:r,className:o}),document.body)}var M6={grad:.9,turn:360,rad:360/(2*Math.PI)},bo=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Ut=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},rr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ay=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},iy=function(e){return{r:rr(e.r,0,255),g:rr(e.g,0,255),b:rr(e.b,0,255),a:rr(e.a)}},qf=function(e){return{r:Ut(e.r),g:Ut(e.g),b:Ut(e.b),a:Ut(e.a,3)}},N6=/^#([0-9a-f]{3,8})$/i,lu=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},ly=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:s?a/s*100:0,v:s/255*100,a:o}},cy=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:255*[r,i,a,a,l,r][u],g:255*[l,r,r,i,a,a][u],b:255*[a,a,l,r,r,i][u],a:o}},uy=function(e){return{h:ay(e.h),s:rr(e.s,0,100),l:rr(e.l,0,100),a:rr(e.a)}},dy=function(e){return{h:Ut(e.h),s:Ut(e.s),l:Ut(e.l),a:Ut(e.a,3)}},py=function(e){return cy((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},el=function(e){return{h:(t=ly(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},$6=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,k6=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,I6=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V6=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Kf={string:[[function(e){var t=N6.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Ut(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Ut(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=I6.exec(e)||V6.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:iy({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=$6.exec(e)||k6.exec(e);if(!t)return null;var n,r,o=uy({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(M6[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return py(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=o===void 0?1:o;return bo(t)&&bo(n)&&bo(r)?iy({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,s=o===void 0?1:o;if(!bo(t)||!bo(n)||!bo(r))return null;var a=uy({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return py(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!bo(t)||!bo(n)||!bo(r))return null;var a=function(i){return{h:ay(i.h),s:rr(i.s,0,100),v:rr(i.v,0,100),a:rr(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return cy(a)},"hsv"]]},fy=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},H6=function(e){return typeof e=="string"?fy(e.trim(),Kf.string):typeof e=="object"&&e!==null?fy(e,Kf.object):[null,void 0]},Zf=function(e,t){var n=el(e);return{h:n.h,s:rr(n.s+100*t,0,100),l:n.l,a:n.a}},Yf=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},hy=function(e,t){var n=el(e);return{h:n.h,s:n.s,l:rr(n.l+100*t,0,100),a:n.a}},Xf=function(){function e(t){this.parsed=H6(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Ut(Yf(this.rgba),2)},e.prototype.isDark=function(){return Yf(this.rgba)<.5},e.prototype.isLight=function(){return Yf(this.rgba)>=.5},e.prototype.toHex=function(){return t=qf(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?lu(Ut(255*s)):"","#"+lu(n)+lu(r)+lu(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return qf(this.rgba)},e.prototype.toRgbString=function(){return t=qf(this.rgba),n=t.r,r=t.g,o=t.b,(s=t.a)<1?"rgba("+n+", "+r+", "+o+", "+s+")":"rgb("+n+", "+r+", "+o+")";var t,n,r,o,s},e.prototype.toHsl=function(){return dy(el(this.rgba))},e.prototype.toHslString=function(){return t=dy(el(this.rgba)),n=t.h,r=t.s,o=t.l,(s=t.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+s+")":"hsl("+n+", "+r+"%, "+o+"%)";var t,n,r,o,s},e.prototype.toHsv=function(){return t=ly(this.rgba),{h:Ut(t.h),s:Ut(t.s),v:Ut(t.v),a:Ut(t.a,3)};var t},e.prototype.invert=function(){return jn({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),jn(Zf(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),jn(Zf(this.rgba,-t))},e.prototype.grayscale=function(){return jn(Zf(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),jn(hy(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),jn(hy(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?jn({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Ut(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=el(this.rgba);return typeof t=="number"?jn({h:t,s:n.s,l:n.l,a:n.a}):Ut(n.h)},e.prototype.isEqual=function(t){return this.toHex()===jn(t).toHex()},e}(),jn=function(e){return e instanceof Xf?e:new Xf(e)},gy=[],j6=function(e){e.forEach(function(t){gy.indexOf(t)<0&&(t(Xf,Kf),gy.push(t))})},D6={grad:.9,turn:360,rad:360/(2*Math.PI)},Jf=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},cu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Qf=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},my=function(e){return{h:(t=e.h,(t=isFinite(t)?t%360:0)>0?t:t+360),w:Qf(e.w,0,100),b:Qf(e.b,0,100),a:Qf(e.a)};var t},vy=function(e){return{h:cu(e.h),w:cu(e.w),b:cu(e.b),a:cu(e.a,3)}},by=function(e){return{h:function(t){var n=t.r,r=t.g,o=t.b,s=t.a,a=Math.max(n,r,o),i=a-Math.min(n,r,o),l=i?a===n?(r-o)/i:a===r?2+(o-n)/i:4+(n-r)/i:0;return{h:60*(l<0?l+6:l),s:a?i/a*100:0,v:a/255*100,a:s}}(e).h,w:Math.min(e.r,e.g,e.b)/255*100,b:100-Math.max(e.r,e.g,e.b)/255*100,a:e.a}},yy=function(e){return function(t){var n=t.h,r=t.s,o=t.v,s=t.a;n=n/360*6,r/=100,o/=100;var a=Math.floor(n),i=o*(1-r),l=o*(1-(n-a)*r),u=o*(1-(1-n+a)*r),d=a%6;return{r:255*[o,l,i,i,u,o][d],g:255*[u,o,o,l,i,i][d],b:255*[i,i,u,o,o,l][d],a:s}}({h:e.h,s:e.b===100?0:100-e.w/(100-e.b)*100,v:100-e.b,a:e.a})},F6=function(e){var t=e.h,n=e.w,r=e.b,o=e.a,s=o===void 0?1:o;if(!Jf(t)||!Jf(n)||!Jf(r))return null;var a=my({h:Number(t),w:Number(n),b:Number(r),a:Number(s)});return yy(a)},B6=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z6=function(e){var t=B6.exec(e);if(!t)return null;var n,r,o=my({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(D6[r]||1)),w:Number(t[3]),b:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return yy(o)};function U6(e,t){e.prototype.toHwb=function(){return vy(by(this.rgba))},e.prototype.toHwbString=function(){return n=vy(by(this.rgba)),r=n.h,o=n.w,s=n.b,(a=n.a)<1?"hwb("+r+" "+o+"% "+s+"% / "+a+")":"hwb("+r+" "+o+"% "+s+"%)";var n,r,o,s,a},t.string.push([z6,"hwb"]),t.object.push([F6,"hwb"])}function W6(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var o in n)r[n[o]]=o;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,l,u=r[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),p=1/0,f="black";if(!s.length)for(var g in n)s[g]=new e(n[g]).toRgb();for(var m in n){var v=(i=d,l=s[m],Math.pow(i.r-l.r,2)+Math.pow(i.g-l.g,2)+Math.pow(i.b-l.b,2));v<p&&(p=v,f=m)}return f}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}j6([W6,U6]);const G6="rgb",wy="rgba(0, 0, 0, 1)",q6=jn(wy).toRgb(),K6=[{id:"rgba",label:"RGB"},{id:"hex",label:"HEX"},{id:"hsla",label:"HSL"},{id:"hwb",label:"HWB"}],Z6=[{id:"hex",label:"HEX"},{id:"rgba",label:"RGB"}],tl=e=>e==null?"":`${e}`,Sy=e=>typeof e=="string",Cy=(e,t)=>e.some(n=>tl(n.id)===t),Y6=e=>{const t=(e||"").trim().toLowerCase();return t?t.startsWith("#")?"hex":t.startsWith("rgba(")||t.startsWith("rgb(")?"rgba":t.startsWith("hsla(")||t.startsWith("hsl(")?"hsla":t.startsWith("hwb(")?"hwb":"":""},Rf=(e,t=[],n)=>{var a;const r=tl(e).trim();if(r&&(!t.length||Cy(t,r)))return r;const o=Y6(n);return o&&(!t.length||Cy(t,o))?o:tl((a=t[0])==null?void 0:a.id).trim()||G6},X6=(e,t)=>{const n=e[t];return typeof n=="function"?n.call(e):void 0},J6=(e=[],t)=>{if(!t)return;const n=tl(t).toLowerCase();return e.find(r=>tl(r.id).toLowerCase()===n)},Q6=(e,t)=>{if(!t)return e;const n=jn(e);if(!n.isValid())return e;switch(t.toLowerCase()){case"rgb":case"rgba":return n.toRgbString();case"hex":return n.toHex();case"hsl":case"hsla":return n.toHslString();case"hwb":return n.toHwbString();case"name":return X6(n,"toName")||e;default:return e}},xy=({value:e,format:t,prevFormat:n,formats:r,onFormatChange:o,callOnFormatChange:s})=>{var u;const a=t||"",i=J6(r,a);if(!!(i!=null&&i.onFormat)||!!(s&&o)){const d=jn(e),p={value:e,format:a,prevFormat:n||a,valueRgb:d.isValid()?d.toRgb():q6},f=(u=i==null?void 0:i.onFormat)==null?void 0:u.call(i,p);if(Sy(f))return f;if(s){const g=o==null?void 0:o(p);if(Sy(g))return g}}return Q6(e,a)||e},R6=e=>{const t=(e||"").trim();if(t.toLowerCase().startsWith("rgba("))return t;const n=jn(t);if(!n.isValid())return wy;const{r,g:o,b:s,a}=n.toRgb();return`rgba(${r}, ${o}, ${s}, ${a})`},e8=e=>!!(e!=null&&e.Components.getType("mjml")),Ey=e=>({formats:e8(e)?Z6:K6}),uu=e=>e==null?"":`${e}`,t8=(e=[],t)=>!t||!e.length||e.some(n=>uu(n.id).trim().toLowerCase()===uu(t).trim().toLowerCase());function Py({value:e,format:t,formats:n=[],onChange:r,onFormatChange:o,disabled:s}){const[a,i]=h.useState(()=>Rf(t,n,e||"")),l=h.useMemo(()=>R6(e||""),[e]),u=h.useMemo(()=>xy({value:e||"",format:a,prevFormat:a,formats:n}),[e,a,n]),d=h.useRef(e||""),[p,f]=h.useState(!1),g=Un()&&!!window.EyeDropper,m=!!n.length;h.useEffect(()=>{i(E=>{if(t){const P=Rf(t,n);return E===P?E:P}return t8(n,E)?E:Rf(void 0,n)})},[t,n]),h.useEffect(()=>{d.current=e||""},[e]);const v=(E,P=a,_={})=>xy({value:E,format:P,prevFormat:_.prevFormat||a,formats:n,onFormatChange:o,callOnFormatChange:_.callOnFormatChange}),b=E=>{d.current=E,r==null||r(E)},w=E=>{const P=v(E);d.current=P,r==null||r(P,!0)},y=E=>{const P=uu(E).trim();if(!P)return;const _=a,T=e||"";i(P);const O=v(T,P,{prevFormat:_,callOnFormatChange:!0});d.current=O,r==null||r(O,!1)},S=()=>{g&&new window.EyeDropper().open().then(P=>{const _=v(P.sRGBHex);d.current=_,r==null||r(_)}).catch(console.warn)},C=()=>{f(!0)},x=()=>{const E=v(d.current);d.current=E,r==null||r(E,!1),f(!1)};return c.jsxs(c.Fragment,{children:[p&&c.jsx(L6,{className:"gs-utl-cursor-grabbing",onPointerUp:x,onPointerCancel:x}),c.jsx(A6,{className:"color-picker",color:l,onChange:w,onPointerDown:C,onPointerUp:x}),m&&c.jsx(Le,{classNameContainer:"gs-utl-mt-3",value:a,options:n,size:"s",onChange:E=>y(uu(E)),disabled:s}),c.jsxs(k,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(rt,{size:"s",value:u,onChange:b,disabled:s})}),g&&c.jsx(Ke,{type:"button",onClick:S,children:c.jsx(re,{icon:K.eyedropperVariant,size:se.s})})]})]})}const n8="gs-cmp-color-picker",r8={backgroundSize:"10px"},o8=[0,15];function Ty({className:e,value:t,format:n,formats:r,onChange:o,onFormatChange:s,disabled:a}){const[i,l]=h.useState(!1),u=N(`${n8}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,U.br),d=()=>{l(!1)},p=c.jsxs("div",{style:r8,className:u,children:[i&&c.jsx("div",{onPointerUp:d,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx("div",{className:"gs-utl-w-4 gs-utl-h-4",style:{backgroundColor:t}})]});return c.jsx(Er,{handler:p,title:"Color",size:"s",placement:"left-end",offset:o8,clickAway:!0,disabled:a,children:c.jsx(Py,{value:t,format:n,formats:r,onChange:o,onFormatChange:s,disabled:a})})}const s8="gs-cmp-color-field";function a8(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i,colorPickerProps:l,name:u,required:d,readOnly:p}=e,[f,g]=h.useState(jc(n)),m=Di(e);h.useEffect(()=>{g(jc(n))},[n]);const v=(S,C)=>{s==null||s(S,C)},b=S=>{switch(S.key){case"Escape":return g(n);case"Enter":v(f),o&&(S.preventDefault(),S.stopPropagation())}},w=()=>{v(f)},y=Ko({...e,className:N(s8,t)});return c.jsxs("div",{...y,children:[c.jsx(Cr,{...e,as:a}),c.jsxs(k,{className:cf(e),items:"center",space:"s",children:[c.jsx(F,{children:c.jsx(Ty,{...l,value:n,onChange:s,disabled:i})}),c.jsx(F,{grow:!0,children:c.jsx("input",{name:u,required:d,readOnly:p,disabled:i,placeholder:r,className:N(m,i&&"gs-utl-pointer-events-none"),value:f,onChange:S=>g(S.target.value),onBlur:w,onKeyDown:b})})]})]})}const Zr=ce(function(t){const{editor:n}=ye(),r=Ac(),o={...Ey(n),...t.colorPickerProps},s=r.getOverrideProps("colorField",{props:{...t,colorPickerProps:o},editor:n});return c.jsx(a8,{...s})}),i8="gs-cmp-studio-color-field",l8=h.memo(ce(function(t){const{editor:n}=ye(),{onChange:r,editorEvents:o}=t,[s,a]=h.useState(()=>({...t})),i=(u,d)=>{r==null||r({value:u||"",partial:d,editor:n,state:s,setState:p=>a(f=>({...f,...p}))})},l={className:N(i8,s.className),style:s.style,value:s.value||"",size:s.size,label:s.label,name:s.name,required:s.required,readOnly:s.readOnly,placeholder:s.placeholder,disabled:s.disabled,preventSubmitOnEnter:s.preventSubmitOnEnter,colorPickerProps:s.colorPickerProps,onChange:i};return So({editor:n,editorEvents:o,localState:s,setLocalState:a}),c.jsx(Zr,{...l})})),c8="gs-cmp-studio-color-picker",u8=h.memo(ce(function(t){const{editor:n}=ye(),o=Ac().getOverrideProps("colorPicker",{props:{...Ey(n),...t},editor:n}),{className:s,style:a,value:i="",format:l,formats:u,disabled:d,onChange:p,onFormatChange:f,editorEvents:g}=o,[m,v]=h.useState(()=>({className:s,style:a,value:i,format:l,formats:u,disabled:d})),b=(y,S)=>{const C=y||"";p==null||p({value:C,partial:S,editor:n,state:m,setState:x=>v(E=>({...E,...x}))})},w=y=>f==null?void 0:f({...y,editor:n,state:m,setState:S=>v(C=>({...C,...S}))});return So({editor:n,editorEvents:g,localState:m,setLocalState:v}),c.jsx("div",{className:N(c8,m.className,Te.m),style:m.style,children:c.jsx(Py,{value:m.value||"",format:m.format,formats:m.formats,onChange:b,onFormatChange:w,disabled:m.disabled})})})),d8="gs-cmp-column",p8=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(d8,U.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:kt(n)})}),eh=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
322
- <path fill="currentColor" d="M20 6c0-2.168-3.663-4-8-4S4 3.832 4 6v2c0 2.168 3.663 4 8 4s8-1.832 8-4zm-8 13c-4.337 0-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4v-3c0 2.168-3.663 4-8 4"/><path fill="currentColor" d="M20 10c0 2.168-3.663 4-8 4s-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4z"/></svg>`,zs="--before-content",th={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},Oy={stylable:!1,traits:[]};function f8(e){return typeof e=="object"&&e.type===Bt.variable}function _y(e){if(f8(e)){const{path:t}=e;return Ay(t||"")}return e}function Ay(e){return`{{ ${e} }}`}function h8(e){const t={};return e.DataSources.getAll().forEach(n=>{const r=n.get("id");if(!r)return;const o=n.getRecords();if(!o){t[r]={};return}t[r]=o.reduce((s,a)=>{if(!a)return s;let i={...a.attributes};return delete i.__p,delete i.id,r===js.globalStyles&&(i={value:i.value}),{...s,[a.id]:i}},{})}),t}function Ly(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const nh=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags)??t?{...Oy}:{}},rh=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e,r=(a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags;return t||r===!0?{...Oy}:{}},g8=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,m8=e=>Array.isArray(e)?"array":e===null?"default":typeof e,v8=ce(({name:e,value:t,isActive:n,isCollection:r,onClick:o,className:s})=>{const a=Ie().tScoped("dataSources"),i=typeof t=="object"&&t!==null,l={array:K.codeBrackets,object:K.codeBraces,string:K.codeString,number:K.number,boolean:K.toggleSwitchOffOutline,default:K.null},u=m8(t),d=N(s,"gs-utl-text-left",U.hBgH,te.b,te.rnd,Te.xy,n?[te.bA,U.tA]:[U.br,U.txtHighEmphasisH]),p=f=>typeof f=="object"?Array.isArray(f)?a("items",{params:{length:f.length}}):f?a("properties",{params:{length:Object.keys(f).length}}):"null":String(f);return c.jsx(Ke,{onClick:o,border:!1,className:d,full:!0,children:c.jsxs(k,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(k,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(k,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(re,{icon:l[u],size:se.s}),c.jsx(F,{className:N(Oe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(F,{className:N("gs-utl-w-full",Oe.txtEllips,Oe.disabled),children:p(t)})]}),i&&c.jsx(F,{children:c.jsx(re,{size:se.sx,icon:K.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),b8="gs-cmp-data-path-explorer",My=ce(function({additionalSources:t,onChange:n,path:r=""}){const{editor:o}=ye(),s=h.useRef({}),[a,i]=h.useState(()=>r.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...o?h8(o):{},...t}),[o,t]),p=(v,b)=>{let w=s.current;for(let y=0;y<b&&y<v.length;y++){const S=v[y];if(w&&typeof w=="object"&&S in w)w=w[S];else{w=void 0;break}}return!w||typeof w!="object"?[]:Object.entries(w).map(([y,S])=>{const C=v.slice(0,b).concat(y),x=a[b]===y,E=b===0&&no(S)&&S.collectionId===y,P=()=>{const _=x?C.slice(0,-1):C;n==null||n(_.join("."),{paths:_}),i(_)};return c.jsx(v8,{className:N(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:P},y)})};h.useEffect(()=>{s.current=d;const v=[];for(let b=0;b<=a.length;b++){const w=p(a,b);w.length>0&&v.push(w)}u(v)},[d,a]);const f=N(b8,U.bg,U.br,te.b,te.rnd,Oe.scrollX,"gs-utl-h-full"),g=N("gs-utl-min-w-[220px]",U.br),m=N("gs-utl-h-full gs-utl-max-h-[60vh]",Oe.scrollY,Te.xyS);return c.jsx(k,{className:f,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(F,{className:N(g,b!==l.length-1&&te.br),children:c.jsx(k,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function Ny(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function oh(e,t){const[n="",r="",...o]=e.split(".");return n&&t[n]?{collectionId:n,variableType:r,path:o.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const y8=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},w8=e=>{const{dataResolver:t,editor:n,value:r,defaultValue:o,additionalSources:s}=e,{path:a="",collectionId:i,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(i){const d=s==null?void 0:s[i],p=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:p}))||""}else return(u==null?void 0:u.getValue(r,o))||""},S8="gs-cmp-data-path-field",nl=ce(e=>{const{size:t="m",value:n="",label:r,open:o,defaultValue:s,additionalSources:a,dataResolver:i,readOnly:l,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:f}=e,{editor:g}=ye(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!o),[w,y]=h.useState(!1),S=!!l||v||w,C=()=>y(!w),x=D=>{const z=D??!v;b(z),f==null||f(z)},E=()=>x(!1),P=(...D)=>{p==null||p(...D)},_=D=>{S||p==null||p(D,{paths:D.split(".")})},T=y8({dataResolver:i,value:n}),O=w&&g?`"${w8({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:T,L=t==="m",A=L?"lg":t,$=L?se.l:se.s,B=m(v?"closePathExplorer":"openPathExplorer"),M={icon:v?K.close:K.databaseOutline,size:se.l},j={icon:w?K.eyeOff:K.eye,size:L?se.m:$},W=c.jsx(Ct,{block:!0,variant:"pr",size:A,title:B,onClick:()=>x(),icon:M});return c.jsxs(k,{className:S8,gap:t,col:!0,children:[c.jsxs(k,{gap:t,items:"end",nowrap:!0,children:[c.jsx(rt,{readOnly:S,label:r,value:w?O:T,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",U.txt,Oe.txtEllips),afterInput:!!n&&c.jsx(Ct,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Oe.hover,icon:j})}),d?c.jsx(Er,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:W,onClose:E,overlay:!0,children:c.jsx(My,{path:T,onChange:P,additionalSources:a})}):W]}),!!v&&!d&&c.jsx(My,{path:T,onChange:P,additionalSources:a})]})}),C8=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},$y=({value:e,step:t})=>{const n=parseFloat(`${e}`);let r=0;if(Math.floor(n)!==n&&t){const o=`${t}`.split(".")[1];r=(o==null?void 0:o.length)||0}return r?parseFloat(n.toFixed(r)):n},x8=({value:e,key:t,shiftKey:n,min:r,max:o,step:s=1})=>{const a=t==="ArrowUp",i=t==="ArrowDown";let l=null;if(a||i){l=Number(e);const u=parseFloat(`${s}`);a&&(l+=(n?10:1)*u),i&&(l-=(n?10:1)*u),l=`${du({min:r,max:o,value:l})}`,l=$y({value:l,step:s})}return l},du=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Ht(e)&&(o=Math.max(o,parseFloat(`${e}`)||0)),Ht(t)&&(o=Math.min(o,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:o}`},E8=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=p=>{const f=p.clientY-t,g=o-f*parseFloat(`${i}`);l=$y({value:du({min:s,max:a,value:g}),step:i}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},P8=(e,t,n={})=>{const{partial:r}=n,o=(s,a)=>s===a||r&&s.startsWith(a);return t.some(s=>o(typeof s=="string"?s:s.id,e))},ky=e=>Ht(e)?e:"",T8="gs-cmp-number-field";function $e(e){const{className:t,value:n,units:r,valueUnit:o,size:s="m",pan:a=!0,min:i,max:l,step:u,placeholder:d,disabled:p,onChange:f,onChangeUnit:g}=e,[m,v]=h.useState(ky(n)),[b,w]=h.useState(!1),y=(r==null?void 0:r.map(T=>({id:T,label:T})))||[],S={min:i,max:l,step:u};h.useEffect(()=>{v(ky(n))},[n,o]);const C=(T,O)=>{f==null||f(du({min:i,max:l,value:T}),O)},x=T=>{if(p)return;w(!0);const O=(L,A)=>{C(L,!!A),!A&&w(!1)};E8(m,T.clientY,O,S)},E=T=>{const{key:O,shiftKey:L}=T;switch(O){case"Escape":return v(n);case"Enter":return C(m)}const A=x8({step:u,value:n,key:O,shiftKey:L});A!==null&&(T.preventDefault(),C(A))},P=()=>{C(m)},_=Ko({...e,className:N(T8,t)});return c.jsxs("div",{..._,children:[b&&c.jsx("div",{className:N("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(Cr,{as:e.labelAs,...e}),c.jsxs(k,{className:cf(e),items:"center",space:"x2s",children:[!!a&&c.jsx(F,{onMouseDown:x,className:N("gs-utl-opacity-50 gs-utl-cursor-ns",s==="m"&&"-gs-utl-ml-3",s==="s"&&"-gs-utl-ml-2",a!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:a===!0?c.jsx(re,{icon:K.panVertical,size:se.s2x}):a}),c.jsx(F,{grow:!0,children:c.jsx("input",{className:Di(e),value:m,disabled:p,onChange:T=>v(T.target.value),placeholder:d,onBlur:P,onKeyDown:E})}),!!y.length&&c.jsx(F,{className:N(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Le,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:o,disabled:p,onChange:T=>g==null?void 0:g(T),options:y})})]})]})}const O8="gs-cmp-switch-field";function rl(e){const{className:t,value:n,label:r,labelAs:o,border:s,disabled:a,onChange:i}=e,l=!!n,u=N("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",l?U.bgA:U.bgH,ri.focus,s&&`${U.br} ${te.b}`);return c.jsx(gp.Group,{children:c.jsxs(k,{items:"center",className:N(O8,t),full:!0,children:[!!r&&c.jsx(gp.Label,{as:o,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(Cr,{...e,as:"span"})}),c.jsx(gp,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:N(U.bg,"gs-utl-inline-block gs-utl-w-4 gs-utl-h-4 gs-utl-transform gs-utl-rounded-full gs-utl-transition-transform",l?"gs-utl-translate-x-6":"gs-utl-translate-x-1")})})]})})}function sh(e){var a;const[t,n]=h.useState(((a=e.getDataResolver)==null?void 0:a.call(e))??{}),r=h.useRef(t),o=i=>{const l={...r.current,...i};r.current=l,n(l)},s=()=>{e.setDataResolver(r.current)};return h.useEffect(()=>{const i="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(i,l),()=>{e.off(i,l)}},[e]),{localData:t,updateLocalData:o,syncToComponent:s}}const _8="gs-cmp-data-collection-picker",A8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=sh(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=Ny(a),d=l===Number.MAX_VALUE,p=Ie().tScoped("dataSources"),f=d?"":l,g=()=>{o(),t==null||t({value:n})},m=y=>r({dataSource:{...a,path:y}}),v=y=>r({startIndex:y}),b=y=>r({endIndex:y}),w=y=>r({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(k,{className:_8,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(rt,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(Tb,{size:"s",value:s,block:!0})]}),c.jsx(nl,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx($e,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:v}),c.jsx($e,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:f==null?void 0:f.toString(),onChange:b,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(F,{children:c.jsx(rl,{label:p("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(k,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:p("confirm")})})]})}),L8="gs-data-collection-picker",M8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(L8,t),...o,children:c.jsx(A8,{component:n,onConfirm:r})})});var Dn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Dn||{}),Fn=(e=>(e.equals="equals",e.isTruthy="isTruthy",e.isFalsy="isFalsy",e.isDefined="isDefined",e.isNull="isNull",e.isUndefined="isUndefined",e.isArray="isArray",e.isObject="isObject",e.isString="isString",e.isNumber="isNumber",e.isBoolean="isBoolean",e.isDefaultValue="isDefaultValue",e))(Fn||{}),ah=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(ah||{}),ih=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(ih||{});const N8=[...Object.values(ih),...Object.values(ah),...Object.values(Fn)],lh={string:Object.values(ih),number:Object.values(ah),dataSource:N8},$8=h.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case Dn.DATA_SOURCE:return c.jsx(nl,{size:"s",pickerInPopover:!0,value:Ny(s),onChange:i=>a(r,i,o),additionalSources:n});case Dn.NUMBER:return c.jsx($e,{size:"s",value:s,onChange:i=>a(r,i,o)});default:return c.jsx(rt,{size:"s",value:s,onChange:i=>a(r,i,o)})}}),k8="gs-cmp-statement-side",Iy=h.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(k,{className:N(k8,"gs-utl-flex-grow"),col:!0,children:[c.jsx(qo,{size:"s",children:o}),c.jsxs(k,{items:"center",gap:"xs",children:[c.jsx(F,{children:c.jsx(Le,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(F,{grow:!0,children:c.jsx($8,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),pu=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Dn.DATA_SOURCE:typeof e=="string"?Dn.STRING:typeof e=="number"?Dn.NUMBER:Dn.STRING,I8=(e,t,n)=>{switch(t){case Dn.STRING:return e||"";case Dn.NUMBER:return e?Number(e):0;case Dn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(ct(e)?oh(e,r):e)??{path:"",defaultValue:""}}}default:return e}},V8=e=>lh[e][0],H8=e=>![Fn.isTruthy,Fn.isFalsy,Fn.isDefined,Fn.isNull,Fn.isUndefined,Fn.isArray,Fn.isObject,Fn.isString,Fn.isNumber,Fn.isBoolean,Fn.isDefaultValue].includes(e),j8="gs-cmp-statement",D8=ce(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=Ie().tScoped("dataSources"),[a,i]=h.useState(()=>pu(t.left)),[l,u]=h.useState(()=>pu(t.right)),d=lh[a]||lh[Dn.STRING],p=h.useMemo(()=>Object.values(Dn).map(C=>({id:C,label:Lr(C)})),[]),f=h.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);h.useEffect(()=>{i(pu(t.left)),u(pu(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const P=I8(x,E,o),_=C==="left",T=_&&E!==Dn.DATA_SOURCE;_?i(E):u(E),g({[C]:P,...T&&{operator:V8(E)}})},v=(C,x)=>m(C,null,x),b=C=>g({operator:C}),w=N(j8,r,U.br,te.b,te.rnd,Te.xy),y=H8(t.operator),S={additionalSources:o,onChange:m,onTypeChange:v,typeOptions:p};return c.jsx(k,{className:N(w,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(k,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(Iy,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(F,{children:c.jsx(Le,{size:"s",label:s("operator"),value:t.operator,options:f,onChange:b})}),y&&c.jsx(Iy,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),ch="gs-cmp-statements-group",F8=e=>e==="and"||e==="or",fu=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),Vy=ce(e=>{const{className:t,condition:n,onUpdate:r,additionalSources:o,skipAddCondition:s}=e,a=Ie().tScoped("dataSources"),i=n.statements??[],l=n.logicalOperator||"and",u=m=>{F8(m)&&r({...n,logicalOperator:m})},d=()=>{fu(n),r(fu(n))},p=m=>{const v=i.filter((b,w)=>w!==m);r({...n,statements:v})},f=(m,v)=>{if(m>=0&&m<i.length){const b=[...i];b[m]=v,r({...n,statements:b})}},g=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return c.jsxs(k,{className:N(ch,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Xo,{value:l,onChange:u,tabs:g}),c.jsx(k,{className:`${ch}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,v)=>c.jsxs(k,{className:N(`${ch}__item`),gap:"s",col:!0,children:[c.jsx(D8,{additionalSources:o,statement:m,onChange:b=>f(v,b)}),v<i.length-1&&c.jsxs(k,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:N(U.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(Ct,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>p(v+1),icon:{icon:K.delete,size:se.s}})]})]},`stmt-${v}`))}),!s&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:K.plus,size:se.s},children:a("addCondition")})})]})}),B8="gs-cmp-data-condition-picker",z8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=sh(e),s=Ie().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:fu(a)})};return c.jsxs(k,{className:B8,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(Vy,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(k,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:K.plus,size:se.s},children:s("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),U8="gs-data-condition-picker",W8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(U8,t),...o,children:c.jsx(z8,{component:n,onConfirm:r})})}),G8="gs-data-path-field",q8=ce(({className:e,value:t="",onChange:n,...r})=>c.jsx(xn,{className:N(G8,e),...r,children:c.jsx(nl,{onChange:o=>n({value:o}),value:t})})),hu={type:"data-variable",path:"",defaultValue:""},Hy={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function ns(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const jy="gs-cmp-dynamic-value-picker",K8=ce(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=h.useState(()=>ns(e)?e:hu),[a,i]=h.useState(o.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const S=ns(e)?e:hu;(S.type!==o.type||JSON.stringify(S)!==JSON.stringify(o))&&(s(S),i(S.type))},[e]);const u=S=>{s(S),t==null||t({value:S})},d=S=>{const C=S;i(C);const x=o.type===C?o:C==="data-variable"?hu:Hy;u(x)},p=S=>{u({type:"data-variable",defaultValue:o.defaultValue,...oh(S,r)})},f=S=>{s(C=>{const x={...C,defaultValue:S};return t==null||t({value:x}),x})},g=S=>{u({...o,condition:S})},m=(S,C)=>{u({...o,[S]:C})},v=()=>{const S=o.condition;g(fu(S))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:hu,y=(o==null?void 0:o.type)==="data-condition"?o:Hy;return c.jsxs(k,{className:jy,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{className:jy,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Xo,{value:a,onChange:d,tabs:b}),c.jsx(F,{grow:!0,className:Te.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(nl,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:p}),c.jsx(rt,{label:l("defaultValue"),value:w.defaultValue||"",onChange:f})]}):c.jsxs(k,{gap:"m",col:!0,children:[c.jsx(Vy,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(rt,{label:l("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),c.jsx(rt,{label:l("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&c.jsx(k,{full:!0,justify:"end",className:Te.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:K.plus,size:se.s},children:l("addCondition")})})]}),c.jsx(k,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),Z8="gs-data-value-picker",Y8=ce(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(xn,{className:N(Z8,e),...s,children:c.jsx(K8,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),X8="gs-cmp-data-variable-picker",J8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=sh(e),s=Ie().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=f=>{r(oh(f,l))},d=()=>{o(),t==null||t({value:n})},p=f=>r({defaultValue:f});return c.jsxs(k,{className:X8,gap:"s",col:!0,nowrap:!0,children:[c.jsx(nl,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(rt,{label:s("defaultValue"),value:i,onChange:p}),c.jsx(k,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),Q8="gs-data-variable-picker",R8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(Q8,t),...o,children:c.jsx(J8,{component:n,onConfirm:r})})}),eI="gs-cmp-input-field",tI=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,disabled:i,inputType:l,readOnly:u,required:d,placeholder:p,onChange:f,onInput:g,editorEvents:m}){const{editor:v}=ye(),[b,w]=h.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:p})),y=x=>({value:x,editor:v,state:b,setState:E=>w(P=>({...P,...E}))}),S=x=>f==null?void 0:f(y(x)),C=x=>g==null?void 0:g(y(x));return So({editor:v,editorEvents:m,localState:b,setLocalState:w}),c.jsx(rt,{type:l,className:N(eI,b.className),style:b.style,label:b.label,name:b.name,value:b.value,size:b.size,required:b.required,disabled:b.disabled,readOnly:b.readOnly,placeholder:b.placeholder,onChange:S,onInput:C})})),nI="gs-menu-list",rI=ce(function({className:e,items:t,onItemClick:n,...r}){const{editor:o}=ye(),[s,a]=h.useState(),i=u=>{const{onClick:d}=u;if(d&&o)return p=>d({item:u,editor:o,...p})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(xn,{className:N(nI,U.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>h.createElement(Oa,{...u,label:u.layout?kt(u.layout):u.label,key:u.id??d,className:u.className,action:i(u),onActive:()=>a(u),onItemClick:l(),active:s===u,items:u.items}))})});function oI({children:e,accept:t,onChange:n,multiple:r=!0,...o}){const s=Ie(),a=h.useRef(null),i=()=>{const{current:l}=a;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:X("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...o,onClick:i,children:e||s.t("upload")})]})}const sI=ce(oI),aI=ce(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=Ai();return kt(r({asset:pr(a.toAsset(n)),assetProps:pr(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),iI="gs-cmp-asset-card",lI=ce(function(t){var p;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=Ie(),{editor:l}=ye();if(a)return l?c.jsx(aI,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return c.jsx(Qn,{padding:!1,className:ae(iI,"overflow-hidden max-w-full group",s),children:c.jsxs(k,{col:!0,children:[c.jsxs(F,{className:ae("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[c.jsx("div",{className:ae("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(k,{justify:"center",items:"center",className:ae(Oe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),c.jsxs(k,{className:ae("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(F,{className:ae(Oe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(su,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(k,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ae("text-center",U.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ae("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(re,{icon:K.delete,size:se.sx})})})]})]})})}),or="gs-asset-manager",cI={search:!0,addUrl:!0,upload:!0},uI=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:f,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=ye(),{editor:P}=E,_=Ie(),[T]=Gp(),O=jf(f==null?void 0:f.itemsPerRow),[L,A]=h.useState(""),$=(f==null?void 0:f.header)===!1?!1:{...cI,...no(f==null?void 0:f.header)?f.header:{}};if(!P)return;const B=d?t.filter(M=>!(a&&!Ys(M.src,a)&&!Ys(M.name??"",a))):t;return c.jsxs(k,{className:X(or,"relative gs-utl-h-full",i&&Oe.disabled),nowrap:!0,col:!0,space:"m",children:[$!==!1&&c.jsxs(k,{className:`${or}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(k,{className:`${or}__header-filters`,items:"center",gap:"m",children:[$.search&&c.jsx(F,{children:c.jsx(rt,{className:`${or}__search-filter`,size:"m",type:"search",value:a,onInput:b,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(F,{children:c.jsx(Le,{className:X(`${or}__type-filter`,"items-center"),size:"m",options:n,value:o,onChange:m,emptyState:_.t("assetManager.assetTypes.all"),includeEmpty:l})}),r.length>(u?0:1)&&c.jsx(F,{children:c.jsx(Le,{classNameContainer:X(`${or}__provider-filter`,"items-center"),size:"m",options:r.map(M=>({...M,label:et(M.label)?M.label({editor:P}):M.label,icon:M.icon})),value:s,onChange:v,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(k,{className:`${or}__header-buttons`,items:"center",gap:"m",children:[$.upload&&c.jsx(F,{className:`${or}__upload`,children:c.jsx(sI,{className:`${or}__upload-field`,onChange:w})}),$.addUrl&&!!y&&c.jsx(F,{className:`${or}__add-url`,children:c.jsx(Er,{className:`${or}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Ke,{variant:"pr",size:"m2",children:_.t("assetManager.addUrl")}),children:({close:M})=>c.jsx("form",{onSubmit:j=>{j.preventDefault(),y(L),A(""),M()},children:c.jsxs(k,{gap:"m",children:[c.jsx(F,{children:c.jsx(rt,{type:"url",size:"s",pattern:"https?://.+",value:L,onChange:A,placeholder:_.t("assetManager.inputPlh"),required:!0})}),c.jsx(F,{children:c.jsx(Ke,{variant:"pr",size:"m2",type:"submit",children:_.t("add")})})]})})})})]}),x&&c.jsx(c.Fragment,{children:kt(x({editor:P}))})]}),c.jsx(k,{className:X(`${or}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!B.length?c.jsx(k,{justify:"center",children:_.t("noItems")}):!!T&&c.jsx(ou,{data:B,listClassName:X("gs-utl-grid gs-utl-gap-2",O),endReached:C,itemContent:(M,j)=>c.jsx(lI,{assetProps:j,onSelect:g,onRemove:S,itemLayout:p},j.id),components:{Footer:C?dI:void 0}})}),i&&c.jsx(No,{abs:!0})]})}),dI=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),pI=ce(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:f}){const{appEditorStore:g,i18nStore:m}=Pn(),{editor:v}=g,b=Ai(),{customOnLoad:w}=b,y=Nv(t);h.useEffect(()=>{const P=T=>ct(T)?{id:T,label:m.t(`assetManager.assetTypes.${T}`)||T}:T;y.setCustomTypes(o==null?void 0:o.map(P)),y.setCustomProviders(ct(s)?[s]:s),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Ht(l)?y.setOptionalType(l):y.initOptionalType(),Ht(u)?y.setOptionalProvider(u):y.initOptionalProvider();const _=setTimeout(()=>y.loadAssets());return()=>clearTimeout(_)},[o,s,a,i,l,u]);const S=P=>{b.addToProjectAssets([{id:P,src:P,type:y.typeFilter??$s.image}])},C=P=>{v&&(d==null||d({asset:b.toAsset(P),assetProps:P,editor:v}),p==null||p())},x=r==null?void 0:r.map(b.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(uI,{assetProps:x??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:P=>{y.setTypeFilter(P),y.loadAssets()},onChangeProviderFilter:P=>{y.setProviderFilter(P),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:P=>b.uploadFile(P.nativeEvent),onRemove:x?void 0:y.handleDelete,onEndReached:E,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:f})});var fI=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),It=function(){return It=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},It.apply(this,arguments)},Dy={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Fy={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},gu={width:"20px",height:"20px",position:"absolute"},hI={top:It(It({},Dy),{top:"-5px"}),right:It(It({},Fy),{left:void 0,right:"-5px"}),bottom:It(It({},Dy),{top:void 0,bottom:"-5px"}),left:It(It({},Fy),{left:"-5px"}),topRight:It(It({},gu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:It(It({},gu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:It(It({},gu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:It(It({},gu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},gI=function(e){fI(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(r){n.props.onResizeStart(r,n.props.direction)},n.onTouchStart=function(r){n.props.onResizeStart(r,n.props.direction)},n}return t.prototype.render=function(){return nt.createElement("div",{className:this.props.className||"",style:It(It({position:"absolute",userSelect:"none"},hI[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(nt.PureComponent),mI=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Yr=function(){return Yr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Yr.apply(this,arguments)},vI={width:"auto",height:"auto"},mu=function(e,t,n){return Math.max(Math.min(e,n),t)},By=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},$a=function(e,t){return new RegExp(e,"i").test(t)},vu=function(e){return!!(e.touches&&e.touches.length)},bI=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},zy=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(s,a,i){return Math.abs(a-e)<Math.abs(t[s]-e)?i:s},0),o=Math.abs(t[r]-e);return n===0||o<n?t[r]:e},uh=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},bu=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var o=Number(e.replace("%",""))/100;return t*o}if(e.endsWith("vw")){var o=Number(e.replace("vw",""))/100;return n*o}if(e.endsWith("vh")){var o=Number(e.replace("vh",""))/100;return r*o}}return e},yI=function(e,t,n,r,o,s,a){return r=bu(r,e.width,t,n),o=bu(o,e.height,t,n),s=bu(s,e.width,t,n),a=bu(a,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof a>"u"?void 0:Number(a)}},wI=function(e){return Array.isArray(e)?e:[e,e]},SI=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Uy="__resizable_base__",CI=function(e){mI(t,e);function t(n){var r,o,s,a,i=e.call(this,n)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var l=i.parentNode;if(!l)return null;var u=i.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(Uy):u.className+=Uy,l.appendChild(u),u},i.removeBase=function(l){var u=i.parentNode;u&&u.removeChild(l)},i.state={isResizing:!1,width:(o=(r=i.propsSize)===null||r===void 0?void 0:r.width)!==null&&o!==void 0?o:"auto",height:(a=(s=i.propsSize)===null||s===void 0?void 0:s.height)!==null&&a!==void 0?a:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||vI},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(i){var l;if(typeof n.state[i]>"u"||n.state[i]==="auto")return"auto";if(n.propsSize&&n.propsSize[i]&&(!((l=n.propsSize[i])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[i].toString().endsWith("%"))return n.state[i].toString();var u=n.getParentSize(),d=Number(n.state[i].toString().replace("px","")),p=d/u[i]*100;return p+"%"}return uh(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?uh(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?uh(r.height):o("height");return{width:s,height:a}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,a=o&&$a("left",s),i=o&&$a("top",s),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=a?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=i?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=i?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=i?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var o=this.props.scale||1,s=wI(this.props.resizeRatio||1),a=s[0],i=s[1],l=this.state,u=l.direction,d=l.original,p=this.props,f=p.lockAspectRatio,g=p.lockAspectRatioExtraHeight,m=p.lockAspectRatioExtraWidth,v=d.width,b=d.height,w=g||0,y=m||0;return $a("right",u)&&(v=d.width+(n-d.x)*a/o,f&&(b=(v-y)/this.ratio+w)),$a("left",u)&&(v=d.width-(n-d.x)*a/o,f&&(b=(v-y)/this.ratio+w)),$a("bottom",u)&&(b=d.height+(r-d.y)*i/o,f&&(v=(b-w)*this.ratio+y)),$a("top",u)&&(b=d.height-(r-d.y)*i/o,f&&(v=(b-w)*this.ratio+y)),{newWidth:v,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,o,s){var a=this.props,i=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,u=a.lockAspectRatioExtraWidth,d=typeof s.width>"u"?10:s.width,p=typeof o.width>"u"||o.width<0?n:o.width,f=typeof s.height>"u"?10:s.height,g=typeof o.height>"u"||o.height<0?r:o.height,m=l||0,v=u||0;if(i){var b=(f-m)*this.ratio+v,w=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,S=(p-v)/this.ratio+m,C=Math.max(d,b),x=Math.min(p,w),E=Math.max(f,y),P=Math.min(g,S);n=mu(n,C,x),r=mu(r,E,P)}else n=mu(n,d,p),r=mu(r,f,g);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var o=r.getBoundingClientRect();this.parentLeft=o.left*n,this.parentTop=o.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*n,this.targetTop=s.top*n}if(this.resizable){var a=this.resizable.getBoundingClientRect(),i=a.left,l=a.top,u=a.right,d=a.bottom;this.resizableLeft=i*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&bI(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&vu(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var i,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",i=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Yr(Yr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(p)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&vu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=vu(n)?n.touches[0].clientX:n.clientX,d=vu(n)?n.touches[0].clientY:n.clientY,p=this.state,f=p.direction,g=p.original,m=p.width,v=p.height,b=this.getParentSize(),w=yI(b,this.window.innerWidth,this.window.innerHeight,s,a,i,l);s=w.maxWidth,a=w.maxHeight,i=w.minWidth,l=w.minHeight;var y=this.calculateNewSizeFromDirection(u,d),S=y.newHeight,C=y.newWidth,x=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(C=zy(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=zy(S,this.props.snap.y,this.props.snapGap));var E=this.calculateNewSizeFromAspectRatio(C,S,{width:x.maxWidth,height:x.maxHeight},{width:i,height:l});if(C=E.newWidth,S=E.newHeight,this.props.grid){var P=By(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=By(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),T=this.props.snapGap||0,O=T===0||Math.abs(P-C)<=T?P:C,L=T===0||Math.abs(_-S)<=T?_:S;C=O,S=L}var A={width:C-g.width,height:S-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var $=C/b.width*100;C=$+"%"}else if(m.endsWith("vw")){var B=C/this.window.innerWidth*100;C=B+"vw"}else if(m.endsWith("vh")){var M=C/this.window.innerHeight*100;C=M+"vh"}}if(v&&typeof v=="string"){if(v.endsWith("%")){var $=S/b.height*100;S=$+"%"}else if(v.endsWith("vw")){var B=S/this.window.innerWidth*100;S=B+"vw"}else if(v.endsWith("vh")){var M=S/this.window.innerHeight*100;S=M+"vh"}}var j={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?j.flexBasis=j.width:this.flexDir==="column"&&(j.flexBasis=j.height);var W=this.state.width!==j.width,D=this.state.height!==j.height,z=this.state.flexBasis!==j.flexBasis,I=W||D||z;I&&On.flushSync(function(){r.setState(j)}),this.props.onResize&&I&&this.props.onResize(n,f,this.resizable,A)}},t.prototype.onMouseUp=function(n){var r,o,s=this.state,a=s.isResizing,i=s.direction,l=s.original;if(!(!a||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,i,this.resizable,u),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Yr(Yr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var r,o;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(o=n.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(n){var r=this,o=this.props,s=o.enable,a=o.handleStyles,i=o.handleClasses,l=o.handleWrapperStyle,u=o.handleWrapperClass,d=o.handleComponent;if(!s)return null;var p=n.filter(function(f){return s[f]!==!1}).map(function(f){return s[f]!==!1?nt.createElement(gI,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:i&&i[f]},d&&d[f]?d[f]:null):null});return nt.createElement("div",{className:u,style:l},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return SI.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=Yr(Yr(Yr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return nt.createElement(s,Yr({style:o,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&nt.createElement("div",{style:this.state.backgroundStyle}),this.renderResizer(["topLeft","top","topRight","left"]),this.props.children,this.renderResizer(["right","bottomLeft","bottom","bottomRight"]))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(nt.PureComponent);function yu({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,onResize:g,onResizeStop:m,...v}){const b={top:n||!1,right:o||!1,bottom:r||!1,left:s||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},w={width:a||"auto",height:i||"auto"},y=N("gs-utl-z-10",U.hBgAct),S={top:y,bottom:y,right:y,left:y},C={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(CI,{className:e,enable:v.enable??b,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,children:t})}const dh="gs-cmp-accordion",ph=`${dh}-handler`,wu=`${ph}__content`,xI=`${dh}-content`;function yo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:p,open:f}){return c.jsx(np,{as:"div",defaultOpen:f,className:X(dh,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(np.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>p==null?void 0:p({event:m,open:!g}),className:({open:m})=>N(ph,et(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs(k,{items:"center",className:X("gap-2"),full:!0,children:[c.jsx(F,{className:X(wu,r,"text-left"),grow:!0,children:et(s)?s(m):c.jsxs(k,{items:"center",className:X(`${wu}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(re,{className:X(`${wu}-icon`),icon:a,size:se.s2x}),c.jsx(F,{className:X(`${wu}-label gs-utl-w-full`),children:s})]})}),c.jsx(F,{className:X(`${ph}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(re,{icon:K.chevronDown,className:X("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(np.Panel,{className:X(xI,n),children:i})]})})}const ol="gs-studio-panel",Wy=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Tr=h.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(xn,{className:N(ol,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(yu,{className:N([`${ol}__resizer`]),...u,children:l}):l,p=n===!0?{collapsible:!0}:n||void 0;return p?c.jsx(yo,{classNameWrap:N(`${ol}__accordion`,s),className:N(`${ol}__accordion-header`,Te.xy,p.className),classNameContent:N(`${ol}__accordion-content`,a),disabled:p.collapsible===!1,style:p.style,handler:c.jsxs(k,{space:"s",items:"center",children:[!!p.icon&&c.jsx(re,{icon:p.icon,size:se.s}),c.jsx(F,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),EI="gs-panel-assets",PI=h.memo(ce(function({className:t,onSelect:n,content:r,assets:o,types:s,providers:a,typeId:i,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:f,...g}){var x;const m=ye(),v=Ai(),b=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=f||w,[S]=h.useState(()=>g.id||ev());return h.useEffect(()=>(v.createAssetManager(S),()=>{v.removeAssetManager(S)}),[S]),Nv(S)?c.jsx(Tr,{className:N(EI,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:b&&c.jsx(pI,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null}));var sl=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(sl||{}),Xr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Xr||{});const al="gs-block-item",Gy=ce(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=ye(),i=Ie(),[,l]=h.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),f=o||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),v=t.getMedia(),b=t.get("attributes")||{},w=u(d)||t.getLabel(),y=s==="compact",S=N(al,`${al}--${d}`,y&&`${al}-compact`,n,"gs-utl-px-2 gs-utl-transition-colors",te.b,te.rnd,U.br,p&&"gs-utl-col-span-full",y?"gs-utl-py-1":"gs-utl-py-2",y?"gs-utl-flex-row gs-utl-nowrap gs-utl-gap-3 gs-utl-justify-start":"gs-utl-flex-col",g?Oe.disabledM:N("gs-utl-cursor-pointer",U.hTAo,U.hBgH)),C=Ht(b.class)&&!y?b.class:N("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),x=N(`${al}__label`,"gs-utl-text-center",Oe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!a)return;const{Blocks:L}=a,A=L.events.update,$=B=>B===t&&l(M=>++M);return a.on(A,$),()=>{a.off(A,$)}},[t,a]),!a)return null;const{Blocks:E}=a,T={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!o},...!!f&&{onClick:()=>f(t,a)}},O=r==null?void 0:r({editor:a,block:t,attributes:T});return O&&kt(O)||c.jsxs(k,{items:"center",...T,children:[m||c.jsx("div",{className:N(`${al}__media`,C),dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:x,title:w,children:w})]})});function fh({className:e,value:t,onChange:n}){const[r,o]=h.useState(t),s=h.useRef(null),a=u=>{const{value:d}=u.target;o(d)},i=()=>{n(r||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(r||t);break}};return h.useEffect(()=>{s.current&&s.current.select()},[]),c.jsx("input",{autoFocus:!0,className:X([e,"w-full",U.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:hs,ref:s})}function qy({className:e,value:t,active:n,unstyled:r,activable:o,onChange:s,onActive:a,...i}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=f=>{a==null||a(f),u(f)},p=f=>{s(f),d(!1)};return c.jsx("div",{className:X("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(fh,{className:X(r&&Oe.noFocusOut),value:t,onChange:p}):c.jsx(c.Fragment,{children:t})})}const Ky=ae("text-sm w-full",Oe.txtEllips),TI=ce(({symbol:e,className:t})=>{const n=Fi(),{Components:r}=n,o=Ie(),s=xa(),a=o.tScoped("blockManager.symbols"),i=()=>{const{draggable:w,droppable:y,attributes:S,type:C,tagName:x}=e.attributes;n.Canvas.startDrag({content:()=>r.addSymbol(e),model:e,dragDef:{type:C,tagName:x,draggable:w,droppable:y,attributes:S}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=r.getSymbolInfo(e).instances.length,f=ae("h-10 w-10 block-media",U.grouphTAo),g=ae("gjs-pt-1 gjs-mt-2",te.bt,U.br),m=ae("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,U.br,U.hBgH,t),v=()=>{s.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},b=w=>{e.set("custom-name",w)};return c.jsxs(k,{className:m,onDragStart:i,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(k,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(F,{children:c.jsx(k,{className:ae(Ky,"gjs-mr-auto"),children:c.jsx(Wt,{title:`${p} ${a("instancesProject")}`,children:c.jsx(Yo,{label:`${p}`,className:ae(U.bgH75)})})})}),c.jsx(F,{className:ae("truncate"),grow:!0,title:d,children:c.jsx(qy,{activable:!0,value:d,className:Ky,onChange:b})}),c.jsx(F,{className:ae(Oe.hoverGroup),children:c.jsx(k,{justify:"end",full:!0,children:c.jsx(Ct,{onClick:v,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(re,{icon:K.delete,size:se.s})})})})]})]})}),rs="gs-block-manager",Zy={id:Xr.before,title:"Add before",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <path d="M4 5v14"/> <rect fill="none" x="8" y="5" width="12" height="14" rx="2" ry="2"/> </svg>'},OI={id:Xr.beforeInside,title:"Add inside first",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M8 8v8"/> </svg>'},_I={id:Xr.afterInside,title:"Add inside last",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M16 8v8"/> </svg>'},Yy={id:Xr.after,title:"Add after",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="12" height="14" rx="2" ry="2"/> <path d="M20 5v14"/> </svg>'},Xy=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Jy=e=>{const t=e.getContent();return et(t)?e.getDragDef():t},AI=e=>{const t=Jy(e);return Array.isArray(t)?t[0]:t},LI=ce(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Ue,tn;const{editor:l}=ye(),u=Ie(),[d,p]=h.useState(0),[f,g]=h.useState(sl.REGULAR),[m,v]=h.useState(""),[b,w]=h.useState(""),y=h.useRef(new Set),[S,C]=h.useState((o==null?void 0:o.position)||Xr.after),[x,E]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),P=f===sl.SYMBOLS,_=h.useRef(null),T=u.tScoped("blockManager"),O=o==null?void 0:o.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:he,Components:De}=l,Fe=he.events.custom,He=De.events.symbol,Mt=()=>{E(De.getSymbols()),p(Gt=>++Gt)};return l.on(He,Mt),l.on(Fe,Mt),()=>{l.off(He,Mt),l.off(Fe,Mt)}},[l]),h.useEffect(()=>{if(_.current&&t){const he=_.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),Ld)}},[_.current,t]),!l)return null;const{Blocks:L,Components:A}=l,$=he=>T(`labels.${he.getId()}`)||he.getLabel(),B=x.filter(he=>Ys(he.getName(),m)),M=L.getAll().map(he=>he),j=((Ue=i.blocks)==null?void 0:Ue.call(i,{blocks:M}))||M,W=S===Xr.before,D=S===Xr.beforeInside,z=S===Xr.afterInside,I=S===Xr.after,H=!!(O!=null&&O.attributes.droppable),V=j.filter(he=>{const De=Xy(l,he.category);if(m&&!Ys(De,m)&&!Ys($(he),m))return!1;if(O){const Fe=AI(he);if(H&&(D||z)){const He=D?0:void 0;return A.canMove(O,Fe,He).result}else if(W||I){const He=O.index(),Mt=O.parent(),Gt=W?He:He+1;return Mt&&A.canMove(Mt,Fe,Gt).result}}return!0}),G=L.getBlocksByCategory(V),Y=r?V:(tn=G.find(he=>!he.category))==null?void 0:tn.items,J=r?[]:G.filter(he=>he.category),Q=i.symbols!==!1,R=i.search!==!1,q=!Q&&!R,ee=s==="compact",le=T("search")||u.t("search"),ge=N(rs,n,"gap-2"),Pe=N(`${rs}__header`,"gs-utl-pt-2",Te.xS,q&&"gs-utl-hidden"),Ce=N(`${rs}__content`,Oe.scrollY,U.br,te.bt),tt=N(`${rs}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Qe=N(`${rs}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ot=N(`${rs}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",ee?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),ut=N(`${rs}__no-category`,Ot,U.br,J.length&&te.bb),Se=N(U.tAo,U.bgH75,te.bA),ot=`${rs}__category`,st=[{id:sl.REGULAR,label:T("types.regular")},{id:sl.SYMBOLS,label:T("types.symbols")}],wt=H?[Zy,OI,_I,Yy]:[Zy,Yy],Ne=O?he=>{const De=Jy(he);if(!De)return;let Fe;if(D||z){const He=D?0:void 0;Fe=O.append(De,{at:He})[0]}else if(W||I){const He=O.index(),Mt=O.parent(),Gt=W?He:He+1;Fe=Mt==null?void 0:Mt.append(De,{at:Gt})[0]}if(Fe){const{activate:He,select:Mt}=he.attributes;Mt||He&&Mt!==!1?requestAnimationFrame(()=>l.em.setSelected(Fe,{activate:He})):He&&Fe.trigger("active")}}:void 0,mt=he=>{if(!O)return;const De=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.min(He+1,De.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.max(He-1,0))||""});else if(he.key==="Enter"&&b){const Fe=L.get(b);Fe&&(Ne==null||Ne(Fe))}},dt=he=>{y.current.clear(),v(he)};return c.jsxs(k,{className:ge,col:!0,full:!0,children:[c.jsxs(k,{className:Pe,gap:"s",col:!0,children:[Q&&c.jsx(Xo,{tabs:st,onChange:g,value:f,variant:"pills"}),O&&c.jsx(Rt,{size:"s",options:wt,value:S,onChange:he=>C(he)}),R&&c.jsx(rt,{ref:_,size:"s",value:m,onInput:dt,onKeyDown:mt,placeholder:le,type:"search"})]}),c.jsxs(F,{className:Ce,grow:!0,children:[P&&(B.length?c.jsx(k,{className:tt,children:B.map(he=>c.jsx(TI,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(k,{className:Qe,justify:"center",children:T("symbols.notFound")})),!P&&(V.length?c.jsxs(c.Fragment,{children:[!!(Y!=null&&Y.length)&&c.jsx(k,{className:ut,children:Y==null?void 0:Y.map(he=>(y.current.add(`${he.id}`),c.jsx(Gy,{block:he,itemLayout:a,onClick:Ne,variant:s,className:N(b===he.id&&Se)},he.id)))}),J.map(({category:he,items:De},Fe)=>c.jsx(yo,{sticky:!0,className:He=>Nd.itemList({index:Fe,open:He,length:J.length}),open:!!(he!=null&&he.get("open")),onChange:({open:He})=>he==null?void 0:he.set({open:He}),handler:Xy(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:N(ot,`${ot}--${he==null?void 0:he.id}`),children:c.jsx(k,{className:Ot,children:De.map(He=>(y.current.add(`${He.id}`),c.jsx(Gy,{block:He,itemLayout:a,onClick:Ne,variant:s,className:N(b===He.id&&Se)},He.id)))})},he==null?void 0:he.id))]}):c.jsx(k,{className:Qe,justify:"center",children:T("notFound")}))]})]})}),MI=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-after"),n),ref:o,...r,children:t})}),NI=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-before"),n),ref:o,...r,children:t})}),$I="gs-panel-blocks",kI=h.memo(ce(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=ye().sdkProps.children,p={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(Tr,{className:N($I,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(Bi,{children:[Rn(d,NI),c.jsx(LI,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),Rn(d,MI)]})})})),II=(e,t)=>{t.runCommand(ne.fontAdd,{font:e})},hh=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(ne.assetProviderGet).filter(i=>ct(i.types)?i.types===r:i.types.includes(r))[0];if(!a){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:r,providerId:a.id,onSelect:i=>{const l=i.assetProps;II(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Su=ce(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=ye(),s=Ie(),a=Ai(),i=Li(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),p=d?Bp(d):u.id;return{...u,content:c.jsx(k,{col:!0,children:c.jsx(F,{style:{fontFamily:p},children:u.label})})}});return c.jsx(Le,{...r,value:ks(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(Ct,{className:t,title:s.t("fontManager.addFontToProject"),icon:K.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&hh(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange(ks(d.family))}})})})}),VI=(e,{t,id:n})=>t(`fields.${n}.label`)||Lr(`${e}`.replace(/-/g," ")),Qy=(e,{t,id:n})=>{const r=ct(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},Ry=e=>e.get("defaultValue")||"",il=e=>e.get("field"),ew=e=>{const t=il(e);return ct(t)?{type:t}:t},tw=e=>`${e.get("value")||Ry(e)||ew(e).defaultValue||""}`,HI=(e,t)=>e||Ry(t)||"",ll=({record:e,value:t,partial:n})=>{e.set({value:HI(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},cl=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=ew(e),a=r??e.get("defaultValue");return{...s,hasClear:()=>{const i=e.get("value");return!!i&&Ht(a)&&i!==a},className:N(n,"gs-utl-w-full"),size:o||"s",value:tw(e),label:VI(e.get("label")||e.id||"",t),onChange:(i,l)=>ll({record:e,value:i,partial:l})}},jI=(e,t)=>{const n=il(e),r=no(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=C8(tw(e)),a=s.number,i=s.unit||o[0]||"";return{...cl(e,t),value:a,valueUnit:i,min:r==null?void 0:r.min,max:r==null?void 0:r.max,step:r==null?void 0:r.step,units:r==null?void 0:r.units,onChange:(l,u)=>{ll({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{ll({value:a?`${a}${l}`:"",record:e})}}},nw=(e,t)=>{var s;const n=il(e),r=no(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Qy(a,t)))||[];return{...cl(e,t),options:o,onChange:a=>ll({value:a,record:e})}},DI=(e,t)=>({...cl(e,t),onChange:n=>ll({value:n,record:e})}),FI=(e,t)=>{var s;const n=il(e),r=no(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Qy(a,t)))||[];return{...nw(e,t),size:"s",options:o}};function BI(e,t){const n=il(e);switch(ct(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Rt,{...FI(e,t)});case"select":return c.jsx(Le,{...nw(e,t)});case"selectFont":{const o=DI(e,t);return c.jsx(Su,{...o,labelAs:"div"})}case"number":return c.jsx($e,{...jI(e,t)});case"color":return c.jsx(Zr,{...cl(e,t)});default:return c.jsx(rt,{...cl(e,t)})}}const rw="gs-cmp-global-style-field",zI=ce(function({record:t}){const n=ye(),o=Ie().tScoped("globalStyleManager"),[,s]=h.useState(0),a=n.editor,i=t.id,l={t:o,id:i};return h.useEffect(()=>{if(!a)return;const u=`data:path:${t.getPath("value")}`,d=()=>s(p=>++p);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(k,{className:N(rw,`${rw}__${i}`),children:BI(t,l)})}),ul="gs-cmp-global-style-manager",ow=({items:e,category:t,className:n})=>{const r=N(t?`${ul}__cat-fields--${t.id}`:`${ul}__uncat-fields`,"gs-utl-gap-2",Te.xy,n);return c.jsx(k,{className:r,nowrap:!0,col:!0,children:e.map(o=>c.jsx(zI,{record:o},o.id))})},UI=ce(function(){const t=DL(),{recordsByCategory:n,openCategories:r}=t,s=Ie().tScoped("globalStyleManager");return c.jsx(k,{col:!0,full:!0,nowrap:!0,className:N(ul,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(k,{col:!0,nowrap:!0,className:N(`${ul}__fields`,Oe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(yo,{sticky:!0,open:r.get(a.id)??a.open,handler:s(`categories.${a.id}.label`)||a.label||a.id,onChange:({open:u})=>t.setCategoryOpen(a.id,u),className:u=>N(`${ul}__cat-fields`,Nd.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(ow,{category:a,items:i})},a.id):c.jsx(ow,{items:i,className:N(n.length!==1&&[te.bt,U.br])},l)):c.jsx(k,{className:N("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),WI="gs-panel-global-styles",GI=h.memo(ce(function({className:t,...n}){return c.jsx(Tr,{className:N(WI,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Bi,{children:c.jsx(UI,{})})})})),qI={maxWidth:`${hC}px`},KI="gs-cmp-layer-item";function sw({component:e,draggingCmp:t,dragParent:n,...r}){const o=Fi(),{Layers:s}=o,a=h.useRef(null),[i,l]=h.useState(!1),[u,d]=h.useState(s.getLayerData(e)),{open:p,selected:f,hovered:g,components:m,visible:v,locked:b,name:w}=u,y=m.map(D=>D.cid),S=t===e,C=y.join("-"),x=r.level+1,E=g||n===e;h.useEffect(()=>{x===0&&d(s.getLayerData(e)),a.current&&(a.current.__cmp=e)},[e]),h.useEffect(()=>{const D=a.current;if(!D)return;const{select:z}=o.Components.events,I=H=>H===e&&D.scrollIntoView({block:"nearest"});return o.on(z,I),()=>{o.off(z,I)}},[e,a.current]),h.useEffect(()=>{const D=I=>{I===e&&d(s.getLayerData(I))},z=s.events.component;return o.on(z,D),()=>{o.off(z,D)}},[o,s,e]);const P=h.useMemo(()=>m.map(D=>c.jsx(sw,{component:D,level:x,draggingCmp:t,dragParent:n},D.cid)),[C,t,n]),_=D=>{s.setLayerData(e,{name:D}),l(!1)},T=D=>{D.stopPropagation(),s.setLayerData(e,{open:!p})},O=D=>{D.stopPropagation(),s.setLayerData(e,{visible:!v})},L=D=>{D.stopPropagation(),s.setLayerData(e,{locked:!b})},A=D=>{D.stopPropagation(),s.setLayerData(e,{selected:!0},{event:D})},$=D=>{D.preventDefault(),o.runCommand(ne.contextMenuComponent,{source:Dp.layers,component:e,event:D.nativeEvent,x:D.clientX,y:D.clientY})},B=D=>{(!D||!t)&&s.setLayerData(e,{hovered:D})},M=j1(e),j=X("layer-item",(f||M.isSymbol)&&M.bgSoftX,(!v||S)&&"opacity-50"),W=X(Te.xyS,te.b,E?M.border:te.bT,f&&M.bgSoft);return c.jsx("div",{className:KI,children:c.jsxs(k,{col:!0,className:j,children:[c.jsx(F,{onClick:A,onContextMenu:$,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),className:X("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(k,{items:"center",space:"xs",className:W,children:[c.jsx(F,{style:{marginLeft:`${x*10}px`},className:X("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:T,children:c.jsx(re,{icon:K.menuDown,size:se.sx,rotate:p?0:-90})}),c.jsx(F,{children:wv(e)}),c.jsx(F,{className:X("truncate"),onDoubleClick:()=>l(!0),style:qI,grow:!0,children:i?c.jsx(fh,{value:w,onChange:_}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:X("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:L,children:c.jsx(re,{icon:b?K.lock:K.lockOpenVariant,size:se.s3x})}),c.jsx(F,{className:X("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:O,children:c.jsx(re,{icon:v?K.eyeOutline:K.eyeOffOutline,size:se.sx})})]})]})}),!!(p&&m.length)&&c.jsx(F,{className:X("max-w-full",!p&&"hidden"),children:P})]})})}const ZI={touchAction:"none"},aw=5,YI=e=>{var s,a;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),r=n==null?void 0:n.__cmp,o=((a=(s=r==null?void 0:r.delegate)==null?void 0:s.move)==null?void 0:a.call(s,r))||r;return{el:n,cmp:o}},iw=ce(function({root:t,header:n}){const{editor:r}=ye(),[o,s]=h.useState(!1),[a,i]=h.useState({}),[l,u]=h.useState(),[d,p]=h.useState(),[f,g]=h.useState(),[m,v]=h.useState(),b=h.useRef(null);if(h.useEffect(()=>{const T=window.document,O=L=>{L.key==="Escape"&&(i({...a,result:!1}),C())};return T.addEventListener("keydown",O),()=>{T.removeEventListener("keydown",O)}},[]),!r)return null;const{Components:w}=r,y=T=>{T.button===0&&s(!0)},S=T=>{if(!o)return;const{cmp:O,el:L}=YI(T);if(!L||!O)return;const A=L.getBoundingClientRect(),$=L.offsetHeight,B=L.offsetTop,M=T.clientY,j=M<A.y+$/2,W=d||O,D=O.parent(),z=O.index()+(j?0:1);!d&&p(O),u(O);const I=w.canMove(D,W,z),H=w.canMove(O,W),V={...I,canMoveInside:H,index:z};let G=!1;H.result&&M>A.y+aw&&M<A.y+$-aw&&(G=!0,V.target=O,delete V.index),g(G?O:void 0),i(V),v({pointerInside:G,y:B+(j?0:$),h:$})},C=()=>{var T;a!=null&&a.result&&((T=a.source)==null||T.move(a.target,{at:a.index})),i({}),s(!1),p(void 0),u(void 0),g(void 0),v(void 0)},x=(l?l.parents():[]).length,E=!!(d&&m&&(a!=null&&a.result)&&!m.pointerInside),P=E?{top:m.y,left:0,marginLeft:x*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(k,{col:!0,full:!0,nowrap:!0,className:X("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(F,{children:c.jsxs(k,{space:"s",items:"center",className:X([Te.xy,te.bb,U.br]),children:[c.jsx(F,{children:c.jsx(re,{icon:K.layers,size:se.s})}),c.jsx(F,{grow:!0,children:_})]})}),c.jsxs(F,{className:X("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:ZI,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(sw,{component:t,level:-1,draggingCmp:d,dragParent:f}),E&&c.jsx("div",{ref:b,className:X("absolute w-full gs-utl-h-0.5",U.cmp),style:P})]})]})}),lw=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-after"),n),ref:o,...r,children:t})}),cw=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-before"),n),ref:o,...r,children:t})}),XI="gs-panel-layers",uw=h.memo(ce(function({className:t,...n}){const r=ye().sdkProps.children;return c.jsx(Tr,{className:N(XI,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(jb,{children:o=>c.jsxs(c.Fragment,{children:[Rn(r,cw),c.jsx(iw,{...o,header:!1}),Rn(r,lw)]})})})})),Us="gs-cmp-file-field";function dl(e){var x;const{className:t,value:n,btnLabel:r,nameLabel:o,size:s,isContain:a,clear:i,inputField:l,placeholder:u,preview:d=50,disabled:p,hideButton:f,labelAs:g,onChange:m,onOpen:v}=e,b=(n||"").replace(/^"|"$/gi,""),w=((x=b.split("/").pop())==null?void 0:x.split("?")[0])||"",y={minWidth:d,minHeight:d},S=b?{...y,backgroundImage:`url("${b}")`}:y,C=N(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",a?"gs-utl-bg-contain":"gs-utl-bg-cover",te.b,te.rnd,U.br);return c.jsxs(k,{className:N(Us,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(Cr,{...e,as:g}),c.jsxs(k,{className:N(`${Us}-content gs-utl-gap-1`,U.bg),items:"center",nowrap:!0,children:[c.jsx(F,{className:N(`${Us}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(F,{className:N(`${Us}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(qo,{className:N(`${Us}-name`,"gs-utl-mb-2",Oe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(k,{className:N(`${Us}-buttons`),space:"s",nowrap:!0,children:[!f&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:s,type:"button",block:!0,full:!0,disabled:p,children:r||"Select image"}),!!n&&i&&c.jsx(Ct,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:K.close,size:se.s},type:"button",block:!0})]})]})]}),l&&c.jsx(rt,{className:N(`${Us}-input`),value:b,onChange:m,size:s,placeholder:u})]})}function JI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Cu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ka(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function gh(e){return"nodeType"in e}function os(e){var t,n;return e?ka(e)?e:gh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mh(e){const{Document:t}=os(e);return e instanceof t}function Ia(e){return ka(e)?!1:e instanceof os(e).HTMLElement}function dw(e){return e instanceof os(e).SVGElement}function Va(e){return e?ka(e)?e.document:gh(e)?mh(e)?e:Ia(e)||dw(e)?e.ownerDocument:document:document:document}const Ws=Cu?h.useLayoutEffect:h.useEffect;function QI(e){const t=h.useRef(e);return Ws(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function RI(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function pl(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vh(e){const t=QI(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}let bh={};function fl(e,t){return h.useMemo(()=>{if(t)return t;const n=bh[e]==null?0:bh[e]+1;return bh[e]=n,e+"-"+n},[e,t])}function pw(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const d=s[l];d!=null&&(s[l]=d+e*u)}return s},{...t})}}const hl=pw(1),fw=pw(-1);function e9(e){return"clientX"in e&&"clientY"in e}function t9(e){if(!e)return!1;const{KeyboardEvent:t}=os(e.target);return t&&e instanceof t}function n9(e){if(!e)return!1;const{TouchEvent:t}=os(e.target);return t&&e instanceof t}function yh(e){if(n9(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return e9(e)?{x:e.clientX,y:e.clientY}:null}const gl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[gl.Translate.toString(e),gl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),r9={display:"none"};function o9(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:r9},n)}function s9(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function a9(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const i9={draggable:`
321
+ `})};function uu({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=$e();return c.jsx(Or,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(I,{className:Q(o),space:"m",col:!0,children:[c.jsx(F,{grow:!0,className:Q("text-center"),children:t||i.t("confirmAction")}),c.jsxs(I,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Je,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...s,children:s.children||i.t("confirm")}),c.jsx(Je,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),r==null||r()},children:i.t("cancel")})]})]})})}const ny=new Map,ry=new Map,uI=async({html:e="",el:t})=>{const n=e,r={};if(document.body.attachShadow){const o=t.shadowRoot||t.attachShadow({mode:"open"});o.innerHTML=n}return r},dI=ce(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var P;const i=$e(),l=Ce(),u=l.editor,[d,p]=g.useState(""),f=g.useRef(null),h=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((P=t.data.custom)==null?void 0:P.id),b=n===Et.web,v=!t.isTemplate||r,w=()=>{v&&(s==null||s({editor:u,template:t,loadTemplate:y}))},y=l.setProject,S=_=>{_.preventDefault(),s({editor:u,template:t,loadTemplate:y})};g.useEffect(()=>{const T=setTimeout(async()=>{if(!f.current||!u)return;const O=`${t.isTemplate?"t-":""}${t.id}`;let M=ny.get(O);if(!M){let $=ry.get(n);if(!$){const j=new Ij({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});$=await cI(u.config.grapesjs,n,j.appEditorStore),ry.set(n,$)}M=$?lI($,t.data,n):"",ny.set(O,M)}const A=f.current;uI({el:A,html:M})});return()=>clearTimeout(T)},[f,u,n,t.data]);const{media:C,author:E}=t,x=c.jsx(Je,{className:ie("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return c.jsx(Rn,{padding:!1,className:ie("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ie("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:C?c.jsx("img",{src:C,alt:t.name,className:ie("max-w-full")}):c.jsx("div",{className:ie("gs-utl-w-[1200px]","gs-utl-flex-shrink-0","gs-utl-flex-grow-0","gs-utl-origin-top","gs-utl-bg-white","gs-utl-scale-[0.232]","gs-utl-h-[431.034%]"),ref:f})}),m&&c.jsx(Qo,{className:ie("absolute top-2 right-2",U.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(I,{justify:"center",items:"center",className:ie(Oe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:v?x:c.jsx(Or,{overlay:!0,title:!1,buttonAs:"span",handler:x,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(I,{space:"m",col:!0,children:[c.jsx(F,{children:c.jsx(at,{size:"s",value:d,onChange:p,placeholder:h,required:!0})}),c.jsx(F,{children:c.jsx(Je,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(I,{className:ie("gjs-p-2 max-w-full",re.bt,U.br),col:!0,space:"s",children:[c.jsxs(I,{className:ie("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(F,{className:ie(Oe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!E&&c.jsxs(F,{children:["by"," ",c.jsx("a",{className:ie($o.link),href:E.link,rel:"noreferrer",target:"_blank",children:E.name})]})]}),c.jsxs(I,{items:"center",children:[b&&c.jsxs(F,{className:ie("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(uu,{onConfirm:()=>a(t),className:"",children:c.jsx(wt,{title:i.t("delete"),children:c.jsx(ne,{icon:K.delete,size:se.sx})})})})]})]})]})})}),oy=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=Xp(),l=$e().tScoped("templates"),d=Ce().editor,p=Uf(n==null?void 0:n.itemsPerRow),f=o??(({template:h,loadTemplate:m})=>m(h));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(I,{justify:"center",children:l("notFound")}):c.jsx(cu,{data:e,listClassName:ie("grid gap-2 gjs-pr-2",p),itemContent:(h,m)=>c.jsx(dI,{template:m,projectType:t,onSelect:f,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(ko,{})})}),pI=ce(function(){var b;const t=Ce(),n=Ub(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=$e(),i=Ea(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:v,template:w})=>{v(w),i.close()},p=async v=>{n.setProjectTypeFilter(v),await n.loadAllTemplates()},f=v=>{n.removeProject(v.id),n.loadProjects()},h=g.useMemo(()=>[{id:Pi.Existing,label:u("existentProjects")},{id:Pi.Templates,label:u("templates")}],[a]),m=((b=l.project)==null?void 0:b.types)&&ed();return g.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&c.jsx(I,{items:"center",space:"m",children:c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(_e,{value:s,onChange:p,options:I$(),handlerSelected:v=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",v.label]})})})}),c.jsx(F,{children:c.jsx(Ro,{tabs:h,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(F,{grow:!0,children:c.jsx(oy,{templates:r,projectType:Et[s],onSelect:d,onRemove:f,content:{itemsPerRow:3}})})]})}),fI=({items:e,editor:t,customItems:n})=>n===!1?[]:ot(n)?n({items:e,editor:t}):n||e,sy=e=>({icon:K.plus,size:se.s,className:Q("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),ay=e=>!e.type||e.type==="button",gI="gs-cmp-topbar-left",hI=ce(function({buttons:t,className:n,style:r}){const o=Ce(),s=$e(),{isOpen:a,toggleOpen:i}=R4(),l=o.editor,d=s.tScoped("blockManager")("blocks"),p=fI({items:[{id:`blocks-${d}`,tooltip:d,size:_v.s,icon:sy(a),variant:Ov.primary,editorEvents:{[_n.toggleBlocksPanel]:({fromEvent:f,setState:h})=>{h({icon:sy(f.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(I,{gap:"s",items:"center",justify:"start",className:Q(gI,Te.xS,n),style:r,nowrap:!0,children:p.map(({id:f,...h})=>ay(h)?c.jsx(Bc,{...h},f):Lt({id:f,...h}))})}),mI=[{id:To.auto,label:"Auto"},{id:To.dark,label:"Dark"},{id:To.light,label:"Light"}],bI={size:"s"},Wf=".grapesjs",vI=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},yI=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const o=r.actions;return o===!1?[]:ot(o)?o({actions:e,editor:t}):o||(n?ot(n)?n({items:e,editor:t}):n:e)},wI="gs-cmp-topbar-right",SI=ce(function({editor:t,className:n,buttons:r,...o}){const s=Ce(),{theme:a,setTheme:i}=xr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:f,setInstallEvent:h,sdkOptions:m,isProjectTypeEmail:b}=s,v=Ea(),w=$e(),y=A=>w.t(`actions.${A}`),S=t.Storage.events,C=l.events,E="change:changesCount",x=(A,$)=>()=>{ot(A)?A({editor:t}):l.isActive(A)?l.stop(A):l.run(A,$)},P=A=>({[`${C.runCommand}${A}`]:({setState:$})=>$({active:!0}),[`${C.stopCommand}${A}`]:({setState:$})=>$({active:!1})}),_=[{id:Cr.componentOutline,icon:K.borderRadius,tooltip:y("componentOutline.title"),onClick:x("core:component-outline"),editorEvents:P("core:component-outline")},{id:Cr.preview,icon:K.eye,tooltip:y("preview.title"),onClick:x("core:preview"),editorEvents:P("core:preview")},{id:Cr.fullscreen,icon:K.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:x("core:fullscreen",{target:"body"}),editorEvents:P("core:fullscreen")},{id:Cr.showCode,icon:K.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(te.dialogExportCode)},{id:Cr.showImportCode,icon:K.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(te.dialogImportCode)},{id:Cr.clearCanvas,icon:K.delete,tooltip:y("clearCanvas.title"),onClick:()=>v.confirm({title:y("clearCanvas.title"),content:y("clearCanvas.content"),confirmButton:{variant:"danger",children:y("clearCanvas.title")},onConfirm:()=>{b?t.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):t.Components.clear()}})},{id:Cr.store,tooltip:y("store.title"),onClick:async()=>{try{if(s.isSaving)return;await t.store()}catch(A){t.getModel()._isStoring=!1,console.error(A)}},editorEvents:{"change:changesCount":({setState:A})=>A({}),[S.startStore]:({setState:A})=>A({disabled:!0}),[S.endStore]:({setState:A})=>A({disabled:!1})},label:()=>c.jsxs("div",{className:Q("relative"),children:[c.jsx(ne,{icon:K.floppy,size:se.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:Q("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",U.bg),children:c.jsx("div",{className:Q(Oe.dot,U.bgW)})}),s.isSaving&&c.jsx("div",{className:Q("absolute right-0 bottom-0 gjs-rounded-full",U.bg),children:c.jsx(ne,{icon:K.refresh,size:"11px",className:Q(Oe.spin)})})]})},{id:Cr.undo,icon:K.arrowULeftTop,disabled:!0,onClick:x("core:undo"),editorEvents:{[E]:({setState:A})=>A({disabled:!u.hasUndo()})}},{id:Cr.redo,icon:K.arrowURightTop,disabled:!0,onClick:x("core:redo"),editorEvents:{[E]:({setState:A})=>A({disabled:!u.hasRedo()})}}],T=yI({actions:_,sdkOptions:m,editor:t,buttons:r}),O=[{id:"about",label:y("about.title"),icon:K.helpCircle,action:()=>v.open({size:"m",title:y("about.title"),content:()=>c.jsx($$,{})})},{id:"embed",label:y("embed.title"),icon:K.powerPlug,action:()=>v.open({size:"m",title:y("embed.title"),content:()=>c.jsx(k$,{})})},{id:"openProject",label:y("open.title"),icon:K.folder,action:async()=>{let A="";try{A=await(await m$({extensions:[Wf]})).text()}catch($){return console.error($)}s.loadProjectData(JSON.parse(A))}},{id:"saveProject",label:y("save.title"),icon:K.contentSave,action:async()=>{const A=t.getProjectData(),$=new Blob([JSON.stringify(A)]),j=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await v$($,{fileName:`${j}${Wf}`,extensions:[Wf]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:K.newspaperVariantOutline,action:()=>v.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(pI,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:K.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const A=await(d==null?void 0:d.userChoice);(A==null?void 0:A.outcome)==="accepted"&&h()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(I,{items:"center",space:"m",children:[c.jsx(F,{children:"Theme"}),c.jsx(F,{children:c.jsx(Ro,{tabs:mI,onChange:A=>i(A),value:a,variant:"pills"})})]})}]].filter(({id:A})=>!((!f||!d)&&A==="installApp"||!vI(m,A))),M=(A,$)=>j=>{ot(A)&&(A(j),$())};return c.jsxs(I,{space:"s",items:"center",justify:"end",className:Q(wI,Te.xS,n),nowrap:!0,...o,children:[T.map(({id:A,...$})=>ay($)?c.jsx(Bc,{size:"s",...$},A):Lt({id:A,...$})),c.jsx(F,{children:m.settingsMenu!==!1&&O.length>0&&c.jsx(Or,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(ne,{icon:K.cog,size:se.s}),buttonProps:bI,overlay:!0,children:({close:A})=>c.jsx(c.Fragment,{children:O.map($=>c.jsx(_a,{action:M($.action,A),icon:$.icon,label:$.label},$.id))})})})]})});function CI({devices:e,selected:t,className:n,style:r,select:o}){const s=e.map(a=>({id:a.id,label:a.getName(),icon:a.attributes.icon}));return s.length?c.jsx(_e,{size:"xs",className:n,style:r,value:t,options:s,onChange:o}):null}const xI="gs-devices",iy=g.memo(function({className:t,style:n}){return c.jsx(JN,{children:r=>c.jsx(CI,{className:N(xI,t),style:n,...r})})}),el="gs-cmp-editor-topbar",EI=ce(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:p}=Ce(),f=n??l,h=g.useMemo(()=>({...r,minHeight:f,marginTop:u||!p?`-${f}px`:0}),[u,p,r]);return c.jsxs(c.Fragment,{children:[c.jsx(F,{className:N(el,"gs-utl-transition-spacing gs-utl-w-full",re.bb,U.br,t),style:h,children:o??c.jsxs(I,{className:N(`${el}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(F,{className:N(`${el}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(hI,{...s})}),c.jsx(F,{className:N(`${el}__wrp-center`),children:i!==!1&&c.jsx(iy,{...i})}),c.jsx(F,{className:N(`${el}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(SI,{editor:d,...a})})]})}),c.jsx(F,{className:N("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:c.jsx(Je,{className:N("gs-cmp-close-preview gs-utl-m-4",U.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(ne,{icon:K.eyeOff,size:se.s})})})]})}),PI="gs-sidebar-top",ly=g.memo(ce(function({height:t,children:n,...r}){return c.jsx(EI,{height:t,...r,style:Gc(r),className:N(PI,"gs-utl-flex",Wc(r)),children:n?Lt(n):void 0})})),TI="gs-canvas-sidebar-top",OI=g.memo(ce(function({className:t,sidebarTop:n,...r}){return c.jsxs(xn,{className:N(TI,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(ly,{...n}),c.jsx(e0,{grow:!0})]})})),_I="gs-code-field",AI=ce(function(e){const{editor:t}=Ce(),{isDarkTheme:n}=xr(),{editorEvents:r,onChange:o}=e,[s,a]=g.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(p=>({...p,...d}))}),l=u=>o==null?void 0:o(i(u||""));return xo({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(Pr,{className:N(_I,s.className),language:s.language,style:s.style,label:s.label,name:s.name,defaultValue:s.value,size:s.size,required:s.required,disabled:s.disabled,readOnly:s.readOnly,minHeight:s.minHeight,row:s.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});function du(){return(du=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function cy(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function Gf(e){var t=g.useRef(e),n=g.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var $a=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},tl=function(e){return"touches"in e},qf=function(e){return e&&e.ownerDocument.defaultView||self},uy=function(e,t,n){var r=e.getBoundingClientRect(),o=tl(t)?function(s,a){for(var i=0;i<s.length;i++)if(s[i].identifier===a)return s[i];return s[0]}(t.touches,n):t;return{left:$a((o.pageX-(r.left+qf(e).pageXOffset))/r.width),top:$a((o.pageY-(r.top+qf(e).pageYOffset))/r.height)}},dy=function(e){!tl(e)&&e.preventDefault()},Kf=g.memo(function(e){var t=e.onMove,n=e.onKey,r=cy(e,["onMove","onKey"]),o=g.useRef(null),s=Gf(t),a=Gf(n),i=g.useRef(null),l=g.useRef(!1),u=g.useMemo(function(){var h=function(v){dy(v),(tl(v)?v.touches.length>0:v.buttons>0)&&o.current?s(uy(o.current,v,i.current)):b(!1)},m=function(){return b(!1)};function b(v){var w=l.current,y=qf(o.current),S=v?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",h),S(w?"touchend":"mouseup",m)}return[function(v){var w=v.nativeEvent,y=o.current;if(y&&(dy(w),!function(C,E){return E&&!tl(C)}(w,l.current)&&y)){if(tl(w)){l.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),s(uy(y,w,i.current)),b(!0)}},function(v){var w=v.which||v.keyCode;w<37||w>40||(v.preventDefault(),a({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},b]},[a,s]),d=u[0],p=u[1],f=u[2];return g.useEffect(function(){return f},[f]),g.createElement("div",du({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:p,tabIndex:0,role:"slider"}))}),pu=function(e){return e.filter(Boolean).join(" ")},Zf=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=pu(["react-colorful__pointer",e.className]);return g.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},g.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},py=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:gn(e.h),s:gn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:gn(o/2),a:gn(r,2)}},Yf=function(e){var t=py(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Xf=function(e){var t=py(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},MI=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:gn(255*[r,i,a,a,l,r][u]),g:gn(255*[l,r,r,i,a,a][u]),b:gn(255*[a,a,l,r,r,i][u]),a:gn(o,2)}},LI=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?NI({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},NI=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:gn(60*(i<0?i+6:i)),s:gn(s?a/s*100:0),v:gn(s/255*100),a:o}},$I=g.memo(function(e){var t=e.hue,n=e.onChange,r=pu(["react-colorful__hue",e.className]);return g.createElement("div",{className:r},g.createElement(Kf,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:$a(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},g.createElement(Zf,{className:"react-colorful__hue-pointer",left:t/360,color:Yf({h:t,s:100,v:100,a:1})})))}),kI=g.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Yf({h:t.h,s:100,v:100,a:1})};return g.createElement("div",{className:"react-colorful__saturation",style:r},g.createElement(Kf,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:$a(t.s+100*o.left,0,100),v:$a(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},g.createElement(Zf,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Yf(t)})))}),II=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},VI=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function HI(e,t,n){var r=Gf(n),o=g.useState(function(){return e.toHsva(t)}),s=o[0],a=o[1],i=g.useRef({color:t,hsva:s});g.useEffect(function(){if(!e.equal(t,i.current.color)){var u=e.toHsva(t);i.current={hsva:u,color:t},a(u)}},[t,e]),g.useEffect(function(){var u;II(s,i.current.hsva)||e.equal(u=e.fromHsva(s),i.current.color)||(i.current={hsva:s,color:u},r(u))},[s,e,r]);var l=g.useCallback(function(u){a(function(d){return Object.assign({},d,u)})},[]);return[s,l]}var jI=typeof window<"u"?g.useLayoutEffect:g.useEffect,DI=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},fy=new Map,FI=function(e){jI(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!fy.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,fy.set(t,n);var r=DI();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},BI=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Xf(Object.assign({},n,{a:0}))+", "+Xf(Object.assign({},n,{a:1}))+")"},s=pu(["react-colorful__alpha",t]),a=gn(100*n.a);return g.createElement("div",{className:s},g.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),g.createElement(Kf,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:$a(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},g.createElement(Zf,{className:"react-colorful__alpha-pointer",left:n.a,color:Xf(n)})))},zI=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=cy(e,["className","colorModel","color","onChange"]),i=g.useRef(null);FI(i);var l=HI(n,o,s),u=l[0],d=l[1],p=pu(["react-colorful",t]);return g.createElement("div",du({},a,{ref:i,className:p}),g.createElement(kI,{hsva:u,onChange:d}),g.createElement($I,{hue:u.h,onChange:d}),g.createElement(BI,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},UI={defaultColor:"rgba(0, 0, 0, 1)",toHsva:LI,fromHsva:function(e){var t=MI(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:VI},WI=function(e){return g.createElement(zI,du({},e,{colorModel:UI}))};function gy(e){if(!Wn()||!document.body)return null;const{className:t,onPointerUp:n,onPointerCancel:r}=e,o=N(t,"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50");return On.createPortal(c.jsx("div",{onPointerUp:n,onPointerCancel:r,className:o}),document.body)}var GI={grad:.9,turn:360,rad:360/(2*Math.PI)},yo=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Wt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},or=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},hy=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},my=function(e){return{r:or(e.r,0,255),g:or(e.g,0,255),b:or(e.b,0,255),a:or(e.a)}},Jf=function(e){return{r:Wt(e.r),g:Wt(e.g),b:Wt(e.b),a:Wt(e.a,3)}},qI=/^#([0-9a-f]{3,8})$/i,fu=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},by=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:s?a/s*100:0,v:s/255*100,a:o}},vy=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:255*[r,i,a,a,l,r][u],g:255*[l,r,r,i,a,a][u],b:255*[a,a,l,r,r,i][u],a:o}},yy=function(e){return{h:hy(e.h),s:or(e.s,0,100),l:or(e.l,0,100),a:or(e.a)}},wy=function(e){return{h:Wt(e.h),s:Wt(e.s),l:Wt(e.l),a:Wt(e.a,3)}},Sy=function(e){return vy((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},nl=function(e){return{h:(t=by(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},KI=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ZI=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YI=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,XI=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qf={string:[[function(e){var t=qI.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Wt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Wt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=YI.exec(e)||XI.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:my({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=KI.exec(e)||ZI.exec(e);if(!t)return null;var n,r,o=yy({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(GI[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Sy(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=o===void 0?1:o;return yo(t)&&yo(n)&&yo(r)?my({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,s=o===void 0?1:o;if(!yo(t)||!yo(n)||!yo(r))return null;var a=yy({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return Sy(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!yo(t)||!yo(n)||!yo(r))return null;var a=function(i){return{h:hy(i.h),s:or(i.s,0,100),v:or(i.v,0,100),a:or(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return vy(a)},"hsv"]]},Cy=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},JI=function(e){return typeof e=="string"?Cy(e.trim(),Qf.string):typeof e=="object"&&e!==null?Cy(e,Qf.object):[null,void 0]},Rf=function(e,t){var n=nl(e);return{h:n.h,s:or(n.s+100*t,0,100),l:n.l,a:n.a}},eg=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},xy=function(e,t){var n=nl(e);return{h:n.h,s:n.s,l:or(n.l+100*t,0,100),a:n.a}},tg=function(){function e(t){this.parsed=JI(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Wt(eg(this.rgba),2)},e.prototype.isDark=function(){return eg(this.rgba)<.5},e.prototype.isLight=function(){return eg(this.rgba)>=.5},e.prototype.toHex=function(){return t=Jf(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?fu(Wt(255*s)):"","#"+fu(n)+fu(r)+fu(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return Jf(this.rgba)},e.prototype.toRgbString=function(){return t=Jf(this.rgba),n=t.r,r=t.g,o=t.b,(s=t.a)<1?"rgba("+n+", "+r+", "+o+", "+s+")":"rgb("+n+", "+r+", "+o+")";var t,n,r,o,s},e.prototype.toHsl=function(){return wy(nl(this.rgba))},e.prototype.toHslString=function(){return t=wy(nl(this.rgba)),n=t.h,r=t.s,o=t.l,(s=t.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+s+")":"hsl("+n+", "+r+"%, "+o+"%)";var t,n,r,o,s},e.prototype.toHsv=function(){return t=by(this.rgba),{h:Wt(t.h),s:Wt(t.s),v:Wt(t.v),a:Wt(t.a,3)};var t},e.prototype.invert=function(){return jn({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),jn(Rf(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),jn(Rf(this.rgba,-t))},e.prototype.grayscale=function(){return jn(Rf(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),jn(xy(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),jn(xy(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?jn({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Wt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=nl(this.rgba);return typeof t=="number"?jn({h:t,s:n.s,l:n.l,a:n.a}):Wt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===jn(t).toHex()},e}(),jn=function(e){return e instanceof tg?e:new tg(e)},Ey=[],QI=function(e){e.forEach(function(t){Ey.indexOf(t)<0&&(t(tg,Qf),Ey.push(t))})},RI={grad:.9,turn:360,rad:360/(2*Math.PI)},ng=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},gu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},rg=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},Py=function(e){return{h:(t=e.h,(t=isFinite(t)?t%360:0)>0?t:t+360),w:rg(e.w,0,100),b:rg(e.b,0,100),a:rg(e.a)};var t},Ty=function(e){return{h:gu(e.h),w:gu(e.w),b:gu(e.b),a:gu(e.a,3)}},Oy=function(e){return{h:function(t){var n=t.r,r=t.g,o=t.b,s=t.a,a=Math.max(n,r,o),i=a-Math.min(n,r,o),l=i?a===n?(r-o)/i:a===r?2+(o-n)/i:4+(n-r)/i:0;return{h:60*(l<0?l+6:l),s:a?i/a*100:0,v:a/255*100,a:s}}(e).h,w:Math.min(e.r,e.g,e.b)/255*100,b:100-Math.max(e.r,e.g,e.b)/255*100,a:e.a}},_y=function(e){return function(t){var n=t.h,r=t.s,o=t.v,s=t.a;n=n/360*6,r/=100,o/=100;var a=Math.floor(n),i=o*(1-r),l=o*(1-(n-a)*r),u=o*(1-(1-n+a)*r),d=a%6;return{r:255*[o,l,i,i,u,o][d],g:255*[u,o,o,l,i,i][d],b:255*[i,i,u,o,o,l][d],a:s}}({h:e.h,s:e.b===100?0:100-e.w/(100-e.b)*100,v:100-e.b,a:e.a})},e6=function(e){var t=e.h,n=e.w,r=e.b,o=e.a,s=o===void 0?1:o;if(!ng(t)||!ng(n)||!ng(r))return null;var a=Py({h:Number(t),w:Number(n),b:Number(r),a:Number(s)});return _y(a)},t6=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,n6=function(e){var t=t6.exec(e);if(!t)return null;var n,r,o=Py({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(RI[r]||1)),w:Number(t[3]),b:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return _y(o)};function r6(e,t){e.prototype.toHwb=function(){return Ty(Oy(this.rgba))},e.prototype.toHwbString=function(){return n=Ty(Oy(this.rgba)),r=n.h,o=n.w,s=n.b,(a=n.a)<1?"hwb("+r+" "+o+"% "+s+"% / "+a+")":"hwb("+r+" "+o+"% "+s+"%)";var n,r,o,s,a},t.string.push([n6,"hwb"]),t.object.push([e6,"hwb"])}function o6(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var o in n)r[n[o]]=o;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,l,u=r[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),p=1/0,f="black";if(!s.length)for(var h in n)s[h]=new e(n[h]).toRgb();for(var m in n){var b=(i=d,l=s[m],Math.pow(i.r-l.r,2)+Math.pow(i.g-l.g,2)+Math.pow(i.b-l.b,2));b<p&&(p=b,f=m)}return f}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}QI([o6,r6]);const s6="rgb",Ay="rgba(0, 0, 0, 1)",a6=jn(Ay).toRgb(),i6=[{id:"rgba",label:"RGB"},{id:"hex",label:"HEX"},{id:"hsla",label:"HSL"},{id:"hwb",label:"HWB"}],l6=[{id:"hex",label:"HEX"},{id:"rgba",label:"RGB"}],rl=e=>e==null?"":`${e}`,My=e=>typeof e=="string",Ly=(e,t)=>e.some(n=>rl(n.id)===t),c6=e=>{const t=(e||"").trim().toLowerCase();return t?t.startsWith("#")?"hex":t.startsWith("rgba(")||t.startsWith("rgb(")?"rgba":t.startsWith("hsla(")||t.startsWith("hsl(")?"hsla":t.startsWith("hwb(")?"hwb":"":""},og=(e,t=[],n)=>{var a;const r=rl(e).trim();if(r&&(!t.length||Ly(t,r)))return r;const o=c6(n);return o&&(!t.length||Ly(t,o))?o:rl((a=t[0])==null?void 0:a.id).trim()||s6},u6=(e,t)=>{const n=e[t];return typeof n=="function"?n.call(e):void 0},d6=(e=[],t)=>{if(!t)return;const n=rl(t).toLowerCase();return e.find(r=>rl(r.id).toLowerCase()===n)},p6=(e,t)=>{if(!t)return e;const n=jn(e);if(!n.isValid())return e;switch(t.toLowerCase()){case"rgb":case"rgba":return n.toRgbString();case"hex":return n.toHex();case"hsl":case"hsla":return n.toHslString();case"hwb":return n.toHwbString();case"name":return u6(n,"toName")||e;default:return e}},Ny=({value:e,format:t,prevFormat:n,formats:r,onFormatChange:o,callOnFormatChange:s})=>{var u;const a=t||"",i=d6(r,a);if(!!(i!=null&&i.onFormat)||!!(s&&o)){const d=jn(e),p={value:e,format:a,prevFormat:n||a,valueRgb:d.isValid()?d.toRgb():a6},f=(u=i==null?void 0:i.onFormat)==null?void 0:u.call(i,p);if(My(f))return f;if(s){const h=o==null?void 0:o(p);if(My(h))return h}}return p6(e,a)||e},f6=e=>{const t=(e||"").trim();if(t.toLowerCase().startsWith("rgba("))return t;const n=jn(t);if(!n.isValid())return Ay;const{r,g:o,b:s,a}=n.toRgb();return`rgba(${r}, ${o}, ${s}, ${a})`},g6=e=>!!(e!=null&&e.Components.getType("mjml")),$y=e=>({formats:g6(e)?l6:i6}),hu=e=>e==null?"":`${e}`,h6=(e=[],t)=>!t||!e.length||e.some(n=>hu(n.id).trim().toLowerCase()===hu(t).trim().toLowerCase());function ky({value:e,format:t,formats:n=[],onChange:r,onFormatChange:o,disabled:s}){const[a,i]=g.useState(()=>og(t,n,e||"")),l=g.useMemo(()=>f6(e||""),[e]),u=g.useMemo(()=>Ny({value:e||"",format:a,prevFormat:a,formats:n}),[e,a,n]),d=g.useRef(e||""),[p,f]=g.useState(!1),h=Wn()&&!!window.EyeDropper,m=!!n.length;g.useEffect(()=>{i(x=>{if(t){const P=og(t,n);return x===P?x:P}return h6(n,x)?x:og(void 0,n)})},[t,n]),g.useEffect(()=>{d.current=e||""},[e]);const b=(x,P=a,_={})=>Ny({value:x,format:P,prevFormat:_.prevFormat||a,formats:n,onFormatChange:o,callOnFormatChange:_.callOnFormatChange}),v=x=>{d.current=x,r==null||r(x)},w=x=>{const P=b(x);d.current=P,r==null||r(P,!0)},y=x=>{const P=hu(x).trim();if(!P)return;const _=a,T=e||"";i(P);const O=b(T,P,{prevFormat:_,callOnFormatChange:!0});d.current=O,r==null||r(O,!1)},S=()=>{h&&new window.EyeDropper().open().then(P=>{const _=b(P.sRGBHex);d.current=_,r==null||r(_)}).catch(console.warn)},C=()=>{f(!0)},E=()=>{const x=b(d.current);d.current=x,r==null||r(x,!1),f(!1)};return c.jsxs(c.Fragment,{children:[p&&c.jsx(gy,{className:"gs-utl-cursor-grabbing",onPointerUp:E,onPointerCancel:E}),c.jsx(WI,{className:"color-picker",color:l,onChange:w,onPointerDown:C,onPointerUp:E}),m&&c.jsx(_e,{classNameContainer:"gs-utl-mt-3",value:a,options:n,size:"s",onChange:x=>y(hu(x)),disabled:s}),c.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(at,{size:"s",value:u,onChange:v,disabled:s})}),h&&c.jsx(Je,{type:"button",onClick:S,children:c.jsx(ne,{icon:K.eyedropperVariant,size:se.s})})]})]})}const m6="gs-cmp-color-picker",b6={backgroundSize:"10px"},v6=[0,15];function Iy({className:e,value:t,format:n,formats:r,onChange:o,onFormatChange:s,disabled:a}){const[i,l]=g.useState(!1),u=N(`${m6}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,re.b,re.rnd,U.br),d=()=>{l(!1)},p=c.jsxs("div",{style:b6,className:u,children:[i&&c.jsx("div",{onPointerUp:d,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx("div",{className:"gs-utl-w-4 gs-utl-h-4",style:{backgroundColor:t}})]});return c.jsx(Or,{handler:p,title:"Color",size:"s",placement:"left-end",offset:v6,clickAway:!0,disabled:a,children:c.jsx(ky,{value:t,format:n,formats:r,onChange:o,onFormatChange:s,disabled:a})})}const y6="gs-cmp-color-field";function w6(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i,colorPickerProps:l,name:u,required:d,readOnly:p}=e,[f,h]=g.useState(zc(n)),m=Bi(e);g.useEffect(()=>{h(zc(n))},[n]);const b=(S,C)=>{s==null||s(S,C)},v=S=>{switch(S.key){case"Escape":return h(n);case"Enter":b(f),o&&(S.preventDefault(),S.stopPropagation())}},w=()=>{b(f)},y=Xo({...e,className:N(y6,t)});return c.jsxs("div",{...y,children:[c.jsx(Er,{...e,as:a}),c.jsxs(I,{className:gf(e),items:"center",space:"s",children:[c.jsx(F,{children:c.jsx(Iy,{...l,value:n,onChange:s,disabled:i})}),c.jsx(F,{grow:!0,children:c.jsx("input",{name:u,required:d,readOnly:p,disabled:i,placeholder:r,className:N(m,i&&"gs-utl-pointer-events-none"),value:f,onChange:S=>h(S.target.value),onBlur:w,onKeyDown:v})})]})]})}const Xr=ce(function(t){const{editor:n}=Ce(),r=$c(),o={...$y(n),...t.colorPickerProps},s=r.getOverrideProps("colorField",{props:{...t,colorPickerProps:o},editor:n});return c.jsx(w6,{...s})}),S6="gs-cmp-studio-color-field",C6=g.memo(ce(function(t){const{editor:n}=Ce(),{onChange:r,editorEvents:o}=t,[s,a]=g.useState(()=>({...t})),i=(u,d)=>{r==null||r({value:u||"",partial:d,editor:n,state:s,setState:p=>a(f=>({...f,...p}))})},l={className:N(S6,s.className),style:s.style,value:s.value||"",size:s.size,label:s.label,name:s.name,required:s.required,readOnly:s.readOnly,placeholder:s.placeholder,disabled:s.disabled,preventSubmitOnEnter:s.preventSubmitOnEnter,colorPickerProps:s.colorPickerProps,onChange:i};return xo({editor:n,editorEvents:o,localState:s,setLocalState:a}),c.jsx(Xr,{...l})})),x6="gs-cmp-studio-color-picker",E6=g.memo(ce(function(t){const{editor:n}=Ce(),o=$c().getOverrideProps("colorPicker",{props:{...$y(n),...t},editor:n}),{className:s,style:a,value:i="",format:l,formats:u,disabled:d,onChange:p,onFormatChange:f,editorEvents:h}=o,[m,b]=g.useState(()=>({className:s,style:a,value:i,format:l,formats:u,disabled:d})),v=(y,S)=>{const C=y||"";p==null||p({value:C,partial:S,editor:n,state:m,setState:E=>b(x=>({...x,...E}))})},w=y=>f==null?void 0:f({...y,editor:n,state:m,setState:S=>b(C=>({...C,...S}))});return xo({editor:n,editorEvents:h,localState:m,setLocalState:b}),c.jsx("div",{className:N(x6,m.className,Te.m),style:m.style,children:c.jsx(ky,{value:m.value||"",format:m.format,formats:m.formats,onChange:v,onFormatChange:w,disabled:m.disabled})})})),P6="gs-cmp-column",T6=g.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(P6,U.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:Lt(n)})}),sg=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
322
+ <path fill="currentColor" d="M20 6c0-2.168-3.663-4-8-4S4 3.832 4 6v2c0 2.168 3.663 4 8 4s8-1.832 8-4zm-8 13c-4.337 0-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4v-3c0 2.168-3.663 4-8 4"/><path fill="currentColor" d="M20 10c0 2.168-3.663 4-8 4s-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4z"/></svg>`,Us="--before-content",ag={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},Vy={stylable:!1,traits:[]};function O6(e){return typeof e=="object"&&e.type===zt.variable}function Hy(e){if(O6(e)){const{path:t}=e;return jy(t||"")}return e}function jy(e){return`{{ ${e} }}`}function _6(e){const t={};return e.DataSources.getAll().forEach(n=>{const r=n.get("id");if(!r)return;const o=n.getRecords();if(!o){t[r]={};return}t[r]=o.reduce((s,a)=>{if(!a)return s;let i={...a.attributes};return delete i.__p,delete i.id,r===Ds.globalStyles&&(i={value:i.value}),{...s,[a.id]:i}},{})}),t}function Dy(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const ig=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags)??t?{...Vy}:{}},lg=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e,r=(a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags;return t||r===!0?{...Vy}:{}},A6=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,M6=e=>Array.isArray(e)?"array":e===null?"default":typeof e,L6=ce(({name:e,value:t,isActive:n,isCollection:r,onClick:o,className:s})=>{const a=$e().tScoped("dataSources"),i=typeof t=="object"&&t!==null,l={array:K.codeBrackets,object:K.codeBraces,string:K.codeString,number:K.number,boolean:K.toggleSwitchOffOutline,default:K.null},u=M6(t),d=N(s,"gs-utl-text-left",U.hBgH,re.b,re.rnd,Te.xy,n?[re.bA,U.tA]:[U.br,U.txtHighEmphasisH]),p=f=>typeof f=="object"?Array.isArray(f)?a("items",{params:{length:f.length}}):f?a("properties",{params:{length:Object.keys(f).length}}):"null":String(f);return c.jsx(Je,{onClick:o,border:!1,className:d,full:!0,children:c.jsxs(I,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(I,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(I,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(ne,{icon:l[u],size:se.s}),c.jsx(F,{className:N(Oe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(F,{className:N("gs-utl-w-full",Oe.txtEllips,Oe.disabled),children:p(t)})]}),i&&c.jsx(F,{children:c.jsx(ne,{size:se.sx,icon:K.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),N6="gs-cmp-data-path-explorer",Fy=ce(function({additionalSources:t,onChange:n,path:r=""}){const{editor:o}=Ce(),s=g.useRef({}),[a,i]=g.useState(()=>r.split(".")),[l,u]=g.useState([]),d=g.useMemo(()=>({...o?_6(o):{},...t}),[o,t]),p=(b,v)=>{let w=s.current;for(let y=0;y<v&&y<b.length;y++){const S=b[y];if(w&&typeof w=="object"&&S in w)w=w[S];else{w=void 0;break}}return!w||typeof w!="object"?[]:Object.entries(w).map(([y,S])=>{const C=b.slice(0,v).concat(y),E=a[v]===y,x=v===0&&oo(S)&&S.collectionId===y,P=()=>{const _=E?C.slice(0,-1):C;n==null||n(_.join("."),{paths:_}),i(_)};return c.jsx(L6,{className:N(x&&"-gs-utl-order-1"),isCollection:x,name:y,value:S,isActive:E,onClick:P},y)})};g.useEffect(()=>{s.current=d;const b=[];for(let v=0;v<=a.length;v++){const w=p(a,v);w.length>0&&b.push(w)}u(b)},[d,a]);const f=N(N6,U.bg,U.br,re.b,re.rnd,Oe.scrollX,"gs-utl-h-full"),h=N("gs-utl-min-w-[220px]",U.br),m=N("gs-utl-h-full gs-utl-max-h-[60vh]",Oe.scrollY,Te.xyS);return c.jsx(I,{className:f,full:!0,nowrap:!0,children:l.map((b,v)=>c.jsx(F,{className:N(h,v!==l.length-1&&re.br),children:c.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:b})},v))})});function By(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function cg(e,t){const[n="",r="",...o]=e.split(".");return n&&t[n]?{collectionId:n,variableType:r,path:o.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const $6=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},k6=e=>{const{dataResolver:t,editor:n,value:r,defaultValue:o,additionalSources:s}=e,{path:a="",collectionId:i,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(i){const d=s==null?void 0:s[i],p=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:p}))||""}else return(u==null?void 0:u.getValue(r,o))||""},I6="gs-cmp-data-path-field",ol=ce(e=>{const{size:t="m",value:n="",label:r,open:o,defaultValue:s,additionalSources:a,dataResolver:i,readOnly:l,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:f}=e,{editor:h}=Ce(),m=$e().tScoped("dataSources"),[b,v]=g.useState(!!o),[w,y]=g.useState(!1),S=!!l||b||w,C=()=>y(!w),E=B=>{const G=B??!b;v(G),f==null||f(G)},x=()=>E(!1),P=(...B)=>{p==null||p(...B)},_=B=>{S||p==null||p(B,{paths:B.split(".")})},T=$6({dataResolver:i,value:n}),O=w&&h?`"${k6({editor:h,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:T,M=t==="m",A=M?"lg":t,$=M?se.l:se.s,j=m(b?"closePathExplorer":"openPathExplorer"),L={icon:b?K.close:K.databaseOutline,size:se.l},H={icon:w?K.eyeOff:K.eye,size:M?se.m:$},W=c.jsx(wt,{block:!0,variant:"pr",size:A,title:j,onClick:()=>E(),icon:L});return c.jsxs(I,{className:I6,gap:t,col:!0,children:[c.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[c.jsx(at,{readOnly:S,label:r,value:w?O:T,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",U.txt,Oe.txtEllips),afterInput:!!n&&c.jsx(wt,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Oe.hover,icon:H})}),d?c.jsx(Or,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:W,onClose:x,overlay:!0,children:c.jsx(Fy,{path:T,onChange:P,additionalSources:a})}):W]}),!!b&&!d&&c.jsx(Fy,{path:T,onChange:P,additionalSources:a})]})}),V6=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},zy=({value:e,step:t})=>{const n=parseFloat(`${e}`);let r=0;if(Math.floor(n)!==n&&t){const o=`${t}`.split(".")[1];r=(o==null?void 0:o.length)||0}return r?parseFloat(n.toFixed(r)):n},H6=({value:e,key:t,shiftKey:n,min:r,max:o,step:s=1})=>{const a=t==="ArrowUp",i=t==="ArrowDown";let l=null;if(a||i){l=Number(e);const u=parseFloat(`${s}`);a&&(l+=(n?10:1)*u),i&&(l-=(n?10:1)*u),l=`${mu({min:r,max:o,value:l})}`,l=zy({value:l,step:s})}return l},mu=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Ht(e)&&e!==""&&(o=Math.max(o,parseFloat(`${e}`)||0)),Ht(t)&&t!==""&&(o=Math.min(o,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:o}`},j6=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=p=>{const f=p.clientY-t,h=o-f*parseFloat(`${i}`);l=zy({value:mu({min:s,max:a,value:h}),step:i}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},D6=(e,t,n={})=>{const{partial:r}=n,o=(s,a)=>s===a||r&&s.startsWith(a);return t.some(s=>o(typeof s=="string"?s:s.id,e))},Uy=e=>Ht(e)?e:"",F6="gs-cmp-number-field";function ke(e){const{className:t,value:n,units:r,valueUnit:o,size:s="m",pan:a=!0,min:i,max:l,step:u,placeholder:d,disabled:p,onChange:f,onChangeUnit:h}=e,[m,b]=g.useState(Uy(n)),[v,w]=g.useState(!1),y=(r==null?void 0:r.map(T=>({id:T,label:T})))||[],S={min:i,max:l,step:u};g.useEffect(()=>{b(Uy(n))},[n,o]);const C=(T,O)=>{f==null||f(mu({min:i,max:l,value:T}),O)},E=T=>{if(p)return;w(!0);const O=(M,A)=>{C(M,!!A),!A&&w(!1)};j6(m,T.clientY,O,S)},x=T=>{const{key:O,shiftKey:M}=T;switch(O){case"Escape":return b(n);case"Enter":return C(m)}const A=H6({step:u,value:n,key:O,shiftKey:M});A!==null&&(T.preventDefault(),C(A))},P=()=>{C(m)},_=Xo({...e,className:N(F6,t)});return c.jsxs("div",{..._,children:[v&&c.jsx("div",{className:N("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(Er,{as:e.labelAs,...e}),c.jsxs(I,{className:gf(e),items:"center",space:"x2s",children:[!!a&&c.jsx(F,{onMouseDown:E,className:N("gs-utl-opacity-50 gs-utl-cursor-ns",s==="m"&&"-gs-utl-ml-3",s==="s"&&"-gs-utl-ml-2",a!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:a===!0?c.jsx(ne,{icon:K.panVertical,size:se.s2x}):a}),c.jsx(F,{grow:!0,children:c.jsx("input",{className:Bi(e),value:m,disabled:p,onChange:T=>b(T.target.value),placeholder:d,onBlur:P,onKeyDown:x})}),!!y.length&&c.jsx(F,{className:N(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(_e,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:o,disabled:p,onChange:T=>h==null?void 0:h(T),options:y})})]})]})}const B6="gs-cmp-switch-field";function sl(e){const{className:t,value:n,label:r,labelAs:o,border:s,disabled:a,onChange:i}=e,l=!!n,u=N("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",l?U.bgA:U.bgH,si.focus,s&&`${U.br} ${re.b}`);return c.jsx(wp.Group,{children:c.jsxs(I,{items:"center",className:N(B6,t),full:!0,children:[!!r&&c.jsx(wp.Label,{as:o,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(Er,{...e,as:"span"})}),c.jsx(wp,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:N(U.bg,"gs-utl-inline-block gs-utl-w-4 gs-utl-h-4 gs-utl-transform gs-utl-rounded-full gs-utl-transition-transform",l?"gs-utl-translate-x-6":"gs-utl-translate-x-1")})})]})})}function ug(e){var a;const[t,n]=g.useState(((a=e.getDataResolver)==null?void 0:a.call(e))??{}),r=g.useRef(t),o=i=>{const l={...r.current,...i};r.current=l,n(l)},s=()=>{e.setDataResolver(r.current)};return g.useEffect(()=>{const i="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(i,l),()=>{e.off(i,l)}},[e]),{localData:t,updateLocalData:o,syncToComponent:s}}const z6="gs-cmp-data-collection-picker",U6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=ug(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=By(a),d=l===Number.MAX_VALUE,p=$e().tScoped("dataSources"),f=d?"":l,h=()=>{o(),t==null||t({value:n})},m=y=>r({dataSource:{...a,path:y}}),b=y=>r({startIndex:y}),v=y=>r({endIndex:y}),w=y=>r({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(I,{className:z6,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(at,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(kv,{size:"s",value:s,block:!0})]}),c.jsx(ol,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(ke,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:b}),c.jsx(ke,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:f==null?void 0:f.toString(),onChange:v,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(F,{children:c.jsx(sl,{label:p("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(I,{full:!0,justify:"end",children:c.jsx(Je,{onClick:h,variant:"pr",size:"m",children:p("confirm")})})]})}),W6="gs-data-collection-picker",G6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(W6,t),...o,children:c.jsx(U6,{component:n,onConfirm:r})})});var Dn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Dn||{}),Fn=(e=>(e.equals="equals",e.isTruthy="isTruthy",e.isFalsy="isFalsy",e.isDefined="isDefined",e.isNull="isNull",e.isUndefined="isUndefined",e.isArray="isArray",e.isObject="isObject",e.isString="isString",e.isNumber="isNumber",e.isBoolean="isBoolean",e.isDefaultValue="isDefaultValue",e))(Fn||{}),dg=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(dg||{}),pg=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(pg||{});const q6=[...Object.values(pg),...Object.values(dg),...Object.values(Fn)],fg={string:Object.values(pg),number:Object.values(dg),dataSource:q6},K6=g.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case Dn.DATA_SOURCE:return c.jsx(ol,{size:"s",pickerInPopover:!0,value:By(s),onChange:i=>a(r,i,o),additionalSources:n});case Dn.NUMBER:return c.jsx(ke,{size:"s",value:s,onChange:i=>a(r,i,o)});default:return c.jsx(at,{size:"s",value:s,onChange:i=>a(r,i,o)})}}),Z6="gs-cmp-statement-side",Wy=g.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(I,{className:N(Z6,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Yo,{size:"s",children:o}),c.jsxs(I,{items:"center",gap:"xs",children:[c.jsx(F,{children:c.jsx(_e,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(F,{grow:!0,children:c.jsx(K6,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),bu=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Dn.DATA_SOURCE:typeof e=="string"?Dn.STRING:typeof e=="number"?Dn.NUMBER:Dn.STRING,Y6=(e,t,n)=>{switch(t){case Dn.STRING:return e||"";case Dn.NUMBER:return e?Number(e):0;case Dn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(dt(e)?cg(e,r):e)??{path:"",defaultValue:""}}}default:return e}},X6=e=>fg[e][0],J6=e=>![Fn.isTruthy,Fn.isFalsy,Fn.isDefined,Fn.isNull,Fn.isUndefined,Fn.isArray,Fn.isObject,Fn.isString,Fn.isNumber,Fn.isBoolean,Fn.isDefaultValue].includes(e),Q6="gs-cmp-statement",R6=ce(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=$e().tScoped("dataSources"),[a,i]=g.useState(()=>bu(t.left)),[l,u]=g.useState(()=>bu(t.right)),d=fg[a]||fg[Dn.STRING],p=g.useMemo(()=>Object.values(Dn).map(C=>({id:C,label:$r(C)})),[]),f=g.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);g.useEffect(()=>{i(bu(t.left)),u(bu(t.right))},[t.left,t.right]);const h=C=>{n({...t,...C})},m=(C,E,x)=>{const P=Y6(E,x,o),_=C==="left",T=_&&x!==Dn.DATA_SOURCE;_?i(x):u(x),h({[C]:P,...T&&{operator:X6(x)}})},b=(C,E)=>m(C,null,E),v=C=>h({operator:C}),w=N(Q6,r,U.br,re.b,re.rnd,Te.xy),y=J6(t.operator),S={additionalSources:o,onChange:m,onTypeChange:b,typeOptions:p};return c.jsx(I,{className:N(w,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(I,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(Wy,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(F,{children:c.jsx(_e,{size:"s",label:s("operator"),value:t.operator,options:f,onChange:v})}),y&&c.jsx(Wy,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),gg="gs-cmp-statements-group",e8=e=>e==="and"||e==="or",vu=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),Gy=ce(e=>{const{className:t,condition:n,onUpdate:r,additionalSources:o,skipAddCondition:s}=e,a=$e().tScoped("dataSources"),i=n.statements??[],l=n.logicalOperator||"and",u=m=>{e8(m)&&r({...n,logicalOperator:m})},d=()=>{vu(n),r(vu(n))},p=m=>{const b=i.filter((v,w)=>w!==m);r({...n,statements:b})},f=(m,b)=>{if(m>=0&&m<i.length){const v=[...i];v[m]=b,r({...n,statements:v})}},h=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return c.jsxs(I,{className:N(gg,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Ro,{value:l,onChange:u,tabs:h}),c.jsx(I,{className:`${gg}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,b)=>c.jsxs(I,{className:N(`${gg}__item`),gap:"s",col:!0,children:[c.jsx(R6,{additionalSources:o,statement:m,onChange:v=>f(b,v)}),b<i.length-1&&c.jsxs(I,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:N(U.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(wt,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>p(b+1),icon:{icon:K.delete,size:se.s}})]})]},`stmt-${b}`))}),!s&&c.jsx(I,{justify:"end",children:c.jsx(Je,{variant:"pr",onClick:d,icon:{icon:K.plus,size:se.s},children:a("addCondition")})})]})}),t8="gs-cmp-data-condition-picker",n8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=ug(e),s=$e().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:vu(a)})};return c.jsxs(I,{className:t8,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(Gy,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(I,{gap:"m",justify:"end",full:!0,children:[c.jsx(Je,{variant:"out",onClick:u,icon:{icon:K.plus,size:se.s},children:s("addCondition")}),c.jsx(Je,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),r8="gs-data-condition-picker",o8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(r8,t),...o,children:c.jsx(n8,{component:n,onConfirm:r})})}),s8="gs-data-path-field",a8=ce(({className:e,value:t="",onChange:n,...r})=>c.jsx(xn,{className:N(s8,e),...r,children:c.jsx(ol,{onChange:o=>n({value:o}),value:t})})),yu={type:"data-variable",path:"",defaultValue:""},qy={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function ss(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const Ky="gs-cmp-dynamic-value-picker",i8=ce(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=g.useState(()=>ss(e)?e:yu),[a,i]=g.useState(o.type),l=$e().tScoped("dataSources");g.useEffect(()=>{const S=ss(e)?e:yu;(S.type!==o.type||JSON.stringify(S)!==JSON.stringify(o))&&(s(S),i(S.type))},[e]);const u=S=>{s(S),t==null||t({value:S})},d=S=>{const C=S;i(C);const E=o.type===C?o:C==="data-variable"?yu:qy;u(E)},p=S=>{u({type:"data-variable",defaultValue:o.defaultValue,...cg(S,r)})},f=S=>{s(C=>{const E={...C,defaultValue:S};return t==null||t({value:E}),E})},h=S=>{u({...o,condition:S})},m=(S,C)=>{u({...o,[S]:C})},b=()=>{const S=o.condition;h(vu(S))},v=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:yu,y=(o==null?void 0:o.type)==="data-condition"?o:qy;return c.jsxs(I,{className:Ky,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{className:Ky,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Ro,{value:a,onChange:d,tabs:v}),c.jsx(F,{grow:!0,className:Te.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(ol,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:p}),c.jsx(at,{label:l("defaultValue"),value:w.defaultValue||"",onChange:f})]}):c.jsxs(I,{gap:"m",col:!0,children:[c.jsx(Gy,{additionalSources:r,condition:y.condition,onUpdate:h,skipAddCondition:!0}),c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(at,{label:l("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),c.jsx(at,{label:l("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&c.jsx(I,{full:!0,justify:"end",className:Te.x,children:c.jsx(Je,{variant:"out",onClick:b,icon:{icon:K.plus,size:se.s},children:l("addCondition")})})]}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Je,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),l8="gs-data-value-picker",c8=ce(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(xn,{className:N(l8,e),...s,children:c.jsx(i8,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),u8="gs-cmp-data-variable-picker",d8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=ug(e),s=$e().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=f=>{r(cg(f,l))},d=()=>{o(),t==null||t({value:n})},p=f=>r({defaultValue:f});return c.jsxs(I,{className:u8,gap:"s",col:!0,nowrap:!0,children:[c.jsx(ol,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(at,{label:s("defaultValue"),value:i,onChange:p}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Je,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),p8="gs-data-variable-picker",f8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(p8,t),...o,children:c.jsx(d8,{component:n,onConfirm:r})})}),g8="gs-cmp-input-field",h8=g.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,disabled:i,inputType:l,readOnly:u,required:d,placeholder:p,onChange:f,onInput:h,editorEvents:m}){const{editor:b}=Ce(),[v,w]=g.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:p})),y=E=>({value:E,editor:b,state:v,setState:x=>w(P=>({...P,...x}))}),S=E=>f==null?void 0:f(y(E)),C=E=>h==null?void 0:h(y(E));return xo({editor:b,editorEvents:m,localState:v,setLocalState:w}),c.jsx(at,{type:l,className:N(g8,v.className),style:v.style,label:v.label,name:v.name,value:v.value,size:v.size,required:v.required,disabled:v.disabled,readOnly:v.readOnly,placeholder:v.placeholder,onChange:S,onInput:C})})),m8="gs-menu-list",b8=ce(function({className:e,items:t,onItemClick:n,...r}){const{editor:o}=Ce(),[s,a]=g.useState(),i=u=>{const{onClick:d}=u;if(d&&o)return p=>d({item:u,editor:o,...p})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(xn,{className:N(m8,U.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>g.createElement(_a,{...u,label:u.layout?Lt(u.layout):u.label,key:u.id??d,className:u.className,action:i(u),onActive:()=>a(u),onItemClick:l(),active:s===u,items:u.items}))})});function v8({children:e,accept:t,onChange:n,multiple:r=!0,...o}){const s=$e(),a=g.useRef(null),i=()=>{const{current:l}=a;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:Q("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),c.jsx(Je,{variant:"pr",size:"m2",...o,onClick:i,children:e||s.t("upload")})]})}const y8=ce(v8),w8=ce(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=Li();return Lt(r({asset:fr(a.toAsset(n)),assetProps:fr(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),S8="gs-cmp-asset-card",C8=ce(function(t){var p;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=$e(),{editor:l}=Ce();if(a)return l?c.jsx(w8,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return c.jsx(Rn,{padding:!1,className:ie(S8,"overflow-hidden max-w-full group",s),children:c.jsxs(I,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[c.jsx("div",{className:ie("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(I,{justify:"center",items:"center",className:ie(Oe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Je,{className:ie("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),c.jsxs(I,{className:ie("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(F,{className:ie(Oe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(uu,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(I,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ie("text-center",U.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ie("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(wt,{title:i.t("delete"),children:c.jsx(ne,{icon:K.delete,size:se.sx})})})]})]})})}),sr="gs-asset-manager",x8={search:!0,addUrl:!0,upload:!0},E8=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:f,onSelect:h,onChangeTypeFilter:m,onChangeProviderFilter:b,onChangeSearchValue:v,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:E}){const x=Ce(),{editor:P}=x,_=$e(),[T]=Xp(),O=Uf(f==null?void 0:f.itemsPerRow),[M,A]=g.useState(""),$=(f==null?void 0:f.header)===!1?!1:{...x8,...oo(f==null?void 0:f.header)?f.header:{}};if(!P)return;const j=d?t.filter(L=>!(a&&!Xs(L.src,a)&&!Xs(L.name??"",a))):t;return c.jsxs(I,{className:Q(sr,"relative gs-utl-h-full",i&&Oe.disabled),nowrap:!0,col:!0,space:"m",children:[$!==!1&&c.jsxs(I,{className:`${sr}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(I,{className:`${sr}__header-filters`,items:"center",gap:"m",children:[$.search&&c.jsx(F,{children:c.jsx(at,{className:`${sr}__search-filter`,size:"m",type:"search",value:a,onInput:v,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(F,{children:c.jsx(_e,{className:Q(`${sr}__type-filter`,"items-center"),size:"m",options:n,value:o,onChange:m,emptyState:_.t("assetManager.assetTypes.all"),includeEmpty:l})}),r.length>(u?0:1)&&c.jsx(F,{children:c.jsx(_e,{classNameContainer:Q(`${sr}__provider-filter`,"items-center"),size:"m",options:r.map(L=>({...L,label:ot(L.label)?L.label({editor:P}):L.label,icon:L.icon})),value:s,onChange:b,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(I,{className:`${sr}__header-buttons`,items:"center",gap:"m",children:[$.upload&&c.jsx(F,{className:`${sr}__upload`,children:c.jsx(y8,{className:`${sr}__upload-field`,onChange:w})}),$.addUrl&&!!y&&c.jsx(F,{className:`${sr}__add-url`,children:c.jsx(Or,{className:`${sr}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Je,{variant:"pr",size:"m2",children:_.t("assetManager.addUrl")}),children:({close:L})=>c.jsx("form",{onSubmit:H=>{H.preventDefault(),y(M),A(""),L()},children:c.jsxs(I,{gap:"m",children:[c.jsx(F,{children:c.jsx(at,{type:"url",size:"s",pattern:"https?://.+",value:M,onChange:A,placeholder:_.t("assetManager.inputPlh"),required:!0})}),c.jsx(F,{children:c.jsx(Je,{variant:"pr",size:"m2",type:"submit",children:_.t("add")})})]})})})})]}),E&&c.jsx(c.Fragment,{children:Lt(E({editor:P}))})]}),c.jsx(I,{className:Q(`${sr}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!j.length?c.jsx(I,{justify:"center",children:_.t("noItems")}):!!T&&c.jsx(cu,{data:j,listClassName:Q("gs-utl-grid gs-utl-gap-2",O),endReached:C,itemContent:(L,H)=>c.jsx(C8,{assetProps:H,onSelect:h,onRemove:S,itemLayout:p},H.id),components:{Footer:C?P8:void 0}})}),i&&c.jsx(ko,{abs:!0})]})}),P8=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),T8=ce(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:f}){const{appEditorStore:h,i18nStore:m}=Pn(),{editor:b}=h,v=Li(),{customOnLoad:w}=v,y=Bb(t);g.useEffect(()=>{const P=T=>dt(T)?{id:T,label:m.t(`assetManager.assetTypes.${T}`)||T}:T;y.setCustomTypes(o==null?void 0:o.map(P)),y.setCustomProviders(dt(s)?[s]:s),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Ht(l)?y.setOptionalType(l):y.initOptionalType(),Ht(u)?y.setOptionalProvider(u):y.initOptionalProvider();const _=setTimeout(()=>y.loadAssets());return()=>clearTimeout(_)},[o,s,a,i,l,u]);const S=P=>{v.addToProjectAssets([{id:P,src:P,type:y.typeFilter??ks.image}])},C=P=>{b&&(d==null||d({asset:v.toAsset(P),assetProps:P,editor:b}),p==null||p())},E=r==null?void 0:r.map(v.toAssetProps),x=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(E8,{assetProps:E??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:P=>{y.setTypeFilter(P),y.loadAssets()},onChangeProviderFilter:P=>{y.setProviderFilter(P),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:P=>v.uploadFile(P.nativeEvent),onRemove:E?void 0:y.handleDelete,onEndReached:x,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:f})});var O8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),It=function(){return It=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},It.apply(this,arguments)},Zy={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Yy={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},wu={width:"20px",height:"20px",position:"absolute"},_8={top:It(It({},Zy),{top:"-5px"}),right:It(It({},Yy),{left:void 0,right:"-5px"}),bottom:It(It({},Zy),{top:void 0,bottom:"-5px"}),left:It(It({},Yy),{left:"-5px"}),topRight:It(It({},wu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:It(It({},wu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:It(It({},wu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:It(It({},wu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},A8=function(e){O8(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(r){n.props.onResizeStart(r,n.props.direction)},n.onTouchStart=function(r){n.props.onResizeStart(r,n.props.direction)},n}return t.prototype.render=function(){return st.createElement("div",{className:this.props.className||"",style:It(It({position:"absolute",userSelect:"none"},_8[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(st.PureComponent),M8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jr=function(){return Jr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Jr.apply(this,arguments)},L8={width:"auto",height:"auto"},Su=function(e,t,n){return Math.max(Math.min(e,n),t)},Xy=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},ka=function(e,t){return new RegExp(e,"i").test(t)},Cu=function(e){return!!(e.touches&&e.touches.length)},N8=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},Jy=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(s,a,i){return Math.abs(a-e)<Math.abs(t[s]-e)?i:s},0),o=Math.abs(t[r]-e);return n===0||o<n?t[r]:e},hg=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},xu=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var o=Number(e.replace("%",""))/100;return t*o}if(e.endsWith("vw")){var o=Number(e.replace("vw",""))/100;return n*o}if(e.endsWith("vh")){var o=Number(e.replace("vh",""))/100;return r*o}}return e},$8=function(e,t,n,r,o,s,a){return r=xu(r,e.width,t,n),o=xu(o,e.height,t,n),s=xu(s,e.width,t,n),a=xu(a,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof a>"u"?void 0:Number(a)}},k8=function(e){return Array.isArray(e)?e:[e,e]},I8=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Qy="__resizable_base__",V8=function(e){M8(t,e);function t(n){var r,o,s,a,i=e.call(this,n)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var l=i.parentNode;if(!l)return null;var u=i.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(Qy):u.className+=Qy,l.appendChild(u),u},i.removeBase=function(l){var u=i.parentNode;u&&u.removeChild(l)},i.state={isResizing:!1,width:(o=(r=i.propsSize)===null||r===void 0?void 0:r.width)!==null&&o!==void 0?o:"auto",height:(a=(s=i.propsSize)===null||s===void 0?void 0:s.height)!==null&&a!==void 0?a:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||L8},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(i){var l;if(typeof n.state[i]>"u"||n.state[i]==="auto")return"auto";if(n.propsSize&&n.propsSize[i]&&(!((l=n.propsSize[i])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[i].toString().endsWith("%"))return n.state[i].toString();var u=n.getParentSize(),d=Number(n.state[i].toString().replace("px","")),p=d/u[i]*100;return p+"%"}return hg(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?hg(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?hg(r.height):o("height");return{width:s,height:a}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,a=o&&ka("left",s),i=o&&ka("top",s),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=a?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=i?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=i?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=i?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var o=this.props.scale||1,s=k8(this.props.resizeRatio||1),a=s[0],i=s[1],l=this.state,u=l.direction,d=l.original,p=this.props,f=p.lockAspectRatio,h=p.lockAspectRatioExtraHeight,m=p.lockAspectRatioExtraWidth,b=d.width,v=d.height,w=h||0,y=m||0;return ka("right",u)&&(b=d.width+(n-d.x)*a/o,f&&(v=(b-y)/this.ratio+w)),ka("left",u)&&(b=d.width-(n-d.x)*a/o,f&&(v=(b-y)/this.ratio+w)),ka("bottom",u)&&(v=d.height+(r-d.y)*i/o,f&&(b=(v-w)*this.ratio+y)),ka("top",u)&&(v=d.height-(r-d.y)*i/o,f&&(b=(v-w)*this.ratio+y)),{newWidth:b,newHeight:v}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,o,s){var a=this.props,i=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,u=a.lockAspectRatioExtraWidth,d=typeof s.width>"u"?10:s.width,p=typeof o.width>"u"||o.width<0?n:o.width,f=typeof s.height>"u"?10:s.height,h=typeof o.height>"u"||o.height<0?r:o.height,m=l||0,b=u||0;if(i){var v=(f-m)*this.ratio+b,w=(h-m)*this.ratio+b,y=(d-b)/this.ratio+m,S=(p-b)/this.ratio+m,C=Math.max(d,v),E=Math.min(p,w),x=Math.max(f,y),P=Math.min(h,S);n=Su(n,C,E),r=Su(r,x,P)}else n=Su(n,d,p),r=Su(r,f,h);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var o=r.getBoundingClientRect();this.parentLeft=o.left*n,this.parentTop=o.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*n,this.targetTop=s.top*n}if(this.resizable){var a=this.resizable.getBoundingClientRect(),i=a.left,l=a.top,u=a.right,d=a.bottom;this.resizableLeft=i*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&N8(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Cu(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var i,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",i=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Jr(Jr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(p)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Cu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=Cu(n)?n.touches[0].clientX:n.clientX,d=Cu(n)?n.touches[0].clientY:n.clientY,p=this.state,f=p.direction,h=p.original,m=p.width,b=p.height,v=this.getParentSize(),w=$8(v,this.window.innerWidth,this.window.innerHeight,s,a,i,l);s=w.maxWidth,a=w.maxHeight,i=w.minWidth,l=w.minHeight;var y=this.calculateNewSizeFromDirection(u,d),S=y.newHeight,C=y.newWidth,E=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(C=Jy(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=Jy(S,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(C,S,{width:E.maxWidth,height:E.maxHeight},{width:i,height:l});if(C=x.newWidth,S=x.newHeight,this.props.grid){var P=Xy(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=Xy(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),T=this.props.snapGap||0,O=T===0||Math.abs(P-C)<=T?P:C,M=T===0||Math.abs(_-S)<=T?_:S;C=O,S=M}var A={width:C-h.width,height:S-h.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var $=C/v.width*100;C=$+"%"}else if(m.endsWith("vw")){var j=C/this.window.innerWidth*100;C=j+"vw"}else if(m.endsWith("vh")){var L=C/this.window.innerHeight*100;C=L+"vh"}}if(b&&typeof b=="string"){if(b.endsWith("%")){var $=S/v.height*100;S=$+"%"}else if(b.endsWith("vw")){var j=S/this.window.innerWidth*100;S=j+"vw"}else if(b.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}var H={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?H.flexBasis=H.width:this.flexDir==="column"&&(H.flexBasis=H.height);var W=this.state.width!==H.width,B=this.state.height!==H.height,G=this.state.flexBasis!==H.flexBasis,D=W||B||G;D&&On.flushSync(function(){r.setState(H)}),this.props.onResize&&D&&this.props.onResize(n,f,this.resizable,A)}},t.prototype.onMouseUp=function(n){var r,o,s=this.state,a=s.isResizing,i=s.direction,l=s.original;if(!(!a||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,i,this.resizable,u),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Jr(Jr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var r,o;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(o=n.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(n){var r=this,o=this.props,s=o.enable,a=o.handleStyles,i=o.handleClasses,l=o.handleWrapperStyle,u=o.handleWrapperClass,d=o.handleComponent;if(!s)return null;var p=n.filter(function(f){return s[f]!==!1}).map(function(f){return s[f]!==!1?st.createElement(A8,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:i&&i[f]},d&&d[f]?d[f]:null):null});return st.createElement("div",{className:u,style:l},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return I8.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=Jr(Jr(Jr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return st.createElement(s,Jr({style:o,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&st.createElement("div",{style:this.state.backgroundStyle}),this.renderResizer(["topLeft","top","topRight","left"]),this.props.children,this.renderResizer(["right","bottomLeft","bottom","bottomRight"]))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(st.PureComponent);function Eu({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,onResize:h,onResizeStop:m,...b}){const v={top:n||!1,right:o||!1,bottom:r||!1,left:s||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},w={width:a||"auto",height:i||"auto"},y=N("gs-utl-z-10",U.hBgAct),S={top:y,bottom:y,right:y,left:y},C={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(V8,{className:e,enable:b.enable??v,defaultSize:w,handleStyles:C,handleClasses:S,onResize:h,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,children:t})}const mg="gs-cmp-accordion",bg=`${mg}-handler`,Pu=`${bg}__content`,H8=`${mg}-content`;function wo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:p,open:f}){return c.jsx(ip,{as:"div",defaultOpen:f,className:Q(mg,t,"relative"),children:({open:h})=>c.jsxs(c.Fragment,{children:[c.jsx(ip.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>p==null?void 0:p({event:m,open:!h}),className:({open:m})=>N(bg,ot(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs(I,{items:"center",className:Q("gap-2"),full:!0,children:[c.jsx(F,{className:Q(Pu,r,"text-left"),grow:!0,children:ot(s)?s(m):c.jsxs(I,{items:"center",className:Q(`${Pu}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(ne,{className:Q(`${Pu}-icon`),icon:a,size:se.s2x}),c.jsx(F,{className:Q(`${Pu}-label gs-utl-w-full`),children:s})]})}),c.jsx(F,{className:Q(`${bg}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(ne,{icon:K.chevronDown,className:Q("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(ip.Panel,{className:Q(H8,n),children:i})]})})}const al="gs-studio-panel",Ry=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Ar=g.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(xn,{className:N(al,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(Eu,{className:N([`${al}__resizer`]),...u,children:l}):l,p=n===!0?{collapsible:!0}:n||void 0;return p?c.jsx(wo,{classNameWrap:N(`${al}__accordion`,s),className:N(`${al}__accordion-header`,Te.xy,p.className),classNameContent:N(`${al}__accordion-content`,a),disabled:p.collapsible===!1,style:p.style,handler:c.jsxs(I,{space:"s",items:"center",children:[!!p.icon&&c.jsx(ne,{icon:p.icon,size:se.s}),c.jsx(F,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),j8="gs-panel-assets",D8=g.memo(ce(function({className:t,onSelect:n,content:r,assets:o,types:s,providers:a,typeId:i,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:f,...h}){var E;const m=Ce(),b=Li(),v=m.editor,w=(E=m.sdkOptions.assets)==null?void 0:E.layoutAfterHeader,y=f||w,[S]=g.useState(()=>h.id||lb());return g.useEffect(()=>(b.createAssetManager(S),()=>{b.removeAssetManager(S)}),[S]),Bb(S)?c.jsx(Ar,{className:N(j8,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...h,children:v&&c.jsx(T8,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null})),ew={indent_size:2},F8=async()=>await yC([{id:"js_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify.min.js"},{id:"css_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify-css.min.js"},{id:"html_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify-html.min.js"}]),B8=(e,t={})=>{const n=window.html_beautify;return n?n(e,{...ew,indent_inner_html:!0,preserve_newlines:!0,inline:[],...t.isEmail&&{inline_custom_elements:!1,unformatted:[],content_unformatted:[]}}):e},z8=e=>{const t=window.css_beautify;return t?t(e,ew):e};function tw(e,t){if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o)||!tw(e[o],t[o]))return!1;return!0}function U8(e){return e.Css.getAll().filter(n=>{var o;const r=(o=n.get("__data_values"))==null?void 0:o.style;return!r||yh(r)})}function nw(e,t){return{avoidProtected:!0,keepUnusedStyles:!1,component:t,rules:U8(e)}}function W8({editor:e,page:t,component:n,includeComponentIds:r=!0}){return{page:t,optionsHtml:{attributes:(o,s)=>{var l;if(!r)return s;const a=o.tagName;return s&&!["body","html","head"].includes(a)&&((l=o.parent())==null?void 0:l.tagName)!=="head"&&(s.id=o.getId()),s}},optionsCss:nw(e,n),skipProject:!0,skipGlobalCode:!0,skipCustomCodeBody:!0,styles:"skipInPage",scriptComponents:"skip"}}function G8({projectFiles:e,isEmail:t}){var s,a,i;const n=(s=e.find(l=>l.mimeType==="text/html"))==null?void 0:s.content,r=(a=e.find(l=>l.mimeType==="text/mjml"))==null?void 0:a.content,o=(i=e.find(l=>l.mimeType==="text/css"))==null?void 0:i.content;return{code:t?r||"":n||"",codeStyle:o||""}}function q8(e){const t={};return e.forEach(n=>{const r=n.getAtRule(),o=n.selectorsToString(),s=`${r}__${o}`;t[s]=n}),t}function K8({editor:e,css:t,component:n}){const{Css:r,Parser:o}=e,s=new Set,a={},i={added:[],updated:[],removed:[]},l=e.getCss({...nw(e,n),json:!0}),u=q8(l);return o.parseCss(t).forEach(p=>{const{atRuleType:f="",mediaText:h="",state:m="",selectorsAdd:b="",selectors:v=[]}=p,w=v.map(P=>P.startsWith("#")?P:`.${P}`).join(""),y=[];w&&y.push(`${w}${m?`:${m}`:""}`),b&&y.push(b);const S=y.join(", "),C=f?`@${f}`:h?"@media":"",x=`${C+(h&&C?` ${h}`:"")}__${S}`;a[x]=p}),Object.keys(a).forEach(p=>{const f=u[p],h=a[p];if(f)f.setStyle(h.style),i.updated.push({rule:f,parsedRule:h});else{const m=r.rules.add(h);i.added.push({rule:m,parsedRule:h})}s.add(p)}),Object.keys(u).forEach(p=>{if(!s.has(p)){const f=u[p];r.remove(f),i.removed.push({rule:f})}}),i}const Bn="gs-panel-edit-code",Z8=ce(function({className:t,style:n,htmlAttrs:r,id:o,as:s,state:a,layoutBefore:i,layoutAfter:l,...u}){const{editor:d}=Ce(),{isDarkTheme:p}=xr(),f=g.useRef(),h=g.useRef(!0),[m,b]=g.useState(!1),[v,w]=g.useState(0),[y,S]=g.useState(""),[C,E]=g.useState(""),[x,P]=g.useState(""),[_,T]=g.useState(""),[O,M]=g.useState(),[A,$]=g.useState(),j=le=>d==null?void 0:d.t(`actions.editCode.${le}`),L=f.current??(a==null?void 0:a({editor:d}))??{};f.current=L;const[H,W]=g.useState(()=>L.page??(d==null?void 0:d.Pages.getSelected())??null),[B]=g.useState(()=>Ob(d)),{className:G,style:D,...V}=r||{},k=H==null?void 0:H.getMainComponent(),z=C!==y,Y=x!==_,X=z||Y,ee={editor:d,state:{page:H,code:C,codeStyle:x,isEmail:B,isCodeChanged:z,isCodeStyleChanged:Y,hasChanges:X},setState:le=>{if("page"in le&&W(le.page??null),"code"in le){const me=le.code??"";E(me),O&&Uc(O,me)}if("codeStyle"in le){const me=le.codeStyle??"";P(me),A&&Uc(A,me)}},update:()=>{if(!(!k||!C||!d)){if(z){const{output:le,error:me}=d.runCommand(te.validateCode,{code:C,showToastError:!0});if(me)return;if(B)return d.loadProjectData({pages:[{component:le}]});k.components().resetFromString(le,{updateOptions:{onAttributes:({component:ve,attributes:He,options:je,item:it})=>{var et;const qe=((et=it.classes)==null?void 0:et.join(" "))||He.class,Se={id:ve.getId(),...ve.getAttributes()},Ue={id:it.attributes.id,...He,...qe!==void 0?{class:qe}:{}};tw(Se,Ue)||ve.setAttributes({...He,class:qe||[]},je)}}})}if(Y){if(x.trim()&&!d.Parser.parseCss(x).length)return;K8({editor:d,css:x,component:k}),T(x)}}}};g.useEffect(()=>{const le=setTimeout(async()=>{await F8(),b(!0)});return()=>clearTimeout(le)},[]),g.useEffect(()=>{if(!k||!d)return;const le=d.Components.events.updateInside,me=()=>w(ve=>ve+1);return k.on(le,me),()=>{k.off(le,me)}},[k,d]),g.useEffect(()=>{if(!d)return;const{Pages:le}=d,me=le.events.select,ve=()=>W(le.getSelected()??null);return d.on(me,ve),()=>{d.off(me,ve)}},[d]),g.useEffect(()=>{if(!d)return;let le=!1;const me=async()=>{if(!H||!O||!m)return;const He=H.getMainComponent(),je=await d.runCommand(te.projectFiles,W8({editor:d,page:H,component:He,includeComponentIds:!B}));if(le)return;const it=G8({projectFiles:je,isEmail:B}),qe=h.current?f.current||{}:{},Se=B8(qe.code??it.code,{isEmail:B}),Ue=z8(qe.codeStyle??it.codeStyle);h.current=!1,E(Se),S(Se),Uc(O,Se),P(Ue),T(Ue),A&&Uc(A,Ue)},ve=setTimeout(()=>me());return()=>{le=!0,clearTimeout(ve)}},[H,O,A,m,v,d,B]);const J=i==null?void 0:i(ee),q=l==null?void 0:l(ee),R=X?"":j("noChanges"),ae={formatOnMount:!1,padding:5,isDarkTheme:p,clean:!0};return c.jsxs(I,{id:o,as:s,style:n??D,className:N(Bn,t??G),gap:"s",nowrap:!0,col:!0,full:!0,...V,...u,children:[J?c.jsx(c.Fragment,{children:Lt(J)}):null,c.jsx(I,{className:N(`${Bn}__fields`,"gs-utl-flex-grow gs-utl-min-h-[300px] md:gs-utl-flex-row"),gap:"s",nowrap:!0,col:!0,children:m&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:`${Bn}__field ${Bn}__field-html`,grow:!0,children:c.jsx(Pr,{...ae,containerClassName:`${Bn}__code-field ${Bn}__code-field-html`,language:"html",defaultValue:C,onMount:M,onChange:le=>E(le||"")})}),!B&&c.jsx(F,{className:N(`${Bn}__field ${Bn}__field-css`,"md:gs-utl-max-w-[25%]"),grow:!0,children:c.jsx(Pr,{...ae,containerClassName:`${Bn}__code-field ${Bn}__code-field-css`,language:"css",defaultValue:x,onMount:$,onChange:le=>P(le||"")})})]})}),l?q?c.jsx(c.Fragment,{children:Lt(q)}):null:c.jsx(I,{className:`${Bn}__row-after`,justify:"end",children:c.jsx(wt,{classNameWrp:`${Bn}__update`,className:`${Bn}__update-btn`,title:R,size:"m2",variant:X?"pr":void 0,disabled:!X,onClick:ee.update,children:j("button")})})]})});var il=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(il||{}),Qr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Qr||{});const ll="gs-block-item",rw=ce(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=Ce(),i=$e(),[,l]=g.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),f=o||t.get("onClick"),h=t.get("disable"),m=t.get("mediaReact"),b=t.getMedia(),v=t.get("attributes")||{},w=u(d)||t.getLabel(),y=s==="compact",S=N(ll,`${ll}--${d}`,y&&`${ll}-compact`,n,"gs-utl-px-2 gs-utl-transition-colors",re.b,re.rnd,U.br,p&&"gs-utl-col-span-full",y?"gs-utl-py-1":"gs-utl-py-2",y?"gs-utl-flex-row gs-utl-nowrap gs-utl-gap-3 gs-utl-justify-start":"gs-utl-flex-col",h?Oe.disabledM:N("gs-utl-cursor-pointer",U.hTAo,U.hBgH)),C=Ht(v.class)&&!y?v.class:N("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),E=N(`${ll}__label`,"gs-utl-text-center",Oe.txtEllips,!y&&"gs-utl-w-full");if(g.useEffect(()=>{if(!a)return;const{Blocks:M}=a,A=M.events.update,$=j=>j===t&&l(L=>++L);return a.on(A,$),()=>{a.off(A,$)}},[t,a]),!a)return null;const{Blocks:x}=a,T={className:S,...!h&&{onDragStart:()=>x.startDrag(t),onDragEnd:()=>x.endDrag(!1),draggable:!o},...!!f&&{onClick:()=>f(t,a)}},O=r==null?void 0:r({editor:a,block:t,attributes:T});return O&&Lt(O)||c.jsxs(I,{items:"center",...T,children:[m||c.jsx("div",{className:N(`${ll}__media`,C),dangerouslySetInnerHTML:{__html:b}}),c.jsx("div",{className:E,title:w,children:w})]})});function vg({className:e,value:t,onChange:n}){const[r,o]=g.useState(t),s=g.useRef(null),a=u=>{const{value:d}=u.target;o(d)},i=()=>{n(r||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(r||t);break}};return g.useEffect(()=>{s.current&&s.current.select()},[]),c.jsx("input",{autoFocus:!0,className:Q([e,"w-full",U.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:ms,ref:s})}function ow({className:e,value:t,active:n,unstyled:r,activable:o,onChange:s,onActive:a,...i}){const[l,u]=g.useState(n);g.useEffect(()=>{u(n)},[n]);const d=f=>{a==null||a(f),u(f)},p=f=>{s(f),d(!1)};return c.jsx("div",{className:Q("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(vg,{className:Q(r&&Oe.noFocusOut),value:t,onChange:p}):c.jsx(c.Fragment,{children:t})})}const sw=ie("text-sm w-full",Oe.txtEllips),Y8=ce(({symbol:e,className:t})=>{const n=zi(),{Components:r}=n,o=$e(),s=Ea(),a=o.tScoped("blockManager.symbols"),i=()=>{const{draggable:w,droppable:y,attributes:S,type:C,tagName:E}=e.attributes;n.Canvas.startDrag({content:()=>r.addSymbol(e),model:e,dragDef:{type:C,tagName:E,draggable:w,droppable:y,attributes:S}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=r.getSymbolInfo(e).instances.length,f=ie("h-10 w-10 block-media",U.grouphTAo),h=ie("gjs-pt-1 gjs-mt-2",re.bt,U.br),m=ie("cursor-pointer gjs-p-2 transition-colors group",re.b,re.rnd,U.br,U.hBgH,t),b=()=>{s.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},v=w=>{e.set("custom-name",w)};return c.jsxs(I,{className:m,onDragStart:i,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(I,{items:"center",justify:"between",className:h,space:"m",full:!0,children:[c.jsx(F,{children:c.jsx(I,{className:ie(sw,"gjs-mr-auto"),children:c.jsx(Gt,{title:`${p} ${a("instancesProject")}`,children:c.jsx(Qo,{label:`${p}`,className:ie(U.bgH75)})})})}),c.jsx(F,{className:ie("truncate"),grow:!0,title:d,children:c.jsx(ow,{activable:!0,value:d,className:sw,onChange:v})}),c.jsx(F,{className:ie(Oe.hoverGroup),children:c.jsx(I,{justify:"end",full:!0,children:c.jsx(wt,{onClick:b,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(ne,{icon:K.delete,size:se.s})})})})]})]})}),as="gs-block-manager",aw={id:Qr.before,title:"Add before",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <path d="M4 5v14"/> <rect fill="none" x="8" y="5" width="12" height="14" rx="2" ry="2"/> </svg>'},X8={id:Qr.beforeInside,title:"Add inside first",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M8 8v8"/> </svg>'},J8={id:Qr.afterInside,title:"Add inside last",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M16 8v8"/> </svg>'},iw={id:Qr.after,title:"Add after",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="12" height="14" rx="2" ry="2"/> <path d="M20 5v14"/> </svg>'},lw=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},cw=e=>{const t=e.getContent();return ot(t)?e.getDragDef():t},Q8=e=>{const t=cw(e);return Array.isArray(t)?t[0]:t},R8=ce(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Ke,tn;const{editor:l}=Ce(),u=$e(),[d,p]=g.useState(0),[f,h]=g.useState(il.REGULAR),[m,b]=g.useState(""),[v,w]=g.useState(""),y=g.useRef(new Set),[S,C]=g.useState((o==null?void 0:o.position)||Qr.after),[E,x]=g.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),P=f===il.SYMBOLS,_=g.useRef(null),T=u.tScoped("blockManager"),O=o==null?void 0:o.component;if(g.useEffect(()=>{if(!l)return;const{Blocks:he,Components:Be}=l,ze=he.events.custom,De=Be.events.symbol,Nt=()=>{x(Be.getSymbols()),p(qt=>++qt)};return l.on(De,Nt),l.on(ze,Nt),()=>{l.off(De,Nt),l.off(ze,Nt)}},[l]),g.useEffect(()=>{if(_.current&&t){const he=_.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),kd)}},[_.current,t]),!l)return null;const{Blocks:M,Components:A}=l,$=he=>T(`labels.${he.getId()}`)||he.getLabel(),j=E.filter(he=>Xs(he.getName(),m)),L=M.getAll().map(he=>he),H=((Ke=i.blocks)==null?void 0:Ke.call(i,{blocks:L}))||L,W=S===Qr.before,B=S===Qr.beforeInside,G=S===Qr.afterInside,D=S===Qr.after,V=!!(O!=null&&O.attributes.droppable),k=H.filter(he=>{const Be=lw(l,he.category);if(m&&!Xs(Be,m)&&!Xs($(he),m))return!1;if(O){const ze=Q8(he);if(V&&(B||G)){const De=B?0:void 0;return A.canMove(O,ze,De).result}else if(W||D){const De=O.index(),Nt=O.parent(),qt=W?De:De+1;return Nt&&A.canMove(Nt,ze,qt).result}}return!0}),z=M.getBlocksByCategory(k),Y=r?k:(tn=z.find(he=>!he.category))==null?void 0:tn.items,X=r?[]:z.filter(he=>he.category),ee=i.symbols!==!1,J=i.search!==!1,q=!ee&&!J,R=s==="compact",ae=T("search")||u.t("search"),le=N(as,n,"gap-2"),me=N(`${as}__header`,"gs-utl-pt-2",Te.xS,q&&"gs-utl-hidden"),ve=N(`${as}__content`,Oe.scrollY,U.br,re.bt),He=N(`${as}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),je=N(`${as}__not-found`,"gs-utl-text-center gs-utl-p-4"),it=N(`${as}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",R?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),qe=N(`${as}__no-category`,it,U.br,X.length&&re.bb),Se=N(U.tAo,U.bgH75,re.bA),Ue=`${as}__category`,et=[{id:il.REGULAR,label:T("types.regular")},{id:il.SYMBOLS,label:T("types.symbols")}],Ct=V?[aw,X8,J8,iw]:[aw,iw],Ne=O?he=>{const Be=cw(he);if(!Be)return;let ze;if(B||G){const De=B?0:void 0;ze=O.append(Be,{at:De})[0]}else if(W||D){const De=O.index(),Nt=O.parent(),qt=W?De:De+1;ze=Nt==null?void 0:Nt.append(Be,{at:qt})[0]}if(ze){const{activate:De,select:Nt}=he.attributes;Nt||De&&Nt!==!1?requestAnimationFrame(()=>l.em.setSelected(ze,{activate:De})):De&&ze.trigger("active")}}:void 0,bt=he=>{if(!O)return;const Be=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),w(ze=>{const De=Be.indexOf(ze);return Be.at(Math.min(De+1,Be.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),w(ze=>{const De=Be.indexOf(ze);return Be.at(Math.max(De-1,0))||""});else if(he.key==="Enter"&&v){const ze=M.get(v);ze&&(Ne==null||Ne(ze))}},pt=he=>{y.current.clear(),b(he)};return c.jsxs(I,{className:le,col:!0,full:!0,children:[c.jsxs(I,{className:me,gap:"s",col:!0,children:[ee&&c.jsx(Ro,{tabs:et,onChange:h,value:f,variant:"pills"}),O&&c.jsx(Rt,{size:"s",options:Ct,value:S,onChange:he=>C(he)}),J&&c.jsx(at,{ref:_,size:"s",value:m,onInput:pt,onKeyDown:bt,placeholder:ae,type:"search"})]}),c.jsxs(F,{className:ve,grow:!0,children:[P&&(j.length?c.jsx(I,{className:He,children:j.map(he=>c.jsx(Y8,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(I,{className:je,justify:"center",children:T("symbols.notFound")})),!P&&(k.length?c.jsxs(c.Fragment,{children:[!!(Y!=null&&Y.length)&&c.jsx(I,{className:qe,children:Y==null?void 0:Y.map(he=>(y.current.add(`${he.id}`),c.jsx(rw,{block:he,itemLayout:a,onClick:Ne,variant:s,className:N(v===he.id&&Se)},he.id)))}),X.map(({category:he,items:Be},ze)=>c.jsx(wo,{sticky:!0,className:De=>Vd.itemList({index:ze,open:De,length:X.length}),open:!!(he!=null&&he.get("open")),onChange:({open:De})=>he==null?void 0:he.set({open:De}),handler:lw(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:N(Ue,`${Ue}--${he==null?void 0:he.id}`),children:c.jsx(I,{className:it,children:Be.map(De=>(y.current.add(`${De.id}`),c.jsx(rw,{block:De,itemLayout:a,onClick:Ne,variant:s,className:N(v===De.id&&Se)},De.id)))})},he==null?void 0:he.id))]}):c.jsx(I,{className:je,justify:"center",children:T("notFound")}))]})]})}),e9=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-block-manager-after"),n),ref:o,...r,children:t})}),t9=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-block-manager-before"),n),ref:o,...r,children:t})}),n9="gs-panel-blocks",r9=g.memo(ce(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=Ce().sdkProps.children,p={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(Ar,{className:N(n9,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(Ui,{children:[er(d,t9),c.jsx(R8,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),er(d,e9)]})})})),o9=(e,t)=>{t.runCommand(te.fontAdd,{font:e})},yg=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(te.assetProviderGet).filter(i=>dt(i.types)?i.types===r:i.types.includes(r))[0];if(!a){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:r,providerId:a.id,onSelect:i=>{const l=i.assetProps;o9(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Tu=ce(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=Ce(),s=$e(),a=Li(),i=Ni(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),p=d?qp(d):u.id;return{...u,content:c.jsx(I,{col:!0,children:c.jsx(F,{style:{fontFamily:p},children:u.label})})}});return c.jsx(_e,{...r,value:Is(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(wt,{className:t,title:s.t("fontManager.addFontToProject"),icon:K.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&yg(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange(Is(d.family))}})})})}),s9=(e,{t,id:n})=>t(`fields.${n}.label`)||$r(`${e}`.replace(/-/g," ")),uw=(e,{t,id:n})=>{const r=dt(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},dw=e=>e.get("defaultValue")||"",cl=e=>e.get("field"),pw=e=>{const t=cl(e);return dt(t)?{type:t}:t},fw=e=>`${e.get("value")||dw(e)||pw(e).defaultValue||""}`,a9=(e,t)=>e||dw(t)||"",ul=({record:e,value:t,partial:n})=>{e.set({value:a9(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},dl=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=pw(e),a=r??e.get("defaultValue");return{...s,hasClear:()=>{const i=e.get("value");return!!i&&Ht(a)&&i!==a},className:N(n,"gs-utl-w-full"),size:o||"s",value:fw(e),label:s9(e.get("label")||e.id||"",t),onChange:(i,l)=>ul({record:e,value:i,partial:l})}},i9=(e,t)=>{const n=cl(e),r=oo(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=V6(fw(e)),a=s.number,i=s.unit||o[0]||"";return{...dl(e,t),value:a,valueUnit:i,min:r==null?void 0:r.min,max:r==null?void 0:r.max,step:r==null?void 0:r.step,units:r==null?void 0:r.units,onChange:(l,u)=>{ul({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{ul({value:a?`${a}${l}`:"",record:e})}}},gw=(e,t)=>{var s;const n=cl(e),r=oo(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>uw(a,t)))||[];return{...dl(e,t),options:o,onChange:a=>ul({value:a,record:e})}},l9=(e,t)=>({...dl(e,t),onChange:n=>ul({value:n,record:e})}),c9=(e,t)=>{var s;const n=cl(e),r=oo(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>uw(a,t)))||[];return{...gw(e,t),size:"s",options:o}};function u9(e,t){const n=cl(e);switch(dt(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Rt,{...c9(e,t)});case"select":return c.jsx(_e,{...gw(e,t)});case"selectFont":{const o=l9(e,t);return c.jsx(Tu,{...o,labelAs:"div"})}case"number":return c.jsx(ke,{...i9(e,t)});case"color":return c.jsx(Xr,{...dl(e,t)});default:return c.jsx(at,{...dl(e,t)})}}const hw="gs-cmp-global-style-field",d9=ce(function({record:t}){const n=Ce(),o=$e().tScoped("globalStyleManager"),[,s]=g.useState(0),a=n.editor,i=t.id,l={t:o,id:i};return g.useEffect(()=>{if(!a)return;const u=`data:path:${t.getPath("value")}`,d=()=>s(p=>++p);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(I,{className:N(hw,`${hw}__${i}`),children:u9(t,l)})}),pl="gs-cmp-global-style-manager",mw=({items:e,category:t,className:n})=>{const r=N(t?`${pl}__cat-fields--${t.id}`:`${pl}__uncat-fields`,"gs-utl-gap-2",Te.xy,n);return c.jsx(I,{className:r,nowrap:!0,col:!0,children:e.map(o=>c.jsx(d9,{record:o},o.id))})},p9=ce(function(){const t=eL(),{recordsByCategory:n,openCategories:r}=t,s=$e().tScoped("globalStyleManager");return c.jsx(I,{col:!0,full:!0,nowrap:!0,className:N(pl,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(I,{col:!0,nowrap:!0,className:N(`${pl}__fields`,Oe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(wo,{sticky:!0,open:r.get(a.id)??a.open,handler:s(`categories.${a.id}.label`)||a.label||a.id,onChange:({open:u})=>t.setCategoryOpen(a.id,u),className:u=>N(`${pl}__cat-fields`,Vd.itemList({index:l,open:u,length:n.length}),l===0&&re.bt),children:c.jsx(mw,{category:a,items:i})},a.id):c.jsx(mw,{items:i,className:N(n.length!==1&&[re.bt,U.br])},l)):c.jsx(I,{className:N("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),f9="gs-panel-global-styles",g9=g.memo(ce(function({className:t,...n}){return c.jsx(Ar,{className:N(f9,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Ui,{children:c.jsx(p9,{})})})})),h9={maxWidth:`${AC}px`},m9="gs-cmp-layer-item";function bw({component:e,draggingCmp:t,dragParent:n,...r}){const o=zi(),{Layers:s}=o,a=g.useRef(null),[i,l]=g.useState(!1),[u,d]=g.useState(s.getLayerData(e)),{open:p,selected:f,hovered:h,components:m,visible:b,locked:v,name:w}=u,y=m.map(B=>B.cid),S=t===e,C=y.join("-"),E=r.level+1,x=h||n===e;g.useEffect(()=>{E===0&&d(s.getLayerData(e)),a.current&&(a.current.__cmp=e)},[e]),g.useEffect(()=>{const B=a.current;if(!B)return;const{select:G}=o.Components.events,D=V=>V===e&&B.scrollIntoView({block:"nearest"});return o.on(G,D),()=>{o.off(G,D)}},[e,a.current]),g.useEffect(()=>{const B=D=>{D===e&&d(s.getLayerData(D))},G=s.events.component;return o.on(G,B),()=>{o.off(G,B)}},[o,s,e]);const P=g.useMemo(()=>m.map(B=>c.jsx(bw,{component:B,level:E,draggingCmp:t,dragParent:n},B.cid)),[C,t,n]),_=B=>{s.setLayerData(e,{name:B}),l(!1)},T=B=>{B.stopPropagation(),s.setLayerData(e,{open:!p})},O=B=>{B.stopPropagation(),s.setLayerData(e,{visible:!b})},M=B=>{B.stopPropagation(),s.setLayerData(e,{locked:!v})},A=B=>{B.stopPropagation(),s.setLayerData(e,{selected:!0},{event:B})},$=B=>{B.preventDefault(),o.runCommand(te.contextMenuComponent,{source:Wp.layers,component:e,event:B.nativeEvent,x:B.clientX,y:B.clientY})},j=B=>{(!B||!t)&&s.setLayerData(e,{hovered:B})},L=q1(e),H=Q("layer-item",(f||L.isSymbol)&&L.bgSoftX,(!b||S)&&"opacity-50"),W=Q(Te.xyS,re.b,x?L.border:re.bT,f&&L.bgSoft);return c.jsx("div",{className:m9,children:c.jsxs(I,{col:!0,className:H,children:[c.jsx(F,{onClick:A,onContextMenu:$,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),className:Q("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(I,{items:"center",space:"xs",className:W,children:[c.jsx(F,{style:{marginLeft:`${E*10}px`},className:Q("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:T,children:c.jsx(ne,{icon:K.menuDown,size:se.sx,rotate:p?0:-90})}),c.jsx(F,{children:Ab(e)}),c.jsx(F,{className:Q("truncate"),onDoubleClick:()=>l(!0),style:h9,grow:!0,children:i?c.jsx(vg,{value:w,onChange:_}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:Q("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-100":"opacity-0"),onClick:M,children:c.jsx(ne,{icon:v?K.lock:K.lockOpenVariant,size:se.s3x})}),c.jsx(F,{className:Q("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-0":"opacity-100"),onClick:O,children:c.jsx(ne,{icon:b?K.eyeOutline:K.eyeOffOutline,size:se.sx})})]})]})}),!!(p&&m.length)&&c.jsx(F,{className:Q("max-w-full",!p&&"hidden"),children:P})]})})}const b9={touchAction:"none"},vw=5,v9=e=>{var s,a;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),r=n==null?void 0:n.__cmp,o=((a=(s=r==null?void 0:r.delegate)==null?void 0:s.move)==null?void 0:a.call(s,r))||r;return{el:n,cmp:o}},yw=ce(function({root:t,header:n}){const{editor:r}=Ce(),[o,s]=g.useState(!1),[a,i]=g.useState({}),[l,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(),[m,b]=g.useState(),v=g.useRef(null);if(g.useEffect(()=>{const T=window.document,O=M=>{M.key==="Escape"&&(i({...a,result:!1}),C())};return T.addEventListener("keydown",O),()=>{T.removeEventListener("keydown",O)}},[]),!r)return null;const{Components:w}=r,y=T=>{T.button===0&&s(!0)},S=T=>{if(!o)return;const{cmp:O,el:M}=v9(T);if(!M||!O)return;const A=M.getBoundingClientRect(),$=M.offsetHeight,j=M.offsetTop,L=T.clientY,H=L<A.y+$/2,W=d||O,B=O.parent(),G=O.index()+(H?0:1);!d&&p(O),u(O);const D=w.canMove(B,W,G),V=w.canMove(O,W),k={...D,canMoveInside:V,index:G};let z=!1;V.result&&L>A.y+vw&&L<A.y+$-vw&&(z=!0,k.target=O,delete k.index),h(z?O:void 0),i(k),b({pointerInside:z,y:j+(H?0:$),h:$})},C=()=>{var T;a!=null&&a.result&&((T=a.source)==null||T.move(a.target,{at:a.index})),i({}),s(!1),p(void 0),u(void 0),h(void 0),b(void 0)},E=(l?l.parents():[]).length,x=!!(d&&m&&(a!=null&&a.result)&&!m.pointerInside),P=x?{top:m.y,left:0,marginLeft:E*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(I,{col:!0,full:!0,nowrap:!0,className:Q("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(F,{children:c.jsxs(I,{space:"s",items:"center",className:Q([Te.xy,re.bb,U.br]),children:[c.jsx(F,{children:c.jsx(ne,{icon:K.layers,size:se.s})}),c.jsx(F,{grow:!0,children:_})]})}),c.jsxs(F,{className:Q("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:b9,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(bw,{component:t,level:-1,draggingCmp:d,dragParent:f}),x&&c.jsx("div",{ref:v,className:Q("absolute w-full gs-utl-h-0.5",U.cmp),style:P})]})]})}),ww=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-layer-manager-after"),n),ref:o,...r,children:t})}),Sw=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-layer-manager-before"),n),ref:o,...r,children:t})}),y9="gs-panel-layers",Cw=g.memo(ce(function({className:t,...n}){const r=Ce().sdkProps.children;return c.jsx(Ar,{className:N(y9,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(qv,{children:o=>c.jsxs(c.Fragment,{children:[er(r,Sw),c.jsx(yw,{...o,header:!1}),er(r,ww)]})})})})),Ws="gs-cmp-file-field";function fl(e){var E;const{className:t,value:n,btnLabel:r,nameLabel:o,size:s,isContain:a,clear:i,inputField:l,placeholder:u,preview:d=50,disabled:p,hideButton:f,labelAs:h,onChange:m,onOpen:b}=e,v=(n||"").replace(/^"|"$/gi,""),w=((E=v.split("/").pop())==null?void 0:E.split("?")[0])||"",y={minWidth:d,minHeight:d},S=v?{...y,backgroundImage:`url("${v}")`}:y,C=N(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",a?"gs-utl-bg-contain":"gs-utl-bg-cover",re.b,re.rnd,U.br);return c.jsxs(I,{className:N(Ws,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(Er,{...e,as:h}),c.jsxs(I,{className:N(`${Ws}-content gs-utl-gap-1`,U.bg),items:"center",nowrap:!0,children:[c.jsx(F,{className:N(`${Ws}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(F,{className:N(`${Ws}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(Yo,{className:N(`${Ws}-name`,"gs-utl-mb-2",Oe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(I,{className:N(`${Ws}-buttons`),space:"s",nowrap:!0,children:[!f&&c.jsx(Je,{onClick:()=>b==null?void 0:b(n),size:s,type:"button",block:!0,full:!0,disabled:p,children:r||"Select image"}),!!n&&i&&c.jsx(wt,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:K.close,size:se.s},type:"button",block:!0})]})]})]}),l&&c.jsx(at,{className:N(`${Ws}-input`),value:v,onChange:m,size:s,placeholder:u})]})}function w9(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ou=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ia(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wg(e){return"nodeType"in e}function is(e){var t,n;return e?Ia(e)?e:wg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Sg(e){const{Document:t}=is(e);return e instanceof t}function Va(e){return Ia(e)?!1:e instanceof is(e).HTMLElement}function xw(e){return e instanceof is(e).SVGElement}function Ha(e){return e?Ia(e)?e.document:wg(e)?Sg(e)?e:Va(e)||xw(e)?e.ownerDocument:document:document:document}const Gs=Ou?g.useLayoutEffect:g.useEffect;function S9(e){const t=g.useRef(e);return Gs(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function C9(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gl(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Cg(e){const t=S9(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}let xg={};function hl(e,t){return g.useMemo(()=>{if(t)return t;const n=xg[e]==null?0:xg[e]+1;return xg[e]=n,e+"-"+n},[e,t])}function Ew(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const d=s[l];d!=null&&(s[l]=d+e*u)}return s},{...t})}}const ml=Ew(1),Pw=Ew(-1);function x9(e){return"clientX"in e&&"clientY"in e}function E9(e){if(!e)return!1;const{KeyboardEvent:t}=is(e.target);return t&&e instanceof t}function P9(e){if(!e)return!1;const{TouchEvent:t}=is(e.target);return t&&e instanceof t}function Eg(e){if(P9(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return x9(e)?{x:e.clientX,y:e.clientY}:null}const bl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[bl.Translate.toString(e),bl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),T9={display:"none"};function O9(e){let{id:t,value:n}=e;return g.createElement("div",{id:t,style:T9},n)}function _9(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return g.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function A9(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const M9={draggable:`
323
323
  To pick up a draggable item, press the space bar.
324
324
  While dragging, use the arrow keys to move the item.
325
325
  Press space again to drop the item in its new position, or press escape to cancel.
326
- `},l9={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}};var gt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(gt||(gt={}));function wh(...e){}class ml extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const xu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:wh,draggableNodes:{},droppableRects:new Map,droppableContainers:new ml,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wh},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:wh,windowRect:null,willRecomputeLayouts:!1});function c9(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new ml}}}function u9(e,t){switch(t.type){case gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case gt.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case gt.DragEnd:case gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case gt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ml(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case gt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new ml(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case gt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new ml(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const hw=h.createContext({type:null,event:null});function d9({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=h.useContext(hw),a=h.useRef(s);h.useEffect(()=>{if(s!==a.current){const{type:i,event:l}=s;switch(i){case gt.DragStart:e==null||e(l);break;case gt.DragMove:t==null||t(l);break;case gt.DragOver:n==null||n(l);break;case gt.DragCancel:o==null||o(l);break;case gt.DragEnd:r==null||r(l);break}a.current=s}},[s,e,t,n,r,o])}function p9({announcements:e=l9,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=a9(),s=fl("DndLiveRegion"),[a,i]=h.useState(!1);return h.useEffect(()=>{i(!0)},[]),d9(h.useMemo(()=>({onDragStart({active:l}){r(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&r(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){r(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){r(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){r(e.onDragCancel(l.id))}}),[r,e])),a?On.createPortal(h.createElement(h.Fragment,null,h.createElement(o9,{id:t,value:n.draggable}),h.createElement(s9,{id:s,announcement:o})),document.body):null}const wo=Object.freeze({x:0,y:0});function gw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mw(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const f9=({collisionRect:e,droppableContainers:t})=>{const n=mw(e,e.left,e.top);let r=1/0,o=null;for(const s of t){const{rect:{current:a}}=s;if(a){const i=gw(mw(a),n);i<r&&(r=i,o=s.id)}}return o};function h9(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function g9(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wo}function m9(e){return function(n,...r){return r.reduce((o,s)=>({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x,offsetLeft:o.offsetLeft+e*s.x,offsetTop:o.offsetTop+e*s.y}),{...n})}}const vw=m9(1);function v9(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function b9(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})!=null}function Sh(e){const t=[];function n(r){if(!r)return t;if(mh(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!Ia(r)||dw(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return b9(r,o)&&t.push(r),v9(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function Ch(e){return!Cu||!e?null:ka(e)?e:gh(e)?mh(e)||e===Va(e).scrollingElement?window:Ia(e)?e:null:null}function xh(e){return ka(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var Ha;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ha||(Ha={}));function bw(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},r=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:r,isLeft:o,isBottom:s,isRight:a,maxScroll:n,minScroll:t}}function y9(e){return!Cu||!e?!1:e===document.scrollingElement}const w9={x:.2,y:.2};function S9(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=w9){const{clientHeight:l,clientWidth:u}=e,d=y9(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:p,isBottom:f,isLeft:g,isRight:m}=bw(e),v={x:0,y:0},b={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!p&&n<=d.top+w.height?(v.y=Ha.Backward,b.y=a*Math.abs((d.top+w.height-n)/w.height)):!f&&s>=d.bottom-w.height&&(v.y=Ha.Forward,b.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(v.x=Ha.Forward,b.x=a*Math.abs((d.right-w.width-o)/w.width)):!g&&r<=d.left+w.width&&(v.x=Ha.Backward,b.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:v,speed:b}}function C9(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function yw(e){return e.reduce((t,n)=>hl(t,xh(n)),wo)}function ww(e,t,n=wo){if(!e||!Ia(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:ww(e.offsetParent,t,r)}function Eu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=ww(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function Pu(e){if(ka(e)){const u=window.innerWidth,d=window.innerHeight;return{top:0,left:0,right:u,bottom:d,width:u,height:d,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=Eu(e),{width:r,height:o,top:s,bottom:a,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:s,bottom:a,right:l,left:i,offsetTop:t,offsetLeft:n}}function Eh(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=Eu(e),s=Sh(e),a=yw(s),i=r-a.y,l=o-a.x;return{width:t,height:n,top:i,bottom:i+n,right:l+t,left:l,offsetTop:r,offsetLeft:o}}function Sw(e){return"top"in e}function Cw(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const x9=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=Cw(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=Cw(a,Sw(a)?a.left:void 0,Sw(a)?a.top:void 0),l=o.reduce((d,p,f)=>d+gw(i[f],p),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function E9(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),s=Math.min(t.top+t.height,e.offsetTop+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,d=a*i,p=d/(l+u-d);return Number(p.toFixed(4))}return 0}const P9=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=E9(s,e);a>n&&(n=a,r=o.id)}}return r};var vl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(vl||(vl={}));var Tu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Tu||(Tu={}));function T9({acceleration:e,activator:t=vl.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=Tu.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[p,f]=RI(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case vl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case vl.DraggableRect:return r}return null},[t,r,i]),v=h.useRef(wo),b=h.useRef(null),w=h.useCallback(()=>{const S=b.current;if(!S)return;const C=g.current.x*v.current.x,x=g.current.y*v.current.y;S.scrollBy(C,x)},[]),y=h.useMemo(()=>a===Tu.TreeOrder?[...l].reverse():l,[a,l]);h.useEffect(()=>{if(!o||!l.length||!m){f();return}for(const S of y){if((n==null?void 0:n(S))===!1)continue;const C=l.indexOf(S),x=u[C];if(!x)continue;const{direction:E,speed:P}=S9(S,x,m,e,d);if(P.x>0||P.y>0){f(),b.current=S,p(w,s),g.current=P,v.current=E;return}}g.current={x:0,y:0},v.current={x:0,y:0},f()},[e,w,n,f,o,s,JSON.stringify(m),p,l,y,u,JSON.stringify(d)])}function O9(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return pl(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function _9(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}function xw(e){const t=h.useRef(e);return Ws(()=>{t.current!==e&&(t.current=e)},[e]),t}var bl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(bl||(bl={}));var Ph;(function(e){e.Optimized="optimized"})(Ph||(Ph={}));const Ew=new Map,A9={measure:Eu,strategy:bl.WhileDragging,frequency:Ph.Optimized};function L9(e,{dragging:t,dependencies:n,config:r}){const[o,s]=h.useState(!1),{frequency:a,measure:i,strategy:l}={...A9,...r},u=h.useRef(e),d=h.useCallback(()=>s(!0),[]),p=h.useRef(null),f=m(),g=pl(v=>{if(f&&!t)return Ew;if(!v||v===Ew||u.current!==e||o){for(let b of e)b&&(b.rect.current=b.node.current?i(b.node.current):null);return M9(e)}return v},[e,t,f,i,o]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{o&&s(!1)},[o]),h.useEffect(function(){f||requestAnimationFrame(d)},[t,f]),h.useEffect(function(){f||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},a))},[a,f,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case bl.Always:return!1;case bl.BeforeDragging:return t;default:return!t}}}function M9(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:r,rect:o}=n;o.current!=null&&t.set(r,o.current)}return t}function N9(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const a=Ch(s.target);a&&n(i=>i?(i.set(a,xh(a)),new Map(i)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=Ch(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,xh(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=Ch(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>hl(s,a),wo):yw(e):wo,[e,t])}const $9=[];function k9(e){const t=h.useRef(e),n=pl(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:Sh(e):$9,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function I9(e){h.useEffect(()=>{if(!Cu)return;const t=e.map(({sensor:n})=>n.setup==null?void 0:n.setup());return()=>{for(const n of t)n==null||n()}},e.map(({sensor:t})=>t))}function V9(e,t){return h.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const Th=Tw(Pu),H9=j9(Pu);function Pw(e,t,n){const r=h.useRef(e);return pl(o=>e?n||!o&&e||e!==r.current?Ia(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function Tw(e){return(t,n)=>Pw(t,e,n)}function j9(e){const t=[];return function(r,o){const s=h.useRef(r);return pl(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function D9(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ia(t)?t:e}function F9(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=Eu(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const B9=Tw(F9);function z9({disabled:e,forceRecompute:t}){const[n,r]=vh(),o=B9(e?null:D9(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function Ow(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function U9(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class yl{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})}}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function W9(e){const{EventTarget:t}=os(e);return e instanceof t?e:Va(e)}function Oh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var sr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(sr||(sr={}));function _w(e){e.preventDefault()}function G9(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(qe||(qe={}));const Aw={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter]},q9=(e,{currentCoordinates:t})=>{switch(e.code){case qe.Right:return{...t,x:t.x+25};case qe.Left:return{...t,x:t.x-25};case qe.Down:return{...t,y:t.y+25};case qe.Up:return{...t,y:t.y-25}}};class _h{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=wo;const{event:{target:n}}=t;this.props=t,this.listeners=new yl(Va(n)),this.windowListeners=new yl(os(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const r=Pu(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(t9(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=Aw,coordinateGetter:i=q9,scrollBehavior:l="smooth"}=s,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const d=i(t,{active:r,context:o.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:f}=o.current;for(const g of f){const m=t.code,v=fw(d,n),{isTop:b,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=bw(g),E=C9(g),P={x:Math.min(m===qe.Right?E.right-E.width/2:E.right,Math.max(m===qe.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(m===qe.Down?E.bottom-E.height/2:E.bottom,Math.max(m===qe.Down?E.top:E.top+E.height/2,d.y))},_=m===qe.Right&&!w||m===qe.Left&&!y,T=m===qe.Down&&!S||m===qe.Up&&!b;if(_&&P.x!==d.x){if(m===qe.Right&&g.scrollLeft+v.x<=C.x||m===qe.Left&&g.scrollLeft+v.x>=x.x){g.scrollBy({left:v.x,behavior:l});return}p.x=m===qe.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-p.x,behavior:l});break}else if(T&&P.y!==d.y){if(m===qe.Down&&g.scrollTop+v.y<=C.y||m===qe.Up&&g.scrollTop+v.y>=x.y){g.scrollBy({top:v.y,behavior:l});return}p.y=m===qe.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,hl(d,p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_h.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=Aw,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function Lw(e){return!!(e&&"distance"in e)}function Mw(e){return!!(e&&"delay"in e)}class Ah{constructor(t,n,r=W9(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Va(s),this.documentListeners=new yl(this.document),this.listeners=new yl(r),this.windowListeners=new yl(os(s)),this.initialCoordinates=yh(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.DragStart,_w),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),this.windowListeners.add(sr.ContextMenu,_w),this.documentListeners.add(sr.Keydown,this.handleKeydown),n){if(Lw(n))return;if(Mw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(sr.Click,G9,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:r,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!r)return;const i=yh(t),l=fw(r,i);if(!n&&a){if(Mw(a))return Oh(l,a.tolerance)?this.handleCancel():void 0;if(Lw(a))return a.tolerance!=null&&Oh(l,a.tolerance)?this.handleCancel():Oh(l,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(i)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const K9={move:{name:"pointermove"},end:{name:"pointerup"}};class Lh extends Ah{constructor(t){const{event:n}=t,r=Va(n.target);super(t,K9,r)}}Lh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const Z9={move:{name:"mousemove"},end:{name:"mouseup"}};var Mh;(function(e){e[e.RightClick=2]="RightClick"})(Mh||(Mh={}));class Y9 extends Ah{constructor(t){super(t,Z9,Va(t.event.target))}}Y9.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Mh.RightClick?!1:(t==null||t({event:e}),!0)}];const Nh={move:{name:"touchmove"},end:{name:"touchend"}};class X9 extends Ah{constructor(t){super(t,Nh)}static setup(){return window.addEventListener(Nh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nh.move.name,t)};function t(){}}}X9.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function J9(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const Q9=[{sensor:Lh,options:{}},{sensor:_h,options:{}}],R9={current:{}},Nw=h.createContext({...wo,scaleX:1,scaleY:1}),e7=h.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=Q9,collisionDetection:a=P9,measuring:i,modifiers:l,screenReaderInstructions:u=i9,...d}){var p,f,g,m,v;const b=h.useReducer(u9,void 0,c9),[w,y]=b,[S,C]=h.useState(()=>({type:null,event:null})),[x,E]=h.useState(!1),{draggable:{active:P,nodes:_,translate:T},droppable:{containers:O}}=w,L=P?_[P]:null,A=h.useRef({initial:null,translated:null}),$=h.useMemo(()=>{var Re;return P!=null?{id:P,data:(Re=L==null?void 0:L.data)!=null?Re:R9,rect:A}:null},[P,L]),B=h.useRef(null),[M,j]=h.useState(null),[W,D]=h.useState(null),z=h.useRef(d),I=fl("DndDescribedBy",t),H=h.useMemo(()=>O.getEnabled(),[O]),{layoutRectMap:V,recomputeLayouts:G,willRecomputeLayouts:Y}=L9(H,{dragging:x,dependencies:[T.x,T.y],config:i==null?void 0:i.droppable}),J=O9(_,P),Q=W?yh(W):null,R=Pw(J,(p=i==null||(f=i.draggable)==null?void 0:f.measure)!=null?p:Eh),q=Th(J),ee=h.useRef(null),le=ee.current,ge=h.useRef({active:null,activeNode:J,collisionRect:null,droppableRects:V,draggableNodes:_,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Pe=O.getNodeFor((g=ge.current.over)==null?void 0:g.id),Ce=Th(J?J.ownerDocument.defaultView:null),tt=Th(J?J.parentElement:null),Qe=k9(P?Pe??J:null),Ot=H9(Qe),ut=z9({disabled:P==null,forceRecompute:Y}),Se=(m=ut.rect)!=null?m:R,ot=Se===R?g9(R,le):wo,st=J9(l,{transform:{x:T.x-ot.x,y:T.y-ot.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:q,containerNodeRect:tt,draggingNodeRect:Se,over:ge.current.over,overlayNodeRect:ut.rect,scrollableAncestors:Qe,scrollableAncestorRects:Ot,windowRect:Ce}),wt=Q?hl(Q,T):null,Ne=N9(Qe),mt=hl(st,Ne),dt=Se?vw(Se,st):null,Ue=dt?vw(dt,Ne):null,tn=$&&Ue?a({active:$,collisionRect:Ue,droppableContainers:H}):null,[he,De]=h.useState(null),Fe=h9(st,(v=he==null?void 0:he.rect)!=null?v:null,R),He=h.useCallback((Re,{sensor:St,options:nn})=>{if(!B.current)return;const Bn=_[B.current];if(!Bn)return;const Yt=new St({active:B.current,activeNode:Bn,event:Re.nativeEvent,options:nn,context:ge,onStart(Tn){const cs=B.current;if(!cs)return;const us=_[cs];if(!us)return;const{onDragStart:ds}=z.current,ps={active:{id:cs,data:us.data,rect:A}};On.unstable_batchedUpdates(()=>{y({type:gt.DragStart,initialCoordinates:Tn,active:cs}),C({type:gt.DragStart,event:ps})}),ds==null||ds(ps)},onMove(Tn){y({type:gt.DragMove,coordinates:Tn})},onEnd:Zs(gt.DragEnd),onCancel:Zs(gt.DragCancel)});On.unstable_batchedUpdates(()=>{j(Yt),D(Re.nativeEvent)});function Zs(Tn){return async function(){const{active:us,over:ds,scrollAdjustedTranslate:ps}=ge.current;let fs=null;if(us&&ps){const{cancelDrop:mn}=z.current;fs={active:us,delta:ps,over:ds},Tn===gt.DragEnd&&typeof mn=="function"&&await Promise.resolve(mn(fs))&&(Tn=gt.DragCancel)}if(B.current=null,On.unstable_batchedUpdates(()=>{y({type:Tn}),De(null),E(!1),j(null),D(null),fs&&C({type:Tn,event:fs})}),fs){const{onDragCancel:mn,onDragEnd:_r}=z.current,Ku=Tn===gt.DragEnd?_r:mn;Ku==null||Ku(fs)}}}},[y,_]),Mt=h.useCallback((Re,St)=>(nn,Bn)=>{const Yt=nn.nativeEvent;B.current!==null||Yt.dndKit||Yt.defaultPrevented||Re(nn,St.options)===!0&&(Yt.dndKit={capturedBy:St.sensor},B.current=Bn,He(nn,St))},[He]),Gt=_9(s,Mt);I9(s),Ws(()=>{z.current=d},Object.values(d)),h.useEffect(()=>{P!=null&&E(!0)},[P]),h.useEffect(()=>{$||(ee.current=null),$&&R&&!ee.current&&(ee.current=R)},[R,$]),h.useEffect(()=>{const{onDragMove:Re}=z.current,{active:St,over:nn}=ge.current;if(!St)return;const Bn={active:St,delta:{x:mt.x,y:mt.y},over:nn};C({type:gt.DragMove,event:Bn}),Re==null||Re(Bn)},[mt.x,mt.y]),h.useEffect(()=>{const{active:Re,droppableContainers:St,scrollAdjustedTranslate:nn}=ge.current;if(!Re||!B.current||!nn)return;const{onDragOver:Bn}=z.current,Yt=St.get(tn),Zs=Yt&&Yt.rect.current?{id:Yt.id,rect:Yt.rect.current,data:Yt.data,disabled:Yt.disabled}:null,Tn={active:Re,delta:{x:nn.x,y:nn.y},over:Zs};On.unstable_batchedUpdates(()=>{De(Zs),C({type:gt.DragOver,event:Tn}),Bn==null||Bn(Tn)})},[tn]),Ws(()=>{ge.current={active:$,activeNode:J,collisionRect:Ue,droppableRects:V,draggableNodes:_,draggingNodeRect:Se,droppableContainers:O,over:he,scrollableAncestors:Qe,scrollAdjustedTranslate:mt,translatedRect:dt},A.current={initial:Se,translated:dt}},[$,J,Ue,_,Se,V,O,he,Qe,mt,dt]),T9({...Ks(),draggingRect:dt,pointerCoordinates:wt,scrollableAncestors:Qe,scrollableAncestorRects:Ot});const xo=h.useMemo(()=>({active:$,activeNode:J,activeNodeRect:R,activeNodeClientRect:q,activatorEvent:W,activators:Gt,ariaDescribedById:{draggable:I},containerNodeRect:tt,dispatch:y,dragOverlay:ut,draggableNodes:_,droppableContainers:O,droppableRects:V,over:he,recomputeLayouts:G,scrollableAncestors:Qe,scrollableAncestorRects:Ot,willRecomputeLayouts:Y,windowRect:Ce}),[$,J,q,R,W,Gt,tt,ut,y,_,I,O,V,he,G,Qe,Ot,Y,Ce]);return h.createElement(hw.Provider,{value:S},h.createElement(xu.Provider,{value:xo},h.createElement(Nw.Provider,{value:Fe},o)),h.createElement(p9,{announcements:r,hiddenTextDescribedById:I,screenReaderInstructions:u}));function Ks(){const Re=(M==null?void 0:M.autoScrollEnabled)===!1,St=typeof n=="object"?n.enabled===!1:n===!1,nn=!Re&&!St;return typeof n=="object"?{...n,enabled:nn}:{enabled:nn}}}),t7=h.createContext(null),$w="button",n7="Droppable";function r7({id:e,data:t,disabled:n=!1,attributes:r}){const o=fl(n7),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:p,over:f}=h.useContext(xu),{role:g=$w,roleDescription:m="draggable",tabIndex:v=0}=r??{},b=(s==null?void 0:s.id)===e,w=h.useContext(b?Nw:t7),[y,S]=vh(),C=V9(p,e),x=xw(t);h.useEffect(()=>(u[e]={id:e,key:o,node:y,data:x},()=>{const P=u[e];P&&P.key===o&&delete u[e]}),[u,e]);const E=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===$w?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,v,b,m,l.draggable]);return{active:s,activeNodeRect:a,activatorEvent:i,attributes:E,droppableRects:d,isDragging:b,listeners:n?void 0:C,node:y,over:f,setNodeRef:S,transform:w}}function o7(){return h.useContext(xu)}const s7="Droppable";function a7({data:e,disabled:t=!1,id:n}){const r=fl(s7),{active:o,dispatch:s,over:a}=h.useContext(xu),i=h.useRef(null),[l,u]=vh(),d=xw(e);return Ws(()=>(s({type:gt.RegisterDroppable,element:{id:n,key:r,disabled:t,node:l,rect:i,data:d}}),()=>s({type:gt.UnregisterDroppable,key:r,id:n})),[n]),h.useEffect(()=>{s({type:gt.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:o,rect:i,isOver:(a==null?void 0:a.id)===n,node:l,over:a,setNodeRef:u}}function i7(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const l7=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:i7(t,e,r)},c7=({transform:e})=>({...e,x:0});function kw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function u7(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function Ou(e){return e!==null&&e>=0}const Iw=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=kw(e,n,t),s=e[r],a=o[r];return!a||!s?null:{x:a.offsetLeft-s.offsetLeft,y:a.offsetTop-s.offsetTop,scaleX:a.width/s.width,scaleY:a.height/s.height}},_u={scaleX:1,scaleY:1},d7=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:r,overIndex:o})=>{var s;const a=(s=r[e])!=null?s:t;if(!a)return null;if(n===e){const l=r[o];return l?{x:0,y:e<o?l.offsetTop+l.height-(a.offsetTop+a.height):l.offsetTop-a.offsetTop,..._u}:null}const i=p7(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,..._u}:n<e&&n>=o?{x:0,y:a.height+i,..._u}:{x:0,y:0,..._u}};function p7(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.offsetTop-(o.offsetTop+o.height):s?s.offsetTop-(r.offsetTop+r.height):0:s?s.offsetTop-(r.offsetTop+r.height):o?r.offsetTop-(o.offsetTop+o.height):0:0}const Vw="Sortable",Hw=h.createContext({activeIndex:-1,containerId:Vw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Iw,wasDragging:{current:!1}});function f7({children:e,id:t,items:n,strategy:r=Iw}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=o7(),d=fl(Vw,t),p=s.rect!==null,f=h.useMemo(()=>n.map(P=>typeof P=="string"?P:P.id),[n]),g=o!=null,m=h.useRef(!1),v=o?f.indexOf(o.id):-1,b=v!==-1,w=i?f.indexOf(i.id):-1,y=h.useRef(f),S=u7(f,a),C=!h7(f,y.current),x=w!==-1&&v===-1||C;Ws(()=>{C&&b&&!u&&l()},[C,b,l,u]),h.useEffect(()=>{y.current=f},[f]),h.useEffect(()=>{const P=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(P)},[g]);const E=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:x,items:f,overIndex:w,useDragOverlay:p,sortedRects:S,strategy:r,wasDragging:m}),[v,d,x,f,w,S,p,r,m]);return h.createElement(Hw.Provider,{value:E},e)}function h7(e,t){return e.join()===t.join()}const g7=({id:e,items:t,activeIndex:n,overIndex:r})=>kw(t,n,r).indexOf(e),m7=({containerId:e,isSorting:t,wasDragging:n,index:r,items:o,newIndex:s,previousItems:a,previousContainerId:i,transition:l})=>!l||!n||a!==o&&r===s?!1:t?!0:s!==r&&e===i,v7={duration:200,easing:"ease"},jw="transform",b7=gl.Transition.toString({property:jw,duration:0,easing:"linear"}),y7={roleDescription:"sortable"};function w7({disabled:e,index:t,node:n,rect:r}){const[o,s]=h.useState(null),a=h.useRef(t);return Ws(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=Pu(n.current),u={x:i.offsetLeft-l.offsetLeft,y:i.offsetTop-l.offsetTop,scaleX:i.width/l.width,scaleY:i.height/l.height};(u.x||u.y)&&s(u)}}t!==a.current&&(a.current=t)},[e,t,n,r]),h.useEffect(()=>{o&&requestAnimationFrame(()=>{s(null)})},[o]),o}function S7({animateLayoutChanges:e=m7,attributes:t,disabled:n,data:r,getNewIndex:o=g7,id:s,strategy:a,transition:i=v7}){const{items:l,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:f,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(Hw),w=l.indexOf(s),y=h.useMemo(()=>({sortable:{containerId:u,index:w,items:l},...r}),[u,r,w,l]),{rect:S,node:C,setNodeRef:x}=a7({id:s,data:y}),{active:E,activeNodeRect:P,activatorEvent:_,attributes:T,setNodeRef:O,listeners:L,isDragging:A,over:$,transform:B}=r7({id:s,data:y,attributes:{...y7,...t},disabled:n}),M=JI(x,O),j=!!E,W=j&&b.current&&!p&&Ou(d)&&Ou(g),D=!m&&A,z=D&&W?B:null,H=W?z??(a??v)({layoutRects:f,activeNodeRect:P,activeIndex:d,overIndex:g,index:w}):null,V=Ou(d)&&Ou(g)?o({id:s,items:l,activeIndex:d,overIndex:g}):w,G=h.useRef(l),Y=l!==G.current,J=h.useRef(V),Q=h.useRef(u),R=e({active:E,containerId:u,isDragging:A,isSorting:j,id:s,index:w,items:l,newIndex:J.current,previousItems:G.current,previousContainerId:Q.current,transition:i,wasDragging:b.current}),q=w7({disabled:!R,index:w,node:C,rect:S});return h.useEffect(()=>{j&&J.current!==V&&(J.current=V),u!==Q.current&&(Q.current=u),l!==G.current&&(G.current=l)},[j,V,u,l]),{active:E,attributes:T,activatorEvent:_,rect:S,index:w,isSorting:j,isDragging:A,listeners:L,node:C,overIndex:g,over:$,setNodeRef:M,setDroppableNodeRef:x,setDraggableNodeRef:O,transform:q??H,transition:ee()};function ee(){if(q||Y&&J.current===w)return b7;if(!(D||!i)&&(j||R))return gl.Transition.toString({...i,property:jw})}}const C7=[qe.Down,qe.Right,qe.Up,qe.Left],x7=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(C7.includes(e.code)){if(e.preventDefault(),!t||!r)return;const a=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=Eh(u),p={...l,rect:{current:d}};switch(e.code){case qe.Down:r.top+r.height<=d.top&&a.push(p);break;case qe.Up:r.top>=d.top+d.height&&a.push(p);break;case qe.Left:r.left>=d.left+d.width&&a.push(p);break;case qe.Right:r.left+r.width<=d.left&&a.push(p);break}});const i=x9({active:t,collisionRect:r,droppableContainers:a});if(i){var s;const l=(s=n.get(i))==null?void 0:s.node.current;if(l){const d=Sh(l).some((m,v)=>o[v]!==m),p=Eh(l),f=d?{x:0,y:0}:{x:r.width-p.width,y:r.height-p.height};return{x:p.left-f.x,y:p.top-f.y}}}}};function E7(e){const{id:t,item:n,className:r,select:o,remove:s,renderItem:a,previewStyle:i,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:f,setNodeRef:g,transform:m,transition:v}=S7({id:t,disabled:u}),b={transform:gl.Transform.toString(m),transition:v},w=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:g,style:b,...p}:{},children:c.jsxs(k,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[l&&c.jsx(F,{className:X(!u&&Oe.hover,!u&&"cursor-grab"),...f,children:c.jsx(re,{icon:K.dotsVertical,size:se.sx})}),c.jsx(F,{grow:!0,className:X("overflow-hidden"),children:c.jsxs(k,{children:[c.jsx(F,{grow:!0,className:X("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(F,{children:c.jsx("div",{className:X("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:i(n)})})]})}),s&&d?c.jsx(su,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(F,{className:X(!u&&Oe.click),children:c.jsx(re,{icon:K.close,size:se.sx})})}):c.jsx(F,{className:X(!u&&Oe.click),onClick:y=>{hs(y),!u&&(s==null||s(n))},children:c.jsx(re,{icon:K.close,size:se.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Jr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=O=>O.id||O.name||O.title||O.label||"",label:p,labelAs:f,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=U9(Ow(Lh),Ow(_h,{coordinateGetter:x7}));function E(O){const{active:L,over:A}=O;if(L.id!==(A==null?void 0:A.id)){const $=n.find(M=>d(M)===L.id),B=n.findIndex(M=>d(M)===(A==null?void 0:A.id));$&&(l==null||l($,B))}}const P=X(te.rnd,U.br,n.length&&te.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:P,children:[n.length===0&&b&&c.jsx(k,{className:N("gs-utl-p-2 gs-utl-text-center",U.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((O,L)=>{const A=d(O),$=O===r,B=X("gjs-px-2 gjs-py-2 text-xs",U.br,L&&te.bt,!!s&&!$&&!w&&U.hBgH2,$&&U.bgH,w&&"opacity-75");return c.jsx(E7,{id:A,item:O,className:B,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},A||L)})]});l&&(_=c.jsx(e7,{sensors:x,collisionDetection:f9,onDragEnd:E,modifiers:[c7,l7],children:c.jsx(f7,{items:n.map(d),strategy:d7,children:_})})),s&&!y&&(_=c.jsx(Er,{placement:S,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!r&&!w,onClose:()=>s==null?void 0:s(null),handler:_,children:g}));const T=a?[{type:"button",icon:K.plus,tooltip:v,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:X(t,"w-full"),children:[!!(p||a)&&c.jsx(Cr,{...e,as:f,afterLabelButtons:T}),_]})}const P7=ce(function(){const t=Ie(),{editor:n}=ye(),r=Ai(),o=Li(),s=o.sortedFonts;return n?c.jsx(Jr,{items:s,selected:null,renderItem:a=>{const i=Bp(a);return c.jsxs(k,{col:!0,children:[c.jsx(F,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(F,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>hh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),Dw=qt(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ae(U.bg,U.br,o&&`${te.b} ${te.rnd}`,t==="m"&&Te.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(k,{className:l,items:"center",space:"x2s",...a,ref:i,children:c.jsx(F,{grow:!0,className:r,children:s})})}),Fw=qt(({autoResize:e,style:t={},...n},r)=>{const o=h.useRef(null),s=r||o;return h.useEffect(()=>{!s.current||!e||(s.current.style.height="auto",s.current.style.height=s.current.scrollHeight+"px")},[n.value,e,s]),c.jsx("textarea",{ref:s,style:{...t,...e?{resize:"none"}:{}},...n})});Fw.displayName="TextAreaWithAutoResize";const T7="gs-field-textarea";function Bw(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,name:u,required:d,minLength:p,maxLength:f,onChange:g,onKeyDown:m,afterInput:v,minHeight:b,maxHeight:w,autoResize:y,classNameField:S,classNameFieldContent:C,classNameInput:x}=e,E=Di(e);return c.jsxs("div",{className:X(T7,t),children:[!!r&&c.jsx(qo,{size:o,children:r}),!!s&&c.jsx(qo,{size:o,as:"span",className:X(U.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(Dw,{size:o,className:S,classNameContent:C,children:[c.jsx(Fw,{className:X(E,x),autoResize:y,value:n,name:u,placeholder:a,readOnly:i,disabled:l,required:d,minLength:p,maxLength:f,onChange:P=>g==null?void 0:g(P.target.value),onKeyDown:m,style:{minHeight:b,maxHeight:w}}),v]})]})}const Au="gs-page-settings",O7=`${Au}-header`,_7=`${Au}-content`,A7=`${Au}-footer`,zw="",L7=ce(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=lf.m}){const i=ye(),{isDarkTheme:l}=zr(),u=Li(),d=Ie(),[p,f]=h.useState(s),[g,m]=h.useState(()=>Tv(p,i)),[v,b]=h.useState(()=>d.t("update")),w=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:S}=i,C={containerClassName:"gs-utl-min-h-80",size:a,padding:5,isDarkTheme:l,clean:!0};if(!S)return null;const x=$=>m(B=>({...B,...$})),E=$=>{$.preventDefault();const{name:B,...M}=g;M.customCodeHead=iC(M.customCodeHead),M.customCodeBody=aC(M.customCodeBody),p?(u4(p,M),p.setName(B)):i.setProjectDataCustom({globalPageSettings:M}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),Sv(S),S.trigger(_n.pageSettingsUpdate,{page:p,data:{name:B,...M}})},P={tooltip:d.t("clear")},_=(p==null?void 0:p.getId())??zw,T=$=>{const B=S.Pages.get($);f(B),m(Tv(B,i))},O=Up(p),L=!!p&&Oc(p),A=[{id:zw,label:w("global")},...S.Pages.getAll().map($=>({icon:yv($),id:$.getId(),label:$.getName()}))];return c.jsx("form",{onSubmit:E,className:N(Au,"gs-utl-h-full",t),children:c.jsxs(k,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(F,{className:N(O7,n,U.br,te.bb),children:c.jsx(Le,{value:_,onChange:T,options:A,handlerSelected:$=>c.jsxs(k,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),$.icon&&ct($.icon)&&c.jsx(re,{icon:$.icon,size:se.s2x}),c.jsx("span",{children:$.label})]})})}),c.jsxs(k,{col:!0,className:N(_7,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!_&&c.jsxs(c.Fragment,{children:[c.jsx(rt,{size:a,value:g.name,onChange:$=>x({name:$}),label:y("name.label"),description:y("name.description"),required:!0}),!O&&c.jsx(rt,{size:a,value:g.slug,onChange:$=>x({slug:L?yC($,["id"]):Pl($)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(rt,{size:a,value:g.title,onChange:$=>x({title:$}),label:y("title.label"),description:y("title.description")}),c.jsx(Bw,{size:a,value:g.description,onChange:$=>x({description:$}),label:y("description.label"),description:y("description.description")}),c.jsx(dl,{size:a,clear:P,value:g.favicon,onChange:$=>x({favicon:$}),onOpen:()=>{S.Assets.open({select($){x({favicon:$.getSrc()}),S.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(rt,{size:a,value:g.keywords,onChange:$=>x({keywords:$}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(rt,{size:a,value:g.socialTitle,onChange:$=>x({socialTitle:$}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(dl,{size:a,clear:P,value:g.socialImage,onChange:$=>x({socialImage:$}),onOpen:()=>{S.Assets.open({select($){x({socialImage:$.getSrc()}),S.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(Bw,{size:a,value:g.socialDescription,onChange:$=>x({socialDescription:$}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(vo,{language:"html",defaultValue:g.customCodeHead,onChange:$=>x({customCodeHead:$}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${_}`),c.jsx(vo,{language:"html",defaultValue:g.customCodeBody,onChange:$=>x({customCodeBody:$}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(P7,{})]}),c.jsx(k,{className:N(A7,"gs-utl-mt-auto",o,U.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),M7="gs-panel-page-settings",N7=h.memo(ce(function({className:t,page:n,...r}){return c.jsx(Tr,{className:N(M7,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:c.jsx(Bi,{children:c.jsx(L7,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:lf.s,classNameHeader:Te.s,classNameContent:Te.s,classNameFooter:Te.s})})})})),Lu="gs-page-item",Uw=ce(function({page:t,rename:n,setRename:r,commandItems:o}){const s=ye(),a=Ie(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,f=u==null?void 0:u.layoutBefore,g=E=>a.t(`pageManager.${E}`),m=E=>l.select(E),v=E=>l.getSelected()===E,b=E=>E===n,w=v(t),y=E=>E.getName()||E.getId(),S=E=>{n==null||n.set({name:E}),r(void 0)},C=ae("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),x=()=>i.runCommand(ne.setPageSettings,{page:t,isOpen:!0});return c.jsxs(k,{gap:"s",items:"center",onClick:()=>m(t),className:ae([Lu,"group cursor-default",Te.xy,w?U.bgH:U.hBgH2]),children:[p&&Up(t)&&c.jsx(F,{className:`${Lu}__icon-home`,title:g("homePage"),children:c.jsx(re,{icon:K.home,size:se.s3x})}),f&&kt(f({page:t,editor:i,isSelected:w})),c.jsx(F,{className:ae(`${Lu}__name truncate`),grow:!0,children:b(t)?c.jsx(fh,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(k,{className:`${Lu}__actions`,gap:"xs",onClick:hs,items:"center",children:[!n&&d!==!1&&c.jsx(Ct,{className:C,size:"xs",border:!1,title:g("settings.label"),onClick:x,block:!0,children:c.jsx(re,{icon:K.cog,size:se.s3x})}),w&&!!o.length&&c.jsx(Er,{placement:"right-start",handler:c.jsx(re,{icon:K.dotsVertical,size:se.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>o.map(P=>c.jsx(Oa,{icon:P.icon,label:et(P.label)?P.label({editor:i}):P.label,action:()=>{var _;E(),(_=P.cmd)==null||_.call(P,{page:t,editor:i})}},P.id))})]})]},t.getId())});function $7({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var Ww=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Ww||{});const $h="gs-cmp-sortable",Gw=3;function k7({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=h.useState(null),[a,i]=h.useState(-1),[l,u]=h.useState(),[d,p]=h.useState(!1),f=h.useRef(null),{showIndicator:g,indicatorStyle:m}=$7({dragging:!!o&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const P=window.document,_=T=>T.key==="Escape"&&y(T);return P.addEventListener("keydown",_),()=>P.removeEventListener("keydown",_)},[]);const b=P=>_=>{_.button===0&&(f.current={x:_.clientX,y:_.clientY},s(P),p(!1),_.target.setPointerCapture(_.pointerId))},w=P=>{const _=f.current;if(!o||!_)return;if(!d){const $=Math.abs(P.clientX-_.x),B=Math.abs(P.clientY-_.y);(t==="vertical"?B>Gw:$>Gw)&&p(!0);return}const T=P.clientY;let O=-1;v.forEach(($,B)=>{const M=$.getBoundingClientRect();T>M.top+M.height/2&&(O=B)});const L=e.findIndex($=>$.id===o.id);O<L&&(O+=1),O=Math.min(O,e.length-1),i(O);const A=v[O];if(A){const{height:$,top:B}=A.getBoundingClientRect(),M=T<B+$/2;u({y:A.offsetTop+(M?0:$),h:$})}},y=P=>{s(null),p(!1),f.current=null,u(void 0);const _=P.target,{pointerId:T}=P;T&&(_==null||_.releasePointerCapture(T))},S=P=>{!o||!f.current||(l&&a!==-1&&(n==null||n(o,a)),y(P))},C=N($h,"gs-utl-relative"),x=N(`${$h}__indicator`,U.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=P=>N(`${$h}__item`,g&&(o==null?void 0:o.id)===P.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(k,{col:t==="vertical",className:C,children:e.map((P,_)=>c.jsx(F,{ref:T=>{T&&(v[_]=T)},className:E(P),onPointerDown:b(P),onPointerMove:w,onPointerUp:S,children:r(P)},P.id))}),g&&c.jsx("div",{className:x,style:m})]})}const I7=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(Uw,{page:l,commandItems:t,rename:n,setRename:r},l.getId()));const s=(l,u)=>{o.Pages.move(l.entity,{at:u})},a=l=>c.jsx(Uw,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(k7,{items:i,direction:Ww.vertical,onDrop:s,renderItem:a})},V7=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:et(r)?r({items:e,editor:t}):r||e},kh="gs-panel-page-manager",qw=ce(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=ye(),u=xa(),d=Ie(),{sdkPagesConfig:p}=l,f=l.editor,[g,m]=h.useState(),v=A=>d.t(`pageManager.${A}`),b=p==null?void 0:p.add,w=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,S=A=>{hs(A);const $=M=>{const j=t.length+1;return r({name:`${v("page")} ${j}`,component:`<div>${v("newPage")} ${j}</div>`,...M},{select:!0})};if(b)return b({event:A,editor:f,rename:m,addPage:$});const B=$();B&&m(B)},C=({page:A})=>{if(y)return y({editor:f,page:A});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const $=t.indexOf(A),B=t[$+1]||t[0];n(B),o(A)}})},x=({page:A})=>{if(w)return w({editor:f,page:A,rename:m});const $=A.getMainComponent(),B=r({name:`${A.getName()} (${v("copy")})`,component:$.clone()},{select:!0});B&&m(B)},E=[{id:"rename",label:v("rename"),icon:K.pencil,cmd:({page:A})=>m(A)},w!==!1&&{id:"duplicate",label:v("duplicate"),icon:K.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:K.delete,cmd:C}].filter(Boolean),P=V7({items:E,editor:f,sdkPageConfig:p}),_=Wy(s,{collapsible:!0,label:v("pages"),icon:K.textBoxMultiple}),T=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,O=c.jsx(I7,{pages:t,commandItems:P,rename:g,setRename:m,editor:f}),L=T?c.jsx(yu,{className:X([`${kh}__content`,"text-sm overflow-auto",te.bt,U.br]),height:i,...T,children:O}):O;return c.jsx(yo,{classNameWrap:kh,className:X(`${kh}__header`,Te.xy,s===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(k,{space:"s",items:"center",children:[!!_.icon&&c.jsx(F,{children:c.jsx(re,{icon:_.icon,size:se.s})}),c.jsx(F,{grow:!0,children:_.label}),b!==!1&&c.jsx(Wt,{title:v("add"),children:c.jsx(k,{onClick:S,className:X("cursor-pointer"),children:c.jsx(re,{icon:K.plus,size:se.s})})})]}),open:_?_.collapsed!==!0:!0,children:L})}),Kw=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-after"),n),ref:o,...r,children:t})}),Zw=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-before"),n),ref:o,...r,children:t})}),H7="gs-panel-pages",Yw=h.memo(ce(function({className:t,header:n,height:r,resizable:o,...s}){const a=ye().sdkProps.children;return c.jsx(xn,{className:N(H7,t),...s,children:c.jsx(Db,{children:i=>c.jsxs(c.Fragment,{children:[Rn(a,Zw),c.jsx(qw,{header:n,height:r,resizable:o,...i}),Rn(a,Kw)]})})})})),j7="gs-panel-pages-layers",D7=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=ye(),a=Ie(),{className:i,...l}=n||{},u=Wy(r==null?void 0:r.header,{icon:K.layers,collapsible:!1,label:a.t("layerManager.layers"),className:N(te.bb,U.br)});return c.jsxs(Tr,{className:N(j7,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(Yw,{className:N(i,te.bb,U.br),...l}),c.jsx(uw,{...r,header:u})]})})),F7="gs-trait-custom",B7=ce(function(t){const{trait:n,editor:r,value:o,disabled:s,labelAs:a,className:i}=t,[,l]=h.useState(0),u=h.useRef(null),d=n.get("component"),p=n.get("render"),f=n.target,g=u.current;if(h.useEffect(()=>{if(f){let b=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(f.on("change",y),!d&&p&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=p({editor:r,component:f,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),b=()=>C(x)):et(x)&&(b=()=>x())}return()=>{f.off("change",y),b()}}},[f,g,o]),!f)return null;const m=Ko({...t,className:N(F7,i)}),v={trait:n,component:f,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(Cr,{...t,as:a}),c.jsx("div",{className:N(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):p?c.jsx("div",{ref:u}):null})]})});function Xw({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:p,onBlur:f,placeholder:g}){const[m,v]=h.useState(null),[b,w]=h.useState(null),{styles:y,attributes:S}=Si(m,b,gf),[C,x]=h.useState(""),E=Di(),P=C===""?t:t.filter(B=>B.label.toLowerCase().includes(C.toLowerCase())),_=B=>x(B.target.value),T=B=>B==null?void 0:B.label,O=d&&C.length>0&&!P.some(B=>B.label===C),L=et(d)?d(C):d,A={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},$=()=>f==null?void 0:f();return c.jsxs("div",{className:X("w-full",e),children:[!!o&&c.jsx(qo,{size:i,children:o}),c.jsxs(ua,{value:n,onChange:p,name:r,nullable:!0,children:[c.jsx(Dw,{size:i,ref:v,border:s,children:c.jsxs(k,{nowrap:!0,children:[c.jsx(ua.Input,{autoFocus:l,className:E,displayValue:T,onChange:_,onBlur:$,placeholder:g}),!a&&c.jsx(ua.Button,{children:c.jsx(re,{icon:K.chevronDown,size:se.sx})})]})}),c.jsx(ua.Options,{static:u,className:_b,ref:w,style:y.popper,...S.popper,children:c.jsxs(Qn,{className:X("h-full"),padding:!1,style:A,children:[O&&c.jsx(ua.Option,{value:{id:null,label:C},children:({active:B})=>c.jsx(Lb,{option:{id:null,label:L},active:B,selected:n})}),!O&&P.length===0&&c.jsx("div",{className:X(Te.xy),children:"No items found"}),P.map(B=>c.jsx(ua.Option,{value:B,children:({active:M})=>c.jsx(Lb,{option:B,active:M,selected:n})},B.id))]})})]})]})}const z7=(e,t)=>{const n=`${Pc}${t}`,r=e.get(n,{skipResolve:!0});return r?Jw(r):e.get(n)||""};function Jw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const U7=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=Tc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(p=>{if(d!=null&&d[p]){const{collectionId:f}=d,g=r.t(`dataSources.collections.${f}`)||f,m=r.t(`dataSources.variableTypes.${p}`)||p,v={collectionId:f,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:Jw(v),label:`${g} > ${m}`,dataVariable:v}}}).filter(Boolean)}).flat().filter(Boolean),i=n.get(s),l=i==null?void 0:i.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...a,...l]},Qw="#",Mu="mailto:",Ih="subject=",Vh="tel:",Rw="hrefType",eS="showIdList",tS=(e,t)=>{const n=t==null?void 0:t.get(Rw);return n||(e.startsWith(Vh)?"phone":e.startsWith(Mu)?"email":e.startsWith(_i)?"pages":e.startsWith(Qw)?"elements":"url")},nS=e=>`${e.getName()} - #${e.getId()}`,W7="gs-trait-href",G7=ce(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=ye(),{isSelectingTarget:u,editor:d}=l,[,p]=h.useState(0),[f,g]=h.useState(""),[m,v]=h.useState(""),[b,w]=h.useState(""),[y,S]=h.useState([]),C=Ie(),x=d==null?void 0:d.Pages.getAll(),E=C.tScoped("traitManager.traits.labels"),P=()=>p(Q=>++Q),_=i.get(eS)??!1,T=tS(r,i),O=T==="pages"?r==null?void 0:r.replace(_i,""):"",L=!!O&&(d==null?void 0:d.Pages.get(O)),A=L?Oc(L):!1,$=h.useMemo(()=>!A||!L||!d?[]:U7({page:L,component:i}),[d,L,A,i]),B=Q=>{n.setValue(Q)},M=Q=>{i.set({[eS]:Q}),P()},j=Q=>{g(""),v(""),w(""),B(""),i.set({[Rw]:Q}),P()},W=Q=>{B(Q),P()},D=(Q,R)=>{f4(i,"id",(R==null?void 0:R.dataVariable)||Q),P()},z=Q=>{Q&&(B(Q.id),P())},I=Q=>{B(`${Vh}${Q}`),w(Q)},H=Q=>{B(`${Mu}${Q}${m?`?${Ih}${m}`:""}`),g(Q)},V=Q=>{B(`${Mu}${f}${Q?`?${Ih}${Q}`:""}`),v(Q)},G=()=>{l.setSelectingTarget(!u)},Y=Q=>{const R=Q.replace(Qw,""),q=d==null?void 0:d.Components.componentsById[R];return{id:Q,label:q?nS(q):Q}};h.useEffect(()=>{var R;const Q=[];if(_){const q=["path","br","b","u","i","strike"],ee=(R=d==null?void 0:d.Pages.getSelected())==null?void 0:R.getMainComponent();ee==null||ee.forEachChild(le=>{!le.is("comment")&&!le.is("textnode")&&!q.includes(le.get("tagName"))&&Q.push({id:`#${le.getId()}`,label:nS(le)})})}S(Q)},[d,_]),h.useEffect(()=>{let Q=()=>{};const R=()=>{Q(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(Bu))};return u&&(Q=nC(R),d==null||d.runCommand(Bu,{onSelect:q=>B(`#${q.getId()}`)})),R},[d,u]),h.useEffect(()=>{if(!r)return;switch(tS(r,i)){case"phone":w(r.replace(Vh,""));break;case"email":{const[R,q=""]=r.replace(Mu,"").split("?");g(R),v(q.replace(Ih,""));break}}},[r]);const J=Ko({className:N(W7,a)});return c.jsxs("div",{...J,children:[c.jsx(Cr,{...t,as:s}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Xo,{onChange:j,classNamePanel:"gs-utl-p-1",value:T,tabs:[{id:"url",label:c.jsx(re,{icon:K.link,size:se.s}),content:c.jsx(rt,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:B,size:"s",type:"url"})},{id:"pages",label:c.jsx(re,{icon:K.textBoxMultiple,size:se.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(Le,{size:"s",options:(x||[]).map(Q=>({id:`${_i}${Q.getId()}`,icon:yv(Q),label:Q.getName()})),value:r,onChange:W,label:"Page"}),A&&c.jsx(Le,{size:"s",options:$,value:z7(i,"id"),onChange:D,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(re,{icon:K.viewDayOutline,size:se.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(qo,{size:"s",children:"Element ID"}),c.jsxs(k,{gap:"xs",nowrap:!0,children:[_?c.jsx(Xw,{options:y,onChange:z,value:Y(r),placeholder:C.t("selectList")}):c.jsx(rt,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:B,className:"gs-utl-flex-1"}),c.jsx(Ct,{title:C.t("selectTarget"),size:"m2",active:u,onClick:G,className:"gs-utl-h-[30px]",children:c.jsx(re,{icon:K.target,size:se.sx})})]}),c.jsx(rl,{value:_,onChange:M,label:E("showList")})]})},{id:"email",label:c.jsx(re,{icon:K.email,size:se.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(rt,{placeholder:"eg. mail@gmail.com",value:f,onChange:H,size:"s",label:"Email",type:"email"}),c.jsx(rt,{placeholder:"eg. My subject",value:m,onChange:V,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(re,{icon:K.phone,size:se.s}),content:c.jsx(rt,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:I})}]})})]})});function q7({trait:e,value:t,disabled:n,label:r,labelAs:o}){const[s,a]=h.useState(),i=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(f=>f.id===(s==null?void 0:s.id));return c.jsx(Jr,{items:d,selected:p>-1?s:null,select:a,disabled:n,label:r,labelAs:o,add:()=>{const f=d.length+1,g=l?l(f):{id:`opt${f}`,label:`New option ${f}`};e.setValue([...d,g])},move:(f,g)=>{const m=e.getValue().filter(v=>v.id!==f.id);m.splice(g,0,f),e.setValue(m)},remove:f=>{const g=e.getValue().filter(m=>m.id!==f.id);e.setValue(g,{removed:f})},renderItem:f=>u?u(f):f.label,children:c.jsx(k,{space:"m",col:!0,children:!!s&&i.map(f=>{const{name:g,getValue:m}=f,v=f.setValue,b=f.label||g,w=d[p];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const P={...w};w[g]=v?v(E,S):E,e.setValue([...d],{item:w,previous:P}),g==="id"&&a(w)};let x=c.jsx(rt,{label:b,value:S,onChange:C});switch(f.type){case"select":x=c.jsx(Le,{label:b,options:f.options,value:S,onChange:C})}return c.jsx(h.Fragment,{children:x},g)})})})}const K7="gs-trait-custom-type",Z7=ce(function({trait:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=t.target,{Traits:a}=n,i=a.getType(o),l=!!(s&&i);return h.useEffect(()=>{const u=r.current;if(i&&u&&s){const d=new i({model:t,config:a.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:K7,ref:r})}),Y7=e=>{const{value:t={},onConfirm:n,additionalSources:r,editor:o}=e;if(!o)return;const s="DataValuePicker",a={id:s,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:i})=>{n==null||n(i),o.runCommand(ne.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(ne.layoutToggle,{...a})};function rS(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:r,editor:o,additionalSources:s,enableDataValue:a,hasDataResolverValue:i}=e;if(!o||!a)return[];const l={type:"button",className:i?U.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:o.I18n.t("dataSources.connectDataValue"),icon:{icon:K.databaseOutline,size:se.s2x},onClick:()=>Y7({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:K.close,size:se.s2x},onClick:r}),u}function X7(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:no(t)&&et(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=ns(s);return{hasDataResolverValue:i,dataResolverValue:i?e.getValue():void 0,enableDataValue:o,initialDataValue:s,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:a}}const J7=({label:e,buttons:t})=>c.jsxs(k,{items:"center",nowrap:!0,full:!0,children:[c.jsx(F,{grow:!0,children:e}),c.jsx(k,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(Ct,{...n},r))})]}),oS=e=>Lr((e||"").replace(/-/g," ")),Q7=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&oS(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,r)=>e.setValue(n,{partial:r})}),Or=(e,t,n)=>{const r=X7(e,n.traitManagerDataConfig),o=rS(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=Q7(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(J7,{label:i.label,buttons:o})}},sS=(e,t,n)=>Or(e,t,n),R7=(e,t,n)=>Or(e,t,n),eV=(e,t,n)=>{const r=ns(e.getValue({skipResolve:!0})),o=Or(e,t,n),s={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!r,units:r?[]:e.get("units"),onChange:(a,i)=>{const l=i||isNaN(parseFloat(a))?a:parseFloat(a);e.setValue(l,{partial:i})}};return{...o,...s}},aS=(e,t,n)=>{const r=e.get("labelToTitle"),o=ns(e.getValue({skipResolve:!0})),s=Or(e,t,n),a={options:e.getOptions().map(i=>{const l=i.labelReact||i.name||i.label||i.value;return ct(i)?{id:i,label:i}:{id:i.id||i.value,title:r?l:i.title,icon:i.icon,label:r?"":l}}),onChange:i=>e.setValue(i),emptyState:o&&e.getValue()||void 0,hideCaret:o};return{...s,...a}},tV=(e,t,n)=>{const{options:r,onChange:o}=aS(e,t,n),s={options:r,onChange:o};return{...Or(e,t,n),...s}},nV=(e,t,n)=>{const r=e.get("typeProps")||{},o=ns(e.getValue({skipResolve:!0}));return{...Or(e,t,n),isContain:!0,hideButton:o,btnLabel:e.get("text"),onOpen(){if(o)return;const a=t==null?void 0:t.Assets;a==null||a.open({select(i){e.setValue(i.getSrc()),a.close()}})},...r}},rV=e=>({children:oS(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");ct(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),oV=(e,t,n)=>{const r=Or(e,t,n),s={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...s}},sV=(e,t,n)=>{const r=Or(e,t,n),o=e.get("typeProps")||{},s=ns(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},aV=(e,t,n)=>({...Or(e,t,n),trait:e}),iV=(e,t,n)=>({...Or(e,t,n),trait:e}),lV=(e,t,n)=>({...Or(e,t,n),trait:e,editor:t});function cV(e,t,n={}){var a;const r=e.get("visible"),o=e.getType(),s={traitManagerDataConfig:n.traitManagerDataConfig};if(et(r)&&r({component:e.target,trait:e})===!1)return null;switch(o){case"text":return c.jsx(rt,{...sS(e,t,s)});case"select":return c.jsx(Le,{...aS(e,t,s)});case"number":return c.jsx($e,{...eV(e,t,s)});case"color":return c.jsx(Zr,{...R7(e,t,s)});case"checkbox":return c.jsx(rl,{...oV(e,t,s)});case"button":return c.jsx(Ke,{...rV(e)});case"radio":return c.jsx(Rt,{...tV(e,t,s)});case"code":return c.jsx(vo,{...sV(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(dl,{...nV(e,t,s)});case"stack":return c.jsx(q7,{...aV(e,t,s)});case"href":return c.jsx(G7,{...iV(e,t,s)});case"custom":return c.jsx(B7,{...lV(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(Z7,{editor:t,trait:e}):c.jsx(rt,{...sS(e,t,s)})}}const Nu="gs-trait-manager",iS=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(F,{className:`${Nu}-field gs-utl-mb-2 gs-utl-w-full`,children:cV(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function uV({traits:e,className:t}){var p,f;const n=Fi(),{isDarkTheme:r}=zr(),s=(p=ye().sdkOptions.dataSources)==null?void 0:p.traitManager,a=n.Traits.getTraitsByCategory(e),i=(f=a.find(g=>!g.category))==null?void 0:f.items,l=a.filter(g=>g.category),u=`${Nu}__empty-state gs-utl-text-center`,d=g=>n.t(`traitManager.${g}`);return c.jsx(k,{className:X(Nu,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(g=>c.jsx(iS,{trait:g,isDarkTheme:r,traitManagerDataConfig:s},g.id)),l.map(({category:g,items:m},v)=>c.jsx(yo,{open:!!(g!=null&&g.get("open")),onChange:({open:b})=>g==null?void 0:g.set({open:b}),handler:g==null?void 0:g.getLabel(),handlerIcon:g==null?void 0:g.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Nu}-category -gs-utl-mx-2`,className:b=>X(Nd.itemList({index:v+(i?1:0),open:b,length:l.length})),children:m.map(b=>c.jsx(iS,{trait:b,isDarkTheme:r,traitManagerDataConfig:s},b.id))},g==null?void 0:g.id))]}):c.jsx(F,{className:u,children:d("notFound")}):c.jsx(F,{className:u,children:d("empty")})})}const Hh=ce(uV),dV="gs-panel-properties",pV=h.memo(ce(function({className:t,...n}){return c.jsx(Tr,{className:N(dV,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(mf,{children:r=>c.jsx(Hh,{...r})})})})),fV=async({html:e="",css:t="",el:n})=>{const r=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,o={};if(document.body.attachShadow){const s=n.shadowRoot||n.attachShadow({mode:"open"});s.innerHTML=r}return o},hV=ce(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=h.useRef(null),i=ye().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=zr(),[f,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(f),b=t.selectorsToString(),w=()=>{i.select(),setTimeout(()=>i.Selectors.select(t)),n==null||n()},y=()=>{i.Css.remove(t),r==null||r()},S=()=>{if(m){const C=i.Parser.parseCss(m)[0];C&&(t.setStyle(C.style),g(m))}};return h.useEffect(()=>{if(s.current){const C=s.current;fV({el:C,html:'<div class="prv-rule">Preview</div>',css:`
326
+ `},L9={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}};var mt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(mt||(mt={}));function Pg(...e){}class vl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const _u=g.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:Pg,draggableNodes:{},droppableRects:new Map,droppableContainers:new vl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pg},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:Pg,windowRect:null,willRecomputeLayouts:!1});function N9(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new vl}}}function $9(e,t){switch(t.type){case mt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case mt.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case mt.DragEnd:case mt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case mt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new vl(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case mt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new vl(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case mt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new vl(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const Tw=g.createContext({type:null,event:null});function k9({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=g.useContext(Tw),a=g.useRef(s);g.useEffect(()=>{if(s!==a.current){const{type:i,event:l}=s;switch(i){case mt.DragStart:e==null||e(l);break;case mt.DragMove:t==null||t(l);break;case mt.DragOver:n==null||n(l);break;case mt.DragCancel:o==null||o(l);break;case mt.DragEnd:r==null||r(l);break}a.current=s}},[s,e,t,n,r,o])}function I9({announcements:e=L9,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=A9(),s=hl("DndLiveRegion"),[a,i]=g.useState(!1);return g.useEffect(()=>{i(!0)},[]),k9(g.useMemo(()=>({onDragStart({active:l}){r(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&r(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){r(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){r(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){r(e.onDragCancel(l.id))}}),[r,e])),a?On.createPortal(g.createElement(g.Fragment,null,g.createElement(O9,{id:t,value:n.draggable}),g.createElement(_9,{id:s,announcement:o})),document.body):null}const So=Object.freeze({x:0,y:0});function Ow(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _w(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const V9=({collisionRect:e,droppableContainers:t})=>{const n=_w(e,e.left,e.top);let r=1/0,o=null;for(const s of t){const{rect:{current:a}}=s;if(a){const i=Ow(_w(a),n);i<r&&(r=i,o=s.id)}}return o};function H9(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function j9(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:So}function D9(e){return function(n,...r){return r.reduce((o,s)=>({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x,offsetLeft:o.offsetLeft+e*s.x,offsetTop:o.offsetTop+e*s.y}),{...n})}}const Aw=D9(1);function F9(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function B9(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})!=null}function Tg(e){const t=[];function n(r){if(!r)return t;if(Sg(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!Va(r)||xw(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return B9(r,o)&&t.push(r),F9(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function Og(e){return!Ou||!e?null:Ia(e)?e:wg(e)?Sg(e)||e===Ha(e).scrollingElement?window:Va(e)?e:null:null}function _g(e){return Ia(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var ja;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ja||(ja={}));function Mw(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},r=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:r,isLeft:o,isBottom:s,isRight:a,maxScroll:n,minScroll:t}}function z9(e){return!Ou||!e?!1:e===document.scrollingElement}const U9={x:.2,y:.2};function W9(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=U9){const{clientHeight:l,clientWidth:u}=e,d=z9(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:p,isBottom:f,isLeft:h,isRight:m}=Mw(e),b={x:0,y:0},v={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!p&&n<=d.top+w.height?(b.y=ja.Backward,v.y=a*Math.abs((d.top+w.height-n)/w.height)):!f&&s>=d.bottom-w.height&&(b.y=ja.Forward,v.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(b.x=ja.Forward,v.x=a*Math.abs((d.right-w.width-o)/w.width)):!h&&r<=d.left+w.width&&(b.x=ja.Backward,v.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:b,speed:v}}function G9(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Lw(e){return e.reduce((t,n)=>ml(t,_g(n)),So)}function Nw(e,t,n=So){if(!e||!Va(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:Nw(e.offsetParent,t,r)}function Au(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=Nw(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function Mu(e){if(Ia(e)){const u=window.innerWidth,d=window.innerHeight;return{top:0,left:0,right:u,bottom:d,width:u,height:d,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=Au(e),{width:r,height:o,top:s,bottom:a,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:s,bottom:a,right:l,left:i,offsetTop:t,offsetLeft:n}}function Ag(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=Au(e),s=Tg(e),a=Lw(s),i=r-a.y,l=o-a.x;return{width:t,height:n,top:i,bottom:i+n,right:l+t,left:l,offsetTop:r,offsetLeft:o}}function $w(e){return"top"in e}function kw(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const q9=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=kw(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=kw(a,$w(a)?a.left:void 0,$w(a)?a.top:void 0),l=o.reduce((d,p,f)=>d+Ow(i[f],p),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function K9(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),s=Math.min(t.top+t.height,e.offsetTop+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,d=a*i,p=d/(l+u-d);return Number(p.toFixed(4))}return 0}const Z9=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=K9(s,e);a>n&&(n=a,r=o.id)}}return r};var yl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(yl||(yl={}));var Lu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Lu||(Lu={}));function Y9({acceleration:e,activator:t=yl.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=Lu.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[p,f]=C9(),h=g.useRef({x:1,y:1}),m=g.useMemo(()=>{switch(t){case yl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case yl.DraggableRect:return r}return null},[t,r,i]),b=g.useRef(So),v=g.useRef(null),w=g.useCallback(()=>{const S=v.current;if(!S)return;const C=h.current.x*b.current.x,E=h.current.y*b.current.y;S.scrollBy(C,E)},[]),y=g.useMemo(()=>a===Lu.TreeOrder?[...l].reverse():l,[a,l]);g.useEffect(()=>{if(!o||!l.length||!m){f();return}for(const S of y){if((n==null?void 0:n(S))===!1)continue;const C=l.indexOf(S),E=u[C];if(!E)continue;const{direction:x,speed:P}=W9(S,E,m,e,d);if(P.x>0||P.y>0){f(),v.current=S,p(w,s),h.current=P,b.current=x;return}}h.current={x:0,y:0},b.current={x:0,y:0},f()},[e,w,n,f,o,s,JSON.stringify(m),p,l,y,u,JSON.stringify(d)])}function X9(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return gl(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function J9(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}function Iw(e){const t=g.useRef(e);return Gs(()=>{t.current!==e&&(t.current=e)},[e]),t}var wl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(wl||(wl={}));var Mg;(function(e){e.Optimized="optimized"})(Mg||(Mg={}));const Vw=new Map,Q9={measure:Au,strategy:wl.WhileDragging,frequency:Mg.Optimized};function R9(e,{dragging:t,dependencies:n,config:r}){const[o,s]=g.useState(!1),{frequency:a,measure:i,strategy:l}={...Q9,...r},u=g.useRef(e),d=g.useCallback(()=>s(!0),[]),p=g.useRef(null),f=m(),h=gl(b=>{if(f&&!t)return Vw;if(!b||b===Vw||u.current!==e||o){for(let v of e)v&&(v.rect.current=v.node.current?i(v.node.current):null);return e7(e)}return b},[e,t,f,i,o]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{o&&s(!1)},[o]),g.useEffect(function(){f||requestAnimationFrame(d)},[t,f]),g.useEffect(function(){f||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},a))},[a,f,d,...n]),{layoutRectMap:h,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case wl.Always:return!1;case wl.BeforeDragging:return t;default:return!t}}}function e7(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:r,rect:o}=n;o.current!=null&&t.set(r,o.current)}return t}function t7(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(s=>{const a=Og(s.target);a&&n(i=>i?(i.set(a,_g(a)),new Map(i)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=Og(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,_g(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=Og(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>ml(s,a),So):Lw(e):So,[e,t])}const n7=[];function r7(e){const t=g.useRef(e),n=gl(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:Tg(e):n7,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function o7(e){g.useEffect(()=>{if(!Ou)return;const t=e.map(({sensor:n})=>n.setup==null?void 0:n.setup());return()=>{for(const n of t)n==null||n()}},e.map(({sensor:t})=>t))}function s7(e,t){return g.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const Lg=jw(Mu),a7=i7(Mu);function Hw(e,t,n){const r=g.useRef(e);return gl(o=>e?n||!o&&e||e!==r.current?Va(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function jw(e){return(t,n)=>Hw(t,e,n)}function i7(e){const t=[];return function(r,o){const s=g.useRef(r);return gl(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function l7(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Va(t)?t:e}function c7(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=Au(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const u7=jw(c7);function d7({disabled:e,forceRecompute:t}){const[n,r]=Cg(),o=u7(e?null:l7(n.current),t);return g.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function Dw(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function p7(...e){return g.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class Sl{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})}}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function f7(e){const{EventTarget:t}=is(e);return e instanceof t?e:Ha(e)}function Ng(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ar;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ar||(ar={}));function Fw(e){e.preventDefault()}function g7(e){e.stopPropagation()}var Xe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Xe||(Xe={}));const Bw={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter]},h7=(e,{currentCoordinates:t})=>{switch(e.code){case Xe.Right:return{...t,x:t.x+25};case Xe.Left:return{...t,x:t.x-25};case Xe.Down:return{...t,y:t.y+25};case Xe.Up:return{...t,y:t.y-25}}};class $g{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=So;const{event:{target:n}}=t;this.props=t,this.listeners=new Sl(Ha(n)),this.windowListeners=new Sl(is(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ar.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const r=Mu(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(E9(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=Bw,coordinateGetter:i=h7,scrollBehavior:l="smooth"}=s,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const d=i(t,{active:r,context:o.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:f}=o.current;for(const h of f){const m=t.code,b=Pw(d,n),{isTop:v,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:E}=Mw(h),x=G9(h),P={x:Math.min(m===Xe.Right?x.right-x.width/2:x.right,Math.max(m===Xe.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(m===Xe.Down?x.bottom-x.height/2:x.bottom,Math.max(m===Xe.Down?x.top:x.top+x.height/2,d.y))},_=m===Xe.Right&&!w||m===Xe.Left&&!y,T=m===Xe.Down&&!S||m===Xe.Up&&!v;if(_&&P.x!==d.x){if(m===Xe.Right&&h.scrollLeft+b.x<=C.x||m===Xe.Left&&h.scrollLeft+b.x>=E.x){h.scrollBy({left:b.x,behavior:l});return}p.x=m===Xe.Right?h.scrollLeft-C.x:h.scrollLeft-E.x,h.scrollBy({left:-p.x,behavior:l});break}else if(T&&P.y!==d.y){if(m===Xe.Down&&h.scrollTop+b.y<=C.y||m===Xe.Up&&h.scrollTop+b.y>=E.y){h.scrollBy({top:b.y,behavior:l});return}p.y=m===Xe.Down?h.scrollTop-C.y:h.scrollTop-E.y,h.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,ml(d,p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}$g.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=Bw,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function zw(e){return!!(e&&"distance"in e)}function Uw(e){return!!(e&&"delay"in e)}class kg{constructor(t,n,r=f7(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Ha(s),this.documentListeners=new Sl(this.document),this.listeners=new Sl(r),this.windowListeners=new Sl(is(s)),this.initialCoordinates=Eg(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.DragStart,Fw),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),this.windowListeners.add(ar.ContextMenu,Fw),this.documentListeners.add(ar.Keydown,this.handleKeydown),n){if(zw(n))return;if(Uw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ar.Click,g7,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ar.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:r,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!r)return;const i=Eg(t),l=Pw(r,i);if(!n&&a){if(Uw(a))return Ng(l,a.tolerance)?this.handleCancel():void 0;if(zw(a))return a.tolerance!=null&&Ng(l,a.tolerance)?this.handleCancel():Ng(l,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(i)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const m7={move:{name:"pointermove"},end:{name:"pointerup"}};class Ig extends kg{constructor(t){const{event:n}=t,r=Ha(n.target);super(t,m7,r)}}Ig.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const b7={move:{name:"mousemove"},end:{name:"mouseup"}};var Vg;(function(e){e[e.RightClick=2]="RightClick"})(Vg||(Vg={}));class v7 extends kg{constructor(t){super(t,b7,Ha(t.event.target))}}v7.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Vg.RightClick?!1:(t==null||t({event:e}),!0)}];const Hg={move:{name:"touchmove"},end:{name:"touchend"}};class y7 extends kg{constructor(t){super(t,Hg)}static setup(){return window.addEventListener(Hg.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Hg.move.name,t)};function t(){}}}y7.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function w7(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const S7=[{sensor:Ig,options:{}},{sensor:$g,options:{}}],C7={current:{}},Ww=g.createContext({...So,scaleX:1,scaleY:1}),x7=g.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=S7,collisionDetection:a=Z9,measuring:i,modifiers:l,screenReaderInstructions:u=M9,...d}){var p,f,h,m,b;const v=g.useReducer($9,void 0,N9),[w,y]=v,[S,C]=g.useState(()=>({type:null,event:null})),[E,x]=g.useState(!1),{draggable:{active:P,nodes:_,translate:T},droppable:{containers:O}}=w,M=P?_[P]:null,A=g.useRef({initial:null,translated:null}),$=g.useMemo(()=>{var rt;return P!=null?{id:P,data:(rt=M==null?void 0:M.data)!=null?rt:C7,rect:A}:null},[P,M]),j=g.useRef(null),[L,H]=g.useState(null),[W,B]=g.useState(null),G=g.useRef(d),D=hl("DndDescribedBy",t),V=g.useMemo(()=>O.getEnabled(),[O]),{layoutRectMap:k,recomputeLayouts:z,willRecomputeLayouts:Y}=R9(V,{dragging:E,dependencies:[T.x,T.y],config:i==null?void 0:i.droppable}),X=X9(_,P),ee=W?Eg(W):null,J=Hw(X,(p=i==null||(f=i.draggable)==null?void 0:f.measure)!=null?p:Ag),q=Lg(X),R=g.useRef(null),ae=R.current,le=g.useRef({active:null,activeNode:X,collisionRect:null,droppableRects:k,draggableNodes:_,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),me=O.getNodeFor((h=le.current.over)==null?void 0:h.id),ve=Lg(X?X.ownerDocument.defaultView:null),He=Lg(X?X.parentElement:null),je=r7(P?me??X:null),it=a7(je),qe=d7({disabled:P==null,forceRecompute:Y}),Se=(m=qe.rect)!=null?m:J,Ue=Se===J?j9(J,ae):So,et=w7(l,{transform:{x:T.x-Ue.x,y:T.y-Ue.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:q,containerNodeRect:He,draggingNodeRect:Se,over:le.current.over,overlayNodeRect:qe.rect,scrollableAncestors:je,scrollableAncestorRects:it,windowRect:ve}),Ct=ee?ml(ee,T):null,Ne=t7(je),bt=ml(et,Ne),pt=Se?Aw(Se,et):null,Ke=pt?Aw(pt,Ne):null,tn=$&&Ke?a({active:$,collisionRect:Ke,droppableContainers:V}):null,[he,Be]=g.useState(null),ze=H9(et,(b=he==null?void 0:he.rect)!=null?b:null,J),De=g.useCallback((rt,{sensor:xt,options:nn})=>{if(!j.current)return;const zn=_[j.current];if(!zn)return;const Xt=new xt({active:j.current,activeNode:zn,event:rt.nativeEvent,options:nn,context:le,onStart(Tn){const ds=j.current;if(!ds)return;const ps=_[ds];if(!ps)return;const{onDragStart:fs}=G.current,gs={active:{id:ds,data:ps.data,rect:A}};On.unstable_batchedUpdates(()=>{y({type:mt.DragStart,initialCoordinates:Tn,active:ds}),C({type:mt.DragStart,event:gs})}),fs==null||fs(gs)},onMove(Tn){y({type:mt.DragMove,coordinates:Tn})},onEnd:Ys(mt.DragEnd),onCancel:Ys(mt.DragCancel)});On.unstable_batchedUpdates(()=>{H(Xt),B(rt.nativeEvent)});function Ys(Tn){return async function(){const{active:ps,over:fs,scrollAdjustedTranslate:gs}=le.current;let hs=null;if(ps&&gs){const{cancelDrop:mn}=G.current;hs={active:ps,delta:gs,over:fs},Tn===mt.DragEnd&&typeof mn=="function"&&await Promise.resolve(mn(hs))&&(Tn=mt.DragCancel)}if(j.current=null,On.unstable_batchedUpdates(()=>{y({type:Tn}),Be(null),x(!1),H(null),B(null),hs&&C({type:Tn,event:hs})}),hs){const{onDragCancel:mn,onDragEnd:Lr}=G.current,Ju=Tn===mt.DragEnd?Lr:mn;Ju==null||Ju(hs)}}}},[y,_]),Nt=g.useCallback((rt,xt)=>(nn,zn)=>{const Xt=nn.nativeEvent;j.current!==null||Xt.dndKit||Xt.defaultPrevented||rt(nn,xt.options)===!0&&(Xt.dndKit={capturedBy:xt.sensor},j.current=zn,De(nn,xt))},[De]),qt=J9(s,Nt);o7(s),Gs(()=>{G.current=d},Object.values(d)),g.useEffect(()=>{P!=null&&x(!0)},[P]),g.useEffect(()=>{$||(R.current=null),$&&J&&!R.current&&(R.current=J)},[J,$]),g.useEffect(()=>{const{onDragMove:rt}=G.current,{active:xt,over:nn}=le.current;if(!xt)return;const zn={active:xt,delta:{x:bt.x,y:bt.y},over:nn};C({type:mt.DragMove,event:zn}),rt==null||rt(zn)},[bt.x,bt.y]),g.useEffect(()=>{const{active:rt,droppableContainers:xt,scrollAdjustedTranslate:nn}=le.current;if(!rt||!j.current||!nn)return;const{onDragOver:zn}=G.current,Xt=xt.get(tn),Ys=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Tn={active:rt,delta:{x:nn.x,y:nn.y},over:Ys};On.unstable_batchedUpdates(()=>{Be(Ys),C({type:mt.DragOver,event:Tn}),zn==null||zn(Tn)})},[tn]),Gs(()=>{le.current={active:$,activeNode:X,collisionRect:Ke,droppableRects:k,draggableNodes:_,draggingNodeRect:Se,droppableContainers:O,over:he,scrollableAncestors:je,scrollAdjustedTranslate:bt,translatedRect:pt},A.current={initial:Se,translated:pt}},[$,X,Ke,_,Se,k,O,he,je,bt,pt]),Y9({...Zs(),draggingRect:pt,pointerCoordinates:Ct,scrollableAncestors:je,scrollableAncestorRects:it});const Po=g.useMemo(()=>({active:$,activeNode:X,activeNodeRect:J,activeNodeClientRect:q,activatorEvent:W,activators:qt,ariaDescribedById:{draggable:D},containerNodeRect:He,dispatch:y,dragOverlay:qe,draggableNodes:_,droppableContainers:O,droppableRects:k,over:he,recomputeLayouts:z,scrollableAncestors:je,scrollableAncestorRects:it,willRecomputeLayouts:Y,windowRect:ve}),[$,X,q,J,W,qt,He,qe,y,_,D,O,k,he,z,je,it,Y,ve]);return g.createElement(Tw.Provider,{value:S},g.createElement(_u.Provider,{value:Po},g.createElement(Ww.Provider,{value:ze},o)),g.createElement(I9,{announcements:r,hiddenTextDescribedById:D,screenReaderInstructions:u}));function Zs(){const rt=(L==null?void 0:L.autoScrollEnabled)===!1,xt=typeof n=="object"?n.enabled===!1:n===!1,nn=!rt&&!xt;return typeof n=="object"?{...n,enabled:nn}:{enabled:nn}}}),E7=g.createContext(null),Gw="button",P7="Droppable";function T7({id:e,data:t,disabled:n=!1,attributes:r}){const o=hl(P7),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:p,over:f}=g.useContext(_u),{role:h=Gw,roleDescription:m="draggable",tabIndex:b=0}=r??{},v=(s==null?void 0:s.id)===e,w=g.useContext(v?Ww:E7),[y,S]=Cg(),C=s7(p,e),E=Iw(t);g.useEffect(()=>(u[e]={id:e,key:o,node:y,data:E},()=>{const P=u[e];P&&P.key===o&&delete u[e]}),[u,e]);const x=g.useMemo(()=>({role:h,tabIndex:b,"aria-pressed":v&&h===Gw?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[h,b,v,m,l.draggable]);return{active:s,activeNodeRect:a,activatorEvent:i,attributes:x,droppableRects:d,isDragging:v,listeners:n?void 0:C,node:y,over:f,setNodeRef:S,transform:w}}function O7(){return g.useContext(_u)}const _7="Droppable";function A7({data:e,disabled:t=!1,id:n}){const r=hl(_7),{active:o,dispatch:s,over:a}=g.useContext(_u),i=g.useRef(null),[l,u]=Cg(),d=Iw(e);return Gs(()=>(s({type:mt.RegisterDroppable,element:{id:n,key:r,disabled:t,node:l,rect:i,data:d}}),()=>s({type:mt.UnregisterDroppable,key:r,id:n})),[n]),g.useEffect(()=>{s({type:mt.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:o,rect:i,isOver:(a==null?void 0:a.id)===n,node:l,over:a,setNodeRef:u}}function qw(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const M7=({containerNodeRect:e,draggingNodeRect:t,transform:n})=>!t||!e?n:qw(n,t,e),L7=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:qw(t,e,r)},N7=({transform:e})=>({...e,x:0});function Kw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function $7(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function Nu(e){return e!==null&&e>=0}const Zw=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=Kw(e,n,t),s=e[r],a=o[r];return!a||!s?null:{x:a.offsetLeft-s.offsetLeft,y:a.offsetTop-s.offsetTop,scaleX:a.width/s.width,scaleY:a.height/s.height}},$u={scaleX:1,scaleY:1},k7=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:r,overIndex:o})=>{var s;const a=(s=r[e])!=null?s:t;if(!a)return null;if(n===e){const l=r[o];return l?{x:0,y:e<o?l.offsetTop+l.height-(a.offsetTop+a.height):l.offsetTop-a.offsetTop,...$u}:null}const i=I7(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,...$u}:n<e&&n>=o?{x:0,y:a.height+i,...$u}:{x:0,y:0,...$u}};function I7(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.offsetTop-(o.offsetTop+o.height):s?s.offsetTop-(r.offsetTop+r.height):0:s?s.offsetTop-(r.offsetTop+r.height):o?r.offsetTop-(o.offsetTop+o.height):0:0}const Yw="Sortable",Xw=g.createContext({activeIndex:-1,containerId:Yw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Zw,wasDragging:{current:!1}});function V7({children:e,id:t,items:n,strategy:r=Zw}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=O7(),d=hl(Yw,t),p=s.rect!==null,f=g.useMemo(()=>n.map(P=>typeof P=="string"?P:P.id),[n]),h=o!=null,m=g.useRef(!1),b=o?f.indexOf(o.id):-1,v=b!==-1,w=i?f.indexOf(i.id):-1,y=g.useRef(f),S=$7(f,a),C=!H7(f,y.current),E=w!==-1&&b===-1||C;Gs(()=>{C&&v&&!u&&l()},[C,v,l,u]),g.useEffect(()=>{y.current=f},[f]),g.useEffect(()=>{const P=setTimeout(()=>{m.current=h},100);return()=>clearTimeout(P)},[h]);const x=g.useMemo(()=>({activeIndex:b,containerId:d,disableTransforms:E,items:f,overIndex:w,useDragOverlay:p,sortedRects:S,strategy:r,wasDragging:m}),[b,d,E,f,w,S,p,r,m]);return g.createElement(Xw.Provider,{value:x},e)}function H7(e,t){return e.join()===t.join()}const j7=({id:e,items:t,activeIndex:n,overIndex:r})=>Kw(t,n,r).indexOf(e),D7=({containerId:e,isSorting:t,wasDragging:n,index:r,items:o,newIndex:s,previousItems:a,previousContainerId:i,transition:l})=>!l||!n||a!==o&&r===s?!1:t?!0:s!==r&&e===i,F7={duration:200,easing:"ease"},Jw="transform",B7=bl.Transition.toString({property:Jw,duration:0,easing:"linear"}),z7={roleDescription:"sortable"};function U7({disabled:e,index:t,node:n,rect:r}){const[o,s]=g.useState(null),a=g.useRef(t);return Gs(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=Mu(n.current),u={x:i.offsetLeft-l.offsetLeft,y:i.offsetTop-l.offsetTop,scaleX:i.width/l.width,scaleY:i.height/l.height};(u.x||u.y)&&s(u)}}t!==a.current&&(a.current=t)},[e,t,n,r]),g.useEffect(()=>{o&&requestAnimationFrame(()=>{s(null)})},[o]),o}function W7({animateLayoutChanges:e=D7,attributes:t,disabled:n,data:r,getNewIndex:o=j7,id:s,strategy:a,transition:i=F7}){const{items:l,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:f,overIndex:h,useDragOverlay:m,strategy:b,wasDragging:v}=g.useContext(Xw),w=l.indexOf(s),y=g.useMemo(()=>({sortable:{containerId:u,index:w,items:l},...r}),[u,r,w,l]),{rect:S,node:C,setNodeRef:E}=A7({id:s,data:y}),{active:x,activeNodeRect:P,activatorEvent:_,attributes:T,setNodeRef:O,listeners:M,isDragging:A,over:$,transform:j}=T7({id:s,data:y,attributes:{...z7,...t},disabled:n}),L=w9(E,O),H=!!x,W=H&&v.current&&!p&&Nu(d)&&Nu(h),B=!m&&A,G=B&&W?j:null,V=W?G??(a??b)({layoutRects:f,activeNodeRect:P,activeIndex:d,overIndex:h,index:w}):null,k=Nu(d)&&Nu(h)?o({id:s,items:l,activeIndex:d,overIndex:h}):w,z=g.useRef(l),Y=l!==z.current,X=g.useRef(k),ee=g.useRef(u),J=e({active:x,containerId:u,isDragging:A,isSorting:H,id:s,index:w,items:l,newIndex:X.current,previousItems:z.current,previousContainerId:ee.current,transition:i,wasDragging:v.current}),q=U7({disabled:!J,index:w,node:C,rect:S});return g.useEffect(()=>{H&&X.current!==k&&(X.current=k),u!==ee.current&&(ee.current=u),l!==z.current&&(z.current=l)},[H,k,u,l]),{active:x,attributes:T,activatorEvent:_,rect:S,index:w,isSorting:H,isDragging:A,listeners:M,node:C,overIndex:h,over:$,setNodeRef:L,setDroppableNodeRef:E,setDraggableNodeRef:O,transform:q??V,transition:R()};function R(){if(q||Y&&X.current===w)return B7;if(!(B||!i)&&(H||J))return bl.Transition.toString({...i,property:Jw})}}const G7=[Xe.Down,Xe.Right,Xe.Up,Xe.Left],q7=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(G7.includes(e.code)){if(e.preventDefault(),!t||!r)return;const a=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=Ag(u),p={...l,rect:{current:d}};switch(e.code){case Xe.Down:r.top+r.height<=d.top&&a.push(p);break;case Xe.Up:r.top>=d.top+d.height&&a.push(p);break;case Xe.Left:r.left>=d.left+d.width&&a.push(p);break;case Xe.Right:r.left+r.width<=d.left&&a.push(p);break}});const i=q9({active:t,collisionRect:r,droppableContainers:a});if(i){var s;const l=(s=n.get(i))==null?void 0:s.node.current;if(l){const d=Tg(l).some((m,b)=>o[b]!==m),p=Ag(l),f=d?{x:0,y:0}:{x:r.width-p.width,y:r.height-p.height};return{x:p.left-f.x,y:p.top-f.y}}}}};function K7(e){const{id:t,item:n,className:r,select:o,remove:s,renderItem:a,previewStyle:i,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:f,setNodeRef:h,transform:m,transition:b,isDragging:v}=W7({id:t,disabled:u}),w={transform:bl.Transform.toString(m),transition:b,zIndex:v?1:void 0},y=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:h,style:w,...p}:{},children:c.jsxs(I,{space:"s",onClick:y,className:Q(r,v&&U.bgH2),items:"center",nowrap:!0,children:[l&&c.jsx(F,{className:Q(!u&&Oe.hover,!u&&"cursor-grab",v&&"gs-utl-opacity-100"),...f,children:c.jsx(ne,{icon:K.dotsVertical,size:se.sx})}),c.jsxs(I,{nowrap:!0,items:"center",gap:"s",className:"gs-utl-flex-1",children:[c.jsx(F,{grow:!0,className:Q("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(F,{children:c.jsx("div",{className:Q("w-4 h-4 gjs-bg-white",re.b,re.rnd),style:i(n)})})]}),s&&d?c.jsx(uu,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(F,{className:Q(!u&&Oe.click),children:c.jsx(ne,{icon:K.close,size:se.sx})})}):c.jsx(F,{className:Q(!u&&Oe.click),onClick:S=>{ms(S),!u&&(s==null||s(n))},children:c.jsx(ne,{icon:K.close,size:se.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}const Z7=e=>{var t,n;return`${(e==null?void 0:e.id)||(e==null?void 0:e.cid)||((t=e==null?void 0:e.getId)==null?void 0:t.call(e))||(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.label)||((n=e==null?void 0:e.getIndex)==null?void 0:n.call(e))||""}`};function Rr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=Z7,label:p,labelAs:f,children:h,title:m="Select",titleAdd:b="Add",emptyState:v,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,E=p7(Dw(Ig),Dw($g,{coordinateGetter:q7}));function x(O){const{active:M,over:A}=O;if(M.id!==(A==null?void 0:A.id)){const $=n.find(L=>d(L)===M.id),j=n.findIndex(L=>d(L)===(A==null?void 0:A.id));$&&(l==null||l($,j))}}const P=Q(re.rnd,U.br,n.length&&re.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:P,children:[n.length===0&&v&&c.jsx(I,{className:N("gs-utl-p-2 gs-utl-text-center",U.txtLowEmphasis),items:"center",justify:"center",children:v}),n.map((O,M)=>{const A=d(O),$=O===r,j=Q("gjs-px-2 gjs-py-2 text-xs",U.br,M&&re.bt,!!s&&!$&&!w&&U.hBgH2,$&&U.bgH,w&&"opacity-75");return c.jsx(K7,{id:A,item:O,className:j,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},A||M)})]});l&&(_=c.jsx(x7,{sensors:E,collisionDetection:V9,onDragEnd:x,modifiers:[N7,M7,L7],children:c.jsx(V7,{items:n.map(d),strategy:k7,children:_})})),s&&!y&&(_=c.jsx(Or,{placement:S,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!r&&!w,onClose:()=>s==null?void 0:s(null),handler:_,children:h}));const T=a?[{type:"button",icon:K.plus,tooltip:b,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:Q(t,"w-full"),children:[!!(p||a)&&c.jsx(Er,{...e,as:f,afterLabelButtons:T}),_]})}const Y7=ce(function(){const t=$e(),{editor:n}=Ce(),r=Li(),o=Ni(),s=o.sortedFonts;return n?c.jsx(Rr,{items:s,selected:null,renderItem:a=>{const i=qp(a);return c.jsxs(I,{col:!0,children:[c.jsx(F,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(F,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>yg(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),Qw=Kt(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ie(U.bg,U.br,o&&`${re.b} ${re.rnd}`,t==="m"&&Te.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(I,{className:l,items:"center",space:"x2s",...a,ref:i,children:c.jsx(F,{grow:!0,className:r,children:s})})}),Rw=Kt(({autoResize:e,style:t={},...n},r)=>{const o=g.useRef(null),s=r||o;return g.useEffect(()=>{!s.current||!e||(s.current.style.height="auto",s.current.style.height=s.current.scrollHeight+"px")},[n.value,e,s]),c.jsx("textarea",{ref:s,style:{...t,...e?{resize:"none"}:{}},...n})});Rw.displayName="TextAreaWithAutoResize";const X7="gs-field-textarea";function eS(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,name:u,required:d,minLength:p,maxLength:f,onChange:h,onKeyDown:m,afterInput:b,minHeight:v,maxHeight:w,autoResize:y,classNameField:S,classNameFieldContent:C,classNameInput:E}=e,x=Bi(e);return c.jsxs("div",{className:Q(X7,t),children:[!!r&&c.jsx(Yo,{size:o,children:r}),!!s&&c.jsx(Yo,{size:o,as:"span",className:Q(U.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(Qw,{size:o,className:S,classNameContent:C,children:[c.jsx(Rw,{className:Q(x,E),autoResize:y,value:n,name:u,placeholder:a,readOnly:i,disabled:l,required:d,minLength:p,maxLength:f,onChange:P=>h==null?void 0:h(P.target.value),onKeyDown:m,style:{minHeight:v,maxHeight:w}}),b]})]})}const ku="gs-page-settings",J7=`${ku}-header`,Q7=`${ku}-content`,R7=`${ku}-footer`,tS="",eV=ce(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=ff.m}){const i=Ce(),{isDarkTheme:l}=xr(),u=Ni(),d=$e(),[p,f]=g.useState(s),[h,m]=g.useState(()=>Ib(p,i)),[b,v]=g.useState(()=>d.t("update")),w=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:S}=i,C={containerClassName:"gs-utl-min-h-80",size:a,padding:5,isDarkTheme:l,clean:!0};if(!S)return null;const E=$=>m(j=>({...j,...$})),x=$=>{$.preventDefault();const{name:j,...L}=h;L.customCodeHead=CC(L.customCodeHead),L.customCodeBody=SC(L.customCodeBody),p?(P4(p,L),p.setName(j)):i.setProjectDataCustom({globalPageSettings:L}),v(d.t("updated")),setTimeout(()=>v(d.t("update")),2e3),Mb(S),S.trigger(_n.pageSettingsUpdate,{page:p,data:{name:j,...L}})},P={tooltip:d.t("clear")},_=(p==null?void 0:p.getId())??tS,T=$=>{const j=S.Pages.get($);f(j),m(Ib(j,i))},O=Zp(p),M=!!p&&Lc(p),A=[{id:tS,label:w("global")},...S.Pages.getAll().map($=>({icon:_b($),id:$.getId(),label:$.getName()}))];return c.jsx("form",{onSubmit:x,className:N(ku,"gs-utl-h-full",t),children:c.jsxs(I,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(F,{className:N(J7,n,U.br,re.bb),children:c.jsx(_e,{value:_,onChange:T,options:A,handlerSelected:$=>c.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),$.icon&&dt($.icon)&&c.jsx(ne,{icon:$.icon,size:se.s2x}),c.jsx("span",{children:$.label})]})})}),c.jsxs(I,{col:!0,className:N(Q7,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!_&&c.jsxs(c.Fragment,{children:[c.jsx(at,{size:a,value:h.name,onChange:$=>E({name:$}),label:y("name.label"),description:y("name.description"),required:!0}),!O&&c.jsx(at,{size:a,value:h.slug,onChange:$=>E({slug:M?$C($,["id"]):Al($)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(at,{size:a,value:h.title,onChange:$=>E({title:$}),label:y("title.label"),description:y("title.description")}),c.jsx(eS,{size:a,value:h.description,onChange:$=>E({description:$}),label:y("description.label"),description:y("description.description")}),c.jsx(fl,{size:a,clear:P,value:h.favicon,onChange:$=>E({favicon:$}),onOpen:()=>{S.Assets.open({select($){E({favicon:$.getSrc()}),S.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(at,{size:a,value:h.keywords,onChange:$=>E({keywords:$}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(at,{size:a,value:h.socialTitle,onChange:$=>E({socialTitle:$}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(fl,{size:a,clear:P,value:h.socialImage,onChange:$=>E({socialImage:$}),onOpen:()=>{S.Assets.open({select($){E({socialImage:$.getSrc()}),S.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(eS,{size:a,value:h.socialDescription,onChange:$=>E({socialDescription:$}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(Pr,{language:"html",defaultValue:h.customCodeHead,onChange:$=>E({customCodeHead:$}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${_}`),c.jsx(Pr,{language:"html",defaultValue:h.customCodeBody,onChange:$=>E({customCodeBody:$}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(Y7,{})]}),c.jsx(I,{className:N(R7,"gs-utl-mt-auto",o,U.br,re.bt),children:c.jsx(Je,{type:"submit",variant:"pr",size:"m2",full:!0,children:b})})]})})}),tV="gs-panel-page-settings",nV=g.memo(ce(function({className:t,page:n,...r}){return c.jsx(Ar,{className:N(tV,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:c.jsx(Ui,{children:c.jsx(eV,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:ff.s,classNameHeader:Te.s,classNameContent:Te.s,classNameFooter:Te.s})})})})),Iu="gs-page-item",nS=ce(function({page:t,rename:n,setRename:r,commandItems:o}){const s=Ce(),a=$e(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,f=u==null?void 0:u.layoutBefore,h=x=>a.t(`pageManager.${x}`),m=x=>l.select(x),b=x=>l.getSelected()===x,v=x=>x===n,w=b(t),y=x=>x.getName()||x.getId(),S=x=>{n==null||n.set({name:x}),r(void 0)},C=ie("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),E=()=>i.runCommand(te.setPageSettings,{page:t,isOpen:!0});return c.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ie([Iu,"group cursor-default",Te.xy,w?U.bgH:U.hBgH2]),children:[p&&Zp(t)&&c.jsx(F,{className:`${Iu}__icon-home`,title:h("homePage"),children:c.jsx(ne,{icon:K.home,size:se.s3x})}),f&&Lt(f({page:t,editor:i,isSelected:w})),c.jsx(F,{className:ie(`${Iu}__name truncate`),grow:!0,children:v(t)?c.jsx(vg,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(I,{className:`${Iu}__actions`,gap:"xs",onClick:ms,items:"center",children:[!n&&d!==!1&&c.jsx(wt,{className:C,size:"xs",border:!1,title:h("settings.label"),onClick:E,block:!0,children:c.jsx(ne,{icon:K.cog,size:se.s3x})}),w&&!!o.length&&c.jsx(Or,{placement:"right-start",handler:c.jsx(ne,{icon:K.dotsVertical,size:se.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:x})=>o.map(P=>c.jsx(_a,{icon:P.icon,label:ot(P.label)?P.label({editor:i}):P.label,action:()=>{var _;x(),(_=P.cmd)==null||_.call(P,{page:t,editor:i})}},P.id))})]})]},t.getId())});function rV({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var rS=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(rS||{});const jg="gs-cmp-sortable",oS=3;function oV({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=g.useState(null),[a,i]=g.useState(-1),[l,u]=g.useState(),[d,p]=g.useState(!1),f=g.useRef(null),{showIndicator:h,indicatorStyle:m}=rV({dragging:!!o&&d,dragRect:l}),b=g.useMemo(()=>[],[e]);g.useEffect(()=>{const P=window.document,_=T=>T.key==="Escape"&&y(T);return P.addEventListener("keydown",_),()=>P.removeEventListener("keydown",_)},[]);const v=P=>_=>{_.button===0&&(f.current={x:_.clientX,y:_.clientY},s(P),p(!1),_.target.setPointerCapture(_.pointerId))},w=P=>{const _=f.current;if(!o||!_)return;if(!d){const $=Math.abs(P.clientX-_.x),j=Math.abs(P.clientY-_.y);(t==="vertical"?j>oS:$>oS)&&p(!0);return}const T=P.clientY;let O=-1;b.forEach(($,j)=>{const L=$.getBoundingClientRect();T>L.top+L.height/2&&(O=j)});const M=e.findIndex($=>$.id===o.id);O<M&&(O+=1),O=Math.min(O,e.length-1),i(O);const A=b[O];if(A){const{height:$,top:j}=A.getBoundingClientRect(),L=T<j+$/2;u({y:A.offsetTop+(L?0:$),h:$})}},y=P=>{s(null),p(!1),f.current=null,u(void 0);const _=P.target,{pointerId:T}=P;T&&(_==null||_.releasePointerCapture(T))},S=P=>{!o||!f.current||(l&&a!==-1&&(n==null||n(o,a)),y(P))},C=N(jg,"gs-utl-relative"),E=N(`${jg}__indicator`,U.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),x=P=>N(`${jg}__item`,h&&(o==null?void 0:o.id)===P.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(I,{col:t==="vertical",className:C,children:e.map((P,_)=>c.jsx(F,{ref:T=>{T&&(b[_]=T)},className:x(P),onPointerDown:v(P),onPointerMove:w,onPointerUp:S,children:r(P)},P.id))}),h&&c.jsx("div",{className:E,style:m})]})}const sV=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(nS,{page:l,commandItems:t,rename:n,setRename:r},l.getId()));const s=(l,u)=>{o.Pages.move(l.entity,{at:u})},a=l=>c.jsx(nS,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(oV,{items:i,direction:rS.vertical,onDrop:s,renderItem:a})},aV=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:ot(r)?r({items:e,editor:t}):r||e},Dg="gs-panel-page-manager",sS=ce(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=Ce(),u=Ea(),d=$e(),{sdkPagesConfig:p}=l,f=l.editor,[h,m]=g.useState(),b=A=>d.t(`pageManager.${A}`),v=p==null?void 0:p.add,w=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,S=A=>{ms(A);const $=L=>{const H=t.length+1;return r({name:`${b("page")} ${H}`,component:`<div>${b("newPage")} ${H}</div>`,...L},{select:!0})};if(v)return v({event:A,editor:f,rename:m,addPage:$});const j=$();j&&m(j)},C=({page:A})=>{if(y)return y({editor:f,page:A});u.confirm({title:b("deletePage"),content:b("confirmDelete"),confirmButton:{variant:"danger",children:b("deletePage")},onConfirm:()=>{const $=t.indexOf(A),j=t[$+1]||t[0];n(j),o(A)}})},E=({page:A})=>{if(w)return w({editor:f,page:A,rename:m});const $=A.getMainComponent(),j=r({name:`${A.getName()} (${b("copy")})`,component:$.clone()},{select:!0});j&&m(j)},x=[{id:"rename",label:b("rename"),icon:K.pencil,cmd:({page:A})=>m(A)},w!==!1&&{id:"duplicate",label:b("duplicate"),icon:K.contentCopy,cmd:E},t.length>1&&y!==!1&&{id:"remove",label:b("delete"),icon:K.delete,cmd:C}].filter(Boolean),P=aV({items:x,editor:f,sdkPageConfig:p}),_=Ry(s,{collapsible:!0,label:b("pages"),icon:K.textBoxMultiple}),T=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,O=c.jsx(sV,{pages:t,commandItems:P,rename:h,setRename:m,editor:f}),M=T?c.jsx(Eu,{className:Q([`${Dg}__content`,"text-sm overflow-auto",re.bt,U.br]),height:i,...T,children:O}):O;return c.jsx(wo,{classNameWrap:Dg,className:Q(`${Dg}__header`,Te.xy,s===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(I,{space:"s",items:"center",children:[!!_.icon&&c.jsx(F,{children:c.jsx(ne,{icon:_.icon,size:se.s})}),c.jsx(F,{grow:!0,children:_.label}),v!==!1&&c.jsx(Gt,{title:b("add"),children:c.jsx(I,{onClick:S,className:Q("cursor-pointer"),children:c.jsx(ne,{icon:K.plus,size:se.s})})})]}),open:_?_.collapsed!==!0:!0,children:M})}),aS=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-page-manager-after"),n),ref:o,...r,children:t})}),iS=Kt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ie("gs-page-manager-before"),n),ref:o,...r,children:t})}),iV="gs-panel-pages",lS=g.memo(ce(function({className:t,header:n,height:r,resizable:o,...s}){const a=Ce().sdkProps.children;return c.jsx(xn,{className:N(iV,t),...s,children:c.jsx(Kv,{children:i=>c.jsxs(c.Fragment,{children:[er(a,iS),c.jsx(sS,{header:n,height:r,resizable:o,...i}),er(a,aS)]})})})})),lV="gs-panel-pages-layers",cV=g.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=Ce(),a=$e(),{className:i,...l}=n||{},u=Ry(r==null?void 0:r.header,{icon:K.layers,collapsible:!1,label:a.t("layerManager.layers"),className:N(re.bb,U.br)});return c.jsxs(Ar,{className:N(lV,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(lS,{className:N(i,re.bb,U.br),...l}),c.jsx(Cw,{...r,header:u})]})})),uV="gs-trait-custom",dV=ce(function(t){const{trait:n,editor:r,value:o,disabled:s,labelAs:a,className:i}=t,[,l]=g.useState(0),u=g.useRef(null),d=n.get("component"),p=n.get("render"),f=n.target,h=u.current;if(g.useEffect(()=>{if(f){let v=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(f.on("change",y),!d&&p&&h){const S=x=>h.appendChild(x),C=x=>h.removeChild(x),E=p({editor:r,component:f,trait:n,addEl:S,removeEl:C,onUpdate:x=>{w=x}});E instanceof HTMLElement?(S(E),v=()=>C(E)):ot(E)&&(v=()=>E())}return()=>{f.off("change",y),v()}}},[f,h,o]),!f)return null;const m=Xo({...t,className:N(uV,i)}),b={trait:n,component:f,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(Er,{...t,as:a}),c.jsx("div",{className:N(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...b}):p?c.jsx("div",{ref:u}):null})]})});function cS({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:p,onBlur:f,placeholder:h}){const[m,b]=g.useState(null),[v,w]=g.useState(null),{styles:y,attributes:S}=xi(m,v,wf),[C,E]=g.useState(""),x=Bi(),P=C===""?t:t.filter(j=>j.label.toLowerCase().includes(C.toLowerCase())),_=j=>E(j.target.value),T=j=>j==null?void 0:j.label,O=d&&C.length>0&&!P.some(j=>j.label===C),M=ot(d)?d(C):d,A={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},$=()=>f==null?void 0:f();return c.jsxs("div",{className:Q("w-full",e),children:[!!o&&c.jsx(Yo,{size:i,children:o}),c.jsxs(da,{value:n,onChange:p,name:r,nullable:!0,children:[c.jsx(Qw,{size:i,ref:b,border:s,children:c.jsxs(I,{nowrap:!0,children:[c.jsx(da.Input,{autoFocus:l,className:x,displayValue:T,onChange:_,onBlur:$,placeholder:h}),!a&&c.jsx(da.Button,{children:c.jsx(ne,{icon:K.chevronDown,size:se.sx})})]})}),c.jsx(da.Options,{static:u,className:Vv,ref:w,style:y.popper,...S.popper,children:c.jsxs(Rn,{className:Q("h-full"),padding:!1,style:A,children:[O&&c.jsx(da.Option,{value:{id:null,label:C},children:({active:j})=>c.jsx(jv,{option:{id:null,label:M},active:j,selected:n})}),!O&&P.length===0&&c.jsx("div",{className:Q(Te.xy),children:"No items found"}),P.map(j=>c.jsx(da.Option,{value:j,children:({active:L})=>c.jsx(jv,{option:j,active:L,selected:n})},j.id))]})})]})]})}const pV=(e,t)=>{const n=`${Ac}${t}`,r=e.get(n,{skipResolve:!0});return r?uS(r):e.get(n)||""};function uS(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const fV=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=Mc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(p=>{if(d!=null&&d[p]){const{collectionId:f}=d,h=r.t(`dataSources.collections.${f}`)||f,m=r.t(`dataSources.variableTypes.${p}`)||p,b={collectionId:f,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:uS(b),label:`${h} > ${m}`,dataVariable:b}}}).filter(Boolean)}).flat().filter(Boolean),i=n.get(s),l=i==null?void 0:i.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...a,...l]},dS="#",Vu="mailto:",Fg="subject=",Bg="tel:",pS="hrefType",fS="showIdList",gS=(e,t)=>{const n=t==null?void 0:t.get(pS);return n||(e.startsWith(Bg)?"phone":e.startsWith(Vu)?"email":e.startsWith(Mi)?"pages":e.startsWith(dS)?"elements":"url")},hS=e=>`${e.getName()} - #${e.getId()}`,gV="gs-trait-href",hV=ce(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=Ce(),{isSelectingTarget:u,editor:d}=l,[,p]=g.useState(0),[f,h]=g.useState(""),[m,b]=g.useState(""),[v,w]=g.useState(""),[y,S]=g.useState([]),C=$e(),E=d==null?void 0:d.Pages.getAll(),x=C.tScoped("traitManager.traits.labels"),P=()=>p(ee=>++ee),_=i.get(fS)??!1,T=gS(r,i),O=T==="pages"?r==null?void 0:r.replace(Mi,""):"",M=!!O&&(d==null?void 0:d.Pages.get(O)),A=M?Lc(M):!1,$=g.useMemo(()=>!A||!M||!d?[]:fV({page:M,component:i}),[d,M,A,i]),j=ee=>{n.setValue(ee)},L=ee=>{i.set({[fS]:ee}),P()},H=ee=>{h(""),b(""),w(""),j(""),i.set({[pS]:ee}),P()},W=ee=>{j(ee),P()},B=(ee,J)=>{_4(i,"id",(J==null?void 0:J.dataVariable)||ee),P()},G=ee=>{ee&&(j(ee.id),P())},D=ee=>{j(`${Bg}${ee}`),w(ee)},V=ee=>{j(`${Vu}${ee}${m?`?${Fg}${m}`:""}`),h(ee)},k=ee=>{j(`${Vu}${f}${ee?`?${Fg}${ee}`:""}`),b(ee)},z=()=>{l.setSelectingTarget(!u)},Y=ee=>{const J=ee.replace(dS,""),q=d==null?void 0:d.Components.componentsById[J];return{id:ee,label:q?hS(q):ee}};g.useEffect(()=>{var J;const ee=[];if(_){const q=["path","br","b","u","i","strike"],R=(J=d==null?void 0:d.Pages.getSelected())==null?void 0:J.getMainComponent();R==null||R.forEachChild(ae=>{!ae.is("comment")&&!ae.is("textnode")&&!q.includes(ae.get("tagName"))&&ee.push({id:`#${ae.getId()}`,label:hS(ae)})})}S(ee)},[d,_]),g.useEffect(()=>{let ee=()=>{};const J=()=>{ee(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(qu))};return u&&(ee=bC(J),d==null||d.runCommand(qu,{onSelect:q=>j(`#${q.getId()}`)})),J},[d,u]),g.useEffect(()=>{if(!r)return;switch(gS(r,i)){case"phone":w(r.replace(Bg,""));break;case"email":{const[J,q=""]=r.replace(Vu,"").split("?");h(J),b(q.replace(Fg,""));break}}},[r]);const X=Xo({className:N(gV,a)});return c.jsxs("div",{...X,children:[c.jsx(Er,{...t,as:s}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Ro,{onChange:H,classNamePanel:"gs-utl-p-1",value:T,tabs:[{id:"url",label:c.jsx(ne,{icon:K.link,size:se.s}),content:c.jsx(at,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:j,size:"s",type:"url"})},{id:"pages",label:c.jsx(ne,{icon:K.textBoxMultiple,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(_e,{size:"s",options:(E||[]).map(ee=>({id:`${Mi}${ee.getId()}`,icon:_b(ee),label:ee.getName()})),value:r,onChange:W,label:"Page"}),A&&c.jsx(_e,{size:"s",options:$,value:pV(i,"id"),onChange:B,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(ne,{icon:K.viewDayOutline,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Yo,{size:"s",children:"Element ID"}),c.jsxs(I,{gap:"xs",nowrap:!0,children:[_?c.jsx(cS,{options:y,onChange:G,value:Y(r),placeholder:C.t("selectList")}):c.jsx(at,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:j,className:"gs-utl-flex-1"}),c.jsx(wt,{title:C.t("selectTarget"),size:"m2",active:u,onClick:z,className:"gs-utl-h-[30px]",children:c.jsx(ne,{icon:K.target,size:se.sx})})]}),c.jsx(sl,{value:_,onChange:L,label:x("showList")})]})},{id:"email",label:c.jsx(ne,{icon:K.email,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(at,{placeholder:"eg. mail@gmail.com",value:f,onChange:V,size:"s",label:"Email",type:"email"}),c.jsx(at,{placeholder:"eg. My subject",value:m,onChange:k,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(ne,{icon:K.phone,size:se.s}),content:c.jsx(at,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:v,onChange:D})}]})})]})});function mV({trait:e,value:t,disabled:n,label:r,labelAs:o}){const[s,a]=g.useState(),i=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(f=>f.id===(s==null?void 0:s.id));return c.jsx(Rr,{items:d,selected:p>-1?s:null,select:a,disabled:n,label:r,labelAs:o,add:()=>{const f=d.length+1,h=l?l(f):{id:`opt${f}`,label:`New option ${f}`};e.setValue([...d,h])},move:(f,h)=>{const m=e.getValue().filter(b=>b.id!==f.id);m.splice(h,0,f),e.setValue(m)},remove:f=>{const h=e.getValue().filter(m=>m.id!==f.id);e.setValue(h,{removed:f})},renderItem:f=>u?u(f):f.label,children:c.jsx(I,{space:"m",col:!0,children:!!s&&i.map(f=>{const{name:h,getValue:m}=f,b=f.setValue,v=f.label||h,w=d[p];if(!w)return null;const y=w[h],S=m?m(y):y,C=x=>{const P={...w};w[h]=b?b(x,S):x,e.setValue([...d],{item:w,previous:P}),h==="id"&&a(w)};let E=c.jsx(at,{label:v,value:S,onChange:C});switch(f.type){case"select":E=c.jsx(_e,{label:v,options:f.options,value:S,onChange:C})}return c.jsx(g.Fragment,{children:E},h)})})})}const bV="gs-trait-custom-type",vV=ce(function({trait:t,editor:n}){const r=g.useRef(null),o=t.getType(),s=t.target,{Traits:a}=n,i=a.getType(o),l=!!(s&&i);return g.useEffect(()=>{const u=r.current;if(i&&u&&s){const d=new i({model:t,config:a.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:bV,ref:r})}),yV=e=>{const{value:t={},onConfirm:n,additionalSources:r,editor:o}=e;if(!o)return;const s="DataValuePicker",a={id:s,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:i})=>{n==null||n(i),o.runCommand(te.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(te.layoutToggle,{...a})};function mS(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:r,editor:o,additionalSources:s,enableDataValue:a,hasDataResolverValue:i}=e;if(!o||!a)return[];const l={type:"button",className:i?U.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:o.I18n.t("dataSources.connectDataValue"),icon:{icon:K.databaseOutline,size:se.s2x},onClick:()=>yV({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:K.close,size:se.s2x},onClick:r}),u}function wV(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:oo(t)&&ot(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=ss(s);return{hasDataResolverValue:i,dataResolverValue:i?e.getValue():void 0,enableDataValue:o,initialDataValue:s,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:a}}const SV=({label:e,buttons:t})=>c.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[c.jsx(F,{grow:!0,children:e}),c.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(wt,{...n},r))})]}),bS=e=>$r((e||"").replace(/-/g," ")),CV=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&bS(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,r)=>e.setValue(n,{partial:r})}),Mr=(e,t,n)=>{const r=wV(e,n.traitManagerDataConfig),o=mS(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=CV(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(SV,{label:i.label,buttons:o})}},vS=(e,t,n)=>Mr(e,t,n),xV=(e,t,n)=>Mr(e,t,n),EV=(e,t,n)=>{const r=ss(e.getValue({skipResolve:!0})),o=Mr(e,t,n),s={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!r,units:r?[]:e.get("units"),onChange:(a,i)=>{const l=i||isNaN(parseFloat(a))?a:parseFloat(a);e.setValue(l,{partial:i})}};return{...o,...s}},yS=(e,t,n)=>{const r=e.get("labelToTitle"),o=ss(e.getValue({skipResolve:!0})),s=Mr(e,t,n),a={options:e.getOptions().map(i=>{const l=i.labelReact||i.name||i.label||i.value;return dt(i)?{id:i,label:i}:{id:i.id||i.value,title:r?l:i.title,icon:i.icon,label:r?"":l}}),onChange:i=>e.setValue(i),emptyState:o&&e.getValue()||void 0,hideCaret:o};return{...s,...a}},PV=(e,t,n)=>{const{options:r,onChange:o}=yS(e,t,n),s={options:r,onChange:o};return{...Mr(e,t,n),...s}},TV=(e,t,n)=>{const r=e.get("typeProps")||{},o=ss(e.getValue({skipResolve:!0}));return{...Mr(e,t,n),isContain:!0,hideButton:o,btnLabel:e.get("text"),onOpen(){if(o)return;const a=t==null?void 0:t.Assets;a==null||a.open({select(i){e.setValue(i.getSrc()),a.close()}})},...r}},OV=e=>({children:bS(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");dt(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),_V=(e,t,n)=>{const r=Mr(e,t,n),s={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...s}},AV=(e,t,n)=>{const r=Mr(e,t,n),o=e.get("typeProps")||{},s=ss(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},MV=(e,t,n)=>({...Mr(e,t,n),trait:e}),LV=(e,t,n)=>({...Mr(e,t,n),trait:e}),NV=(e,t,n)=>({...Mr(e,t,n),trait:e,editor:t});function $V(e,t,n={}){var a;const r=e.get("visible"),o=e.getType(),s={traitManagerDataConfig:n.traitManagerDataConfig};if(ot(r)&&r({component:e.target,trait:e})===!1)return null;switch(o){case"text":return c.jsx(at,{...vS(e,t,s)});case"select":return c.jsx(_e,{...yS(e,t,s)});case"number":return c.jsx(ke,{...EV(e,t,s)});case"color":return c.jsx(Xr,{...xV(e,t,s)});case"checkbox":return c.jsx(sl,{..._V(e,t,s)});case"button":return c.jsx(Je,{...OV(e)});case"radio":return c.jsx(Rt,{...PV(e,t,s)});case"code":return c.jsx(Pr,{...AV(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(fl,{...TV(e,t,s)});case"stack":return c.jsx(mV,{...MV(e,t,s)});case"href":return c.jsx(hV,{...LV(e,t,s)});case"custom":return c.jsx(dV,{...NV(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(vV,{editor:t,trait:e}):c.jsx(at,{...vS(e,t,s)})}}const Hu="gs-trait-manager",wS=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(F,{className:`${Hu}-field gs-utl-mb-2 gs-utl-w-full`,children:$V(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function kV({traits:e,className:t}){var p,f;const n=zi(),{isDarkTheme:r}=xr(),s=(p=Ce().sdkOptions.dataSources)==null?void 0:p.traitManager,a=n.Traits.getTraitsByCategory(e),i=(f=a.find(h=>!h.category))==null?void 0:f.items,l=a.filter(h=>h.category),u=`${Hu}__empty-state gs-utl-text-center`,d=h=>n.t(`traitManager.${h}`);return c.jsx(I,{className:Q(Hu,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(h=>c.jsx(wS,{trait:h,isDarkTheme:r,traitManagerDataConfig:s},h.id)),l.map(({category:h,items:m},b)=>c.jsx(wo,{open:!!(h!=null&&h.get("open")),onChange:({open:v})=>h==null?void 0:h.set({open:v}),handler:h==null?void 0:h.getLabel(),handlerIcon:h==null?void 0:h.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Hu}-category -gs-utl-mx-2`,className:v=>Q(Vd.itemList({index:b+(i?1:0),open:v,length:l.length})),children:m.map(v=>c.jsx(wS,{trait:v,isDarkTheme:r,traitManagerDataConfig:s},v.id))},h==null?void 0:h.id))]}):c.jsx(F,{className:u,children:d("notFound")}):c.jsx(F,{className:u,children:d("empty")})})}const zg=ce(kV),IV="gs-panel-properties",VV=g.memo(ce(function({className:t,...n}){return c.jsx(Ar,{className:N(IV,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Sf,{children:r=>c.jsx(zg,{...r})})})})),HV=async({html:e="",css:t="",el:n})=>{const r=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,o={};if(document.body.attachShadow){const s=n.shadowRoot||n.attachShadow({mode:"open"});s.innerHTML=r}return o},jV=ce(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=g.useRef(null),i=Ce().editor,l=$e(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=xr(),[f,h]=g.useState(t.toCSS({allowEmpty:!0})),[m,b]=g.useState(f),v=t.selectorsToString(),w=()=>{i.select(),setTimeout(()=>i.Selectors.select(t)),n==null||n()},y=()=>{i.Css.remove(t),r==null||r()},S=()=>{if(m){const C=i.Parser.parseCss(m)[0];C&&(t.setStyle(C.style),h(m))}};return g.useEffect(()=>{if(s.current){const C=s.current;HV({el:C,html:'<div class="prv-rule">Preview</div>',css:`
327
327
  .prv-rule {
328
328
  background-color: #fff;
329
329
  padding: 5px;
330
330
  }
331
331
  .prv-rule, ${f}
332
- `})}},[s,f]),c.jsx(Qn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(k,{className:ae("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:s,className:ae("relative flex items-center justify-center")})}),c.jsxs(k,{className:ae("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(k,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(F,{grow:!0,children:c.jsx("pre",{className:ae("text-xs bg-white/10",U.txt,te.rnd,Te.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(F,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(re,{icon:K.cellphoneLink,size:se.sx})})}),!!d&&c.jsx(F,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(re,{icon:K.flare,size:se.sx})})})]}),c.jsxs(k,{nowrap:!0,className:ae(Oe.txtEllips),space:"s",children:[c.jsx(F,{className:ae("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Ke,{onClick:w,className:ae("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(Er,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(Ct,{title:l.t("selectorManager.showCSS"),children:c.jsx(re,{icon:K.codeBraces,size:se.sx})}),children:({close:C})=>c.jsxs(k,{className:ae("relative w-80 h-48"),col:!0,children:[c.jsx(F,{grow:!0,children:c.jsx(vo,{defaultValue:vf(f),onChange:v,language:"css",padding:5,isDarkTheme:p,clean:!0})}),c.jsx(Ke,{className:ae("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{S(),C()},children:l.t("update")})]})}),c.jsx(su,{onConfirm:y,className:ae("w-48"),children:c.jsx(Ct,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(re,{icon:K.delete,size:se.sx})})})]})]})]},t.cid)})}),gV=ce(function(){const[t]=Gp(),n=xa(),r=Ie(),[o,s]=h.useState(""),[a,i]=h.useState(""),u=ye().editor,[d,p]=h.useState(u.Css.getRules("")),f=u.Devices.getDevices().map(v=>({id:v.id,label:v.getName()})),g=d.filter(v=>{var b;return!(o&&!Ys(v.selectorsToString(),o)||a&&((b=v.getDevice())==null?void 0:b.id)!==a)}),m=()=>p(u.Css.getRules(""));return c.jsxs(k,{col:!0,space:"m",children:[c.jsxs(k,{items:"center",space:"m",children:[c.jsx(F,{children:c.jsx(rt,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(F,{children:c.jsx(Le,{includeEmpty:!0,size:"s",value:a,options:f,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs(k,{space:"s",items:"center",children:[c.jsx(re,{icon:K.cellphoneLink,size:se.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(F,{className:ae("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(ou,{data:g,listClassName:ae("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(hV,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx(k,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),mV=ce(function({selector:t,className:n,removable:r,toggleable:o}){const s=Ie(),a=ye(),[i,l]=h.useState(),[u,d]=h.useState(t.getActive()),p=a.editor,{Selectors:f}=p,g=t.getLabel(),m=c.jsx(re,{icon:K.dotsVertical,size:se.sx}),v=()=>{f.removeSelected(t)},b=E=>{i&&f.rename(i,E),l(void 0)},w=()=>{f.duplicateSelected(t)},y=()=>{const E=!t.getActive();d(E),t.setActive(E)},C=[{id:"rename",label:s.t("rename"),action:()=>l(t)},{id:"duplicate",label:s.t("duplicate"),action:w},r&&{id:"delete",label:s.t("delete"),action:v},o&&{id:"active",label:s.t(u?"disable":"enable"),action:y}].filter(Boolean),x=(E,P)=>_=>{E(),et(P)&&P(_)};return c.jsx(Yo,{className:ae(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",U.sel,n]),s:"s",children:c.jsxs(k,{items:"center",children:[c.jsx(F,{className:ae("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(qy,{value:g,onChange:b,active:!!i,unstyled:!0})}),c.jsx(k,{className:ae("absolute h-full right-0 transition-opacity",U.sel,U.selBr,te.bl),children:c.jsx(Er,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>C.map(P=>c.jsx(Oa,{className:ae(U.txt),label:P.label,action:x(E,P.action)},P.id))})})]})})}),vV=e=>(e==null?void 0:e.get("groups"))||[],bV=/^\.[a-zA-Z_][\w-]*$/;function yV(e,t={}){const n=e.Css.getAll().filter(r=>vV(r).some(o=>o.startsWith(js.globalStyles)));return t.withSingleClass?n.filter(r=>bV.test(r.getSelectorsString())):n}const wV=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((s,a)=>{const i=s.indexOf(a);return i>=0&&s.splice(i,1),s},n).filter(s=>s.isClass())},SV=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?yV(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...wV(e).map(i=>({id:i,label:i.getLabel()})),...s]},CV=e=>{var r,o;let t=(r=e==null?void 0:e.selectorsToString)==null?void 0:r.call(e);const n=(o=e==null?void 0:e.getAtRule)==null?void 0:o.call(e);return t&&n&&(t=`${n} {
332
+ `})}},[s,f]),c.jsx(Rn,{padding:!1,className:ie("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(I,{className:ie("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:s,className:ie("relative flex items-center justify-center")})}),c.jsxs(I,{className:ie("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(I,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(F,{grow:!0,children:c.jsx("pre",{className:ie("text-xs bg-white/10",U.txt,re.rnd,Te.xyS),children:v})}),!!u&&u.getWidthMedia()&&c.jsx(F,{children:c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(ne,{icon:K.cellphoneLink,size:se.sx})})}),!!d&&c.jsx(F,{children:c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(ne,{icon:K.flare,size:se.sx})})})]}),c.jsxs(I,{nowrap:!0,className:ie(Oe.txtEllips),space:"s",children:[c.jsx(F,{className:ie("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Je,{onClick:w,className:ie("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(Or,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(wt,{title:l.t("selectorManager.showCSS"),children:c.jsx(ne,{icon:K.codeBraces,size:se.sx})}),children:({close:C})=>c.jsxs(I,{className:ie("relative w-80 h-48"),col:!0,children:[c.jsx(F,{grow:!0,children:c.jsx(Pr,{defaultValue:Cf(f),onChange:b,language:"css",padding:5,isDarkTheme:p,clean:!0})}),c.jsx(Je,{className:ie("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{S(),C()},children:l.t("update")})]})}),c.jsx(uu,{onConfirm:y,className:ie("w-48"),children:c.jsx(wt,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(ne,{icon:K.delete,size:se.sx})})})]})]})]},t.cid)})}),DV=ce(function(){const[t]=Xp(),n=Ea(),r=$e(),[o,s]=g.useState(""),[a,i]=g.useState(""),u=Ce().editor,[d,p]=g.useState(u.Css.getRules("")),f=u.Devices.getDevices().map(b=>({id:b.id,label:b.getName()})),h=d.filter(b=>{var v;return!(o&&!Xs(b.selectorsToString(),o)||a&&((v=b.getDevice())==null?void 0:v.id)!==a)}),m=()=>p(u.Css.getRules(""));return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{items:"center",space:"m",children:[c.jsx(F,{children:c.jsx(at,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(F,{children:c.jsx(_e,{includeEmpty:!0,size:"s",value:a,options:f,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:b=>c.jsxs(I,{space:"s",items:"center",children:[c.jsx(ne,{icon:K.cellphoneLink,size:se.sx}),c.jsx("span",{children:b.label})]})})})]}),c.jsx(F,{className:ie("gs-utl-h-[75vh] w-full overflow-auto"),children:h.length?c.jsx(cu,{data:h,listClassName:ie("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(b,v)=>c.jsx(jV,{rule:v,onRemove:m,onSelect:n.close},v.cid)},t):c.jsx(I,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),FV=ce(function({selector:t,className:n,removable:r,toggleable:o}){const s=$e(),a=Ce(),[i,l]=g.useState(),[u,d]=g.useState(t.getActive()),p=a.editor,{Selectors:f}=p,h=t.getLabel(),m=c.jsx(ne,{icon:K.dotsVertical,size:se.sx}),b=()=>{f.removeSelected(t)},v=x=>{i&&f.rename(i,x),l(void 0)},w=()=>{f.duplicateSelected(t)},y=()=>{const x=!t.getActive();d(x),t.setActive(x)},C=[{id:"rename",label:s.t("rename"),action:()=>l(t)},{id:"duplicate",label:s.t("duplicate"),action:w},r&&{id:"delete",label:s.t("delete"),action:b},o&&{id:"active",label:s.t(u?"disable":"enable"),action:y}].filter(Boolean),E=(x,P)=>_=>{x(),ot(P)&&P(_)};return c.jsx(Qo,{className:ie(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",U.sel,n]),s:"s",children:c.jsxs(I,{items:"center",children:[c.jsx(F,{className:ie("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(ow,{value:h,onChange:v,active:!!i,unstyled:!0})}),c.jsx(I,{className:ie("absolute h-full right-0 transition-opacity",U.sel,U.selBr,re.bl),children:c.jsx(Or,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:x})=>C.map(P=>c.jsx(_a,{className:ie(U.txt),label:P.label,action:E(x,P.action)},P.id))})})]})})}),BV=e=>(e==null?void 0:e.get("groups"))||[],zV=/^\.[a-zA-Z_][\w-]*$/;function UV(e,t={}){const n=e.Css.getAll().filter(r=>BV(r).some(o=>o.startsWith(Ds.globalStyles)));return t.withSingleClass?n.filter(r=>zV.test(r.getSelectorsString())):n}const WV=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((s,a)=>{const i=s.indexOf(a);return i>=0&&s.splice(i,1),s},n).filter(s=>s.isClass())},GV=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?UV(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...WV(e).map(i=>({id:i,label:i.getLabel()})),...s]},qV=e=>{var r,o;let t=(r=e==null?void 0:e.selectorsToString)==null?void 0:r.call(e);const n=(o=e==null?void 0:e.getAtRule)==null?void 0:o.call(e);return t&&n&&(t=`${n} {
333
333
  ${t}
334
- }`),t},ar="gs-cmp-selector-manager",jh={},lS=ce(function(t){var le,ge,Pe;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=ye(),[l,u]=h.useState(!1),[d,p]=h.useState([]),[f,g]=h.useState(jh),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:w}=ye(),{i18nStore:y,modalStore:S}=w,C=b==null?void 0:b.getSelected(),x=b==null?void 0:b.Styles.getSelected();if(h.useEffect(()=>{if(b&&x&&i){const Ce=setTimeout(()=>{let tt=jh;const Qe=C==null?void 0:C.get("selectorManager");C&&et(Qe)&&(tt=Qe({editor:b,component:C})),g(tt||jh),p(SV(b,i))});return()=>clearTimeout(Ce)}},[C,b,x,i]),!b)return null;const{Selectors:E}=b,P=f.disableClasses,_=f.disableComponent,T=P&&_,O=E.getComponentFirst()&&!_,L=E.getSelectedAll(),A=b.getSelectedAll(),$=r.map(Ce=>({id:Ce.getName(),label:Ce.getLabel()})),B=b.getModel(),M=(le=x==null?void 0:x.getDevice)==null?void 0:le.call(x),j=(ge=x==null?void 0:x.getState)==null?void 0:ge.call(x),W=N("gs-utl-overflow-hidden",te.b,te.rnd,U.br),D=N(U.bA),z=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,U.br),I=`${U.bgA}`,H=CV(x),V=L.length>0,G=A.length>0,Y=V||G,J=O&&G||!O&&!V,Q=J?"Components":"Selectors",R=Ce=>y.t(`selectorManager.${Ce}`),q=y.t("modals.styleCatalog.title"),ee=()=>S.open({title:q,content:c.jsx(gV,{})});return c.jsxs(k,{className:ar,gap:"s",col:!0,full:!0,children:[c.jsxs(k,{className:N(`${ar}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(k,{className:N(`${ar}__head-start`),items:"center",gap:"s",children:[c.jsx(F,{className:N(`${ar}__head-title`),children:R("selection")}),s!==!1&&c.jsx(F,{className:N(`${ar}__style-catalog`),children:c.jsx(Wt,{className:"gs-utl-cursor-pointer",onClick:ee,title:q,children:c.jsx(re,{icon:K.paletteSwatch,size:se.s})})})]}),!!x&&a!==!1&&!T&&c.jsx(F,{className:`${ar}__head-end`,children:c.jsx(Le,{size:"s",value:n,options:$,includeEmpty:!0,onChange:o,emptyState:`- ${R("state")} -`,className:N(n&&U.bA)})})]}),Y&&!T?c.jsxs(c.Fragment,{children:[!P&&c.jsxs(k,{className:N(`${ar}__field-selectors`,W,!J&&D),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:R(V?"applyOnSelector":"noSelectors"),className:N(z,!J&&I),onClick:()=>V&&E.setComponentFirst(!1),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(re,{icon:K.tag,size:se.sx})})}),c.jsx(F,{grow:!0,children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Xw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:R("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Ce=>{Ce&&(E.addSelected(Ce.id||Ce.label),u(!1))}}):c.jsxs(c.Fragment,{children:[G&&c.jsx(Ct,{title:R("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(re,{icon:K.plus,size:se.sx})}),L.map(Ce=>c.jsx(mV,{selector:Ce,removable:G,toggleable:G&&L.filter(tt=>tt.getActive()||tt===Ce).length>1},Ce.toString()))]})})})]}),!_&&c.jsxs(k,{className:N(`${ar}__field-components`,W,J&&D),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:R(G?"applyOnComponents":"noComponents"),onClick:()=>G&&E.setComponentFirst(!0),className:N(z,J&&I),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(re,{icon:K.targetVariant,size:se.sx})})}),c.jsx(F,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:A.map(Ce=>c.jsx(Yo,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",U.cmp),onPointerEnter:()=>B.setHovered(Ce),onPointerOut:()=>B.setHovered(),label:Ce.getName()},Ce.getId()))})})]}),c.jsxs(k,{className:`${ar}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:R("selected")}),c.jsx("pre",{className:N("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",te.rnd,Te.xyS),children:H}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:R("currentSelection")})]}),children:c.jsx(Yo,{className:N(te.b,te.rnd,U.br),s:"xs",nopad:!0,block:!0,children:c.jsx(re,{icon:K.target,size:se.sx})})}),c.jsx(F,{className:"gs-utl-text-sm",children:c.jsx(Yo,{className:N(te.b,te.rnd,U.br),s:"xs",nopad:!0,children:c.jsxs(k,{space:"xs",items:"center",nowrap:!0,children:[!!M&&M.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[R("device"),": ",c.jsx("b",{children:M.getName()})]}),children:c.jsx(re,{icon:K.cellphoneLink,size:se.sx})}),c.jsx(F,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[R("target"),": ",c.jsx("b",{children:Q}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Pe=x==null?void 0:x.selectorsToString)==null?void 0:Pe.call(x,{skipState:1})]})]}),children:c.jsx(re,{icon:J?K.targetVariant:K.tag,size:se.sx})}),!!j&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[R("state"),": ",c.jsx("b",{children:j.getLabel()})]}),children:c.jsx(re,{icon:K.flare,size:se.sx})})]})]})})}),c.jsx(Ct,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(re,{icon:K.codeBraces,size:se.sx})})]})]}):c.jsxs(k,{className:N(`${ar}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(F,{className:`${ar}__empty-state-title`,children:R("noSelecton")}),c.jsxs("ul",{className:N(`${ar}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:R("selectFromCanvas")}),c.jsx("li",{children:R("selectFromList")})]})]})]})}),xV="gs-panel-selectors",EV=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(Tr,{className:N(xV,t),...o,children:c.jsx(Fb,{children:s=>c.jsx(lS,{...s,styleCatalog:n,stateSelector:r})})})}));function ss({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,tooltip:l,skipClear:u,className:d,...p}){const f=e||(t==null?void 0:t.getLabel()),g=t==null?void 0:t.getParentTarget(),m=n||!r&&(t==null?void 0:t.hasValue({noParent:!0})),v=!m&&(t==null?void 0:t.hasValue())&&g,b=g==null?void 0:g.getDevice(),w=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),S=()=>o?o():t==null?void 0:t.clear(),C={className:N(d,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...p},x=N("gs-utl-flex-1",m&&!a&&U.tAo);return t&&!t.isVisible()?null:c.jsxs(k,{gap:"xs",...C,children:[c.jsxs(k,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(F,{children:c.jsx(Wt,{title:l,children:c.jsx(re,{icon:K.information,size:se.sx})})}),c.jsx(F,{children:r?c.jsx("span",{children:" "}):f}),!!v&&!a&&c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N("gs-utl-mb-1"),children:"Value inherited from"}),!!b&&c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(re,{icon:K.cellphoneLink,size:se.sx})}),c.jsx(F,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(re,{icon:y?K.targetVariant:K.tag,size:se.sx})}),c.jsxs(F,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:N("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!w&&c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(re,{icon:K.flare,size:se.sx})}),c.jsx(F,{children:c.jsx("b",{children:w.getLabel()})})]})]}),children:c.jsx("div",{className:N("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",U.bgW)})}),m&&!a&&!u&&c.jsx(Wt,{title:"Clear value",onClick:S,children:c.jsx(re,{className:Oe.click,icon:K.close,size:se.s2x})})]}),!!s&&c.jsx(F,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function $u(e){const t=e.indexOf("(")+1,n=e.lastIndexOf(")");return{name:e.substring(0,t-1).trim(),value:String.prototype.substring.apply(e,[t,n>=0?n:void 0]).trim()}}const PV=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,TV=/,(?![^(]*\))/,Dh=/\s(?![^(]*\))/,OV=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Fh=/^circle|ellipse/i,Bh=e=>{var d;const t=[],{name:n,value:r}=$u(e),[o,...s]=r.split(TV).map(p=>p.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(PV.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if(OV.test(i))l.type="size",l.value=i;else if(Fh.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const p=((d=i.match(Fh))==null?void 0:d[0])||"circle";l.shape=p;const f={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=i.replace(Fh,"").trim().split("at").map(b=>b.trim());if(m){const[b,w]=m.split(Dh);f.x=b,f.y=w||b}if(v){const[b,w]=v.split(Dh);g.x=b,g.y=w||b}l.size=f,l.position=g}return u.forEach(p=>{const[f,g]=p.split(Dh);t.push({color:f,hint:g?parseFloat(g):null})}),t.forEach((p,f)=>{p.hint===null&&(p.hint=f/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},as=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const o=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(s=>`${s.color} ${s.hint?`${s.hint}%`:""}`.trim()).join(", ");return o?`${n}(${t}, ${o})`:"none"},_V=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),AV="gs-cmp-grad-picker";function LV({className:e,value:t,onChange:n}){var j,W,D;const r=Bh(t),[o,s]=h.useState(r.colorStops),[a,i]=h.useState(null),l=h.useRef(null),u=X(AV,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=r.name||"linear-gradient",p=d.indexOf("radial")>=0,f=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(j=r.orientation.size)==null?void 0:j.x}`)||0}`,b=`${parseFloat(`${(W=r.orientation.position)==null?void 0:W.x}`)||0}`,w=`${parseFloat(`${(D=r.orientation.position)==null?void 0:D.y}`)||0}`,y=0,S=100,C=(z,I=!1)=>{const H=_V(z);s(H),n==null||n(as({name:d,orientation:g,stops:H}),I)},x=(z,I=!1)=>{n==null||n(as({stops:o,name:d,orientation:`${z}deg`}),I)},E=(z,I=!1)=>{n==null||n(as({stops:o,name:d,orientation:`${z}px at ${b}% ${w}%`}),I)},P=(z,I=!1)=>{n==null||n(as({stops:o,name:d,orientation:`${v}px at ${z}% ${w}%`}),I)},_=(z,I=!1)=>{n==null||n(as({stops:o,name:d,orientation:`${v}px at ${b}% ${z}%`}),I)},T=z=>{const I=`${z?"repeating-":""}${p?"radial":"linear"}-gradient`;n==null||n(as({stops:o,orientation:g,name:I}))},O=z=>{const I=`${f?"repeating-":""}${z?"radial":"linear"}-gradient`;n==null||n(as({stops:o,orientation:z?"100px at 50% 50%":"90deg",name:I}))};h.useEffect(()=>{if(!a)return;const z=parseFloat(`${a.stop.hint}`),I=V=>{let Y=(V.clientX-a.x)*100;Y=Y/a.w,Y=z+Y,Y=Y<y?y:Y,Y=Y>S?S:Y,a.stop.hint=parseInt(`${Y}`,10),C(o,!0)},H=()=>{i(null),C(o)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",H),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",H),H()}},[a]);const L=(z,I)=>{const H=l.current;i({stop:I,w:(H==null?void 0:H.clientWidth)||0,h:(H==null?void 0:H.clientHeight)||0,x:z.clientX,y:z.clientY})},A=z=>{const I=l.current,H=(I==null?void 0:I.clientWidth)||0,V=(I==null?void 0:I.clientHeight)||0,G=z.nativeEvent.offsetX-((I==null?void 0:I.clientLeft)||0),Y=z.nativeEvent.offsetY-((I==null?void 0:I.clientTop)||0),J=G/H*100,Q=document.createElement("canvas"),R=Q.getContext("2d");if(!R)return;Q.width=H,Q.height=V;const q=R.createLinearGradient(0,0,H,V);o.forEach(Ce=>q.addColorStop(parseFloat(`${Ce.hint}`)/100,Ce.color)),R.fillStyle=q,R.fillRect(0,0,Q.width,Q.height),Q.style.background="black";const ee=R.getImageData(G,Y,1,1).data,le=ee[3]?(100/255*ee[3]/100).toFixed(2):0,ge=`rgba(${ee[0]}, ${ee[1]}, ${ee[2]}, ${le})`,Pe=ge==="rgba(0, 0, 0, 0)"?"#000":ge;C([...o,{color:Pe,hint:J}])},$=z=>{C(o.filter(I=>I!==z))},B=(z,I,H)=>{I&&(z.color=I),C(o,H)},M=z=>(a==null?void 0:a.stop)===z;return c.jsxs(k,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx("div",{className:X("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:X("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:X("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:X("w-full h-full cursor-cross",te.b,te.rnd,U.br),style:{backgroundImage:as({stops:o})},onClick:A})}),o.map((z,I)=>c.jsxs("div",{className:X("absolute top-0 h-full"),style:{left:`${z.hint}%`},children:[c.jsx("div",{className:X("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>$(z),children:c.jsx(re,{icon:K.close,size:se.s3x})}),c.jsx("div",{onPointerDown:H=>L(H,z),className:X("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,M(z)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:X("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(Ty,{value:z.color,onChange:(H,V)=>B(z,H,V),className:X("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},I))]}),c.jsxs(k,{space:"s",items:"center",children:[c.jsx(F,{grow:!0,children:c.jsx(rl,{label:"Repeat",value:f,onChange:T})}),c.jsx(F,{grow:!0,children:c.jsx(rl,{label:"Radial",value:p,onChange:O})})]}),p?c.jsxs(k,{space:"s",col:!0,children:[c.jsx(F,{children:c.jsx(k,{space:"s",items:"center",children:c.jsx(F,{grow:!0,children:c.jsx($e,{pan:"S",size:"s",value:v,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(F,{children:c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:c.jsx($e,{pan:"X",size:"s",value:b,onChange:P,valueUnit:"%",units:["%"]})}),c.jsx(F,{grow:!0,children:c.jsx($e,{pan:"Y",size:"s",value:w,onChange:_,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(k,{space:"s",items:"center",nowrap:!0,children:c.jsx(F,{grow:!0,children:c.jsx($e,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const MV="gs-sm-custom-type",NV=ce(function({property:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=n.StyleManager,a=s.getType(o),i=a==null?void 0:a.view;return h.useEffect(()=>{const l=r.current;if(i&&l){const u=new i({model:t,config:s.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[i,t,n]),i&&c.jsx("div",{className:MV,ref:r})});function cS(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const uS="gs-cmp-style-field";function dS({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=N(uS,`${uS}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(Su,{className:o,...yS(e,s),...r});case"number":case"slider":case"integer":return c.jsx($e,{className:o,...lt(e,s),...r});case"color":return c.jsx(Zr,{className:o,...qs(e,s),...r});case"select":return c.jsx(Le,{className:o,...Lt(e,s),...r});case"radio":return c.jsx(Rt,{className:o,...eo(e,s),...r});case"file":return c.jsx(dl,{className:o,...tH(e,s),...r});case"composite":return c.jsx(En,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Jr,{className:o,...ls(e,s),children:c.jsx(Qr,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(NV,{editor:a,property:e}):c.jsx(rt,{className:o,...Kh(e,s)})}}}const pS="gs-cmp-style-prop-row";function Qr({properties:e,sector:t,styleManagerDataConfig:n}){const r={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(o=>{const s=o.getId(),a=N(pS,`${pS}__${s}`,cS(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(dS,{property:o,...r})},s):null})})}function $V({sector:e,styleManagerDataConfig:t}){const n=Li(),r=e.getProperties().filter(o=>o.isVisible()).map(o=>(n.sdkAddFonts&&o.getId()==="font-family"&&o.set("type","selectFont"),o));return c.jsx("div",{className:N("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Qr,{properties:r,sector:e,styleManagerDataConfig:t})})}const kV="gs-cmp-sector-row";function be({className:e,children:t,bottom:n,separator:r,separatorTop:o,property:s,...a}){const i=c.jsx("div",{className:X("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,U.br)}),l=X(kV,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(k,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function wl(e,t,n={}){const r=e.getType(),{compact:o=!1,sector:s,styleManagerDataConfig:a}=n,i=e.getParent(),l={sector:s,styleManagerDataConfig:a},u=e.getDefaultValue();if(r==="select"){const p={property:i.getName()};return c.jsx(Le,{...Lt(e,l,p),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,p)||u:"Custom",onChange:f=>t.all.map(g=>g.upValue(f))}:{},label:void 0})}else return r==="color"?c.jsx(Zr,{...qs(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p}))}:{},label:void 0}):c.jsx($e,{...lt(e,l),...o?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p})),onChangeUnit:d=>t.all.map(p=>p.upUnit(d))}:{},label:void 0})}const ku="gs-cmp-style-prop-composite";function En({className:e,property:t,sector:n,styleManagerDataConfig:r,corners:o,compact:s,generic:a,children:i,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const p={id:"custom",label:c.jsx(re,{icon:K.borderStyle,size:se.s}),title:"Custom"},f=[{id:"all",label:c.jsx(re,{icon:K.borderAllVariant,size:se.s}),title:"All"},p],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,w,y,S]=m,C=b.getFullValue(),E=m.map(D=>D.getFullValue()).every(D=>D===C),P=u!==null?u:E||l?"all":p.id,_=l?[...l,p]:[],T=t.getFullValue(),O=_.some(D=>D.id===T),L=P===p.id||(l?!O:!1)||!!a,A={compact:s,sector:n,styleManagerDataConfig:r},$=c.jsx(ss,{property:s?null:b,shallow:!g,children:wl(b,null,A)}),B=c.jsx(ss,{property:s?null:w,shallow:!g,children:wl(w,null,A)}),M=!!y&&c.jsx(ss,{property:s?null:y,shallow:!g,children:wl(y,null,A)}),j=!!S&&c.jsx(ss,{property:s?null:S,shallow:!g,children:wl(S,null,A)}),W=s?{label:t.getLabel()}:{property:t};return c.jsxs(k,{className:X(ku,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(be,{className:`${ku}__main`,children:c.jsx(ss,{...W,children:!a&&c.jsx(be,{bottom:"0",children:i!==void 0?i:l?c.jsx(c.Fragment,{children:c.jsx(F,{grow:!0,children:c.jsx(Rt,{size:"s",options:_,value:L?p.id:T,onChange:D=>{D===p.id?d(D):(t.upValue(D),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(F,{grow:!0,children:wl(b,{same:E,all:m},A)}),c.jsx(F,{grow:!0,children:c.jsx(Rt,{size:"s",options:f,value:P,onChange:d})})]})})})}),L&&c.jsx(be,{col:!0,className:X(`${ku}__details`,"gjs-px-2 gjs-py-1",U.bgH2,te.rnd,te.b,U.br),children:a?c.jsx("div",{className:X(`${ku}__props`,"grid grid-cols-2 gap-2"),children:m.map(D=>c.jsx(ss,{property:D,shallow:!g,className:X(cS(D)&&"col-span-full"),children:c.jsx(dS,{property:D,...A,fieldProps:{label:void 0}})},D.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:$}),c.jsx(F,{grow:!0,children:B})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:$}),c.jsx(F,{grow:!0,children:B})]}),c.jsx(k,{space:"s",children:c.jsx(F,{grow:!0,children:M})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:$}),c.jsx(F,{grow:!0,children:B})]}),c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:j}),c.jsx(F,{grow:!0,children:M})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(k,{className:X("gs-utl-w-1/2 gjs-m-auto"),children:$}),c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:j}),c.jsx(F,{grow:!0,children:B})]}),c.jsx(k,{className:X("gs-utl-w-1/2 gjs-m-auto"),children:M})]})})]})}var is=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(is||{});const Iu="background-image",Rr="__background-type",Sl=Iu,fS="https://placehold.co/150/777/white.png?text=IMAGE",zh="50px",IV={[Rr]:"image","background-image":`url("${fS}")`,"background-size":`${zh} ${zh}`,"background-repeat":"repeat","background-position":"0px 0px"},VV=e=>(e.includes("gradient(")?Bh(e).colorStops[0].color:e)||"";function HV({sector:e,styleManagerDataConfig:t}){var C;const n=Fi(),r=e.getProperty("background"),o=r.getProperty(Rr),s=r.getProperty("background-image"),a=r.getProperty("background-position"),i=r.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},p=[r,l,u].map(x=>x==null?void 0:x.id),f=e.getProperties().filter(x=>!p.includes(`${x.id}`)),g=((C=r.getSelectedLayer())==null?void 0:C.getIndex())||-1,m=o==null?void 0:o.getValue(),v=m==="image",b=s.getValue(),w=()=>{const x=n.Assets;x.open({select(E){const P=E.getSrc();s.upValue(`url("${P}")`),x.close()}})},y=x=>{let E="none",P="100%";x==="image"?(E=`url("${fS}")`,P=zh):x==="gradient"?E="linear-gradient(90deg, black 10%, white 90%)":x==="color"&&(E="rgba(0, 0, 0, 0.5)"),s.upValue(E),o.upValue(x),a.upValue("0 0"),i.upValue(`${P} ${P}`)},S=RV(o,[{id:"image",label:c.jsx(re,{icon:K.image,size:se.s})},{id:"gradient",label:c.jsx(re,{icon:K.gradientVertical,size:se.s})},{id:"color",label:c.jsx(re,{icon:K.checkboxBlank,size:se.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(be,{property:r,separator:!0,children:c.jsxs(Jr,{...ls(r,d,IV),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[c.jsx(be,{children:c.jsx(Rt,{...eo(o,d),options:S,onChange:y,label:void 0})}),c.jsx(be,{children:c.jsxs(ss,{children:[v&&c.jsx(dl,{value:$u(b).value,onOpen:w}),m==="color"&&c.jsx(Zr,{...qs(s,d),value:VV(b),label:void 0}),m==="gradient"&&c.jsx(LV,{value:b,onChange:(x,E)=>s.upValue(x,{partial:E})},g)]})}),v&&c.jsxs(c.Fragment,{children:[c.jsx(be,{col:!0,children:c.jsx(En,{property:a,...d})}),c.jsx(be,{col:!0,children:c.jsx(En,{property:i,...d})}),c.jsxs(be,{children:[c.jsx(Le,{...Lt(r.getProperty("background-repeat"),{sector:e})}),c.jsx(Le,{...Lt(r.getProperty("background-attachment"),{sector:e})})]}),c.jsx(be,{children:c.jsx(Le,{...Lt(r.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(be,{property:l,children:c.jsx(Zr,{...qs(l,d)})}),c.jsx(be,{property:u,children:c.jsx(Le,{...Lt(u,d)})}),f.length>0&&c.jsx(Qr,{properties:f,...d})]})}function jV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),r=e.getProperty("border-width"),o=e.getProperty("border-style"),s=e.getProperty("border-color"),a={sector:e,styleManagerDataConfig:t},i=[n,r,o,s].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!i.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,corners:!0,...a}),c.jsx(En,{property:r,...a}),c.jsx(En,{property:o,...a}),c.jsx(En,{property:s,...a}),l.length>0&&c.jsx(Qr,{properties:l,...a})]})}const Gs=e=>du({value:parseFloat(e),min:-3,max:3}),Uh=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=P8(a,s)?a:s[0];return{...lt(r,n),units:s,valueUnit:i,onChange:(l,u)=>{r.upValue(l,{partial:u,units:s,min:o.min,max:o.max})}}},hS=(e,t,n,r)=>{const o=e.getProperty(`${t}-name`),s=e.getProperty(`${t}-value`);return{...Lt(o,n,r),onChange:a=>{o.upValue(a),s.upValue("")}}},DV={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function FV({sector:e,styleManagerDataConfig:t}){const n=Ie(),r=_=>n.t(`styleManager.effects.${_}`),o=e.getProperty("box-shadow"),s=e.getProperty("text-shadow"),a=e.getProperty("filter"),i=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),p=e.getProperty("backface-visibility"),f=e.getProperty("perspective"),g=e.getProperty("transform-style"),m=e.getProperty("opacity"),v=e.getProperty("mix-blend-mode"),b=e.getProperty("cursor"),w=e.getProperty("transform-origin"),y=e.getProperty("overflow"),S={sector:e,styleManagerDataConfig:t},C=[o,s,a,i,l,u,d,p,f,g,m,v,b,w,y].map(_=>_==null?void 0:_.id),x=e.getProperties().filter(_=>!C.includes(`${_.id}`)),E=_=>{const{boxShadowH:T,boxShadowV:O,boxShadowBlur:L,boxShadowColor:A,boxShadowSpread:$,boxShadowType:B}=_.getValues({camelCase:!0}),M=Gs(T),j=Gs(O),W=Gs(L),D=Gs($),z=`${M}px ${j}px ${W}px ${D}px ${A} ${B}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[T," ",O," ",L," ",$]}),c.jsx(F,{children:c.jsx("div",{className:X("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:z}})})]})},P=_=>{const{textShadowH:T,textShadowV:O,textShadowBlur:L,textShadowColor:A}=_.getValues({camelCase:!0}),$=Gs(T),B=Gs(O),M=Gs(L),j=`${$}px ${B}px ${M}px ${A}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[T," ",O," ",L]}),c.jsx(F,{children:c.jsx("div",{className:X("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:j}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[m,v],children:[c.jsx($e,{...lt(m,S)}),c.jsx(Le,{...Lt(v,S)})]}),c.jsx(be,{property:b,separator:!0,children:c.jsx(Le,{...Lt(b,S)})}),c.jsx(be,{property:o,separator:!0,children:c.jsxs(Jr,{...ls(o,S),renderItem:E,children:[c.jsx(be,{children:c.jsx(Rt,{...eo(o.getProperty("box-shadow-type"),S),label:""})}),c.jsxs(be,{children:[c.jsx($e,{...lt(o.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),c.jsx($e,{...lt(o.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),c.jsxs(be,{children:[c.jsx($e,{...lt(o.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),c.jsx($e,{...lt(o.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),c.jsx(be,{children:c.jsx(Zr,{...qs(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(be,{property:s,separator:!0,children:c.jsxs(Jr,{...ls(s,S,DV),renderItem:P,children:[c.jsxs(be,{children:[c.jsx($e,{...lt(s.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),c.jsx($e,{...lt(s.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),c.jsx(be,{children:c.jsx($e,{...lt(s.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),c.jsx(be,{children:c.jsx(Zr,{...qs(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(be,{property:a,separator:!0,children:c.jsx(Jr,{...ls(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...hS(a,"filter",S),label:r("filter.type")}),c.jsx($e,{...Uh(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(be,{property:i,separator:!0,children:c.jsx(Jr,{...ls(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Lt(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),c.jsx($e,{...Uh(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(be,{property:l,separator:!0,children:c.jsxs(Jr,{...ls(l,S),children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-property"),S),label:r("transition.type")})}),c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),c.jsxs(be,{children:[c.jsx($e,{...lt(l.getProperty("transition-duration"),S),label:r("transition.duration")}),c.jsx($e,{...lt(l.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),c.jsx(be,{property:u,separator:!0,children:c.jsx(Jr,{...ls(u,S),children:c.jsxs(be,{children:[c.jsx(Le,{...hS(u,"transform",S),label:r("transform.type")}),c.jsx($e,{...Uh(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(En,{property:w,...S}),c.jsx(En,{property:y,...S}),c.jsx(be,{property:p,children:c.jsx(Rt,{...eo(p,S)})}),c.jsx(be,{property:[f,g,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(be,{property:[f,g],children:[c.jsx($e,{...lt(f,S)}),c.jsx(Rt,{...eo(g,S)})]}),c.jsx(En,{property:d,...S}),x.length>0&&c.jsx(Qr,{properties:x,...S})]})}function BV(e,t){return e.indexOf(t)>=0}const bt=se.s,Vu="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Hu="M6 6v12h13V6H6zm0-1h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm6-5h1v24h-1V0z",ju="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",gS="M2 6v12h6V6H2zm0 13v5H1V0h1v5h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H2zM16 6v12h6V6h-6zm6-1V0h1v24h-1v-5h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1h6z",mS="M11 0h1v24h-1V0zM1 6h6v12H1V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H1a1 1 0 01-1-1V6c0-.6.4-1 1-1zm15 1h6v12h-6V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1z",zV="M3 6v12h6V6H3zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H3a1 1 0 01-1-1V6c0-.6.4-1 1-1zM0 0h1v24H0V0zm14 6v12h6V6h-6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm8-5h1v24h-1V0zM11 0h1v24h-1V0z",Wh="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function UV({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=Ie(),[o,s]=h.useState({}),[a,i]=h.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),p=e.getProperty("align-items"),f=e.getProperty("flex-wrap"),g=e.getProperty("align-content"),m=e.getProperty("align-self"),v=e.getProperty("order"),b=e.getProperty("gap"),w=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},S=[l,u,d,p,f,g,m,v,b,w].map(D=>D.id),C=e.getProperties().filter(D=>!S.includes(`${D.id}`)),x=D=>r.t(`styleManager.layout.${D}`),E=l.getValue(),P=E==="flex",_=(a.display||"").indexOf("flex")>=0,T=u.getValue(),O=T.indexOf("reverse")>=0,L=!BV(["column","column-reverse"],T),A=[{id:"row",label:c.jsx(re,{icon:K.arrowRight,size:se.sx}),title:x("direction.title.row")},{id:"row-reverse",label:c.jsx(re,{icon:K.arrowRight,size:bt,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:c.jsx(re,{icon:K.arrowDown,size:se.sx}),title:x("direction.title.column")},{id:"column-reverse",label:c.jsx(re,{icon:K.arrowDown,size:bt,vertical:!0}),title:x("direction.title.column-reverse")}],$=[{id:"flex-start",title:x("justify.title.start"),label:c.jsx(re,{icon:Vu,size:bt,rotate:L?0:90,horizontal:L&&O,vertical:!L&&O})},{id:"center",title:x("justify.title.center"),label:c.jsx(re,{icon:Hu,size:bt,rotate:L?0:90})},{id:"flex-end",title:x("justify.title.end"),label:c.jsx(re,{icon:ju,size:bt,rotate:L?0:90,horizontal:L&&O,vertical:!L&&O})},{id:"space-between",title:x("justify.title.spaceBetween"),label:c.jsx(re,{icon:gS,size:bt,rotate:L?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:c.jsx(re,{icon:mS,size:bt,rotate:L?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:c.jsx(re,{icon:zV,size:bt,rotate:L?0:90})}],B=[{id:"stretch",title:x("align.title.stretch"),label:c.jsx(re,{icon:Wh,size:bt,rotate:L?0:90})},{id:"flex-start",title:x("align.title.start"),label:c.jsx(re,{icon:Vu,size:bt,rotate:L?90:0})},{id:"center",title:x("align.title.center"),label:c.jsx(re,{icon:Hu,size:bt,rotate:L?90:0})},{id:"flex-end",title:x("align.title.end"),label:c.jsx(re,{icon:ju,size:bt,rotate:L?90:0})}],M=[{id:"flex-start",title:x("alignContent.title.start"),label:c.jsx(re,{icon:Vu,size:bt,rotate:L?90:0,horizontal:L&&O,vertical:!L&&O})},{id:"center",title:x("alignContent.title.center"),label:c.jsx(re,{icon:Hu,size:bt,rotate:L?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:c.jsx(re,{icon:ju,size:bt,rotate:L?90:0,horizontal:L&&O,vertical:!L&&O})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:c.jsx(re,{icon:gS,size:bt,rotate:L?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:c.jsx(re,{icon:mS,size:bt,rotate:L?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:c.jsx(re,{icon:Wh,size:bt,rotate:L?0:90})}],j=[{id:"auto",title:x("alignSelf.title.auto"),label:c.jsx(re,{icon:K.close,size:bt})},{id:"flex-start",title:x("alignSelf.title.start"),label:c.jsx(re,{icon:Vu,size:bt,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:c.jsx(re,{icon:Hu,size:bt,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:c.jsx(re,{icon:ju,size:bt,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:c.jsx(re,{icon:Wh,size:bt,rotate:0})}],W=[{id:"0 0 auto",label:c.jsx(re,{icon:K.close,size:bt}),title:x("flex.title.auto")},{id:"1 1 0%",label:c.jsx(re,{icon:K.unfoldMoreHorizontal,size:bt,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(re,{icon:K.unfoldLessHorizontal,size:bt,rotate:90}),title:x("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:D}=n,z=()=>{const H=n.getSelected();let V={},G={};if(H){const Y=H.getEl();if(Y){V=window.getComputedStyle(Y);const J=Y.parentElement;J&&(G=window.getComputedStyle(J))}}s(V),i(G)},I=D.events.target;return n.on(I,z),z(),()=>n.off(I,z)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l,y),...Gh,tip:x(`display.tips.${E}`)})}),P&&c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Rt,{...eo(u,y),options:A})}),c.jsx(be,{children:c.jsx(Rt,{...eo(d,y),options:$})}),c.jsx(be,{children:c.jsx(Rt,{...eo(p,y),options:B})}),c.jsx(be,{children:c.jsx(En,{property:b,...y})}),c.jsx(be,{children:c.jsx(Le,{...Lt(f,y),...Gh})}),f.getValue()!=="nowrap"&&c.jsx(be,{children:c.jsx(Rt,{...eo(g,y),options:M})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(be,{separatorTop:!0,children:x("flexChild")}),c.jsx(be,{children:c.jsx(En,{property:w,options:W,...y})}),c.jsx(be,{children:c.jsx(Rt,{...eo(m,y),options:j})}),c.jsx(be,{children:c.jsx($e,{...lt(v,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(Qr,{properties:C,...y})]})}const WV=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function GV({sector:e,styleManagerDataConfig:t}){var w;const n=Ie(),r=e.getProperty("position"),o=r.getValue(),s=e.getProperty("top"),a=e.getProperty("right"),i=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},p=y=>n.t(`styleManager.position.${y}`),f=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!f.includes(`${y.id}`)),m=WV.map(y=>({id:y,label:p(`presets.options.${y}`)})),v=["absolute","fixed"].includes(o),b=y=>{let S="auto",C="auto",x="auto",E="auto";switch(y){case"topLeft":S="0%",E="0%";break;case"topRight":S="0%",C="0%";break;case"bottomLeft":x="0%",E="0%";break;case"bottomRight":x="0%",C="0%";break;case"left":S="0%",x="0%",E="0%";break;case"right":S="0%",x="0%",C="0%";break;case"bottom":E="0%",x="0%",C="0%";break;case"top":E="0%",S="0%",C="0%";break;case"full":E="0%",S="0%",C="0%",x="0%";break}s.upValue(S),a.upValue(C),i.upValue(x),l.upValue(E)};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:r,children:[c.jsx(Le,{...Lt(r,d),tip:p(`tips.${(w=r.getOption())==null?void 0:w.id}`),...Gh}),v&&c.jsx(F,{children:c.jsx(Wt,{title:p("presets.title"),children:c.jsx(Le,{options:m,onChange:b,emptyState:"P",size:"s",caret:"",value:!0})})})]}),o!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(be,{col:!0,children:[c.jsx(k,{className:X("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx($e,{...lt(s,d)})}),c.jsxs(k,{gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx($e,{...lt(l,d)})}),c.jsx(F,{grow:!0,children:c.jsx($e,{...lt(a,d)})})]}),c.jsx(k,{className:X("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx($e,{...lt(i,d)})})]}),c.jsx(be,{children:c.jsx($e,{...lt(u,d)})})]}),g.length>0&&c.jsx(Qr,{properties:g,...d})]})}function qV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),r=e.getProperty("min-width"),o=e.getProperty("max-width"),s=e.getProperty("height"),a=e.getProperty("min-height"),i=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,r,o,s,a,i].map(p=>p==null?void 0:p.id),d=e.getProperties().filter(p=>!u.includes(`${p.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[n,s],children:[c.jsx($e,{...lt(n,l)}),c.jsx($e,{...lt(s,l)})]}),c.jsxs(be,{property:[r,a],children:[c.jsx($e,{...lt(r,l)}),c.jsx($e,{...lt(a,l)})]}),c.jsxs(be,{property:[o,i],children:[c.jsx($e,{...lt(o,l)}),c.jsx($e,{...lt(i,l)})]}),d.length>0&&c.jsx(Qr,{properties:d,...l})]})}function KV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),r=e.getProperty("margin"),o={sector:e,styleManagerDataConfig:t},s=[n,r].map(i=>i==null?void 0:i.id),a=e.getProperties().filter(i=>!s.includes(`${i.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,...o}),c.jsx(En,{property:r,...o}),a.length>0&&c.jsx(Qr,{properties:a,...o})]})}function ZV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),r=e.getProperty("color"),o=e.getProperty("font-size"),s=e.getProperty("font-weight"),a=e.getProperty("line-height"),i=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),p=e.getProperty("text-transform"),f=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},v=[n,r,o,s,a,i,l,u,d,p,f,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:w}=Li();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(be,{property:n,children:w?c.jsx(Su,{...yS(n,m)}):c.jsx(Le,{...Lt(n,m)})}),!!r&&c.jsx(be,{property:r,children:c.jsx(Zr,{...qs(r,m)})}),c.jsxs(be,{property:[o,s],children:[!!o&&c.jsx($e,{...lt(o,m)}),!!s&&c.jsx(Le,{...Lt(s,m)})]}),c.jsxs(be,{property:[a,i],children:[!!a&&c.jsx($e,{...lt(a,m)}),!!i&&c.jsx($e,{...lt(i,m)})]}),c.jsxs(be,{property:[l,u],children:[!!l&&c.jsx(Le,{...Lt(l,m)}),!!u&&c.jsx(Le,{...Lt(u,m)})]}),c.jsxs(be,{property:[p,f],children:[!!p&&c.jsx(Le,{...Lt(p,m)}),!!f&&c.jsx(Le,{...Lt(f,m)})]}),c.jsxs(be,{property:[g,d],children:[!!g&&c.jsx(Le,{...Lt(g,m)}),!!d&&c.jsx(Le,{...Lt(d,m)})]}),b.length>0&&c.jsx(Qr,{properties:b,...m})]})}const Gh={row:!0,classNameLabel:"gs-utl-w-full"},YV=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(k,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(F,{grow:!1,children:c.jsx(ss,{property:e,skipClear:t,label:n})}),!!r.length&&c.jsx(k,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:r.map((o,s)=>c.jsx(Ct,{...o},s))})]}),qh="gs-style-manager",Du=`${qh}-sector`,XV=`${Du}-header`,JV=`${Du}-content`,vS=(e,t=0,n=!0)=>N(XV,U.bgH2,Te.xyS,U.br,t&&te.bt,(e||n)&&te.bb),QV=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),RV=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),Cl=(e,t)=>{const n=eH(e,t),r=rS(n),{hasDataResolverValue:o}=n,{label:s}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:o,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:r.length?"span":void 0,label:c.jsx(YV,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},Kh=(e,t)=>{const{connectDataSources:n,commonProps:r}=Cl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},bS=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=Cl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:QV(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},eo=(e,t,n)=>bS(e,t,n).fieldProps,Lt=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=bS(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},yS=(e,t)=>{const{commonProps:n,connectDataSources:r}=Cl(e,t),o=r.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:o,hideCaret:r.hasDataResolverValue,value:r.dataResolverValue??e.getValue(),onChange:s=>e.upValue(s)}},ls=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=Cl(e,t),{hasDataResolverValue:s,dataResolverValue:a}=r;return{...o,title:e.getLabel(),emptyState:s?a:void 0,titleAdd:`Add new ${e.getLabel()}`,items:s?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:i=>e.getLayerLabel(i),add:s?void 0:()=>e.addLayer(n,{at:0}),select:i=>e.selectLayer(i),remove:i=>e.removeLayer(i),move:(i,l=0)=>e.moveLayer(i,l)}},lt=(e,t)=>{const{connectDataSources:n,commonProps:r}=Cl(e,t),{hasDataResolverValue:o}=n;return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(s,a)=>e.upValue(s,{partial:a}),valueUnit:e.getUnit(),pan:!o,units:o?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:s=>e.upUnit(s)}};function eH(e,t){const{styleManagerDataConfig:n=!1,sector:r}=t,o=e.em.getEditor(),{Styles:s}=o,a=o.getSelected(),i=s.getSelectedAll(),l=s.getSelected();let u=!1;n===!0?u=!0:a&&no(n)&&et(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),p=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",f=ns(p),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:f,dataResolverValue:f?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{i.forEach(v=>{v.addStyle({[d]:m})})},handleValueClear:()=>{i.forEach(m=>{const v=m.getStyle()[d]??"";m.addStyle({[d]:v})})},editor:o,additionalSources:g}}const qs=(e,t)=>Kh(e,t),tH=(e,t)=>{const{label:n,...r}=Kh(e,t);return{...r,label:n,isContain:e.get("contain")??!0,hideButton:r.disabled,inputField:e.get("inputField"),onOpen(){const o=e.em.Assets;o.open({select(s){e.upValue(s.getSrc()),o.close()}})}}},nH=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=$V;switch(n){case"gs-layout":r=UV;break;case"gs-size":r=qV;break;case"gs-space":r=KV;break;case"gs-position":r=GV;break;case"gs-borders":r=jV;break;case"gs-effects":r=FV;break;case"gs-typography":r=ZV;break;case"gs-background":r=HV;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},Zh={},wS=ce(function({className:t,sectors:n}){var m;const[r,o]=h.useState(Zh),s=ye(),{editor:a}=s,i=a==null?void 0:a.Styles,l=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected(),d=`${qh}__empty-state ${Te.s} gs-utl-text-center`,p=v=>a==null?void 0:a.t(`styleManager.${v}`);if(h.useEffect(()=>{if(u&&a){const v=setTimeout(()=>{let b=Zh;const w=u.get("styleManager");et(w)&&(b=w({editor:a,component:u})),o(b||Zh)});return()=>clearTimeout(v)}},[u,a]),!i||!l)return c.jsx(F,{className:d,children:p("empty")});const f=n.length?n:i.getSectors({visible:!0}),g=(m=s.sdkOptions.dataSources)==null?void 0:m.styleManager;return r.disabled?null:c.jsxs("div",{className:N(qh,t,"gs-utl-select-none"),children:[!f.length&&c.jsx(F,{className:d,children:p("notFound")}),f.map((v,b)=>c.jsx(yo,{open:v.isOpen(),onChange:({open:w})=>v.setOpen(w),classNameWrap:N(Du,`${Du}__${v.id}`),sticky:!0,handler:()=>{const w=v.getProperties({withValue:!0}).length>0,y=v.getProperties({withParentValue:!0}).length>0;return c.jsxs(k,{gap:"xs",items:"center",children:[c.jsx(F,{className:"gs-utl-mr-2",children:v.getName()}),w&&c.jsx(F,{children:c.jsx("div",{className:N(Oe.dot,U.bgA2)})}),y&&c.jsx(F,{children:c.jsx("div",{className:N(Oe.dot,U.bgW)})})]})},className:w=>vS(w,b,b===f.length-1),children:c.jsx(k,{className:N(JV,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:nH(v,{styleManagerDataConfig:g})})},v.id))]})}),rH=qt(function({children:t,className:n,content:r,...o},s){return c.jsx("div",{className:N(ae("gs-design-manager-tab"),n),ref:s,...o,children:t})}),SS="gs-cmp-sidebar-right",CS="gs-cmp-traits-provider",Yh=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function oH(e={}){var T,O,L;const{propsInStyles:t,hideTabs:n,hideSelectors:r,tabsProps:o}=e,{isCssPanelActive:s,selectedDesignerTab:a,showSelectors:i,setSelectedDesignerTab:l,sdkProps:u,sdkOptions:d,isProjectTypeEmail:p}=ye(),f=Ie(),g=N(s&&"gs-utl-hidden"),v=(((T=Rn(u.children,rH))==null?void 0:T.filter(Boolean))||[]).map(({props:A},$)=>({id:A.id,label:A.label,content:c.jsx(Bi,{children:A.children}),order:A.order??2+$+1})),b=t??((O=d.designPanel)==null?void 0:O.propsInStyles),w=n??((L=d.designPanel)==null?void 0:L.hideTabs),y=b===!0||p&&b!==!1,S=w===!0||p&&w!==!1,C=r===void 0?i:!r,x=f.t("traitManager.panelLabel"),E=N(`${SS}__tabs`,S&&"gs-utl-hidden",o==null?void 0:o.className),_=[{id:"style",label:f.t("styleManager.panelLabel"),order:1,content:c.jsxs(k,{col:!0,full:!0,children:[!!C&&c.jsx(F,{className:N("gs-cmp-selectors-provider",Te.s,te.bb,U.br),children:c.jsx(Fb,{children:A=>c.jsx(lS,{...A})})}),y&&c.jsx(F,{className:N(CS,Yh),children:c.jsx(yo,{handler:x,className:vS(!1),sticky:!0,open:!0,children:c.jsx(mf,{children:A=>c.jsx(Hh,{...A,className:N("gs-utl-p-2",U.br,te.bb)})})})}),c.jsx(F,{className:N("gs-cmp-styles-provider",Yh),grow:!0,children:c.jsx(Bb,{children:A=>c.jsxs(c.Fragment,{children:[s&&c.jsx(zb,{}),c.jsx(wS,{className:g,...A})]})})})]})},!y&&{id:"props",label:x,order:2,content:c.jsx(k,{className:CS,col:!0,full:!0,children:c.jsx(F,{className:N(Te.s,Yh),children:c.jsx(mf,{children:A=>c.jsx(Hh,{...A})})})})},...v].filter(Boolean).sort((A,$)=>A.order-$.order);return c.jsx(k,{className:SS,col:!0,full:!0,nowrap:!0,children:c.jsx(Xo,{...o,value:a,onChange:l,tabs:_,className:E})})}const xS=ce(oH),sH="gs-panel-sidebar-tabs",aH=h.memo(ce(function({className:t,propsInStyles:n,hideTabs:r,hideSelectors:o,tabsProps:s,...a}){return c.jsx(Tr,{className:N(sH,"gs-utl-h-full",t),...a,children:c.jsx(xS,{propsInStyles:n,hideTabs:r,hideSelectors:o,tabsProps:s})})})),iH="gs-panel-styles",lH=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:r}=ye(),o=N(r&&" gs-utl-hidden");return c.jsx(Tr,{className:N(iH,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Bb,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(zb,{}),c.jsx(wS,{className:o,...s})]})})})})),cH="gs-panel-templates",uH=h.memo(ce(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=kv(),{projectTypeFilter:i}=a;let l=n??a.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||a.loadTemplates()},[n]),c.jsx(Tr,{className:N(cH,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(k,{className:ae("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(k,{className:ae("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(X0,{templates:l,projectType:xt[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),dH="gs-cmp-row",pH=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(dH,U.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:kt(n)})}),fH="gs-cmp-select-field",hH=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,options:a,size:i,onChange:l,required:u,disabled:d,emptyState:p,editorEvents:f}){const{editor:g}=ye(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:p})),b=w=>{l({value:w,editor:g,state:m,setState:y=>v(S=>({...S,...y}))})};return So({editor:g,editorEvents:f,localState:m,setLocalState:v}),c.jsx(Le,{classNameContainer:N(fH,m.className),style:m.style,label:m.label,name:m.name,value:m.value??"",options:m.options??[],size:m.size,required:m.required,disabled:m.disabled,emptyState:m.emptyState,onChange:b})})),gH="gs-cmp-select-field",mH=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,onChange:i,required:l,disabled:u,emptyState:d,editorEvents:p}){const{editor:f}=ye(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:r,name:o,value:s,size:a,emptyState:d})),v=b=>{i({value:b,editor:f,state:g,setState:w=>m(y=>({...y,...w}))})};return So({editor:f,editorEvents:p,localState:g,setLocalState:m}),c.jsx(Su,{classNameContainer:N(gH,g.className),style:g.style,label:g.label,name:g.name,value:g.value??"",size:g.size,required:g.required,disabled:g.disabled,emptyState:g.emptyState,onChange:v})})),vH="gs-sidebar-bottom",bH=h.memo(ce(function({children:t,className:n,style:r,height:o,...s}){const{isInPreview:a,isBottomSidebarOpen:i}=ye(),l=o??35,u=h.useMemo(()=>({height:l,marginBottom:a||!i?`-${l}px`:0,...r}),[a,i,r]);return c.jsx(xn,{className:N(vH,"gs-utl-flex gs-utl-transition-spacing",te.bt,U.br,n),style:u,...s,children:t?kt(t):void 0})})),yH=ce(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:o,isInPreview:s,isLeftSidebarOpen:a,sdkProps:i,showPages:l}=ye(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,p=d??n,f=t.resizable===!1,g=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,U.br),m=N("gs-utl-w-full",te.bb,U.br),v=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:s||!a?`-${p}px`:0,...t.style}),[p,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return c.jsx(yu,{className:g,enable:f?!1:void 0,right:!f,style:b,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(k,{full:!0,col:!0,children:[l&&c.jsx(F,{className:m,children:c.jsx(Db,{children:C=>c.jsxs(c.Fragment,{children:[Rn(u,Zw),c.jsx(qw,{...C}),Rn(u,Kw)]})})}),c.jsx(F,{className:v,grow:!0,children:c.jsx(jb,{children:C=>c.jsxs(c.Fragment,{children:[Rn(u,cw),c.jsx(iw,{...C}),Rn(u,lw)]})})})]})})}),wH="gs-sidebar-left",SH=h.memo(ce(function({children:t,width:n,resizable:r,...o}){return c.jsx(yH,{className:N(wH,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Dc(o)),width:n,resizable:r,style:Fc(o),children:t?kt(t):void 0})})),CH=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:o,isInPreview:s,isRightSidebarOpen:a}=ye(),i=((m=t.style)==null?void 0:m.width)??t.width,l=i??n,u=t.resizable===!1,d=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.bl,U.br),p=h.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),f=()=>o==null?void 0:o.refresh(),g=(v,b,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(yu,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:f,onResizeStop:g,children:t.children??c.jsx(xS,{})})}),xH="gs-sidebar-right",EH=h.memo(ce(function({children:t,resizable:n,...r}){return c.jsx(CH,{className:N(xH,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Dc(r)),resizable:n,style:Fc(r),children:t?kt(t):void 0})})),PH=ce(function({className:t,variant:n,value:r,tabs:o,style:s,editorEvents:a,onChange:i}){const{editor:l}=ye(),[u,d]=h.useState(()=>({tabs:o,style:s,value:r,variant:n,className:t})),p=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:kt(m.children)})))||[]},[u.tabs]),f=g=>{i&&l?i({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return So({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Xo,{tabs:p,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:f})}),TH="gs-cmp-text",OH=h.memo(function({className:t,content:n,children:r,...o}){return c.jsx(xn,{className:N(TH,t),...o,children:r||n})}),_H="gs-cmp-virtual-list",AH=ce(function({id:t,items:n,itemLayout:r,footerLayout:o,onRef:s,itemsPerRow:a=12,className:i,style:l,htmlAttrs:u}){const[d,p]=h.useState(0),{editor:f,transitionTime:g}=ye(),m=jf(a),v=a===1;h.useEffect(()=>{const S=setTimeout(()=>p(C=>++C),g);return()=>clearTimeout(S)},[g]);const b={id:t,...u},w=!!d&&!!f,y={data:n,style:l,className:N(_H,"gs-utl-h-full",i),itemContent:(S,C)=>c.jsx(h.Fragment,{children:r?kt(r({item:C,index:S,editor:f})):c.jsx("pre",{children:JSON.stringify(C,void 0,2)})},C.id??S),components:{Footer:o&&f?()=>kt(o({editor:f})):void 0}};return w&&(v?c.jsx(Ak,{...b,...y,ref:s},t):c.jsx(ou,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:s},t))});var Xh=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",e.colorField="colorField",e.colorPicker="colorPicker",e.menuList="menuList",e.inputField="inputField",e.codeField="codeField",e.selectField="selectField",e.selectFontField="selectFontField",e.tabs="tabs",e.devices="devices",e.custom="custom",e.panelLayers="panelLayers",e.panelPages="panelPages",e.panelSelectors="panelSelectors",e.panelStyles="panelStyles",e.panelProperties="panelProperties",e.panelSidebarTabs="panelSidebarTabs",e.panelPagesLayers="panelPagesLayers",e.panelBlocks="panelBlocks",e.panelPageSettings="panelPageSettings",e.panelGlobalStyles="panelGlobalStyles",e.panelAssets="panelAssets",e.panelTemplates="panelTemplates",e.sidebarLeft="sidebarLeft",e.sidebarRight="sidebarRight",e.sidebarTop="sidebarTop",e.sidebarBottom="sidebarBottom",e.canvas="canvas",e.canvasSidebarTop="canvasSidebarTop",e.virtualList="virtualList",e.dataPathField="dataPathField",e.panelDataVariablePicker="panelDataVariablePicker",e.panelDataConditionPicker="panelDataConditionPicker",e.panelDataCollectionPicker="panelDataCollectionPicker",e.panelDataValuePicker="panelDataValuePicker",e))(Xh||{});const LH={icon:re,row:pH,column:p8,text:OH,tabs:PH,button:Hc,buttonMenu:qN,buttonGroupField:ZN,colorField:l8,colorPicker:u8,menuList:rI,inputField:tI,codeField:h6,selectField:hH,selectFontField:mH,devices:R0,panelPages:Yw,panelPageSettings:N7,panelLayers:uw,panelPagesLayers:D7,panelBlocks:kI,panelGlobalStyles:GI,panelSelectors:EV,panelStyles:lH,panelProperties:pV,panelSidebarTabs:aH,panelAssets:PI,panelTemplates:uH,sidebarRight:EH,sidebarLeft:SH,sidebarTop:ey,sidebarBottom:bH,canvas:qb,canvasSidebarTop:p6,virtualList:AH,dataPathField:q8,panelDataVariablePicker:R8,panelDataConditionPicker:W8,panelDataCollectionPicker:M8,panelDataValuePicker:Y8},kt=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=$4();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=ct(r)?{type:Xh.text,content:r}:r||{},i=a.id||"",l=LH[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),p=i||o;if(u)return c.jsx(Kp,{id:i,...u},p);if(d){const f=d({id:i,...a});return kt([f])[0]}else{if(s===Xh.custom)return c.jsx(Kp,{id:i,...a},p);if(l)return c.jsx(l,{id:i,...a},p)}return null})},MH=ce(({components:e})=>(Ac().customLayoutComponents,kt(e))),So=e=>{const{editorEvents:t,editor:n,localState:r,setLocalState:o}=e;h.useEffect(()=>{if(!t||!n)return;const s=Object.keys(t).reduce((i,l)=>(i[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:r,setState:p=>o(f=>({...f,...p}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},NH=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=s4(o.get("name")||`${i.substring(0,20)}`);r[s]={mime:a[1],name:l,base64:i}}return r},{}),$H=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ES=(e,t,n={})=>{let r=e;const o=n.pathPfx||"";for(const s in t)if(r.includes(s)){const a=t[s];r=r.replace(new RegExp($H(s),"g"),`${o}${a.name}`),a.found=!0}return r},kH=(e,t,n)=>`${t||""}${e||""}${n||""}`,IH=(e,t)=>{const n=e?`<div ${Ec}>${e}</div>`:"",r=t?`<div ${Ec} data-gjs-global>${t}</div>`:"";return`${n}${r}`},VH=async(e,t={})=>{const{page:n,skipProject:r,assetsFolder:o="assets",filenameCss:s="style.css",styles:a,isMJML:i,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,f={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=NH(e),b=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=ES(w,v,{pathPfx:b}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=p==="skip",P=u?{}:Ca(e).globalPageSettings||{},_=[],T=(O,L)=>{var Gt,xo,Ks;const{pageSettingOpts:A}=L||{},$=O.getName(),B=S||(A==null?void 0:A.replaceDataSources),M=Bo(O,"title",A)||$,j=Bo(O,"favicon",A),W=Bo(O,"description",A),D=Bo(O,"keywords",A),z=Bo(O,"socialTitle",A),I=Bo(O,"socialDescription",A),H=Bo(O,"socialImage",A),V=u?"":fv(Bo(O,"fonts")),G=cn({page:O,key:"customCodeHead",opts:A})??"",Y=kH(G,P.customCodeHead,V),J=cn({page:O,key:"customCodeBody",opts:A})??"",Q=d?"":IH(J,P.customCodeBody),R=O.getMainComponent(),q=E?"":e.getJs({component:R}),ee=q?`<script>${q}<\/script>`:"",le=[],ge=[],Pe={asDocument:!1,...f},Ce=R.toHTML(Pe).replace("</body>",()=>`${Q}${ee}</body>`),tt=R.head;let Qe=M&&`<title>${M}</title>`,Ot=j&&`<link rel="icon" href="${j}"/>`,ut=W&&`<meta name="description" content="${W}"/>`,Se=D&&`<meta name="keywords" content="${D}"/>`,ot=z&&`<meta property="og:title" content="${z}"/>`,st=I&&`<meta property="og:description" content="${I}"/>`,wt=H&&`<meta property="og:image" content="${H}"/>`,Ne='<meta charset="utf-8">',mt='<meta name="viewport" content="width=device-width,initial-scale=1">',dt='<meta name="robots" content="index,follow">',Ue='<meta name="generator" content="GrapesJS Studio">';tt.components().forEach(Re=>{const St=Re.toHTML(f);ft.title({cmp:Re})?Qe=St:ft.favicon({cmp:Re})?Ot=St:ft.description({cmp:Re})?ut=St:ft.keywords({cmp:Re})?Se=St:ft.socialTitle({cmp:Re})?ot=St:ft.socialDescription({cmp:Re})?st=St:ft.socialImage({cmp:Re})?wt=St:ft.charset({cmp:Re})?Ne=St:ft.viewport({cmp:Re})?mt=St:ft.robots({cmp:Re})?dt=St:ft.generator({cmp:Re})&&(Ue=St)}),Qe&&le.push(Qe),Ne&&le.push(Ne),mt&&le.push(mt),dt&&le.push(dt),Ue&&le.push(Ue),ut&&le.push(ut),Se&&le.push(Se),ot&&le.push(ot),st&&le.push(st),wt&&le.push(wt),Ot&&le.push(Ot),ge.length&&le.push(...ge),Y&&le.push(Y),y&&!(C||x)&&le.push(B?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const he=R.doctype||"<!DOCTYPE html>",De=(xo=(Gt=R.docEl).__attrToString)==null?void 0:xo.call(Gt,f),Fe=(Ks=tt.__attrToString)==null?void 0:Ks.call(tt,f),He=e.getHtml(f).trim(),Mt=i?e.runCommand(Nc,{mjml:He}).html:`${he}
335
- <html${De?` ${De}`:""}>
336
- <head${Fe?` ${Fe}`:""}>
337
- ${le.join(`
334
+ }`),t},ir="gs-cmp-selector-manager",Ug={},SS=ce(function(t){var ae,le,me;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=Ce(),[l,u]=g.useState(!1),[d,p]=g.useState([]),[f,h]=g.useState(Ug),{toggleCssPanel:m,isCssPanelActive:b,editor:v,store:w}=Ce(),{i18nStore:y,modalStore:S}=w,C=v==null?void 0:v.getSelected(),E=v==null?void 0:v.Styles.getSelected();if(g.useEffect(()=>{if(v&&E&&i){const ve=setTimeout(()=>{let He=Ug;const je=C==null?void 0:C.get("selectorManager");C&&ot(je)&&(He=je({editor:v,component:C})),h(He||Ug),p(GV(v,i))});return()=>clearTimeout(ve)}},[C,v,E,i]),!v)return null;const{Selectors:x}=v,P=f.disableClasses,_=f.disableComponent,T=P&&_,O=x.getComponentFirst()&&!_,M=x.getSelectedAll(),A=v.getSelectedAll(),$=r.map(ve=>({id:ve.getName(),label:ve.getLabel()})),j=v.getModel(),L=(ae=E==null?void 0:E.getDevice)==null?void 0:ae.call(E),H=(le=E==null?void 0:E.getState)==null?void 0:le.call(E),W=N("gs-utl-overflow-hidden",re.b,re.rnd,U.br),B=N(U.bA),G=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",re.br,U.br),D=`${U.bgA}`,V=qV(E),k=M.length>0,z=A.length>0,Y=k||z,X=O&&z||!O&&!k,ee=X?"Components":"Selectors",J=ve=>y.t(`selectorManager.${ve}`),q=y.t("modals.styleCatalog.title"),R=()=>S.open({title:q,content:c.jsx(DV,{})});return c.jsxs(I,{className:ir,gap:"s",col:!0,full:!0,children:[c.jsxs(I,{className:N(`${ir}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(I,{className:N(`${ir}__head-start`),items:"center",gap:"s",children:[c.jsx(F,{className:N(`${ir}__head-title`),children:J("selection")}),s!==!1&&c.jsx(F,{className:N(`${ir}__style-catalog`),children:c.jsx(Gt,{className:"gs-utl-cursor-pointer",onClick:R,title:q,children:c.jsx(ne,{icon:K.paletteSwatch,size:se.s})})})]}),!!E&&a!==!1&&!T&&c.jsx(F,{className:`${ir}__head-end`,children:c.jsx(_e,{size:"s",value:n,options:$,includeEmpty:!0,onChange:o,emptyState:`- ${J("state")} -`,className:N(n&&U.bA)})})]}),Y&&!T?c.jsxs(c.Fragment,{children:[!P&&c.jsxs(I,{className:N(`${ir}__field-selectors`,W,!X&&B),items:"stretch",gap:"xs",children:[c.jsx(Gt,{title:J(k?"applyOnSelector":"noSelectors"),className:N(G,!X&&D),onClick:()=>k&&x.setComponentFirst(!1),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:K.tag,size:se.sx})})}),c.jsx(F,{grow:!0,children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(cS,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:J("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:ve=>{ve&&(x.addSelected(ve.id||ve.label),u(!1))}}):c.jsxs(c.Fragment,{children:[z&&c.jsx(wt,{title:J("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(ne,{icon:K.plus,size:se.sx})}),M.map(ve=>c.jsx(FV,{selector:ve,removable:z,toggleable:z&&M.filter(He=>He.getActive()||He===ve).length>1},ve.toString()))]})})})]}),!_&&c.jsxs(I,{className:N(`${ir}__field-components`,W,X&&B),items:"stretch",gap:"xs",children:[c.jsx(Gt,{title:J(z?"applyOnComponents":"noComponents"),onClick:()=>z&&x.setComponentFirst(!0),className:N(G,X&&D),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:K.targetVariant,size:se.sx})})}),c.jsx(F,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:A.map(ve=>c.jsx(Qo,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",U.cmp),onPointerEnter:()=>j.setHovered(ve),onPointerOut:()=>j.setHovered(),label:ve.getName()},ve.getId()))})})]}),c.jsxs(I,{className:`${ir}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:J("selected")}),c.jsx("pre",{className:N("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",re.rnd,Te.xyS),children:V}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:J("currentSelection")})]}),children:c.jsx(Qo,{className:N(re.b,re.rnd,U.br),s:"xs",nopad:!0,block:!0,children:c.jsx(ne,{icon:K.target,size:se.sx})})}),c.jsx(F,{className:"gs-utl-text-sm",children:c.jsx(Qo,{className:N(re.b,re.rnd,U.br),s:"xs",nopad:!0,children:c.jsxs(I,{space:"xs",items:"center",nowrap:!0,children:[!!L&&L.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[J("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(ne,{icon:K.cellphoneLink,size:se.sx})}),c.jsx(F,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[J("target"),": ",c.jsx("b",{children:ee}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(me=E==null?void 0:E.selectorsToString)==null?void 0:me.call(E,{skipState:1})]})]}),children:c.jsx(ne,{icon:X?K.targetVariant:K.tag,size:se.sx})}),!!H&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[J("state"),": ",c.jsx("b",{children:H.getLabel()})]}),children:c.jsx(ne,{icon:K.flare,size:se.sx})})]})]})})}),c.jsx(wt,{title:y.t("toggleCss"),onClick:m,active:b,size:"s",children:c.jsx(ne,{icon:K.codeBraces,size:se.sx})})]})]}):c.jsxs(I,{className:N(`${ir}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(F,{className:`${ir}__empty-state-title`,children:J("noSelecton")}),c.jsxs("ul",{className:N(`${ir}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:J("selectFromCanvas")}),c.jsx("li",{children:J("selectFromList")})]})]})]})}),KV="gs-panel-selectors",ZV=g.memo(ce(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(Ar,{className:N(KV,t),...o,children:c.jsx(Zv,{children:s=>c.jsx(SS,{...s,styleCatalog:n,stateSelector:r})})})}));function Co({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,tooltip:l,skipClear:u,afterLabel:d,className:p,...f}){const h=e||(t==null?void 0:t.getLabel()),m=t==null?void 0:t.getParentTarget(),b=n||!r&&(t==null?void 0:t.hasValue({noParent:!0})),v=!b&&(t==null?void 0:t.hasValue())&&m,w=m==null?void 0:m.getDevice(),y=m==null?void 0:m.getState(),S=m==null?void 0:m.getComponent(),C=()=>o?o():t==null?void 0:t.clear(),E={className:N(p,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...f},x=N(b&&!a&&U.tAo);return t&&!t.isVisible()?null:c.jsxs(I,{gap:"xs",...E,children:[c.jsxs(I,{className:"gs-utl-flex-1",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(F,{children:c.jsx(Gt,{title:l,children:c.jsx(ne,{icon:K.information,size:se.sx})})}),c.jsx(F,{className:x,children:r?c.jsx("span",{children:" "}):h}),!!v&&!a&&c.jsx(Gt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"gs-utl-mb-1",children:"Value inherited from"}),!!w&&c.jsxs(I,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:K.cellphoneLink,size:se.sx})}),c.jsx(F,{children:c.jsx("b",{children:w.getName()})})]}),c.jsxs(I,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:S?K.targetVariant:K.tag,size:se.sx})}),c.jsxs(F,{children:[c.jsx("b",{children:S?"Components":"Selectors"}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",m==null?void 0:m.selectorsToString({skipState:1})]})]})]}),!!y&&c.jsxs(I,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:K.flare,size:se.sx})}),c.jsx(F,{children:c.jsx("b",{children:y.getLabel()})})]})]}),children:c.jsx("div",{className:N("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",U.bgW)})}),b&&!a&&!u&&c.jsx(Gt,{title:"Clear value",onClick:C,children:c.jsx(ne,{className:N(Oe.click,x),icon:K.close,size:se.s2x})}),d]}),!!s&&c.jsx(F,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function ju(e){const t=e.indexOf("(")+1,n=e.lastIndexOf(")");return{name:e.substring(0,t-1).trim(),value:String.prototype.substring.apply(e,[t,n>=0?n:void 0]).trim()}}const YV=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,XV=/,(?![^(]*\))/,Wg=/\s(?![^(]*\))/,JV=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Gg=/^circle|ellipse/i,qg=e=>{var d;const t=[],{name:n,value:r}=ju(e),[o,...s]=r.split(XV).map(p=>p.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(YV.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if(JV.test(i))l.type="size",l.value=i;else if(Gg.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const p=((d=i.match(Gg))==null?void 0:d[0])||"circle";l.shape=p;const f={x:"0%",y:"0%"},h={x:"0%",y:"0%"},[m,b]=i.replace(Gg,"").trim().split("at").map(v=>v.trim());if(m){const[v,w]=m.split(Wg);f.x=v,f.y=w||v}if(b){const[v,w]=b.split(Wg);h.x=v,h.y=w||v}l.size=f,l.position=h}return u.forEach(p=>{const[f,h]=p.split(Wg);t.push({color:f,hint:h?parseFloat(h):null})}),t.forEach((p,f)=>{p.hint===null&&(p.hint=f/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},ls=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const o=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(s=>`${s.color} ${s.hint!=null?`${s.hint}%`:""}`.trim()).join(", ");return o?`${n}(${t}, ${o})`:"none"},QV=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),RV="gs-cmp-grad-picker";function eH({className:e,value:t,onChange:n}){var B,G,D;const r=qg(t),[o,s]=g.useState(r.colorStops),[a,i]=g.useState(null),l=g.useRef(null),u=g.useRef(null),d=Q(RV,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,re.rnd),p=r.name||"linear-gradient",f=p.indexOf("radial")>=0,h=p.indexOf("repeating")>=0,m=r.orientation.value,b=`${parseFloat(`${m}`)||180}`,v=`${parseFloat(`${(B=r.orientation.size)==null?void 0:B.x}`)||0}`,w=`${parseFloat(`${(G=r.orientation.position)==null?void 0:G.x}`)||0}`,y=`${parseFloat(`${(D=r.orientation.position)==null?void 0:D.y}`)||0}`,S=0,C=100,E=(V,k=!1)=>{const z=QV(V);s(z),n==null||n(ls({name:p,orientation:m,stops:z}),k)},x=(V,k=!1)=>{n==null||n(ls({stops:o,name:p,orientation:`${V}deg`}),k)},P=(V,k=!1)=>{n==null||n(ls({stops:o,name:p,orientation:`${V}px at ${w}% ${y}%`}),k)},_=(V,k=!1)=>{n==null||n(ls({stops:o,name:p,orientation:`${v}px at ${V}% ${y}%`}),k)},T=(V,k=!1)=>{n==null||n(ls({stops:o,name:p,orientation:`${v}px at ${w}% ${V}%`}),k)},O=V=>{const k=`${V?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(ls({stops:o,orientation:m,name:k}))},M=V=>{const k=`${h?"repeating-":""}${V?"radial":"linear"}-gradient`;n==null||n(ls({stops:o,orientation:V?"100px at 50% 50%":"90deg",name:k}))},A=V=>{var z;const k=u.current;if(!k||V==null){u.current=null;return}(z=k.hasPointerCapture)!=null&&z.call(k,V)&&k.releasePointerCapture(V),u.current=null};g.useEffect(()=>{if(!a)return;const V=parseFloat(`${a.stop.hint}`),k=a.pointerId,z=X=>{let J=(X.clientX-a.x)*100;J=J/a.w,J=V+J,J=J<S?S:J,J=J>C?C:J,a.stop.hint=parseInt(`${J}`,10),E(o,!0)},Y=()=>{A(k),i(null),E(o)};return window.addEventListener("pointermove",z),window.addEventListener("pointerup",Y),window.addEventListener("pointercancel",Y),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",Y),window.removeEventListener("pointercancel",Y),A(k)}},[a]),g.useEffect(()=>{a||s(r.colorStops)},[t,a]);const $=(V,k)=>{if(V.button!==0)return;V.preventDefault(),V.stopPropagation(),V.currentTarget.setPointerCapture(V.pointerId),u.current=V.currentTarget;const z=l.current;i({stop:k,pointerId:V.pointerId,w:(z==null?void 0:z.clientWidth)||0,h:(z==null?void 0:z.clientHeight)||0,x:V.clientX,y:V.clientY})},j=V=>{const k=l.current,z=(k==null?void 0:k.clientWidth)||0,Y=(k==null?void 0:k.clientHeight)||0;if(!z||!Y)return;const X=V.nativeEvent.offsetX-((k==null?void 0:k.clientLeft)||0),ee=V.nativeEvent.offsetY-((k==null?void 0:k.clientTop)||0),J=X/z*100,q=document.createElement("canvas"),R=q.getContext("2d");if(!R)return;q.width=z,q.height=Y;const ae=R.createLinearGradient(0,0,z,0);o.forEach(je=>ae.addColorStop(parseFloat(`${je.hint}`)/100,je.color)),R.fillStyle=ae,R.fillRect(0,0,q.width,q.height),q.style.background="black";const le=R.getImageData(X,ee,1,1).data,me=le[3]?(100/255*le[3]/100).toFixed(2):0,ve=`rgba(${le[0]}, ${le[1]}, ${le[2]}, ${me})`,He=ve==="rgba(0, 0, 0, 0)"?"#000":ve;E([...o,{color:He,hint:J}])},L=V=>{E(o.filter(k=>k!==V))},H=(V,k,z)=>{k&&(V.color=k),E(o,z)},W=V=>(a==null?void 0:a.stop)===V;return c.jsxs(I,{className:d,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx(gy,{className:"cursor-colr"}),c.jsxs("div",{className:Q("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:Q("bg-checker h-8",re.rnd),children:c.jsx("div",{ref:l,className:Q("w-full h-full cursor-cross",re.b,re.rnd,U.br),style:{backgroundImage:ls({stops:o})},onClick:j})}),o.map((V,k)=>c.jsxs("div",{className:Q("absolute top-0 h-full"),style:{left:`${V.hint}%`},children:[c.jsx("div",{className:Q("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>L(V),children:c.jsx(ne,{icon:K.close,size:se.s3x})}),c.jsx("div",{onPointerDown:z=>$(z,V),className:Q("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",re.br,re.bl,W(V)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:Q("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(Iy,{value:V.color,onChange:(z,Y)=>H(V,z,Y),className:Q("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},k))]}),c.jsxs(I,{space:"s",items:"center",children:[c.jsx(F,{grow:!0,children:c.jsx(sl,{label:"Repeat",value:h,onChange:O})}),c.jsx(F,{grow:!0,children:c.jsx(sl,{label:"Radial",value:f,onChange:M})})]}),f?c.jsxs(I,{space:"s",col:!0,children:[c.jsx(F,{children:c.jsx(I,{space:"s",items:"center",children:c.jsx(F,{grow:!0,children:c.jsx(ke,{pan:"S",size:"s",value:v,onChange:P,valueUnit:"px",units:["px"]})})})}),c.jsx(F,{children:c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(ke,{pan:"X",size:"s",value:w,onChange:_,valueUnit:"%",units:["%"]})}),c.jsx(F,{grow:!0,children:c.jsx(ke,{pan:"Y",size:"s",value:y,onChange:T,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(I,{space:"s",items:"center",nowrap:!0,children:c.jsx(F,{grow:!0,children:c.jsx(ke,{pan:"A",size:"s",value:b,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const tH="gs-sm-custom-type",nH=ce(function({property:t,editor:n}){const r=g.useRef(null),o=t.getType(),s=n.StyleManager,a=s.getType(o),i=a==null?void 0:a.view;return g.useEffect(()=>{const l=r.current;if(i&&l){const u=new i({model:t,config:s.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[i,t,n]),i&&c.jsx("div",{className:tH,ref:r})});function CS(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const xS="gs-cmp-style-field";function ES({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=N(xS,`${xS}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(Tu,{className:o,...kS(e,s),...r});case"number":case"slider":case"integer":return c.jsx(ke,{className:o,...ut(e,s),...r});case"color":return c.jsx(Xr,{className:o,...Ks(e,s),...r});case"select":return c.jsx(_e,{className:o,..._t(e,s),...r});case"radio":return c.jsx(Rt,{className:o,...no(e,s),...r});case"file":return c.jsx(fl,{className:o,...TH(e,s),...r});case"composite":return c.jsx(En,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Rr,{className:o,...us(e,s),children:c.jsx(eo,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(nH,{editor:a,property:e}):c.jsx(at,{className:o,...Qg(e,s)})}}}const PS="gs-cmp-style-prop-row";function eo({properties:e,sector:t,styleManagerDataConfig:n}){const r={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(o=>{const s=o.getId(),a=N(PS,`${PS}__${s}`,CS(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(ES,{property:o,...r})},s):null})})}function rH({sector:e,styleManagerDataConfig:t}){const n=Ni(),r=e.getProperties().filter(o=>o.isVisible()).map(o=>(n.sdkAddFonts&&o.getId()==="font-family"&&o.set("type","selectFont"),o));return c.jsx("div",{className:N("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(eo,{properties:r,sector:e,styleManagerDataConfig:t})})}const oH="gs-cmp-sector-row";function we({className:e,children:t,bottom:n,separator:r,separatorTop:o,property:s,...a}){const i=c.jsx("div",{className:Q("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",re.bb,U.br)}),l=Q(oH,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(I,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function Cl(e,t,n={}){const r=e.getType(),{compact:o=!1,sector:s,styleManagerDataConfig:a}=n,i=e.getParent(),l={sector:s,styleManagerDataConfig:a},u=e.getDefaultValue();if(r==="select"){const p={property:i.getName()};return c.jsx(_e,{..._t(e,l,p),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,p)||u:"Custom",onChange:f=>t.all.map(h=>h.upValue(f))}:{},label:void 0})}else return r==="color"?c.jsx(Xr,{...Ks(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p}))}:{},label:void 0}):c.jsx(ke,{...ut(e,l),...o?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p})),onChangeUnit:d=>t.all.map(p=>p.upUnit(d))}:{},label:void 0})}const Du="gs-cmp-style-prop-composite";function En({className:e,property:t,sector:n,styleManagerDataConfig:r,corners:o,hideLabel:s,compact:a,generic:i,children:l,options:u}){const[d,p]=g.useState(null);if(!(t!=null&&t.isVisible()))return null;const f={id:"custom",label:c.jsx(ne,{icon:K.borderStyle,size:se.s}),title:"Custom"},h=[{id:"all",label:c.jsx(ne,{icon:K.borderAllVariant,size:se.s}),title:"All"},f],m=t.isDetached(),b=t.getProperties(),v=b.length,[w,y,S,C]=b,E=w.getFullValue(),P=b.map(D=>D.getFullValue()).every(D=>D===E),_=d!==null?d:P||u?"all":f.id,T=u?[...u,f]:[],O=t.getFullValue(),M=T.some(D=>D.id===O),A=_===f.id||(u?!M:!1)||!!i,$={compact:a,sector:n,styleManagerDataConfig:r},j=c.jsx(Co,{property:a?null:w,shallow:!m,children:Cl(w,null,$)}),L=c.jsx(Co,{property:a?null:y,shallow:!m,children:Cl(y,null,$)}),H=!!S&&c.jsx(Co,{property:a?null:S,shallow:!m,children:Cl(S,null,$)}),W=!!C&&c.jsx(Co,{property:a?null:C,shallow:!m,children:Cl(C,null,$)}),B=a?{label:t.getLabel()}:{property:t},G=!i&&c.jsx(we,{bottom:"0",children:l!==void 0?l:u?c.jsx(c.Fragment,{children:c.jsx(F,{grow:!0,children:c.jsx(Rt,{size:"s",options:T,value:A?f.id:O,onChange:D=>{D===f.id?p(D):(t.upValue(D),p(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(F,{grow:!0,children:Cl(w,{same:P,all:b},$)}),c.jsx(F,{grow:!0,children:c.jsx(Rt,{size:"s",options:h,value:_,onChange:p})})]})});return c.jsxs(I,{className:Q(Du,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsxs(we,{className:`${Du}__main`,children:[!s&&c.jsx(Co,{...B,children:G}),s&&G]}),A&&c.jsx(we,{col:!0,className:Q(`${Du}__details`,"gjs-px-2 gjs-py-1",U.bgH2,re.rnd,re.b,U.br),children:i?c.jsx("div",{className:Q(`${Du}__props`,"grid grid-cols-2 gap-2"),children:b.map(D=>c.jsx(Co,{property:D,shallow:!m,className:Q(CS(D)&&"col-span-full"),children:c.jsx(ES,{property:D,...$,fieldProps:{label:void 0}})},D.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:j}),c.jsx(F,{grow:!0,children:L})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:j}),c.jsx(F,{grow:!0,children:L})]}),c.jsx(I,{space:"s",children:c.jsx(F,{grow:!0,children:H})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:j}),c.jsx(F,{grow:!0,children:L})]}),c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:W}),c.jsx(F,{grow:!0,children:H})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(I,{className:Q("gs-utl-w-1/2 gjs-m-auto"),children:j}),c.jsxs(I,{space:"s",children:[c.jsx(F,{grow:!0,children:W}),c.jsx(F,{grow:!0,children:L})]}),c.jsx(I,{className:Q("gs-utl-w-1/2 gjs-m-auto"),children:H})]})})]})}var cs=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(cs||{});const Fu="background-image",to="__background-type",xl=Fu,Da="background-size-options",TS="https://placehold.co/150/777/white.png?text=IMAGE",El="50px",sH={[to]:"image","background-image":`url("${TS}")`,"background-size":`${El} ${El}`,"background-repeat":"repeat","background-position":"0px 0px"},aH=e=>(e.includes("gradient(")?qg(e).colorStops[0].color:e)||"",Kg=["cover","contain"],iH=(e="")=>Kg.includes(e);function lH({sector:e,styleManagerDataConfig:t}){var A;const n=zi(),r=$e(),o=e.getProperty("background"),s=o.getProperty(to),a=o.getProperty("background-image"),i=o.getProperty("background-position"),l=o.getProperty("background-size"),u=o.getProperty(Da),d=e.getProperty("background-color"),p=e.getProperty("background-clip"),f={sector:e,styleManagerDataConfig:t},h=[o,d,p].map($=>$==null?void 0:$.id),m=e.getProperties().filter($=>!h.includes(`${$.id}`)),b=((A=o.getSelectedLayer())==null?void 0:A.getIndex())||-1,v=s==null?void 0:s.getValue(),w=v==="image",y=a.getValue(),S=`${u.getValue()||""}`.trim(),C=iH(S)?"options":"numeric",E=C==="options",x=$=>r.t(`styleManager.background.${$}`),P=[{id:"numeric",label:x("sizeMode.custom")},{id:"options",label:x("sizeMode.preset")}],_=()=>{const $=n.Assets;$.open({select(j){const L=j.getSrc();a.upValue(`url("${L}")`),$.close()}})},T=$=>{let j="none",L="100%";$==="image"?(j=`url("${TS}")`,L=El):$==="gradient"?j="linear-gradient(90deg, black 10%, white 90%)":$==="color"&&(j="rgba(0, 0, 0, 0.5)"),a.upValue(j),s.upValue($),i.upValue("0 0"),u.upValue(""),l.upValue(`${L} ${L}`)},O=$=>{$!==C&&($==="options"?(u.upValue("cover"),l.upValue("")):(u.upValue(""),l.upValue(`${El} ${El}`)))},M=EH(s,[{id:"image",label:c.jsx(ne,{icon:K.image,size:se.s})},{id:"gradient",label:c.jsx(ne,{icon:K.gradientVertical,size:se.s})},{id:"color",label:c.jsx(ne,{icon:K.checkboxBlank,size:se.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(we,{property:o,separator:!0,children:c.jsxs(Rr,{...us(o,f,sH),previewStyle:$=>o.getStyleFromLayer($,{camelCase:!0}),children:[c.jsx(we,{children:c.jsx(Rt,{...no(s,f),options:M,onChange:T,label:void 0})}),c.jsx(we,{children:c.jsxs(Co,{children:[w&&c.jsx(fl,{value:ju(y).value,onOpen:_}),v==="color"&&c.jsx(Xr,{...Ks(a,f),value:aH(y),label:void 0}),v==="gradient"&&c.jsx(eH,{value:y,onChange:($,j)=>a.upValue($,{partial:j})},b)]})}),w&&c.jsxs(c.Fragment,{children:[c.jsx(we,{col:!0,children:c.jsx(En,{property:i,...f})}),c.jsx(we,{col:!0,children:c.jsx(Co,{property:E?u:l,afterLabel:c.jsx("div",{className:"gs-utl-ml-auto",children:c.jsx(_e,{size:"xs",caret:"",label:void 0,value:C,options:P,onChange:O})}),children:E?c.jsx(_e,{..._t(u,f),label:void 0}):c.jsx(En,{property:l,hideLabel:!0,...f})})}),c.jsxs(we,{children:[c.jsx(_e,{..._t(o.getProperty("background-repeat"),{sector:e})}),c.jsx(_e,{..._t(o.getProperty("background-attachment"),{sector:e})})]}),c.jsx(we,{children:c.jsx(_e,{..._t(o.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(we,{property:d,children:c.jsx(Xr,{...Ks(d,f)})}),c.jsx(we,{property:p,children:c.jsx(_e,{..._t(p,f)})}),m.length>0&&c.jsx(eo,{properties:m,...f})]})}function cH({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),r=e.getProperty("border-width"),o=e.getProperty("border-style"),s=e.getProperty("border-color"),a={sector:e,styleManagerDataConfig:t},i=[n,r,o,s].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!i.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,corners:!0,...a}),c.jsx(En,{property:r,...a}),c.jsx(En,{property:o,...a}),c.jsx(En,{property:s,...a}),l.length>0&&c.jsx(eo,{properties:l,...a})]})}const qs=e=>mu({value:parseFloat(e),min:-3,max:3}),Zg=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=D6(a,s)?a:s[0];return{...ut(r,n),units:s,valueUnit:i,onChange:(l,u)=>{r.upValue(l,{partial:u,units:s,min:o.min,max:o.max})}}},OS=(e,t,n,r)=>{const o=e.getProperty(`${t}-name`),s=e.getProperty(`${t}-value`);return{..._t(o,n,r),onChange:a=>{o.upValue(a),s.upValue("")}}},uH={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"},_S=e=>{const{boxShadowH:t,boxShadowV:n,boxShadowBlur:r,boxShadowColor:o,boxShadowSpread:s,boxShadowType:a}=e.getValues({camelCase:!0}),i=qs(t),l=qs(n),u=qs(r),d=qs(s);return{label:`${t} ${n} ${r} ${s}`,style:{boxShadow:`${i}px ${l}px ${u}px ${d}px ${o} ${a}`.trim()}}},AS=e=>{const{textShadowH:t,textShadowV:n,textShadowBlur:r,textShadowColor:o}=e.getValues({camelCase:!0}),s=qs(t),a=qs(n),i=qs(r);return{label:`${t} ${n} ${r}`,style:{boxShadow:`${s}px ${a}px ${i}px ${o}`.trim()}}};function dH({sector:e,styleManagerDataConfig:t}){const n=$e(),r=x=>n.t(`styleManager.effects.${x}`),o=e.getProperty("box-shadow"),s=e.getProperty("text-shadow"),a=e.getProperty("filter"),i=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),p=e.getProperty("backface-visibility"),f=e.getProperty("perspective"),h=e.getProperty("transform-style"),m=e.getProperty("opacity"),b=e.getProperty("mix-blend-mode"),v=e.getProperty("cursor"),w=e.getProperty("transform-origin"),y=e.getProperty("overflow"),S={sector:e,styleManagerDataConfig:t},C=[o,s,a,i,l,u,d,p,f,h,m,b,v,w,y].map(x=>x==null?void 0:x.id),E=e.getProperties().filter(x=>!C.includes(`${x.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(we,{property:[m,b],children:[c.jsx(ke,{...ut(m,S)}),c.jsx(_e,{..._t(b,S)})]}),c.jsx(we,{property:v,separator:!0,children:c.jsx(_e,{..._t(v,S)})}),c.jsx(we,{property:o,separator:!0,children:c.jsxs(Rr,{...us(o,S),renderItem:x=>_S(x).label,previewStyle:x=>_S(x).style,children:[c.jsx(we,{children:c.jsx(Rt,{...no(o.getProperty("box-shadow-type"),S),label:""})}),c.jsxs(we,{children:[c.jsx(ke,{...ut(o.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),c.jsx(ke,{...ut(o.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),c.jsxs(we,{children:[c.jsx(ke,{...ut(o.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),c.jsx(ke,{...ut(o.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),c.jsx(we,{children:c.jsx(Xr,{...Ks(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(we,{property:s,separator:!0,children:c.jsxs(Rr,{...us(s,S,uH),renderItem:x=>AS(x).label,previewStyle:x=>AS(x).style,children:[c.jsxs(we,{children:[c.jsx(ke,{...ut(s.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),c.jsx(ke,{...ut(s.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),c.jsx(we,{children:c.jsx(ke,{...ut(s.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),c.jsx(we,{children:c.jsx(Xr,{...Ks(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(we,{property:a,separator:!0,children:c.jsx(Rr,{...us(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(we,{children:[c.jsx(_e,{...OS(a,"filter",S),label:r("filter.type")}),c.jsx(ke,{...Zg(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(we,{property:i,separator:!0,children:c.jsx(Rr,{...us(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(we,{children:[c.jsx(_e,{..._t(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),c.jsx(ke,{...Zg(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(we,{property:l,separator:!0,children:c.jsxs(Rr,{...us(l,S),children:[c.jsx(we,{children:c.jsx(_e,{..._t(l.getProperty("transition-property"),S),label:r("transition.type")})}),c.jsx(we,{children:c.jsx(_e,{..._t(l.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),c.jsxs(we,{children:[c.jsx(ke,{...ut(l.getProperty("transition-duration"),S),label:r("transition.duration")}),c.jsx(ke,{...ut(l.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),c.jsx(we,{property:u,separator:!0,children:c.jsx(Rr,{...us(u,S),children:c.jsxs(we,{children:[c.jsx(_e,{...OS(u,"transform",S),label:r("transform.type")}),c.jsx(ke,{...Zg(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(En,{property:w,...S}),c.jsx(En,{property:y,...S}),c.jsx(we,{property:p,children:c.jsx(Rt,{...no(p,S)})}),c.jsx(we,{property:[f,h,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(we,{property:[f,h],children:[c.jsx(ke,{...ut(f,S)}),c.jsx(Rt,{...no(h,S)})]}),c.jsx(En,{property:d,...S}),E.length>0&&c.jsx(eo,{properties:E,...S})]})}function pH(e,t){return e.indexOf(t)>=0}const yt=se.s,Bu="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",zu="M6 6v12h13V6H6zm0-1h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm6-5h1v24h-1V0z",Uu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",MS="M2 6v12h6V6H2zm0 13v5H1V0h1v5h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H2zM16 6v12h6V6h-6zm6-1V0h1v24h-1v-5h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1h6z",LS="M11 0h1v24h-1V0zM1 6h6v12H1V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H1a1 1 0 01-1-1V6c0-.6.4-1 1-1zm15 1h6v12h-6V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1z",fH="M3 6v12h6V6H3zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H3a1 1 0 01-1-1V6c0-.6.4-1 1-1zM0 0h1v24H0V0zm14 6v12h6V6h-6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm8-5h1v24h-1V0zM11 0h1v24h-1V0z",Yg="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function gH({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=$e(),[o,s]=g.useState({}),[a,i]=g.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),p=e.getProperty("align-items"),f=e.getProperty("flex-wrap"),h=e.getProperty("align-content"),m=e.getProperty("align-self"),b=e.getProperty("order"),v=e.getProperty("gap"),w=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},S=[l,u,d,p,f,h,m,b,v,w].map(B=>B.id),C=e.getProperties().filter(B=>!S.includes(`${B.id}`)),E=B=>r.t(`styleManager.layout.${B}`),x=l.getValue(),P=x==="flex",_=(a.display||"").indexOf("flex")>=0,T=u.getValue(),O=T.indexOf("reverse")>=0,M=!pH(["column","column-reverse"],T),A=[{id:"row",label:c.jsx(ne,{icon:K.arrowRight,size:se.sx}),title:E("direction.title.row")},{id:"row-reverse",label:c.jsx(ne,{icon:K.arrowRight,size:yt,horizontal:!0}),title:E("direction.title.row-reverse")},{id:"column",label:c.jsx(ne,{icon:K.arrowDown,size:se.sx}),title:E("direction.title.column")},{id:"column-reverse",label:c.jsx(ne,{icon:K.arrowDown,size:yt,vertical:!0}),title:E("direction.title.column-reverse")}],$=[{id:"flex-start",title:E("justify.title.start"),label:c.jsx(ne,{icon:Bu,size:yt,rotate:M?0:90,horizontal:M&&O,vertical:!M&&O})},{id:"center",title:E("justify.title.center"),label:c.jsx(ne,{icon:zu,size:yt,rotate:M?0:90})},{id:"flex-end",title:E("justify.title.end"),label:c.jsx(ne,{icon:Uu,size:yt,rotate:M?0:90,horizontal:M&&O,vertical:!M&&O})},{id:"space-between",title:E("justify.title.spaceBetween"),label:c.jsx(ne,{icon:MS,size:yt,rotate:M?0:90})},{id:"space-around",title:E("justify.title.spaceAround"),label:c.jsx(ne,{icon:LS,size:yt,rotate:M?0:90})},{id:"space-evenly",title:E("justify.title.spaceEvenly"),label:c.jsx(ne,{icon:fH,size:yt,rotate:M?0:90})}],j=[{id:"stretch",title:E("align.title.stretch"),label:c.jsx(ne,{icon:Yg,size:yt,rotate:M?0:90})},{id:"flex-start",title:E("align.title.start"),label:c.jsx(ne,{icon:Bu,size:yt,rotate:M?90:0})},{id:"center",title:E("align.title.center"),label:c.jsx(ne,{icon:zu,size:yt,rotate:M?90:0})},{id:"flex-end",title:E("align.title.end"),label:c.jsx(ne,{icon:Uu,size:yt,rotate:M?90:0})}],L=[{id:"flex-start",title:E("alignContent.title.start"),label:c.jsx(ne,{icon:Bu,size:yt,rotate:M?90:0,horizontal:M&&O,vertical:!M&&O})},{id:"center",title:E("alignContent.title.center"),label:c.jsx(ne,{icon:zu,size:yt,rotate:M?90:0})},{id:"flex-end",title:E("alignContent.title.end"),label:c.jsx(ne,{icon:Uu,size:yt,rotate:M?90:0,horizontal:M&&O,vertical:!M&&O})},{id:"space-between",title:E("alignContent.title.spaceBetween"),label:c.jsx(ne,{icon:MS,size:yt,rotate:M?90:0})},{id:"space-around",title:E("alignContent.title.spaceAround"),label:c.jsx(ne,{icon:LS,size:yt,rotate:M?90:0})},{id:"stretch",title:E("alignContent.title.stretch"),label:c.jsx(ne,{icon:Yg,size:yt,rotate:M?0:90})}],H=[{id:"auto",title:E("alignSelf.title.auto"),label:c.jsx(ne,{icon:K.close,size:yt})},{id:"flex-start",title:E("alignSelf.title.start"),label:c.jsx(ne,{icon:Bu,size:yt,rotate:90})},{id:"center",title:E("alignSelf.title.center"),label:c.jsx(ne,{icon:zu,size:yt,rotate:90})},{id:"flex-end",title:E("alignSelf.title.end"),label:c.jsx(ne,{icon:Uu,size:yt,rotate:90})},{id:"stretch",title:E("alignSelf.title.stretch"),label:c.jsx(ne,{icon:Yg,size:yt,rotate:0})}],W=[{id:"0 0 auto",label:c.jsx(ne,{icon:K.close,size:yt}),title:E("flex.title.auto")},{id:"1 1 0%",label:c.jsx(ne,{icon:K.unfoldMoreHorizontal,size:yt,rotate:90}),title:E("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(ne,{icon:K.unfoldLessHorizontal,size:yt,rotate:90}),title:E("flex.title.hugContents")}];return g.useEffect(()=>{if(!n)return()=>{};const{Styles:B}=n,G=()=>{const V=n.getSelected();let k={},z={};if(V){const Y=V.getEl();if(Y){k=window.getComputedStyle(Y);const X=Y.parentElement;X&&(z=window.getComputedStyle(X))}}s(k),i(z)},D=B.events.target;return n.on(D,G),G(),()=>n.off(D,G)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(we,{children:c.jsx(_e,{..._t(l,y),...Xg,tip:E(`display.tips.${x}`)})}),P&&c.jsxs(c.Fragment,{children:[c.jsx(we,{children:c.jsx(Rt,{...no(u,y),options:A})}),c.jsx(we,{children:c.jsx(Rt,{...no(d,y),options:$})}),c.jsx(we,{children:c.jsx(Rt,{...no(p,y),options:j})}),c.jsx(we,{children:c.jsx(En,{property:v,...y})}),c.jsx(we,{children:c.jsx(_e,{..._t(f,y),...Xg})}),f.getValue()!=="nowrap"&&c.jsx(we,{children:c.jsx(Rt,{...no(h,y),options:L})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(we,{separatorTop:!0,children:E("flexChild")}),c.jsx(we,{children:c.jsx(En,{property:w,options:W,...y})}),c.jsx(we,{children:c.jsx(Rt,{...no(m,y),options:H})}),c.jsx(we,{children:c.jsx(ke,{...ut(b,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(eo,{properties:C,...y})]})}const hH=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function mH({sector:e,styleManagerDataConfig:t}){var w;const n=$e(),r=e.getProperty("position"),o=r.getValue(),s=e.getProperty("top"),a=e.getProperty("right"),i=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},p=y=>n.t(`styleManager.position.${y}`),f=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),h=e.getProperties().filter(y=>!f.includes(`${y.id}`)),m=hH.map(y=>({id:y,label:p(`presets.options.${y}`)})),b=["absolute","fixed"].includes(o),v=y=>{let S="auto",C="auto",E="auto",x="auto";switch(y){case"topLeft":S="0%",x="0%";break;case"topRight":S="0%",C="0%";break;case"bottomLeft":E="0%",x="0%";break;case"bottomRight":E="0%",C="0%";break;case"left":S="0%",E="0%",x="0%";break;case"right":S="0%",E="0%",C="0%";break;case"bottom":x="0%",E="0%",C="0%";break;case"top":x="0%",S="0%",C="0%";break;case"full":x="0%",S="0%",C="0%",E="0%";break}s.upValue(S),a.upValue(C),i.upValue(E),l.upValue(x)};return c.jsxs(c.Fragment,{children:[c.jsxs(we,{property:r,children:[c.jsx(_e,{..._t(r,d),tip:p(`tips.${(w=r.getOption())==null?void 0:w.id}`),...Xg}),b&&c.jsx(F,{children:c.jsx(Gt,{title:p("presets.title"),children:c.jsx(_e,{options:m,onChange:v,emptyState:"P",size:"s",caret:"",value:!0})})})]}),o!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(we,{col:!0,children:[c.jsx(I,{className:Q("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(ke,{...ut(s,d)})}),c.jsxs(I,{gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(ke,{...ut(l,d)})}),c.jsx(F,{grow:!0,children:c.jsx(ke,{...ut(a,d)})})]}),c.jsx(I,{className:Q("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(ke,{...ut(i,d)})})]}),c.jsx(we,{children:c.jsx(ke,{...ut(u,d)})})]}),h.length>0&&c.jsx(eo,{properties:h,...d})]})}function bH({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),r=e.getProperty("min-width"),o=e.getProperty("max-width"),s=e.getProperty("height"),a=e.getProperty("min-height"),i=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,r,o,s,a,i].map(p=>p==null?void 0:p.id),d=e.getProperties().filter(p=>!u.includes(`${p.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(we,{property:[n,s],children:[c.jsx(ke,{...ut(n,l)}),c.jsx(ke,{...ut(s,l)})]}),c.jsxs(we,{property:[r,a],children:[c.jsx(ke,{...ut(r,l)}),c.jsx(ke,{...ut(a,l)})]}),c.jsxs(we,{property:[o,i],children:[c.jsx(ke,{...ut(o,l)}),c.jsx(ke,{...ut(i,l)})]}),d.length>0&&c.jsx(eo,{properties:d,...l})]})}function vH({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),r=e.getProperty("margin"),o={sector:e,styleManagerDataConfig:t},s=[n,r].map(i=>i==null?void 0:i.id),a=e.getProperties().filter(i=>!s.includes(`${i.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,...o}),c.jsx(En,{property:r,...o}),a.length>0&&c.jsx(eo,{properties:a,...o})]})}function yH({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),r=e.getProperty("color"),o=e.getProperty("font-size"),s=e.getProperty("font-weight"),a=e.getProperty("line-height"),i=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),p=e.getProperty("text-transform"),f=e.getProperty("direction"),h=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},b=[n,r,o,s,a,i,l,u,d,p,f,h].map(y=>y==null?void 0:y.id),v=e.getProperties().filter(y=>!b.includes(`${y.id}`)),{sdkAddFonts:w}=Ni();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(we,{property:n,children:w?c.jsx(Tu,{...kS(n,m)}):c.jsx(_e,{..._t(n,m)})}),!!r&&c.jsx(we,{property:r,children:c.jsx(Xr,{...Ks(r,m)})}),c.jsxs(we,{property:[o,s],children:[!!o&&c.jsx(ke,{...ut(o,m)}),!!s&&c.jsx(_e,{..._t(s,m)})]}),c.jsxs(we,{property:[a,i],children:[!!a&&c.jsx(ke,{...ut(a,m)}),!!i&&c.jsx(ke,{...ut(i,m)})]}),c.jsxs(we,{property:[l,u],children:[!!l&&c.jsx(_e,{..._t(l,m)}),!!u&&c.jsx(_e,{..._t(u,m)})]}),c.jsxs(we,{property:[p,f],children:[!!p&&c.jsx(_e,{..._t(p,m)}),!!f&&c.jsx(_e,{..._t(f,m)})]}),c.jsxs(we,{property:[h,d],children:[!!h&&c.jsx(_e,{..._t(h,m)}),!!d&&c.jsx(_e,{..._t(d,m)})]}),v.length>0&&c.jsx(eo,{properties:v,...m})]})}const Xg={row:!0,classNameLabel:"gs-utl-w-full"},wH=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(F,{grow:!1,children:c.jsx(Co,{property:e,skipClear:t,label:n})}),!!r.length&&c.jsx(I,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:r.map((o,s)=>c.jsx(wt,{...o},s))})]}),Jg="gs-style-manager",Wu=`${Jg}-sector`,SH=`${Wu}-header`,CH=`${Wu}-content`,NS=(e,t=0,n=!0)=>N(SH,U.bgH2,Te.xyS,U.br,t&&re.bt,(e||n)&&re.bb),xH=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),EH=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),Pl=(e,t)=>{const n=PH(e,t),r=mS(n),{hasDataResolverValue:o}=n,{label:s}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:o,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:r.length?"span":void 0,label:c.jsx(wH,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},Qg=(e,t)=>{const{connectDataSources:n,commonProps:r}=Pl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},$S=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=Pl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:xH(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},no=(e,t,n)=>$S(e,t,n).fieldProps,_t=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=$S(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},kS=(e,t)=>{const{commonProps:n,connectDataSources:r}=Pl(e,t),o=r.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:o,hideCaret:r.hasDataResolverValue,value:r.dataResolverValue??e.getValue(),onChange:s=>e.upValue(s)}},us=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=Pl(e,t),{hasDataResolverValue:s,dataResolverValue:a}=r;return{...o,title:e.getLabel(),emptyState:s?a:void 0,titleAdd:`Add new ${e.getLabel()}`,items:s?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:i=>e.getLayerLabel(i),add:s?void 0:()=>e.addLayer(n,{at:0}),select:i=>e.selectLayer(i),remove:i=>e.removeLayer(i),move:(i,l=0)=>e.moveLayer(i,l)}},ut=(e,t)=>{const{connectDataSources:n,commonProps:r}=Pl(e,t),{hasDataResolverValue:o}=n;return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(s,a)=>e.upValue(s,{partial:a}),valueUnit:e.getUnit(),pan:!o,units:o?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:s=>e.upUnit(s)}};function PH(e,t){const{styleManagerDataConfig:n=!1,sector:r}=t,o=e.em.getEditor(),{Styles:s}=o,a=o.getSelected(),i=s.getSelectedAll(),l=s.getSelected();let u=!1;n===!0?u=!0:a&&oo(n)&&ot(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),p=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",f=ss(p),h=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:f,dataResolverValue:f?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{i.forEach(b=>{b.addStyle({[d]:m})})},handleValueClear:()=>{i.forEach(m=>{const b=m.getStyle()[d]??"";m.addStyle({[d]:b})})},editor:o,additionalSources:h}}const Ks=(e,t)=>Qg(e,t),TH=(e,t)=>{const{label:n,...r}=Qg(e,t);return{...r,label:n,isContain:e.get("contain")??!0,hideButton:r.disabled,inputField:e.get("inputField"),onOpen(){const o=e.em.Assets;o.open({select(s){e.upValue(s.getSrc()),o.close()}})}}},OH=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=rH;switch(n){case"gs-layout":r=gH;break;case"gs-size":r=bH;break;case"gs-space":r=vH;break;case"gs-position":r=mH;break;case"gs-borders":r=cH;break;case"gs-effects":r=dH;break;case"gs-typography":r=yH;break;case"gs-background":r=lH;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},Rg={},IS=ce(function({className:t,sectors:n}){var m;const[r,o]=g.useState(Rg),s=Ce(),{editor:a}=s,i=a==null?void 0:a.Styles,l=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected(),d=`${Jg}__empty-state ${Te.s} gs-utl-text-center`,p=b=>a==null?void 0:a.t(`styleManager.${b}`);if(g.useEffect(()=>{if(u&&a){const b=setTimeout(()=>{let v=Rg;const w=u.get("styleManager");ot(w)&&(v=w({editor:a,component:u})),o(v||Rg)});return()=>clearTimeout(b)}},[u,a]),!i||!l)return c.jsx(F,{className:d,children:p("empty")});const f=n.length?n:i.getSectors({visible:!0}),h=(m=s.sdkOptions.dataSources)==null?void 0:m.styleManager;return r.disabled?null:c.jsxs("div",{className:N(Jg,t,"gs-utl-select-none"),children:[!f.length&&c.jsx(F,{className:d,children:p("notFound")}),f.map((b,v)=>c.jsx(wo,{open:b.isOpen(),onChange:({open:w})=>b.setOpen(w),classNameWrap:N(Wu,`${Wu}__${b.id}`),sticky:!0,handler:()=>{const w=b.getProperties({withValue:!0}).length>0,y=b.getProperties({withParentValue:!0}).length>0;return c.jsxs(I,{gap:"xs",items:"center",children:[c.jsx(F,{className:"gs-utl-mr-2",children:b.getName()}),w&&c.jsx(F,{children:c.jsx("div",{className:N(Oe.dot,U.bgA2)})}),y&&c.jsx(F,{children:c.jsx("div",{className:N(Oe.dot,U.bgW)})})]})},className:w=>NS(w,v,v===f.length-1),children:c.jsx(I,{className:N(CH,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:OH(b,{styleManagerDataConfig:h})})},b.id))]})}),_H=Kt(function({children:t,className:n,content:r,...o},s){return c.jsx("div",{className:N(ie("gs-design-manager-tab"),n),ref:s,...o,children:t})}),VS="gs-cmp-sidebar-right",HS="gs-cmp-traits-provider",eh=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function AH(e={}){var T,O,M;const{propsInStyles:t,hideTabs:n,hideSelectors:r,tabsProps:o}=e,{isCssPanelActive:s,selectedDesignerTab:a,showSelectors:i,setSelectedDesignerTab:l,sdkProps:u,sdkOptions:d,isProjectTypeEmail:p}=Ce(),f=$e(),h=N(s&&"gs-utl-hidden"),b=(((T=er(u.children,_H))==null?void 0:T.filter(Boolean))||[]).map(({props:A},$)=>({id:A.id,label:A.label,content:c.jsx(Ui,{children:A.children}),order:A.order??2+$+1})),v=t??((O=d.designPanel)==null?void 0:O.propsInStyles),w=n??((M=d.designPanel)==null?void 0:M.hideTabs),y=v===!0||p&&v!==!1,S=w===!0||p&&w!==!1,C=r===void 0?i:!r,E=f.t("traitManager.panelLabel"),x=N(`${VS}__tabs`,S&&"gs-utl-hidden",o==null?void 0:o.className),_=[{id:"style",label:f.t("styleManager.panelLabel"),order:1,content:c.jsxs(I,{col:!0,full:!0,children:[!!C&&c.jsx(F,{className:N("gs-cmp-selectors-provider",Te.s,re.bb,U.br),children:c.jsx(Zv,{children:A=>c.jsx(SS,{...A})})}),y&&c.jsx(F,{className:N(HS,eh),children:c.jsx(wo,{handler:E,className:NS(!1),sticky:!0,open:!0,children:c.jsx(Sf,{children:A=>c.jsx(zg,{...A,className:N("gs-utl-p-2",U.br,re.bb)})})})}),c.jsx(F,{className:N("gs-cmp-styles-provider",eh),grow:!0,children:c.jsx(Yv,{children:A=>c.jsxs(c.Fragment,{children:[s&&c.jsx(Xv,{}),c.jsx(IS,{className:h,...A})]})})})]})},!y&&{id:"props",label:E,order:2,content:c.jsx(I,{className:HS,col:!0,full:!0,children:c.jsx(F,{className:N(Te.s,eh),children:c.jsx(Sf,{children:A=>c.jsx(zg,{...A})})})})},...b].filter(Boolean).sort((A,$)=>A.order-$.order);return c.jsx(I,{className:VS,col:!0,full:!0,nowrap:!0,children:c.jsx(Ro,{...o,value:a,onChange:l,tabs:_,className:x})})}const jS=ce(AH),MH="gs-panel-sidebar-tabs",LH=g.memo(ce(function({className:t,propsInStyles:n,hideTabs:r,hideSelectors:o,tabsProps:s,...a}){return c.jsx(Ar,{className:N(MH,"gs-utl-h-full",t),...a,children:c.jsx(jS,{propsInStyles:n,hideTabs:r,hideSelectors:o,tabsProps:s})})})),NH="gs-panel-styles",$H=g.memo(ce(function({className:t,...n}){const{isCssPanelActive:r}=Ce(),o=N(r&&" gs-utl-hidden");return c.jsx(Ar,{className:N(NH,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Yv,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(Xv,{}),c.jsx(IS,{className:o,...s})]})})})})),kH="gs-panel-templates",IH=g.memo(ce(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=Ub(),{projectTypeFilter:i}=a;let l=n??a.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),g.useEffect(()=>{n||a.loadTemplates()},[n]),c.jsx(Ar,{className:N(kH,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(I,{className:ie("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(I,{className:ie("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(oy,{templates:l,projectType:Et[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),VH="gs-cmp-row",HH=g.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(VH,U.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:Lt(n)})}),jH="gs-cmp-select-field",DH=g.memo(ce(function({className:t,style:n,label:r,name:o,value:s,options:a,size:i,onChange:l,required:u,disabled:d,emptyState:p,editorEvents:f}){const{editor:h}=Ce(),[m,b]=g.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:p})),v=w=>{l({value:w,editor:h,state:m,setState:y=>b(S=>({...S,...y}))})};return xo({editor:h,editorEvents:f,localState:m,setLocalState:b}),c.jsx(_e,{classNameContainer:N(jH,m.className),style:m.style,label:m.label,name:m.name,value:m.value??"",options:m.options??[],size:m.size,required:m.required,disabled:m.disabled,emptyState:m.emptyState,onChange:v})})),FH="gs-cmp-select-field",BH=g.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,onChange:i,required:l,disabled:u,emptyState:d,editorEvents:p}){const{editor:f}=Ce(),[h,m]=g.useState(()=>({required:l,disabled:u,style:n,className:t,label:r,name:o,value:s,size:a,emptyState:d})),b=v=>{i({value:v,editor:f,state:h,setState:w=>m(y=>({...y,...w}))})};return xo({editor:f,editorEvents:p,localState:h,setLocalState:m}),c.jsx(Tu,{classNameContainer:N(FH,h.className),style:h.style,label:h.label,name:h.name,value:h.value??"",size:h.size,required:h.required,disabled:h.disabled,emptyState:h.emptyState,onChange:b})})),zH="gs-sidebar-bottom",UH=g.memo(ce(function({children:t,className:n,style:r,height:o,...s}){const{isInPreview:a,isBottomSidebarOpen:i}=Ce(),l=o??35,u=g.useMemo(()=>({height:l,marginBottom:a||!i?`-${l}px`:0,...r}),[a,i,r]);return c.jsx(xn,{className:N(zH,"gs-utl-flex gs-utl-transition-spacing",re.bt,U.br,n),style:u,...s,children:t?Lt(t):void 0})})),WH=ce(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:o,isInPreview:s,isLeftSidebarOpen:a,sdkProps:i,showPages:l}=Ce(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,p=d??n,f=t.resizable===!1,h=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",re.br,U.br),m=N("gs-utl-w-full",re.bb,U.br),b=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),v=g.useMemo(()=>({marginLeft:s||!a?`-${p}px`:0,...t.style}),[p,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,E,x)=>{r(x.getBoundingClientRect().width)};return c.jsx(Eu,{className:h,enable:f?!1:void 0,right:!f,style:v,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(I,{full:!0,col:!0,children:[l&&c.jsx(F,{className:m,children:c.jsx(Kv,{children:C=>c.jsxs(c.Fragment,{children:[er(u,iS),c.jsx(sS,{...C}),er(u,aS)]})})}),c.jsx(F,{className:b,grow:!0,children:c.jsx(qv,{children:C=>c.jsxs(c.Fragment,{children:[er(u,Sw),c.jsx(yw,{...C}),er(u,ww)]})})})]})})}),GH="gs-sidebar-left",qH=g.memo(ce(function({children:t,width:n,resizable:r,...o}){return c.jsx(WH,{className:N(GH,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Wc(o)),width:n,resizable:r,style:Gc(o),children:t?Lt(t):void 0})})),KH=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:o,isInPreview:s,isRightSidebarOpen:a}=Ce(),i=((m=t.style)==null?void 0:m.width)??t.width,l=i??n,u=t.resizable===!1,d=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",re.bl,U.br),p=g.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),f=()=>o==null?void 0:o.refresh(),h=(b,v,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(Eu,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:f,onResizeStop:h,children:t.children??c.jsx(jS,{})})}),ZH="gs-sidebar-right",YH=g.memo(ce(function({children:t,resizable:n,...r}){return c.jsx(KH,{className:N(ZH,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Wc(r)),resizable:n,style:Gc(r),children:t?Lt(t):void 0})})),XH=ce(function({className:t,variant:n,value:r,tabs:o,style:s,editorEvents:a,onChange:i}){const{editor:l}=Ce(),[u,d]=g.useState(()=>({tabs:o,style:s,value:r,variant:n,className:t})),p=g.useMemo(()=>{var h;return((h=u.tabs)==null?void 0:h.map(m=>({...m,content:Lt(m.children)})))||[]},[u.tabs]),f=h=>{i&&l?i({value:h,editor:l,state:u,setState:m=>d(b=>({...b,...m}))}):d(m=>({...m,value:h}))};return xo({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Ro,{tabs:p,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:f})}),JH="gs-cmp-text",QH=g.memo(function({className:t,content:n,children:r,...o}){return c.jsx(xn,{className:N(JH,t),...o,children:r||n})}),RH="gs-cmp-virtual-list",ej=ce(function({id:t,items:n,itemLayout:r,footerLayout:o,onRef:s,itemsPerRow:a=12,className:i,style:l,htmlAttrs:u}){const[d,p]=g.useState(0),{editor:f,transitionTime:h}=Ce(),m=Uf(a),b=a===1;g.useEffect(()=>{const S=setTimeout(()=>p(C=>++C),h);return()=>clearTimeout(S)},[h]);const v={id:t,...u},w=!!d&&!!f,y={data:n,style:l,className:N(RH,"gs-utl-h-full",i),itemContent:(S,C)=>c.jsx(g.Fragment,{children:r?Lt(r({item:C,index:S,editor:f})):c.jsx("pre",{children:JSON.stringify(C,void 0,2)})},C.id??S),components:{Footer:o&&f?()=>Lt(o({editor:f})):void 0}};return w&&(b?c.jsx(Wk,{...v,...y,ref:s},t):c.jsx(cu,{...v,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:s},t))});var th=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",e.colorField="colorField",e.colorPicker="colorPicker",e.menuList="menuList",e.inputField="inputField",e.codeField="codeField",e.selectField="selectField",e.selectFontField="selectFontField",e.tabs="tabs",e.devices="devices",e.custom="custom",e.panelLayers="panelLayers",e.panelPages="panelPages",e.panelSelectors="panelSelectors",e.panelStyles="panelStyles",e.panelProperties="panelProperties",e.panelSidebarTabs="panelSidebarTabs",e.panelPagesLayers="panelPagesLayers",e.panelBlocks="panelBlocks",e.panelPageSettings="panelPageSettings",e.panelGlobalStyles="panelGlobalStyles",e.panelAssets="panelAssets",e.panelEditCode="panelEditCode",e.panelTemplates="panelTemplates",e.sidebarLeft="sidebarLeft",e.sidebarRight="sidebarRight",e.sidebarTop="sidebarTop",e.sidebarBottom="sidebarBottom",e.canvas="canvas",e.canvasSidebarTop="canvasSidebarTop",e.virtualList="virtualList",e.dataPathField="dataPathField",e.panelDataVariablePicker="panelDataVariablePicker",e.panelDataConditionPicker="panelDataConditionPicker",e.panelDataCollectionPicker="panelDataCollectionPicker",e.panelDataValuePicker="panelDataValuePicker",e))(th||{});const tj={icon:ne,row:HH,column:T6,text:QH,tabs:XH,button:Bc,buttonMenu:i$,buttonGroupField:c$,colorField:C6,colorPicker:E6,menuList:b8,inputField:h8,codeField:AI,selectField:DH,selectFontField:BH,devices:iy,panelPages:lS,panelPageSettings:nV,panelLayers:Cw,panelPagesLayers:cV,panelBlocks:r9,panelGlobalStyles:g9,panelSelectors:ZV,panelStyles:$H,panelProperties:VV,panelSidebarTabs:LH,panelAssets:D8,panelEditCode:Z8,panelTemplates:IH,sidebarRight:YH,sidebarLeft:qH,sidebarTop:ly,sidebarBottom:UH,canvas:e0,canvasSidebarTop:OI,virtualList:ej,dataPathField:a8,panelDataVariablePicker:f8,panelDataConditionPicker:o8,panelDataCollectionPicker:G6,panelDataValuePicker:c8},Lt=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=Z4();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=dt(r)?{type:th.text,content:r}:r||{},i=a.id||"",l=tj[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),p=i||o;if(u)return c.jsx(Qp,{id:i,...u},p);if(d){const f=d({id:i,...a});return Lt([f])[0]}else{if(s===th.custom)return c.jsx(Qp,{id:i,...a},p);if(l)return c.jsx(l,{id:i,...a},p)}return null})},nj=ce(({components:e})=>($c().customLayoutComponents,Lt(e))),xo=e=>{const{editorEvents:t,editor:n,localState:r,setLocalState:o}=e;g.useEffect(()=>{if(!t||!n)return;const s=Object.keys(t).reduce((i,l)=>(i[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:r,setState:p=>o(f=>({...f,...p}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},rj=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=S4(o.get("name")||`${i.substring(0,20)}`);r[s]={mime:a[1],name:l,base64:i}}return r},{}),oj=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),DS=(e,t,n={})=>{let r=e;const o=n.pathPfx||"";for(const s in t)if(r.includes(s)){const a=t[s];r=r.replace(new RegExp(oj(s),"g"),`${o}${a.name}`),a.found=!0}return r},sj=(e,t,n)=>`${t||""}${e||""}${n||""}`,aj=(e,t)=>{const n=e?`<div ${_c}>${e}</div>`:"",r=t?`<div ${_c} data-gjs-global>${t}</div>`:"";return`${n}${r}`},ij=async(e,t={})=>{const{page:n,skipProject:r,assetsFolder:o="assets",filenameCss:s="style.css",styles:a,isMJML:i,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,f={...l,...e.config.optsHtml||{},...t.optionsHtml},h=[],m=n?[n]:e.Pages.getAll(),b=rj(e),v=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=DS(w,b,{pathPfx:v}),S=a==="inline",C=a==="skip",E=a==="skipInPage",x=p==="skip",P=u?{}:xa(e).globalPageSettings||{},_=[],T=(O,M)=>{var qt,Po,Zs;const{pageSettingOpts:A}=M||{},$=O.getName(),j=S||(A==null?void 0:A.replaceDataSources),L=Wo(O,"title",A)||$,H=Wo(O,"favicon",A),W=Wo(O,"description",A),B=Wo(O,"keywords",A),G=Wo(O,"socialTitle",A),D=Wo(O,"socialDescription",A),V=Wo(O,"socialImage",A),k=u?"":Sb(Wo(O,"fonts")),z=cn({page:O,key:"customCodeHead",opts:A})??"",Y=sj(z,P.customCodeHead,k),X=cn({page:O,key:"customCodeBody",opts:A})??"",ee=d?"":aj(X,P.customCodeBody),J=O.getMainComponent(),q=x?"":e.getJs({component:J}),R=q?`<script>${q}<\/script>`:"",ae=[],le=[],me={asDocument:!1,...f},ve=J.toHTML(me).replace("</body>",()=>`${ee}${R}</body>`),He=J.head;let je=L&&`<title>${L}</title>`,it=H&&`<link rel="icon" href="${H}"/>`,qe=W&&`<meta name="description" content="${W}"/>`,Se=B&&`<meta name="keywords" content="${B}"/>`,Ue=G&&`<meta property="og:title" content="${G}"/>`,et=D&&`<meta property="og:description" content="${D}"/>`,Ct=V&&`<meta property="og:image" content="${V}"/>`,Ne='<meta charset="utf-8">',bt='<meta name="viewport" content="width=device-width,initial-scale=1">',pt='<meta name="robots" content="index,follow">',Ke='<meta name="generator" content="GrapesJS Studio">';He.components().forEach(rt=>{const xt=rt.toHTML(f);gt.title({cmp:rt})?je=xt:gt.favicon({cmp:rt})?it=xt:gt.description({cmp:rt})?qe=xt:gt.keywords({cmp:rt})?Se=xt:gt.socialTitle({cmp:rt})?Ue=xt:gt.socialDescription({cmp:rt})?et=xt:gt.socialImage({cmp:rt})?Ct=xt:gt.charset({cmp:rt})?Ne=xt:gt.viewport({cmp:rt})?bt=xt:gt.robots({cmp:rt})?pt=xt:gt.generator({cmp:rt})&&(Ke=xt)}),je&&ae.push(je),Ne&&ae.push(Ne),bt&&ae.push(bt),pt&&ae.push(pt),Ke&&ae.push(Ke),qe&&ae.push(qe),Se&&ae.push(Se),Ue&&ae.push(Ue),et&&ae.push(et),Ct&&ae.push(Ct),it&&ae.push(it),le.length&&ae.push(...le),Y&&ae.push(Y),y&&!(C||E)&&ae.push(j?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const he=J.doctype||"<!DOCTYPE html>",Be=(Po=(qt=J.docEl).__attrToString)==null?void 0:Po.call(qt,f),ze=(Zs=He.__attrToString)==null?void 0:Zs.call(He,f),De=e.getHtml(f).trim(),Nt=i?e.runCommand(Vc,{mjml:De}).html:`${he}
335
+ <html${Be?` ${Be}`:""}>
336
+ <head${ze?` ${ze}`:""}>
337
+ ${ae.join(`
338
338
  `)}
339
339
  </head>
340
- ${Ce}
340
+ ${ve}
341
341
  </html>
342
- `;return{filename:zp(e,O),content:ES(Mt,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(O=>{if(Tc(O)){const A=O.getMainComponent(),{dataSourceItem:$}=t,B=$?[$]:A.getDataSourceItems(),M=A.resolverCurrentItem;Object.entries(B).forEach(([j,W])=>{const D=W;A.setResolverCurrentItem(D.id??j);const z=T(O,{pageSettingOpts:{replaceDataSources:!0}}),{path:I,filename:H}=Pv(O,{currentItem:D});z.path=I,z.filename=H,_.push(z)}),A.setResolverCurrentItem(M)}else _.push(T(O))}),g.push(..._),i&&m.forEach(O=>{g.push({filename:zp(e,O,"mjml"),content:O.getMainComponent().toHTML(f),mimeType:"text/mjml"})});for(const O in v){const L=v[O];L.found&&g.push({path:o,filename:L.name,content:atob(L.base64),mimeType:L.mime})}return y&&!S&&!C&&g.push({filename:s,content:y,mimeType:"text/css"}),r||g.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),g};function HH(e){const{Components:t,Blocks:n}=e,r=o=>{const{model:s,id:a}=o,i=s.getDefaults(),l=n.get(a),u=i.icon,d=l==null?void 0:l.get("media"),p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M19 3H5c-1.11 0-2 .89-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z"></path></svg>',f=u&&u!==p&&!d?u:d||p;t.addType(a,{model:{defaults:{icon:f}}})};t.getTypes().forEach(r),e.on("component:type:add",r)}const jH=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:r}=e;e.on(r.events.frameLoad,({window:o,el:s})=>{o.document.addEventListener("contextmenu",async i=>{if(!n.isEnabled||e.getEditing())return;i.preventDefault();const l=i.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=s.getBoundingClientRect(),p=r.getZoomDecimal();e.runCommand(ne.contextMenuComponent,{component:u,event:i,x:i.clientX*p+d.left,y:i.clientY*p+d.top})}})})};function DH(e,t){var g;const{Components:n,I18n:r}=e,{appStore:o}=t,s=r.t("dataSources.collection"),a=Bt.collection,i=Bt.collectionItem,l="data-type-data-collection",u='<svg viewBox="0 0 24 24"><path d="M2 14H8V20H2M16 8H10V10H16M2 10H8V4H2M10 4V6H22V4M10 20H16V18H10M10 16H22V14H10" /></svg>',d=(g=t.appStore.sdkOptions.dataSources)==null?void 0:g.blocks,p=m=>{const v=m.is(a)?m:m.closestType(a);if(!v)return;const b="dataCollectionPicker",w={id:b,header:!1,layout:{type:"panelDataCollectionPicker",component:v,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:b})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(ne.layoutToggle,{...w})},f=({items:m,component:v})=>[{id:`open-${a}-picker`,label:eh,command:()=>p(v)},...m];n.addType(i,{isComponent:m=>Sa(m,i),model:{defaults:{...rh(o),name:r.t("dataSources.collectionItem"),copyable:!1,emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M22 13H14V11H22V13M22 7H14V9H22V7M14 17H22V15H14V17M12 9V15C12 16.1 11.1 17 10 17H4C2.9 17 2 16.1 2 15V9C2 7.9 2.9 7 4 7H10C11.1 7 12 7.9 12 9M10.5 15L8.3 12L6.5 14.3L5.3 12.8L3.5 15H10.5Z" /></svg>',toolbarItems:f}}}),n.addType(a,{isComponent:m=>Ti(m,l)||Sa(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...th},model:{defaults:{...nh(o),icon:u,name:s,attributes:{[l]:!0},toolbarItems:f},init(){const m="collection-";if(!this.getCollectionId()){const b=m+Math.random().toString(36).substring(2,9);this.setCollectionId(b)}}},view:{onActive(m){m==null||m.stopPropagation(),p(this.model)}}})}function FH(e,t){var w;const{Components:n,I18n:r}=e,o=r.t("dataSources.condition"),s=r.t("dataSources.conditionTrue"),a=r.t("dataSources.conditionFalse"),i=r.t("dataSources.conditionElse"),{appStore:l}=t,u=(w=l.sdkOptions.dataSources)==null?void 0:w.blocks,d=Bt.condition,p=Bt.conditionTrue,f=Bt.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
342
+ `;return{filename:Kp(e,O),content:DS(Nt,b,{pathPfx:v}),mimeType:"text/html"}};m.forEach(O=>{if(Mc(O)){const A=O.getMainComponent(),{dataSourceItem:$}=t,j=$?[$]:A.getDataSourceItems(),L=A.resolverCurrentItem;Object.entries(j).forEach(([H,W])=>{const B=W;A.setResolverCurrentItem(B.id??H);const G=T(O,{pageSettingOpts:{replaceDataSources:!0}}),{path:D,filename:V}=kb(O,{currentItem:B});G.path=D,G.filename=V,_.push(G)}),A.setResolverCurrentItem(L)}else _.push(T(O))}),h.push(..._),i&&m.forEach(O=>{h.push({filename:Kp(e,O,"mjml"),content:O.getMainComponent().toHTML(f),mimeType:"text/mjml"})});for(const O in b){const M=b[O];M.found&&h.push({path:o,filename:M.name,content:atob(M.base64),mimeType:M.mime})}return y&&!S&&!C&&h.push({filename:s,content:y,mimeType:"text/css"}),r||h.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),h};function lj(e){const{Components:t,Blocks:n}=e,r=o=>{const{model:s,id:a}=o,i=s.getDefaults(),l=n.get(a),u=i.icon,d=l==null?void 0:l.get("media"),p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M19 3H5c-1.11 0-2 .89-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z"></path></svg>',f=u&&u!==p&&!d?u:d||p;t.addType(a,{model:{defaults:{icon:f}}})};t.getTypes().forEach(r),e.on("component:type:add",r)}const cj=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:r}=e;e.on(r.events.frameLoad,({window:o,el:s})=>{o.document.addEventListener("contextmenu",async i=>{if(!n.isEnabled||e.getEditing())return;i.preventDefault();const l=i.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=s.getBoundingClientRect(),p=r.getZoomDecimal();e.runCommand(te.contextMenuComponent,{component:u,event:i,x:i.clientX*p+d.left,y:i.clientY*p+d.top})}})})};function uj(e,t){var h;const{Components:n,I18n:r}=e,{appStore:o}=t,s=r.t("dataSources.collection"),a=zt.collection,i=zt.collectionItem,l="data-type-data-collection",u='<svg viewBox="0 0 24 24"><path d="M2 14H8V20H2M16 8H10V10H16M2 10H8V4H2M10 4V6H22V4M10 20H16V18H10M10 16H22V14H10" /></svg>',d=(h=t.appStore.sdkOptions.dataSources)==null?void 0:h.blocks,p=m=>{const b=m.is(a)?m:m.closestType(a);if(!b)return;const v="dataCollectionPicker",w={id:v,header:!1,layout:{type:"panelDataCollectionPicker",component:b,onConfirm:()=>e.runCommand(te.layoutRemove,{id:v})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(te.layoutToggle,{...w})},f=({items:m,component:b})=>[{id:`open-${a}-picker`,label:sg,command:()=>p(b)},...m];n.addType(i,{isComponent:m=>Ca(m,i),model:{defaults:{...lg(o),name:r.t("dataSources.collectionItem"),copyable:!1,emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M22 13H14V11H22V13M22 7H14V9H22V7M14 17H22V15H14V17M12 9V15C12 16.1 11.1 17 10 17H4C2.9 17 2 16.1 2 15V9C2 7.9 2.9 7 4 7H10C11.1 7 12 7.9 12 9M10.5 15L8.3 12L6.5 14.3L5.3 12.8L3.5 15H10.5Z" /></svg>',toolbarItems:f}}}),n.addType(a,{isComponent:m=>_i(m,l)||Ca(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...ag},model:{defaults:{...ig(o),icon:u,name:s,attributes:{[l]:!0},toolbarItems:f},init(){const m="collection-";if(!this.getCollectionId()){const v=m+Math.random().toString(36).substring(2,9);this.setCollectionId(v)}}},view:{onActive(m){m==null||m.stopPropagation(),p(this.model)}}})}function dj(e,t){var w;const{Components:n,I18n:r}=e,o=r.t("dataSources.condition"),s=r.t("dataSources.conditionTrue"),a=r.t("dataSources.conditionFalse"),i=r.t("dataSources.conditionElse"),{appStore:l}=t,u=(w=l.sdkOptions.dataSources)==null?void 0:w.blocks,d=zt.condition,p=zt.conditionTrue,f=zt.conditionFalse,h="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
343
343
  <path d="M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29" />
344
- </svg>`,v=y=>{const S=y.is(d)?y:y.closestType(d);if(!S)return;const C="dataConditionPicker",x={id:C,header:!1,layout:{type:"panelDataConditionPicker",component:S,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(ne.layoutToggle,{...x})},b=({items:y,component:S})=>[{id:`open-${d}-picker`,label:eh,command:()=>v(S)},...y];n.addType(p,{isComponent:y=>Sa(y,p),model:{defaults:{...rh(l),tagName:"span",name:s,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:b}}}),n.addType(f,{isComponent:y=>Sa(y,f),model:{defaults:{...rh(l),tagName:"span",name:a,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:b}}}),n.addType(d,{isComponent:y=>Ti(y,g)||Sa(y,d),block:u&&{label:o,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:p},{type:f}]},...th},model:{defaults:{...nh(l),icon:m,name:o,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:b}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,_n.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),v(this.model))},getConditionString(){const{model:y}=this,{operator:S,statements:C=[]}=y.getCondition(),x=S==="AND"?" AND ":" OR ",P=C.map(_=>{const{left:T="",operator:O="",right:L=""}=_,A=_y(T),$=_y(L);return`(${A} ${O} ${$})`}).join(x);return`${o}: ${P}`},renderDataResolver(){const y=this.model,S=y.getIfTrueContent(),C=y.getIfFalseContent(),x=S==null?void 0:S.getEl(),E=C==null?void 0:C.getEl();if(e.runCommand(ne.getStateDataSource).showPlaceholder){x&&(x.style.display="",x.style.setProperty(zs,`"${this.getConditionString()} "`)),E&&(E.style.display="",E.style.setProperty(zs,`" ${i} "`));return}const _=y.isTrue();x&&(x.style.removeProperty(zs),x.style.display=_?"":"none"),E&&(E.style.removeProperty(zs),E.style.display=_?"none":"")}}})}function BH(e,t){var p;const{Components:n,I18n:r}=e,o=Bt.variable,s="data-type-data-variable",a="Variable",i=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${Kl.codeBraces}"/></svg>`,{appStore:l}=t,u=(p=l.sdkOptions.dataSources)==null?void 0:p.blocks,d=f=>{const g="dataVariablePicker",m={id:g,header:!1,layout:{type:"panelDataVariablePicker",component:f,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:g})},placer:{type:"dialog",title:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(ne.layoutToggle,{...m})};n.addType(o,{isComponent:f=>Ti(f,s)||Sa(f,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...th},model:{defaults:{...nh(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:f,component:g})=>[{id:`open-${o}-modal`,label:eh,command:()=>d(g)},...f]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:f}=this;this.listenTo(f,_n.toggleDataSourcesPreview,this.renderDataResolver)},onActive(f){e.getEditing()||(f==null||f.stopPropagation(),d(this.model))},renderDataResolver(){const{model:f,el:g}=this;if(e.runCommand(ne.getStateDataSource).showPlaceholder){const v=f.getPath();g.textContent="",g.style.setProperty(zs,`"${Ay(v)}"`);return}g.style.removeProperty(zs),g.textContent=f.getDataValue()}}})}const ja=(e,t,n)=>{const r=e.Components.getType(t);if(!r){console.warn(`Component type ${t} not found`);return}const o=r.model;e.Components.addType(t,{model:{...n,toHTML(s){var i;const{exporter:a}=s??{};return a?((i=n.toHTML)==null?void 0:i.call(this,s))??"":o.prototype.toHTML.call(this,s)??""}}})};function Fu({component:e,value:t,getCustomPath:n}){if(no(t)&&t.path&&!t.collectionId&&n){const r=t.path??"",o=r.split(".");return{...t,path:n({component:e,path:r,paths:o})}}return t}function zH(e,{isProjectTypeEmail:t}){const n=({content:s})=>t?`<mj-raw>${s}</mj-raw>`:s,r=({content:s})=>s;function o(s){const a=this.getInnerHTML(s);if(t||s.skipTags)return a;const i=this.tagName,l=this.__attrToString(s),u=l?` ${l}`:"",d=`<${i}${u}>`,p=`</${i}>`;return`${d}${a}${p}`}ja(e,Bt.variable,{toHTML(s){var b;const a=s.skipTags??t,i=s.exporter,l=s.wrapTemplateContent??r,u=w=>l({component:this,content:w}),d=this.tagName,p=this.__attrToString(s),f=(b=this.getDataResolver)==null?void 0:b.call(this),g=Fu({component:this,value:f,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return a?v:`<${d}${p?` ${p}`:""}>${v}</${d}>`}}),ja(e,Bt.condition,{toHTML(s){var S,C,x;const{exporter:a}=s,i=s.wrapTemplateContent??n,l=E=>i({component:this,content:E}),u={component:this},d=s==null?void 0:s.getCustomPath,[p,f]=((S=this.components())==null?void 0:S.models)??[],g=(C=this.getDataResolver)==null?void 0:C.call(this),m=((x=this.resolveCondition)==null?void 0:x.call(this,g==null?void 0:g.condition,d))??{};let v="";if(f){const E=a.getConditionElseSyntax(u);v=`
345
- ${l(E)}
346
- ${f.toHTML(s)??""}`}const b=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
347
- ${`${l(b)}
348
- ${(p==null?void 0:p.toHTML(s))??""}${v}
344
+ </svg>`,b=y=>{const S=y.is(d)?y:y.closestType(d);if(!S)return;const C="dataConditionPicker",E={id:C,header:!1,layout:{type:"panelDataConditionPicker",component:S,onConfirm:()=>e.runCommand(te.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(te.layoutToggle,{...E})},v=({items:y,component:S})=>[{id:`open-${d}-picker`,label:sg,command:()=>b(S)},...y];n.addType(p,{isComponent:y=>Ca(y,p),model:{defaults:{...lg(l),tagName:"span",name:s,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:v}}}),n.addType(f,{isComponent:y=>Ca(y,f),model:{defaults:{...lg(l),tagName:"span",name:a,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:v}}}),n.addType(d,{isComponent:y=>_i(y,h)||Ca(y,d),block:u&&{label:o,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:p},{type:f}]},...ag},model:{defaults:{...ig(l),icon:m,name:o,textable:!0,stylable:!1,tagName:"span",attributes:{[h]:!0},toolbarItems:v}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,_n.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),b(this.model))},getConditionString(){const{model:y}=this,{operator:S,statements:C=[]}=y.getCondition(),E=S==="AND"?" AND ":" OR ",P=C.map(_=>{const{left:T="",operator:O="",right:M=""}=_,A=Hy(T),$=Hy(M);return`(${A} ${O} ${$})`}).join(E);return`${o}: ${P}`},renderDataResolver(){const y=this.model,S=y.getIfTrueContent(),C=y.getIfFalseContent(),E=S==null?void 0:S.getEl(),x=C==null?void 0:C.getEl();if(e.runCommand(te.getStateDataSource).showPlaceholder){E&&(E.style.display="",E.style.setProperty(Us,`"${this.getConditionString()} "`)),x&&(x.style.display="",x.style.setProperty(Us,`" ${i} "`));return}const _=y.isTrue();E&&(E.style.removeProperty(Us),E.style.display=_?"":"none"),x&&(x.style.removeProperty(Us),x.style.display=_?"none":"")}}})}function pj(e,t){var p;const{Components:n,I18n:r}=e,o=zt.variable,s="data-type-data-variable",a="Variable",i=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${Jl.codeBraces}"/></svg>`,{appStore:l}=t,u=(p=l.sdkOptions.dataSources)==null?void 0:p.blocks,d=f=>{const h="dataVariablePicker",m={id:h,header:!1,layout:{type:"panelDataVariablePicker",component:f,onConfirm:()=>e.runCommand(te.layoutRemove,{id:h})},placer:{type:"dialog",title:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(te.layoutToggle,{...m})};n.addType(o,{isComponent:f=>_i(f,s)||Ca(f,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...ag},model:{defaults:{...ig(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:f,component:h})=>[{id:`open-${o}-modal`,label:sg,command:()=>d(h)},...f]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:f}=this;this.listenTo(f,_n.toggleDataSourcesPreview,this.renderDataResolver)},onActive(f){e.getEditing()||(f==null||f.stopPropagation(),d(this.model))},renderDataResolver(){const{model:f,el:h}=this;if(e.runCommand(te.getStateDataSource).showPlaceholder){const b=f.getPath();h.textContent="",h.style.setProperty(Us,`"${jy(b)}"`);return}h.style.removeProperty(Us),h.textContent=f.getDataValue()}}})}const Fa=(e,t,n)=>{const r=e.Components.getType(t);if(!r){console.warn(`Component type ${t} not found`);return}const o=r.model;e.Components.addType(t,{model:{...n,toHTML(s){var i;const{exporter:a}=s??{};return a?((i=n.toHTML)==null?void 0:i.call(this,s))??"":o.prototype.toHTML.call(this,s)??""}}})};function Gu({component:e,value:t,getCustomPath:n}){if(oo(t)&&t.path&&!t.collectionId&&n){const r=t.path??"",o=r.split(".");return{...t,path:n({component:e,path:r,paths:o})}}return t}function fj(e,{isProjectTypeEmail:t}){const n=({content:s})=>t?`<mj-raw>${s}</mj-raw>`:s,r=({content:s})=>s;function o(s){const a=this.getInnerHTML(s);if(t||s.skipTags)return a;const i=this.tagName,l=this.__attrToString(s),u=l?` ${l}`:"",d=`<${i}${u}>`,p=`</${i}>`;return`${d}${a}${p}`}Fa(e,zt.variable,{toHTML(s){var v;const a=s.skipTags??t,i=s.exporter,l=s.wrapTemplateContent??r,u=w=>l({component:this,content:w}),d=this.tagName,p=this.__attrToString(s),f=(v=this.getDataResolver)==null?void 0:v.call(this),h=Gu({component:this,value:f,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:h}),b=u(m);return a?b:`<${d}${p?` ${p}`:""}>${b}</${d}>`}}),Fa(e,zt.condition,{toHTML(s){var S,C,E;const{exporter:a}=s,i=s.wrapTemplateContent??n,l=x=>i({component:this,content:x}),u={component:this},d=s==null?void 0:s.getCustomPath,[p,f]=((S=this.components())==null?void 0:S.models)??[],h=(C=this.getDataResolver)==null?void 0:C.call(this),m=((E=this.resolveCondition)==null?void 0:E.call(this,h==null?void 0:h.condition,d))??{};let b="";if(f){const x=a.getConditionElseSyntax(u);b=`
345
+ ${l(x)}
346
+ ${f.toHTML(s)??""}`}const v=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
347
+ ${`${l(v)}
348
+ ${(p==null?void 0:p.toHTML(s))??""}${b}
349
349
  ${l(w)}`}
350
- `},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(g8(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:Fu({...i,value:s.left}),right:Fu({...i,value:s.right})}}}),ja(e,Bt.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=P=>l({component:this,content:P}),d={component:this},p=this.getDataResolver(),f={...p,dataSource:Fu({component:this,value:p==null?void 0:p.dataSource,getCustomPath:s==null?void 0:s.getCustomPath})},g=this.components().at(0),m=i.getCollectionStartSyntax({...d,dataResolver:f}),v=i.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(s))??"",w=`${u(m)}
351
- ${b}
352
- ${u(v)}`;if(a)return`
350
+ `},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(A6(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:Gu({...i,value:s.left}),right:Gu({...i,value:s.right})}}}),Fa(e,zt.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=P=>l({component:this,content:P}),d={component:this},p=this.getDataResolver(),f={...p,dataSource:Gu({component:this,value:p==null?void 0:p.dataSource,getCustomPath:s==null?void 0:s.getCustomPath})},h=this.components().at(0),m=i.getCollectionStartSyntax({...d,dataResolver:f}),b=i.getCollectionEndSyntax(d),v=(h==null?void 0:h.toHTML(s))??"",w=`${u(m)}
351
+ ${v}
352
+ ${u(b)}`;if(a)return`
353
353
  ${w}
354
- `;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",x=`<${y}${C}>`,E=`</${y}>`;return`
355
- ${x}${w}${E}
356
- `}}),ja(e,Bt.conditionTrue,{toHTML:o}),ja(e,Bt.conditionFalse,{toHTML:o}),ja(e,Bt.collectionItem,{toHTML:o})}const UH=function(e,t){const{Components:n,Canvas:r,events:o}=e;if(!n.getType(Bt.conditionTrue))return;const{isProjectTypeEmail:s,sdkOptions:a}=t.appStore,{dataSources:i}=a;i!=null&&i.globalData&&e.on(o.projectLoad,()=>{e.DataSources.add({id:js.globalData,records:Ly(i.globalData),skipFromStorage:!0})}),e.on(r.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const f=d.createElement("style"),g=[Bt.variable,Bt.condition,Bt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);f.setAttribute(u,""),f.textContent=`
357
- ${g.join(",")} {
354
+ `;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",E=`<${y}${C}>`,x=`</${y}>`;return`
355
+ ${E}${w}${x}
356
+ `}}),Fa(e,zt.conditionTrue,{toHTML:o}),Fa(e,zt.conditionFalse,{toHTML:o}),Fa(e,zt.collectionItem,{toHTML:o})}const gj=function(e,t){const{Components:n,Canvas:r,events:o}=e;if(!n.getType(zt.conditionTrue))return;const{isProjectTypeEmail:s,sdkOptions:a}=t.appStore,{dataSources:i}=a;i!=null&&i.globalData&&e.on(o.projectLoad,()=>{e.DataSources.add({id:Ds.globalData,records:Dy(i.globalData),skipFromStorage:!0})}),e.on(r.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const f=d.createElement("style"),h=[zt.variable,zt.condition,zt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);f.setAttribute(u,""),f.textContent=`
357
+ ${h.join(",")} {
358
358
  outline: 2px dotted #8b5cf6;
359
359
  }
360
360
 
@@ -366,7 +366,7 @@ ${x}${w}${E}
366
366
  [data-gjs-type="data-variable"]::before,
367
367
  [data-gjs-type="data-condition-true-content"]::before,
368
368
  [data-gjs-type="data-condition-false-content"]::before {
369
- content: var(${zs});
369
+ content: var(${Us});
370
370
  font-style: italic;
371
371
  color: #666;
372
372
  white-space: nowrap;
@@ -377,7 +377,7 @@ ${x}${w}${E}
377
377
  font-weight: 500;
378
378
  font-family: sans-serif;
379
379
  }
380
- `,d.head.appendChild(f)}),BH(e,t),FH(e,t),DH(e,t),zH(e,{isProjectTypeEmail:s})};function WH(e){const{Components:t}=e,n=r=>{const{id:o,model:s}=r;if(o==="custom-code"){const a="<span>Insert here your custom code</span>";t.addType(o,{model:{defaults:{emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path></svg>',classes:"gjs-custom-code",components:a,"custom-code-plugin__code":a,styles:".gjs-custom-code { padding: 5px; }"}}})}if(o==="typed"){const a=s.getDefaults().traits.map(i=>i.name==="strings"?{...i,type:"stack",addItem(l){return{id:l,label:`New string ${l}`}},getValue({component:l}){return l.get("strings").map((u,d)=>({id:`${d}`,label:u}))},setValue:({component:l,value:u})=>{const d=u.map(p=>p.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:i);t.addType(o,{model:{defaults:{traits:a,strings:["These are the default values...!!!","Use your own strings from Properties!","Have a great day!"],icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',classes:"gjs-typed",styles:`
380
+ `,d.head.appendChild(f)}),pj(e,t),dj(e,t),uj(e,t),fj(e,{isProjectTypeEmail:s})};function hj(e){const{Components:t}=e,n=r=>{const{id:o,model:s}=r;if(o==="custom-code"){const a="<span>Insert here your custom code</span>";t.addType(o,{model:{defaults:{emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path></svg>',classes:"gjs-custom-code",components:a,"custom-code-plugin__code":a,styles:".gjs-custom-code { padding: 5px; }"}}})}if(o==="typed"){const a=s.getDefaults().traits.map(i=>i.name==="strings"?{...i,type:"stack",addItem(l){return{id:l,label:`New string ${l}`}},getValue({component:l}){return l.get("strings").map((u,d)=>({id:`${d}`,label:u}))},setValue:({component:l,value:u})=>{const d=u.map(p=>p.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:i);t.addType(o,{model:{defaults:{traits:a,strings:["These are the default values...!!!","Use your own strings from Properties!","Have a great day!"],icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',classes:"gjs-typed",styles:`
381
381
  .gjs-typed {
382
382
  padding: 5px;
383
383
  }
@@ -385,4 +385,4 @@ ${x}${w}${E}
385
385
  <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
386
386
  <path d="M22 9.3c0-.8-.5-1.3-1.3-1.3H3.4C2.5 8 2 8.5 2 9.3v7.4c0 .8.5 1.3 1.3 1.3h17.4c.8 0 1.3-.5 1.3-1.3V9.3zM21 17H3V9h18v8z" fill-rule="nonzero"/><rect x="3" y="5" width="4" height="2" rx=".5"/><rect x="8" y="5" width="4" height="2" rx=".5"/><rect x="13" y="5" width="4" height="2" rx=".5"/>
387
387
  </svg>
388
- `:void 0};o==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(TS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const GH=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},qH=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:r}=e;r.getConfig().uploadFile=async(...o)=>{const s=o[0],a=await n.handleUpload(s),i=o[1];a&&(i==null||i({data:a}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},KH=()=>{const{baseApiUrl:e}=Av();return`${e}/sdk/projects`},PS=e=>`${KH()}/${e}`,ZH=async({licenseKey:e,projectId:t,...n})=>{const r=await jr.put(PS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},YH=async(e,t)=>await jr.put(t,{body:e,headers:{"Content-Type":"application/json"}}),XH=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await ZH({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([o]).size},identityId:r,name:e.name,description:e.description});if(!s)throw new Error("Project not found");const{uploadUrl:a}=s;await YH(o,a)},JH=(e,t,n)=>jr.get(PS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),QH=async e=>await jr.get(e),RH=async(e,t,n,r)=>{const o=await JH(t,n,r),s=o==null?void 0:o.result,a=o==null?void 0:o.errorData;if(!s&&(a!=null&&a.notFoundInDb))return{id:n,project:{}};if(!s)throw new Error("Project not found");const{downloadUrl:i}=s,l=await QH(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},ej=(e,t)=>{const{appEditorStore:n,toastStore:r,i18nStore:o}=t.appStore.store,{isUsingProjectSelfHosted:s,isUsingProjectCloud:a,sdkOptions:i}=n,l=i.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:f,autosaveIntervalMs:g}=l;let m,v,b,w;if(s)b=d,w=p,m=f,v=g;else if(a){const P=i.licenseKey,_=n.sdkProjectId,T=n.sdkIdentityId,O=10,L=1e4;w=({project:A})=>XH(A,P,_,T),b=({editor:A})=>RH(A,P,_,T),m=Math.max(O,f??O),g&&(v=Math.max(L,g))}const{Storage:y,events:S}=e,{events:C}=y,x=P=>P instanceof Error?P.message:typeof P=="string"?P:"Unknown error";let E=!1;if(e.once(S.projectLoad,P=>{E=!!P.loaded}),e.once("change:readyLoad",()=>{var _;const P=(_=i.project)==null?void 0:_.default;!E&&P&&e.loadProjectData(P)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(b||u)&&w){const P="remote";y.setCurrent(P),y.add(P,{async load(){return u||(await b({editor:e})).project},async store(_){await w({project:_,editor:e})}}),e.on(C.errorLoad,_=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:x(_)})}),e.on(C.errorStore,_=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:x(_)})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const _=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(_))})}},Bu="select-target",TS="enable-sm";function tj(e,t){var j,W,D,z;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:f,sdkOptions:g}=r,m=()=>o.toggleOpen(),v=()=>r.toggleLeftSidebar(),b=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,x=C.events,E=e.events,P=(W=(j=g.gjsOptions)==null?void 0:j.assetManager)==null?void 0:W.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Ht(P)&&(y.getConfig().custom=P),f&&(w.projectData=f,r.setNextProjectData()),p){const I=S.getConfig().options;I&&(I.local.key=p)}e.on(E.projectLoad,({project:I})=>{var H;n.setProjectDataCustom(I.custom||{projectType:(H=r.sdkOptions.project)==null?void 0:H.type}),d.loadFonts()}),e.on(E.projectGet,({project:I})=>{I.custom=Ca(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:T}=e,O=zo(()=>r.setCanvasPanning(!1),200);e.on(T.events.coords,()=>{r.setCanvasPanning(!0),O()}),e.on(T.events.frameLoad,({el:I})=>{I.tabIndex=-1});const{Parser:L}=e,A=((D=r.sdkOptions.parser)==null?void 0:D.showErrors)!==!1;(z=L.events)!=null&&z.css&&A&&e.on(L.events.css,I=>{const{error:H}=I;if(H){const V=ct(H)?H:H.name&&H.reason?`${H.name}: ${H.reason}`:H.message;s.addError("css-error",{header:"CSS Parser Error",content:V})}});const{builtIn:$}=e.StyleManager;$.add("border-radius",{type:"composite",properties:[{...$.get("border-top-left-radius"),id:"border-top-left-radius-sub"},{...$.get("border-top-right-radius"),id:"border-top-right-radius-sub"},{...$.get("border-bottom-right-radius"),id:"border-bottom-right-radius-sub"},{...$.get("border-bottom-left-radius"),id:"border-bottom-left-radius-sub"}]}),[{id:"toggle-lsidebar",keys:"alt+ctrl+,",cmd:v},{id:"toggle-lsidebar2",keys:"alt+⌘+,",cmd:v},{id:"toggle-rsidebar",keys:"alt+ctrl+., alt+⌘+.",cmd:b},{id:"show-blocks",keys:"ctrl+b, ⌘+b",cmd:m},{id:"add-symbol",keys:"alt+ctrl+k, alt+⌘+k",cmd:ne.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:ne.symbolDetach}].forEach(({id:I,keys:H,cmd:V})=>{e.Keymaps.add(`preset:${I}`,H,V,{prevent:!0})}),e.on(`${x.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),Eb(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),Eb(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const B="target-selection",{Components:M}=e;C.add(Bu,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(I,H){const V={id:B,type:"target",component:H};H?T.addSpot(V):T.removeSpots(V)},beforeSelect(I,H={}){H.abort=!0,H.useValid=!1,this.opts.onSelect(I),e.stopCommand(Bu)},run(I,H,V){this.opts=V,e.on("component:select:before",this.beforeSelect),e.on("change:componentHovered",this.onComponentHover)},stop(){e.off("component:select:before",this.beforeSelect),e.off("change:componentHovered",this.onComponentHover),T.removeSpots({id:B}),r.setSelectingTarget(!1)}}),C.add(TS,()=>{r.setSelectedDesignerTab("style")}),C.add(ne.toastAdd,(I,H,V)=>{s.add(V.id,V)}),C.add(ne.toastRemove,(I,H,V)=>{s.remove(V.id)}),C.add(ne.dialogOpen,(I,H,V)=>{a.open(V)}),C.add(ne.dialogClose,()=>{a.close()}),C.add(ne.dialogExportCode,()=>{a.open({fullH:!0,preventOverflow:!0,title:e.t("actions.showCode.title"),content:()=>{var I,H;return h.createElement(UN,{options:(H=(I=g.commands)==null?void 0:I.options)==null?void 0:H[Sr.showCode]})}})}),C.add(ne.dialogImportCode,()=>{a.open({fullH:!0,preventOverflow:!0,title:e.t("actions.importCode.title"),content:()=>h.createElement(xb)})}),C.add(ne.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(ne.sidebarLeftSet,(I,H,V)=>{r.setLeftSidebarOpen(!!V.visible)}),C.add(ne.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(ne.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(ne.sidebarRightSet,(I,H,V)=>{r.setRightSidebarOpen(!!V.visible)}),C.add(ne.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(ne.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(ne.sidebarTopSet,(I,H,V)=>{r.setTopSidebarOpen(!!V.visible)}),C.add(ne.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(ne.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(ne.sidebarBottomSet,(I,H,V)=>{r.setBottomSidebarOpen(!!V.visible)}),C.add(ne.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(ne.layoutAdd,(I,H,V)=>{V.id&&i.add(V.id,V)}),C.add(ne.layoutRemove,(I,H,V)=>{const{id:G,...Y}=V;i.remove(G,Y)}),C.add(ne.layoutToggle,(I,H,V)=>{const{id:G,...Y}=V;G&&(i.get(G)?i.remove(G,Y):i.add(G,Y))}),C.add(ne.layoutUpdate,(I,H,V)=>{const G=V;e.runCommand(ne.layoutRemove,{id:G.id,layout:{placer:{...G.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(ne.layoutAdd,{...G}))}),C.add(ne.layoutGet,(I,H,V)=>[pr(i.get(V.id))]),C.add(ne.layoutConfigGet,()=>pr(i.customConfig)),C.add(ne.layoutConfigSet,(I,H,V)=>{const G=V;i.setCustomConfig(G)}),C.add(ne.layoutComponentAdd,(I,H,V)=>{const{type:G,component:Y}=V;G&&Y&&i.addCustomLayoutComponent(G,Y)}),C.add(ne.layoutComponentGet,(I,H,V)=>i.getCustomLayoutComponent(V.type)),C.add(ne.layoutComponentRemove,(I,H,V)=>{i.removeCustomLayoutComponent(V.type)}),C.add(ne.layoutComponentRender,(I,H,V)=>h.createElement(MH,{components:V.components})),C.add(ne.getStateTheme,()=>r.publicStateTheme),C.add(ne.setStateTheme,(I,H,V)=>r.setPublicStateTheme(V)),C.add(ne.settings,()=>({baseUrl:r.baseApiUrl,licenseKey:r.licenseKey,license:pr(r.sdkLicense),licenseError:r.sdkLicenseError||void 0,licensePlan:pr(r.licensePlan),loadsInfo:pr(r.loadsInfo)})),C.add(ne.getPagesConfig,()=>r.sdkPagesConfig),C.add(ne.setPagesConfig,(I,H,V)=>{const{config:G}=V||{};Ht(G)&&r.setSdkPagesConfig(G)}),C.add(ne.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(ne.setPageSettings,(I,H,V)=>{r.setPanelPageSettings(V)}),C.add(ne.clearPage,()=>{const I=H=>e.t(`actions.${H}`);a.confirm({title:I("clearCanvas.title"),content:I("clearCanvas.content"),confirmButton:{variant:"danger",children:I("clearCanvas.title")},onConfirm:()=>{c4(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(ne.projectFiles,(I,H,V)=>{var Q,R;const G=(Q=r.sdkOptions.dataSources)==null?void 0:Q.exportConfig,Y=((R=V.exportConfig)==null?void 0:R.exportPreset)??G,J={isMJML:pg(e),exportConfig:Y,...V};return VH(I,J)}),C.add(ne.validateCode,(I,H,V)=>rb({...V,appStore:n})),C.add(ne.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(ne.setBlocksPanel,(I,H,V)=>{const G=V||{};Ht(G.isOpen)&&o.setOpen(G.isOpen)}),C.add(ne.canvasReload,()=>{const I=e.getSelected(),H=T.getCanvasView(),{frames:V}=T.canvas;V.once("loaded:all",()=>{const G=I==null?void 0:I.getView();G&&!G.isInViewport()&&G.el.scrollIntoView({block:"center"})}),H.renderFrames()}),C.add(ne.contextMenuComponent,(I,H,V)=>{const{component:G,...Y}=V;l.showForComponent(G,Y)}),C.add(ne.getStateContextMenu,()=>l.publicState),C.add(ne.setStateContextMenu,(I,H,V)=>{l.setPublicState(V)}),C.add(ne.symbolAdd,(I,H,V)=>{const G=V.component||e.getSelected();if(G)return M.getSymbolInfo(G).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:sn.Warning}):M.addSymbol(G)}),C.add(ne.symbolDetach,(I,H,V)=>{const G=V.component||e.getSelected();G&&M.getSymbolInfo(G).isRoot&&M.detachSymbol(G)}),C.add(ne.symbolOverride,(I,H,V)=>{const G=V.component||e.getSelected();G&&(G.setSymbolOverride(V.override),e.Layers.updateLayer(G))}),C.add(ne.symbolPropagateStyles,(I,H,V)=>{const G=V.component||e.getSelected();if(!G)return;const{Css:Y}=e,J=Y.getComponentRules(G,{current:!0})[0];if(J){const{state:Q,mediaText:R}=J.attributes,q=J.getStyle();M.getSymbolInfo(G).relatives.forEach(ee=>{Y.setIdRule(ee.getId(),q,{state:Q,mediaText:R})})}V.deep&&G.components().forEach(Q=>e.runCommand(ne.symbolPropagateStyles,{...V,component:Q}))}),C.add(ne.assetProviderGet,()=>pr(u.allProviders)),C.add(ne.assetProviderAdd,(I,H,{provider:V,index:G})=>{u.addProvider(V,G)}),C.add(ne.assetProviderRemove,(I,H,{id:V})=>{const G=u.allProviders.filter(Y=>Y.id!==V);u.setAllProviders(G)}),C.add(ne.fontGet,()=>pr(d.fonts)),C.add(ne.fontAdd,(I,H,{font:V})=>{d.addFont(V)}),C.add(ne.fontRemove,(I,H,{family:V})=>{d.removeFont(V)}),C.add(ne.fontManagerOpen,(I,H,V)=>{hh(I,V)}),C.add(ne.menuFontLoad,(I,H,{font:V})=>Bp(V,!1)),C.add(ne.toggleStateDataSource,()=>(_=!_,e.trigger(_n.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),C.add(ne.getStateDataSource,()=>({showPlaceholder:_})),C.add(ne.dataSourceSetGlobalData,(I,H,{globalData:V})=>{const G=Ly(V);return e.DataSources.get(js.globalData).setRecords(G)}),C.add(ne.setDragAbsolute,(I,H,{enabled:V})=>{r.setIsDraggingAbsolute(!!V)}),C.add(ne.dataSourceSetImporter,(I,H,V)=>{e.on(e.Parser.events.htmlBefore,G=>{G.input=V.import(G.input)})}),C.add(ne.dataSourceSetExporter,(I,H,V)=>{e.config.optsHtml={...e.config.optsHtml,exporter:V}}),qH(e,t),ej(e,t),GH(e,t),WH(e),HH(e),fN(e),jH(e,t),UH(e,t)}const nj=/\s(?![^(]*\))/,OS=/^-?[0-9]+[a-zA-Z%]{0,}$/;function _S(e){const t=e.split(nj),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!OS.test(d))[0]||"currentColor",s=r.filter(d=>OS.test(d)),[a="0",i="0",l="0",u="0"]=s;return{x:a,y:i,blur:l,spread:u,inset:n,color:o}}const zu=["%"],Uu=["s","ms"],xl=["deg","rad","grad"],to=["px","%","em","rem","vw","vh"],AS={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},rj=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Wu=e=>({id:e,label:e.split("-").map(Lr).join(" ")}),LS=e=>({property:t,to:n})=>{if(n.value){const r=t.getOption(),o=t.getParent().getProperty(e),s=o.getUnit(),a={units:r.units||[],min:r.min,max:r.max,unit:""};(!s||(a==null?void 0:a.units.indexOf(s))<0)&&(a.unit=(a==null?void 0:a.units[0])||""),o.up(a)}},oj=e=>{const t=`${e}-name`,n=`${e}-value`;return(r,{separatorLayers:o})=>{const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=$u(a);return{[t]:i,[n]:l}}):[]}},MS=e=>{const t={[Sl]:e};if(e.indexOf("url(")>-1)t[Rr]=is.Image;else if(e.indexOf("gradient(")>-1){const n=Bh(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[Rr]=is.Color:t[Rr]=is.Gradient}else t[Rr]=is.Color,t[Sl]=rj(e);return t},NS=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:o}){const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=$u(a);return{[t]:i,[n]:l}}):[]},toStyle(r,{name:o}){return{[o]:`${r[t]}(${r[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:LS(n)},{property:n,type:"integer"}]}},Gu=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:to,...t},s={property:`${e}-y`,type:"integer",units:to,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,p]=u.getProperties(),[f,g]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||f||"",[p.getId()]:a[p.getName()]||g||f||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),p=a[u.getId()],f=a[d.getId()];return{[i]:p===f?p:`${p} ${f}`}}}}},sj=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Wu),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Wu),["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,fixedValues:e==="background-position-x"?["left","center","right"]:["top","center","bottom"],units:["px"],default:"auto"})),Gu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Wu),cC("(?<!\\(.*[^)]),(?![^()]*\\))"),is.Image,is.Gradient,is.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:to,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:to,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:to})),["border-top-style","border-right-style","border-bottom-style","border-left-style"].map(e=>({type:"select",property:e,default:"none",options:[{id:"none",label:"None"},{id:"solid",label:"Solid"},{id:"dotted",label:"Dotted"},{id:"dashed",label:"Dashed"},{id:"double",label:"Double"},{id:"groove",label:"Groove"},{id:"ridge",label:"Ridge"},{id:"inset",label:"Inset"},{id:"outset",label:"Outset"}]})),["border-top-color","border-right-color","border-bottom-color","border-left-color"].map(e=>({type:"color",property:e,default:"currentColor"})),Gu("overflow",{x:AS,y:AS,mergable:!0}),NS(),NS("backdrop-filter"),["width","height","min-width","min-height","max-width","max-height","padding","margin","color","font-size","line-height","letter-height","border","border-radius","background","opacity","box-shadow","text-shadow","filter","backdrop-filter","transform","all"].map(Wu),Uu[0],Uu[0],oj("transform"),sj("transform","0"),LS("transform-value"),Gu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Gu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function $S(e,t){return[n=>EN(n,t),...xN[e],n=>tj(n,t),yN(e,t)]}class aj{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,an(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield lj()).filter(o=>o.projectType.includes(t));this.setProjectPlugins(r)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const r=[...$S(t,{appStore:n}),...this.projectPlugins||[]],o=n.sdkOptions.plugins||[];return et(o)?o({plugins:r}):[...r,...o]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;r.includes(o)?this.pendingUninstalled=r.filter(s=>s!==o):n.includes(o)||n.push(o)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;n.includes(o)?this.pendingInstalled=n.filter(s=>s!==o):r.push(o)}setSelectedShown(t){this.selectedShown=t}}const ij={db:tv.gjsStudio},lj=()=>new Promise(async e=>{let t=[];try{t=await N3(wc.Settings,"plugins",ij)||[]}catch(n){Un()&&console.error(n)}e(t)}),cj=h.createContext(void 0);class uj{constructor(t){this.blockManagerStore=new H4(this),this.appEditorStore=new b4(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new zL(t==null?void 0:t.localSettingsStore),this.toastStore=new V4(this),this.modalStore=new UL(this),this.i18nStore=new A4(this),this.pluginStore=new aj(this),this.pointerBadgeStore=new k4(this),this.contextMenu=new dj(this),this.layoutStore=new N4(this),this.templatesStore=new I4(this),this.assetsStore=new O4(this),this.globalStylesStore=new jL(this),this.fontsStore=new _4(this),this.appEditorStore.init(),Xu()&&(window.__gjss=this)}}const Pn=()=>{const e=h.useContext(cj);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Jh=()=>{throw new Error("Store has not been initialized")};class dj{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=Ss(function*(n,r={}){var w;if(!(n!=null&&n.em))return[];const o=n.em.getEditor(),{isSymbol:s,isRoot:a}=o.Components.getSymbolInfo(n),i=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:Do.selectParent,icon:K.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:Do.duplicate,icon:K.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:Do.symbolCreate,icon:K.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(ne.symbolAdd)}},s&&a&&{id:Do.symbolDetach,icon:K.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(ne.symbolDetach)}},s&&!i&&{id:Do.symbolOverride,icon:K.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(ne.symbolOverride,{override:!0})}},s&&i&&{id:Do.symbolOverrideClear,icon:K.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(ne.symbolOverride)}},l&&{id:Do.delete,icon:K.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),f=n.get("contextMenu"),g={...r,items:p,component:n,editor:o,type:n.get("type")||"default",source:r.source||Dp.canvas},m=yield kS(f,g),v=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield kS(v,{...g,items:m})}),this.store=t,an(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const r=t==null?void 0:t.em;if(!r)return;n.skipSelect||r.selected.hasComponent(t)||r.setSelected(t);const o=yield this.getItemsForComponent(t,n);o.length&&this.show({...n,items:o})}show({items:t,x:n,y:r,w:o,h:s}){this.isOpen=!0,this.coordinates={x:n,y:r,w:o,h:s},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const kS=async(e,t)=>et(e)?(await e(t)).filter(Boolean):t.items,pj=()=>Pn().contextMenu,IS=Un()&&document.body,Qh=(e={})=>({...gf,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??IS}},{name:"preventOverflow",options:{boundary:e.boundary??IS}}]}),fj=Qh(),qu="gs-ctx-menu-list",hj=ce(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=pj(),[d,p]=h.useState(),[f,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:v,attributes:b}=Si(m,f,fj),w=N(`${qu}-wrp gs-utl-z-20`,l),y=N(`${qu} gs-utl-z-20`),S=N(`${qu}-body gs-utl-max-w-56`),C=N(`${qu}-item`),x="gs-utl-max-w-40",E=P=>{const{action:_,onClick:T}=P;if(_||T)return O=>{const L={editor:u.store.appEditorStore.editor,...O};et(_)?(_(L),u.hide()):et(T)&&(T(L),u.hide())}};return c.jsx("div",{className:w,ref:g,style:v.popper,...b.popper,children:c.jsx(Cp,{show:!!n,...HP,unmount:!1,children:c.jsx(Qn,{padding:!1,className:y,classNameBody:S,children:r.map((P,_)=>h.createElement(Oa,{onItemClick:t,...P,key:P.id??_,className:C,classNameLabel:x,action:E(P),onActive:()=>p(P),active:d===P}))})})})}),Rh="gs-cmp-tooltip";function Wt({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:o="bottom",children:s,title:a,onClick:i,inline:l,size:u}){const[d,p]=h.useState(!1),[f,g]=h.useState(!1),m=Ht(u),[v,b]=h.useState(null),[w,y]=h.useState(null),S=Si(v,w,{...Qh(),placement:o,...r?{strategy:r}:{}});h.useEffect(()=>{var E;d&&((E=S.update)==null||E.call(S))},[d,S.update]),h.useEffect(()=>{const E=setTimeout(()=>p(f),10);return()=>clearTimeout(E)},[f]);const C=N(`${Rh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=N(`${Rh}-content`,n,"gs-utl-fixed gs-utl-z-30 gs-utl-text-sm",!m&&!n&&"gs-utl-whitespace-nowrap",u==="s"&&"gs-utl-w-60");return c.jsxs("div",{className:N(Rh,"gs-utl-relative",t),children:[c.jsx("span",{ref:b,className:C,onMouseEnter:()=>a&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:N(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),i==null||i()},children:s})}),!!f&&c.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(Cp,{show:!!d,unmount:!1,...$1,children:c.jsx(Qn,{className:k1.txt,bg:k1.bg,size:"s",border:!1,children:a})})})]})}function Ct({children:e,title:t,classNameWrp:n,tooltipProps:r,...o}){return c.jsx(Wt,{title:t,classNameWrp:n,...r,children:c.jsx(Ke,{...o,children:e})})}const Da="gs-cmp-ai-chat-assets",gj=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},mj=e=>e.mediaType==="application/pdf",VS=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${Da}__asset-item`,a=N(`${Da}__asset-image`,"gs-utl-object-cover",te.rnd,Zl.m),i=N(`${Da}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,Zl.m),l=N(`${Da}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,Zl.m,U.bgH2),u=N(`${Da}__asset-remove`,"gs-utl-absolute gs-utl--top-2 gs-utl--right-1 gs-utl-text-white gs-utl-flex gs-utl-items-center gs-utl-justify-center gs-utl-z-10",Zl.s,te.pill,U.bgRed,U.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const p=(f,g)=>{const m={params:{num:g+1}},v=e.t(`${d}.imageAlt`,m),b=e.t(`${d}.pdfTitle`,m);return gj(f)?c.jsx("img",{src:f.src,alt:v,className:a}):mj(f)?c.jsx("iframe",{src:f.src,title:b,className:i}):c.jsx("div",{className:l,children:c.jsx(re,{icon:v2,size:se.l})})};return c.jsx(k,{className:N(Da,n),gap:"xs",wrap:"wrap",style:o,children:t.map((f,g)=>c.jsxs("div",{className:N(s,"gs-utl-relative gs-utl-inline-block"),children:[p(f,g),r&&c.jsx(Ct,{title:e.t(`${d}.remove`),icon:{icon:K.close,size:se.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},f.src))})},gn="gs-cmp-ai-chat-input",vj=e=>{const{className:t,style:n,editor:r,disabled:o,maxAssets:s,currentAssetsCount:a,acceptAssetType:i,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(s<=0)return null;const p=`${gn}__attach-btn`,f=`${gn}__file-input`,g=a>=s,m="aiChat.input.attach",v=r.t(`${m}.upload`),b=r.t(`${m}.selectFromAssets`),w=r.t(`${m}.title`),y=r.t(`${m}.maxAssets`,{params:{count:s}}),S=x=>{const E=Array.from(x.target.files||[]);E.length>0&&l(E),d.current&&(d.current.value="")},C=x=>{if(!r||g)return;const E="btnAttachImages",P=()=>r.runCommand(ne.layoutRemove,{id:E});r.runCommand(ne.layoutToggle,{id:E,header:!1,placer:{type:"popover",target:x.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:P,items:[{id:"upload",label:v,icon:K.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:b,icon:O2,onClick:()=>{r.Assets.open({onSelect:({asset:_})=>{const T=_.getSrc();T&&u(T)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:f,style:{display:"none"}}),c.jsx(Ct,{className:N(p,te.pill,t),style:n,title:g?y:w,icon:K.plus,border:!1,onClick:C,disabled:o||g,size:"s",block:!0})]})},bj=({editor:e,className:t,style:n,contextComponents:r,disabled:o})=>{const[s,a]=h.useState(()=>e.getSelectedAll()),i="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,S=()=>a(e.getSelectedAll());return e.on(y,S),()=>{e.off(y,S)}},[e]),h.useEffect(()=>{r.clear(),s.forEach(y=>r.add(y))},[s,r]);const l=()=>a([]);if(s.length===0)return null;const u=`${gn}__context`,d=`${gn}__context-icon`,p=`${gn}__context-badge`,f=`${gn}__context-name`,g=`${gn}__context-divider`,m=s.length===1,v=s[0],b=e.t(`${i}.multiple`,{params:{count:s.length}}),w=m?v.getName():b;return c.jsxs(k,{className:N(u,o&&Oe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:K.target,size:se.sx,className:N(d,U.txtLowEmphasis)}),c.jsx(Yo,{className:N(p,j1(v).bg,Te.xyS2),s:"s",children:c.jsxs(k,{gap:"xs",items:"center",nowrap:!0,children:[m&&wv(v),c.jsx("div",{className:N(f,Oe.txtEllips,"gs-utl-max-w-36"),children:w}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N(g,te.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(Ct,{title:e.t(`${i}.clear`),icon:{icon:K.close,size:se.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function HS(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function yj(){const[e,t]=h.useState(""),[n,r]=h.useState(!1),[o,s]=h.useState(!1),a=h.useRef();h.useEffect(()=>s(!!HS()),[]);const i=()=>{const u=HS();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>r(!0),d.onend=l,d.onresult=p=>{const g=Array.from(p.results).map(m=>m[0].transcript).join("");t(g)},d.onerror=p=>{console.error("Speech recognition error",p),l()},a.current=d,d.start()},l=()=>{var u;(u=a.current)==null||u.stop(),r(!1)};return{transcript:e,isSupported:o,isListening:n,start:i,stop:l}}const wj=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:o,style:s})=>{const a=`${gn}__dictate`,{transcript:i,isSupported:l,isListening:u,start:d,stop:p}=yj(),f="aiChat.input.dictate",g=e.t(`${f}.start`),m=e.t(`${f}.stop`),v=u?m:g;return h.useEffect(()=>{i&&n(i)},[i]),h.useEffect(()=>{r==null||r(u)},[u]),l?c.jsx(Ct,{block:!0,size:"s",border:!1,className:N(a,te.pill,o),style:s,title:v,disabled:t,icon:u?D2:j2,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},Sj=({autoResize:e,autoFocus:t,style:n={},...r})=>{const o=h.useRef(null);return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[r.value,e]),h.useEffect(()=>{const s=o.current;if(s&&t){const a=setTimeout(()=>s==null?void 0:s.focus(),150);return()=>clearTimeout(a)}},[o.current,t]),c.jsx("textarea",{ref:o,style:{...n,...e?{resize:"none"}:{}},...r})},jS=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},DS=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,Cj=({className:e,style:t,chatContext:n,editor:r,maxAssets:o=5,acceptAssetType:s="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:a,layoutBefore:i,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:f,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[w,y]=h.useState(b||""),[S,C]=h.useState(""),[x,E]=h.useState(!1),[P,_]=h.useState([]),[T,O]=h.useState(!1),L="aiChat.input",A=r.runCommand(vr.getChatApi),$=r.runCommand(vr.getChatState),{status:B,stop:M,sendMessage:j,setError:W}=n||A,D=B==="streaming"||B==="submitted",z=P.length>0,I=S?DS(w,S):w,H=!T&&(D||I.trim()||z),V={input:I,assets:P},G=Se=>{const ot=o-P.length,st=Se.slice(0,ot);if(st.length===0)return;const wt=st.map(Ne=>({src:URL.createObjectURL(Ne),file:Ne,mediaType:Ne.type}));_(Ne=>[...Ne,...wt])},Y=Se=>{P.length>=o||_(ot=>[...ot,{src:Se,mediaType:"image/*"}])},J=Se=>{const ot=P[Se];ot!=null&&ot.file&&jS([ot.src]),_(st=>st.filter((wt,Ne)=>Ne!==Se))},Q=async Se=>{if(Se.preventDefault(),D||T)return;const ot=()=>R();if(u){u({event:Se,submit:ot,state:V});return}ot()},R=async()=>{if(D||T)return;const Se=I.trim();if(!Se&&!z)return;const ot=P.filter(Ne=>Ne.file).map(Ne=>Ne.file);let wt=P.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src.trim(),mediaType:Ne.mediaType}));if(ot.length>0){O(!0);try{const mt=await async function(Ue){return a?await a({files:Ue}):new Promise((tn,he)=>{try{const De={dataTransfer:{files:Ue}};r.Assets.FileUploader().uploadFile(De,({data:Fe})=>{tn(Fe)})}catch(De){he(De)}})}(ot),dt=P.filter(Ue=>Ue.file).map(Ue=>Ue.src);wt=[...wt,...mt.map(Ue=>({type:"file",url:Ue.src,mediaType:Ue.mimeType}))],jS(dt)}catch(Ne){const mt=r.t(`${L}.uploadError`);W(Ne instanceof Error?Ne:new Error(mt)),O(!1);return}finally{O(!1)}}j({text:Se,files:wt.length>0?wt:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},q=Se=>{Se.key==="Enter"&&!Se.shiftKey&&(Se.preventDefault(),Q(Se))};h.useEffect(()=>{x||y(Se=>DS(Se,S)),C("")},[x]);const ee=`${gn}__root`,le=`${gn}__actions`,ge=`${gn}__actions-left`,Pe=`${gn}__actions-right`,Ce=`${gn}__submit-btn`,tt=N(`${gn}__textarea gs-utl-w-full`,U.bgTr,Mo.inputText,Oe.noFocusOut,Oe.noResize),Qe=r.t(`${L}.placeholder`),Ot=i==null?void 0:i({state:V}),ut=l==null?void 0:l({state:V});return c.jsxs("form",{onSubmit:Q,className:N(gn,Te.s,te.bt,U.br,e),style:t,children:[Ot&&Qt(r,Ot),c.jsxs(k,{className:N(ee,te.b,te.rndLg,U.br,U.bg,Te.s,"gs-utl-relative"),col:!0,gap:"s",children:[T&&c.jsx(No,{abs:!0,full:!0,className:U.bgH25}),c.jsx(bj,{editor:r,disabled:D,contextComponents:$.contextComponents,...d}),c.jsx(Sj,{value:I,name:"prompt",onChange:Se=>y(Se.target.value),onKeyDown:q,placeholder:Qe,readOnly:x,disabled:D,className:tt,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),c.jsx(VS,{editor:r,assets:P,onRemove:J,...f}),c.jsxs(k,{className:le,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(k,{className:ge,gap:"s",items:"center",children:c.jsx(vj,{editor:r,disabled:D,maxAssets:o,currentAssetsCount:P.length,acceptAssetType:s,onFilesSelected:G,onAssetSelected:Y,...g})}),c.jsxs(k,{className:Pe,gap:"s",items:"center",children:[c.jsx(wj,{editor:r,disabled:D,onTranscript:C,onListeningChange:E,...m}),c.jsx(Ke,{className:N(Ce,te.pill),size:"s",type:D?"button":"submit",onClick:D?M:void 0,icon:D?K.stop:K.arrowUp,variant:D?"out-clear":"pr",disabled:!H,disabledClassName:Oe.disabledM,...v})]})]})]}),ut&&Qt(r,ut)]})},xj="gs-cmp-ai-chat-loading-state",Ej=({className:e,chatContext:t,editor:n,...r})=>c.jsx(k,{className:N(xj,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(No,{})}),Pj="file-refs",FS="gs-cmp-ai-chat-markdown",yt=`${FS}__el`,Tj={ul:({children:e})=>c.jsx("ul",{className:`${yt}-ul ${jt.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${yt}-ol ${jt.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${yt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${yt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${yt}-h1 ${jt.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${yt}-h2 ${jt.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${yt}-h3 ${jt.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${yt}-h4 ${jt.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${yt}-h5 ${jt.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${yt}-h6 ${jt.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${yt}-a ${Mo.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${yt}-code-inline ${jt.codeInline}`,children:e}):c.jsx("code",{className:`${yt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${yt}-pre ${jt.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${yt}-blockquote ${jt.blockquote} ${U.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${yt}-hr ${jt.hr} ${U.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${yt}-strong ${jt.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${yt}-em ${jt.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${yt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${yt}-table ${jt.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${yt}-thead ${jt.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${yt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${yt}-tr ${jt.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${yt}-th ${jt.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${yt}-td ${jt.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${yt}-checkbox gs-utl-mr-2`,readOnly:!0}),[Pj]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function Oj(e){return ZS.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const _j=h.memo(function({content:t}){return c.jsx(YS,{components:Tj,remarkPlugins:[XS],children:t})},(e,t)=>e.content===t.content),BS=h.memo(function({content:t,id:n,className:r}){const o=h.useMemo(()=>Oj(t),[t]);return c.jsx("div",{className:`${FS} ${r||""}`,children:o.map((s,a)=>c.jsx(_j,{content:s},`${n}-block_${a}`))})});function eg(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function zS(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const tg="gs-cmp-ai-chat-message",Fa="aiChat.message",Aj=h.memo(function({className:t,style:n,message:r,isStreaming:o,showSources:s=!1,editor:a,chatContext:i,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g}){const m=r.parts||[],v=m.filter(lr.isFileUIPart),b=m.filter(T=>!lr.isFileUIPart(T)&&(s||!eg(T)&&!zS(T))),w=v.map(T=>({src:T.url,mediaType:T.mediaType??"image/*"})),y=b.length-1,S=r.role==="user",C=N(tg,`${tg}--${r.role}`,Te.s,t),x=N(`${tg}__content gs-utl-break-words`,S?N(U.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Te.xyS,te.rnd):"gs-utl-w-full"),E={editor:a,chatContext:i,message:r},P=l==null?void 0:l(E),_=u==null?void 0:u(E);return c.jsxs(k,{col:!0,gap:"s",className:C,style:n,children:[P&&Qt(a,P),c.jsxs(k,{gap:"s",className:N(x,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((T,O)=>c.jsx(Lj,{part:T,messageId:r.id,partIndex:O,isStreamingPart:O===y&&o,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g,layoutProps:E},`${r.id}-part-${O}`)),c.jsx(VS,{editor:a,assets:w,className:"gs-utl-justify-end"})]}),_&&Qt(a,_)]})}),Co="gs-cmp-ai-chat-message-part",Lj=h.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d,p;if(s){const f=s({...u,part:t,partIndex:r});if(f)return Qt(u.editor,f)}if(lr.isReasoningUIPart(t)){const{text:f,state:g}=t,m=f==null?void 0:f.trim(),v=o&&g==="streaming",b=`${Co} ${Co}__reasoning`,w=u.editor.t(`${Fa}.reasoning`);return!!m&&c.jsx(yo,{className:N(b,U.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(k,{className:N(`${b}-label`,vn.semibold),items:"center",gap:"s",children:[v?c.jsx(No,{size:"xs",currentColor:!0}):c.jsx(za,{path:M2,size:se.s2x}),c.jsx("div",{children:w})]}),children:c.jsx("div",{className:N(`${b}-text`,U.txtLowEmphasis,bn.xs,vn.italic),children:c.jsx(BS,{id:`${n}-${r}`,content:m})})})}if(lr.isTextUIPart(t)){const f=t.text;if(!f)return null;const g=`${Co} ${Co}__text`;return c.jsx(BS,{content:f,id:`${n}-${r}`,className:g})}if(lr.isToolUIPart(t)){const{type:f,toolCallId:g,input:m="",output:v="",errorText:b}=t,w=f.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),S=typeof v=="string"?v:JSON.stringify(v),C=typeof t.state=="string"?t.state:void 0,x=C==="output-available",E=!!o&&(C==="input-streaming"||C==="input-available"),P=`${Co}__tool`,_=`${Co}__tool-result`,T=`${P}-detail`,O=N(T,"gs-utl-max-w-full"),L="gs-utl-max-w-full gs-utl-whitespace-normal",A=N(`${T}-info gs-utl-max-h-24 gs-utl-overflow-auto`,L,U.txtLowEmphasis,bn.xs),$=N(`${Co}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,L,U.txtLowEmphasis,bn.xs),B=`${P}-section-label`,M=y&&y!=="{}",j=S&&S!=="{}",W=!!b,D=M||j||W,z=u.editor.t(`${Fa}.tool.input`),I=u.editor.t(`${Fa}.tool.output`),H=u.editor.t(`${Fa}.tool.error`),G=u.editor.t(`${Fa}.tools.${w}`,{params:m||{}})||w,J=u.editor.runCommand(vr.getChatManager).tools[w],Q={...u,part:t,partIndex:r,toolName:w,isCompleted:x,isProcessing:E,input:t.input,output:t.output},R=(a==null?void 0:a(Q))||((d=J==null?void 0:J.layoutToolLabel)==null?void 0:d.call(J,Q)),q=i==null?void 0:i(Q),ee=(l==null?void 0:l(Q))||((p=J==null?void 0:J.layoutToolResult)==null?void 0:p.call(J,Q)),le=R?Qt(u.editor,R):G,ge=ee?Qt(u.editor,ee):null,Pe=q?Qt(u.editor,q):c.jsxs(k,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[M&&c.jsxs(k,{className:N(O,`${T}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:B,children:z}),c.jsx("pre",{className:A,children:y})]}),j&&c.jsxs(k,{className:N(O,`${T}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:B,children:I}),c.jsx("pre",{className:A,children:S})]}),W&&c.jsxs(k,{className:N(O,`${T}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:B,children:H}),c.jsx("pre",{className:A,children:b})]})]});return c.jsxs(k,{className:N(`${Co} ${P}`,U.bgH2,te.rnd,Te.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(yo,{disabled:!D&&!q,handler:c.jsxs(k,{className:N(`${P}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${P}-status`,children:x?c.jsx(za,{className:`${P}-status-success`,path:hg,size:se.s2x}):E?c.jsx(No,{className:`${P}-status-processing`,size:"xs",currentColor:!0}):c.jsx(za,{className:`${P}-status-error`,path:gg,size:se.s2x})}),c.jsx("div",{className:N(`${P}-name`,jP.all),children:le})]}),children:Pe}),c.jsx(Mj,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:$}),!!ge&&c.jsx("div",{className:_,children:ge})]})}if(eg(t)||zS(t)){const f=`${Co}__source`,m=eg(t)?t.url:void 0,v=t.title,b=u.editor.t(`${Fa}.source.document`),w=v||m||b,y=m?new URL(m).hostname:"",S=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${f}-title`,vn.semibold,bn.sm,"gs-utl-truncate"),children:w}),y&&c.jsx("div",{className:N(`${f}-url`,U.txtLowEmphasis,bn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(za,{className:N(`${f}-icon`,U.txtLowEmphasis),path:mg,size:se.s2x})]}),C=N(f,U.bgH2,te.rnd,Te.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Oe.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:C,children:S}):c.jsx("div",{className:C,children:S})}return null}),Mj=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:r,className:o}){const[s,a]=h.useState(""),i=h.useRef(null);return h.useEffect(()=>{if(!r||!t){a("");return}const l=n.get(t);l!=null&&l.content&&a(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&a(d.content),d!=null&&d.completed&&(clearInterval(u),a(""))},100);return()=>clearInterval(u)},[t,n,r]),h.useEffect(()=>{i.current&&s&&(i.current.scrollTop=i.current.scrollHeight)},[s]),!s||!r?null:c.jsx("pre",{ref:i,className:o,children:s})}),Nj="gs-cmp-ai-chat-messages-status",$j=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=N(U.bgA,Oe.dot,Oe.bounce);return o?c.jsxs(k,{items:"center",gap:"xs",className:N(Nj,e,Te.s),style:n,children:[c.jsx("div",{className:s}),c.jsx("div",{className:s,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:s,style:{animationDelay:"0.3s"}})]}):null},ng="gs-cmp-ai-chat-messages";function kj({editor:e,chatContext:t,messages:n,pluginOptions:r}){const o=h.useRef(null),[s,a]=h.useState(null),{status:i}=t,l=i==="streaming"||i==="submitted",u=N(ng,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>$d(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},r),[t,e,l,n.length,r]),p=h.useCallback(()=>({type:"column",className:`${ng}__footer`,children:$d(e,{type:"aiChatMessagesStatus",chatContext:t},r)}),[t,e,r]),f=g=>{requestAnimationFrame(()=>{s==null||s.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{f(!0)},[n]),h.useEffect(()=>{f()},[s]),c.jsx(k,{ref:o,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?Qt(e,{type:"aiChatEmptyState",chatContext:t},r):Qt(e,{type:"virtualList",className:`${ng}__list`,itemsPerRow:1,items:n,onRef:a,itemLayout:d,footerLayout:p})})}const US=h.createContext(void 0),Ij=({chatManager:e,children:t})=>{const n=e.currentChatState,r=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(US.Provider,{value:r,children:t})},Vj=()=>h.useContext(US),Hj="gs-cmp-ai-chat-panel";function jj({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=Vj(),[,s]=h.useState(0),[a,i]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=o;h.useEffect(()=>o.onUpdate(()=>s(E=>++E)),[]);const f=on.useChat({chat:o.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:w}=f,y=w||a,S=h.useMemo(()=>({id:f.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(x=>x.abort()),l.clear(),f.stop()),addToolApprovalResponse:f.addToolApprovalResponse,addToolOutput:f.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{f.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),C=N(Hj,r,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx(k,{className:C,style:n,col:!0,nowrap:!0,children:p?c.jsxs(c.Fragment,{children:[Qt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(kj,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Qt(e,{type:"aiChatError",chatContext:S},t),Qt(e,{type:"aiChatInput",chatContext:S},t)]}):Qt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const Dj=(e,t,n)=>(e.runCommand(ne.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(Ij,{chatManager:n,children:c.jsx(jj,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:LT})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:AT})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:Ej})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:Cj})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:_T})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:Aj})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:$j})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(ne.layoutComponentRemove,{type:r})})}),Fj={aiChat:{header:{title:"AI Chat",clear:"Clear"},emptyState:{title:"AI Assistant",subtitle:"How can I help you build your project?",suggestions:{webHero:"Create a hero section with a headline and call-to-action",webFeatures:"Add a features grid with icons",webContact:"Create a contact form",webTestimonials:"Add testimonials section",emailHeader:"Add an email header",emailCta:"Add a call-to-action button",emailFooter:"Add an email footer with links",emailProduct:"Add a product showcase section"}},error:{title:"Error"},panel:{loadError:"Failed to load messages",messagesUpdate:"Error during messages update"},input:{placeholder:"Ask anything...",uploadError:"Failed to upload images",attach:{title:"Attach images",upload:"Upload new image",selectFromAssets:"Select image from Assets",maxAssets:"Maximum {count} assets allowed"},assets:{imageAlt:"Image {num}",pdfTitle:"PDF {num}",remove:"Remove"},context:{multiple:"{count} Components",clear:"Clear"},dictate:{start:"Dictate",stop:"Stop"}},message:{reasoning:"Reasoning",tools:{webSearch:"Web search",removeComponent:"Remove component",moveComponent:"Move component",getPageContent:"Get page content",listPages:"List pages",generateImage:"Generate image",runCommand:"Run command",addComponentCode:"Create component",editComponentCode:"Edit component",addPageCode:"Create page",addProjectPageCode:"Create new project page"},tool:{input:"Input",output:"Output",error:"Error",generateImage:{generating:"Generating...",imageAlt:"Generated image {num}",useImage:"Use image"},command:{notFound:'Command "{id}" not found',missingHandler:'Command "{id}" has no execute handler',showCode:{pending:"Opening code panel",done:"Code panel opened"},importCode:{pending:"Opening import panel",done:"Import panel opened"},preview:{pending:"Opening preview",done:"Preview opened"},pageSettings:{pending:"Opening page settings",done:"Page settings opened"}}},source:{document:"Document"}}}},Bj="aiChat",zj=Xs.startup;return CC(function(e,t={}){t.getAccessToken&&(Jt.getAccessToken=t.getAccessToken),F1();const n=new PT(e,t),{Commands:r}=e;r.add(vr.getChatManager,()=>n),r.add(vr.getChatState,()=>n.currentChatState),r.add(vr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:Fj});const o=Dj(e,t,n),s=()=>{delete r.commands[vr.getChatManager],delete r.commands[vr.getChatState],delete r.commands[vr.getChatApi],o(),FP()};xC({editor:e,licenseKey:t.licenseKey,plan:zj,pluginName:Bj,onLicenseCheckResponse:a=>{a?Jt.license=a:Jt.license=void 0},cleanup:s})})});
388
+ `:void 0};o==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(BS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const mj=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},bj=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:r}=e;r.getConfig().uploadFile=async(...o)=>{const s=o[0],a=await n.handleUpload(s),i=o[1];a&&(i==null||i({data:a}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},vj=()=>{const{baseApiUrl:e}=jb();return`${e}/sdk/projects`},FS=e=>`${vj()}/${e}`,yj=async({licenseKey:e,projectId:t,...n})=>{const r=await Br.put(FS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},wj=async(e,t)=>await Br.put(t,{body:e,headers:{"Content-Type":"application/json"}}),Sj=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await yj({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([o]).size},identityId:r,name:e.name,description:e.description});if(!s)throw new Error("Project not found");const{uploadUrl:a}=s;await wj(o,a)},Cj=(e,t,n)=>Br.get(FS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),xj=async e=>await Br.get(e),Ej=async(e,t,n,r)=>{const o=await Cj(t,n,r),s=o==null?void 0:o.result,a=o==null?void 0:o.errorData;if(!s&&(a!=null&&a.notFoundInDb))return{id:n,project:{}};if(!s)throw new Error("Project not found");const{downloadUrl:i}=s,l=await xj(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},Pj=(e,t)=>{const{appEditorStore:n,toastStore:r,i18nStore:o}=t.appStore.store,{isUsingProjectSelfHosted:s,isUsingProjectCloud:a,sdkOptions:i}=n,l=i.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:f,autosaveIntervalMs:h}=l;let m,b,v,w;if(s)v=d,w=p,m=f,b=h;else if(a){const P=i.licenseKey,_=n.sdkProjectId,T=n.sdkIdentityId,O=10,M=1e4;w=({project:A})=>Sj(A,P,_,T),v=({editor:A})=>Ej(A,P,_,T),m=Math.max(O,f??O),h&&(b=Math.max(M,h))}const{Storage:y,events:S}=e,{events:C}=y,E=P=>P instanceof Error?P.message:typeof P=="string"?P:"Unknown error";let x=!1;if(e.once(S.projectLoad,P=>{x=!!P.loaded}),e.once("change:readyLoad",()=>{var _;const P=(_=i.project)==null?void 0:_.default;!x&&P&&e.loadProjectData(P)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(v||u)&&w){const P="remote";y.setCurrent(P),y.add(P,{async load(){return u||(await v({editor:e})).project},async store(_){await w({project:_,editor:e})}}),e.on(C.errorLoad,_=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:E(_)})}),e.on(C.errorStore,_=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:E(_)})}),m&&y.setStepsBeforeSave(m),b&&e.onReady(()=>{const _=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},b);e.on("destroy",()=>clearInterval(_))})}},qu="select-target",BS="enable-sm";function Tj(e,t){var H,W,B,G;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:f,sdkOptions:h}=r,m=()=>o.toggleOpen(),b=()=>r.toggleLeftSidebar(),v=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,E=C.events,x=e.events,P=(W=(H=h.gjsOptions)==null?void 0:H.assetManager)==null?void 0:W.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Ht(P)&&(y.getConfig().custom=P),f&&(w.projectData=f,r.setNextProjectData()),p){const D=S.getConfig().options;D&&(D.local.key=p)}e.on(x.projectLoad,({project:D})=>{var V;n.setProjectDataCustom(D.custom||{projectType:(V=r.sdkOptions.project)==null?void 0:V.type}),d.loadFonts()}),e.on(x.projectGet,({project:D})=>{D.custom=xa(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:T}=e,O=Go(()=>r.setCanvasPanning(!1),200);e.on(T.events.coords,()=>{r.setCanvasPanning(!0),O()}),e.on(T.events.frameLoad,({el:D})=>{D.tabIndex=-1});const{Parser:M}=e,A=((B=r.sdkOptions.parser)==null?void 0:B.showErrors)!==!1;(G=M.events)!=null&&G.css&&A&&e.on(M.events.css,D=>{const{error:V}=D;if(V){const k=dt(V)?V:V.name&&V.reason?`${V.name}: ${V.reason}`:V.message;s.addError("css-error",{header:"CSS Parser Error",content:k})}});const{builtIn:$}=e.StyleManager;$.add("border-radius",{type:"composite",properties:[{...$.get("border-top-left-radius"),id:"border-top-left-radius-sub"},{...$.get("border-top-right-radius"),id:"border-top-right-radius-sub"},{...$.get("border-bottom-right-radius"),id:"border-bottom-right-radius-sub"},{...$.get("border-bottom-left-radius"),id:"border-bottom-left-radius-sub"}]}),[{id:"toggle-lsidebar",keys:"alt+ctrl+,",cmd:b},{id:"toggle-lsidebar2",keys:"alt+⌘+,",cmd:b},{id:"toggle-rsidebar",keys:"alt+ctrl+., alt+⌘+.",cmd:v},{id:"show-blocks",keys:"ctrl+b, ⌘+b",cmd:m},{id:"add-symbol",keys:"alt+ctrl+k, alt+⌘+k",cmd:te.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:te.symbolDetach}].forEach(({id:D,keys:V,cmd:k})=>{e.Keymaps.add(`preset:${D}`,V,k,{prevent:!0})}),e.on(`${E.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),Nv(e,!1)}),e.on(`${E.stopCommand}core:preview`,()=>{r.setPreview(!1),Nv(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const j="target-selection",{Components:L}=e;C.add(qu,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(D,V){const k={id:j,type:"target",component:V};V?T.addSpot(k):T.removeSpots(k)},beforeSelect(D,V={}){V.abort=!0,V.useValid=!1,this.opts.onSelect(D),e.stopCommand(qu)},run(D,V,k){this.opts=k,e.on("component:select:before",this.beforeSelect),e.on("change:componentHovered",this.onComponentHover)},stop(){e.off("component:select:before",this.beforeSelect),e.off("change:componentHovered",this.onComponentHover),T.removeSpots({id:j}),r.setSelectingTarget(!1)}}),C.add(BS,()=>{r.setSelectedDesignerTab("style")}),C.add(te.toastAdd,(D,V,k)=>{s.add(k.id,k)}),C.add(te.toastRemove,(D,V,k)=>{s.remove(k.id)}),C.add(te.dialogOpen,(D,V,k)=>{a.open(k)}),C.add(te.dialogClose,()=>{a.close()}),C.add(te.dialogExportCode,()=>{a.open({fullH:!0,preventOverflow:!0,title:e.t("actions.showCode.title"),content:()=>{var D,V;return g.createElement(o$,{options:(V=(D=h.commands)==null?void 0:D.options)==null?void 0:V[Cr.showCode]})}})}),C.add(te.dialogImportCode,()=>{a.open({fullH:!0,preventOverflow:!0,title:e.t("actions.importCode.title"),content:()=>g.createElement(Lv)})}),C.add(te.openEditCode,(D,V,k={})=>{const{editCode:z,layout:Y,...X}=k;e.runCommand(te.layoutToggle,{id:"dialogEditCode",header:!1,layout:{type:"panelEditCode",...z},placer:{type:"dialog",size:"xl",fullH:!0,title:e.t("actions.editCode.title")},...X})}),C.add(te.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(te.sidebarLeftSet,(D,V,k)=>{r.setLeftSidebarOpen(!!k.visible)}),C.add(te.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(te.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(te.sidebarRightSet,(D,V,k)=>{r.setRightSidebarOpen(!!k.visible)}),C.add(te.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(te.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(te.sidebarTopSet,(D,V,k)=>{r.setTopSidebarOpen(!!k.visible)}),C.add(te.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(te.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(te.sidebarBottomSet,(D,V,k)=>{r.setBottomSidebarOpen(!!k.visible)}),C.add(te.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(te.layoutAdd,(D,V,k)=>{k.id&&i.add(k.id,k)}),C.add(te.layoutRemove,(D,V,k)=>{const{id:z,...Y}=k;i.remove(z,Y)}),C.add(te.layoutToggle,(D,V,k)=>{const{id:z,...Y}=k;z&&(i.get(z)?i.remove(z,Y):i.add(z,Y))}),C.add(te.layoutUpdate,(D,V,k)=>{const z=k;e.runCommand(te.layoutRemove,{id:z.id,layout:{placer:{...z.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(te.layoutAdd,{...z}))}),C.add(te.layoutGet,(D,V,k)=>[fr(i.get(k.id))]),C.add(te.layoutConfigGet,()=>fr(i.customConfig)),C.add(te.layoutConfigSet,(D,V,k)=>{const z=k;i.setCustomConfig(z)}),C.add(te.layoutComponentAdd,(D,V,k)=>{const{type:z,component:Y}=k;z&&Y&&i.addCustomLayoutComponent(z,Y)}),C.add(te.layoutComponentGet,(D,V,k)=>i.getCustomLayoutComponent(k.type)),C.add(te.layoutComponentRemove,(D,V,k)=>{i.removeCustomLayoutComponent(k.type)}),C.add(te.layoutComponentRender,(D,V,k)=>g.createElement(nj,{components:k.components})),C.add(te.getStateTheme,()=>r.publicStateTheme),C.add(te.setStateTheme,(D,V,k)=>r.setPublicStateTheme(k)),C.add(te.settings,()=>({baseUrl:r.baseApiUrl,licenseKey:r.licenseKey,license:fr(r.sdkLicense),licenseError:r.sdkLicenseError||void 0,licensePlan:fr(r.licensePlan),loadsInfo:fr(r.loadsInfo)})),C.add(te.getPagesConfig,()=>r.sdkPagesConfig),C.add(te.setPagesConfig,(D,V,k)=>{const{config:z}=k||{};Ht(z)&&r.setSdkPagesConfig(z)}),C.add(te.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(te.setPageSettings,(D,V,k)=>{r.setPanelPageSettings(k)}),C.add(te.clearPage,()=>{const D=V=>e.t(`actions.${V}`);a.confirm({title:D("clearCanvas.title"),content:D("clearCanvas.content"),confirmButton:{variant:"danger",children:D("clearCanvas.title")},onConfirm:()=>{Ob(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(te.projectFiles,(D,V,k)=>{var ee,J;const z=(ee=r.sdkOptions.dataSources)==null?void 0:ee.exportConfig,Y=((J=k.exportConfig)==null?void 0:J.exportPreset)??z,X={isMJML:wh(e),exportConfig:Y,...k};return ij(D,X)}),C.add(te.validateCode,(D,V,k)=>dv({...k,appStore:n})),C.add(te.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(te.setBlocksPanel,(D,V,k)=>{const z=k||{};Ht(z.isOpen)&&o.setOpen(z.isOpen)}),C.add(te.canvasReload,()=>{const D=e.getSelected(),V=T.getCanvasView(),{frames:k}=T.canvas;k.once("loaded:all",()=>{const z=D==null?void 0:D.getView();z&&!z.isInViewport()&&z.el.scrollIntoView({block:"center"})}),V.renderFrames()}),C.add(te.contextMenuComponent,(D,V,k)=>{const{component:z,...Y}=k;l.showForComponent(z,Y)}),C.add(te.getStateContextMenu,()=>l.publicState),C.add(te.setStateContextMenu,(D,V,k)=>{l.setPublicState(k)}),C.add(te.symbolAdd,(D,V,k)=>{const z=k.component||e.getSelected();if(z)return L.getSymbolInfo(z).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:sn.Warning}):L.addSymbol(z)}),C.add(te.symbolDetach,(D,V,k)=>{const z=k.component||e.getSelected();z&&L.getSymbolInfo(z).isRoot&&L.detachSymbol(z)}),C.add(te.symbolOverride,(D,V,k)=>{const z=k.component||e.getSelected();z&&(z.setSymbolOverride(k.override),e.Layers.updateLayer(z))}),C.add(te.symbolPropagateStyles,(D,V,k)=>{const z=k.component||e.getSelected();if(!z)return;const{Css:Y}=e,X=Y.getComponentRules(z,{current:!0})[0];if(X){const{state:ee,mediaText:J}=X.attributes,q=X.getStyle();L.getSymbolInfo(z).relatives.forEach(R=>{Y.setIdRule(R.getId(),q,{state:ee,mediaText:J})})}k.deep&&z.components().forEach(ee=>e.runCommand(te.symbolPropagateStyles,{...k,component:ee}))}),C.add(te.assetProviderGet,()=>fr(u.allProviders)),C.add(te.assetProviderAdd,(D,V,{provider:k,index:z})=>{u.addProvider(k,z)}),C.add(te.assetProviderRemove,(D,V,{id:k})=>{const z=u.allProviders.filter(Y=>Y.id!==k);u.setAllProviders(z)}),C.add(te.fontGet,()=>fr(d.fonts)),C.add(te.fontAdd,(D,V,{font:k})=>{d.addFont(k)}),C.add(te.fontRemove,(D,V,{family:k})=>{d.removeFont(k)}),C.add(te.fontManagerOpen,(D,V,k)=>{yg(D,k)}),C.add(te.menuFontLoad,(D,V,{font:k})=>qp(k,!1)),C.add(te.toggleStateDataSource,()=>(_=!_,e.trigger(_n.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),C.add(te.getStateDataSource,()=>({showPlaceholder:_})),C.add(te.dataSourceSetGlobalData,(D,V,{globalData:k})=>{const z=Dy(k);return e.DataSources.get(Ds.globalData).setRecords(z)}),C.add(te.setDragAbsolute,(D,V,{enabled:k})=>{r.setIsDraggingAbsolute(!!k)}),C.add(te.dataSourceSetImporter,(D,V,k)=>{e.on(e.Parser.events.htmlBefore,z=>{z.input=k.import(z.input)})}),C.add(te.dataSourceSetExporter,(D,V,k)=>{e.config.optsHtml={...e.config.optsHtml,exporter:k}}),bj(e,t),Pj(e,t),mj(e,t),hj(e),lj(e),_N(e),cj(e,t),gj(e,t)}const Oj=/\s(?![^(]*\))/,zS=/^-?[0-9]+[a-zA-Z%]{0,}$/;function US(e){const t=e.split(Oj),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!zS.test(d))[0]||"currentColor",s=r.filter(d=>zS.test(d)),[a="0",i="0",l="0",u="0"]=s;return{x:a,y:i,blur:l,spread:u,inset:n,color:o}}const Ku=["%"],Zu=["s","ms"],Tl=["deg","rad","grad"],ro=["px","%","em","rem","vw","vh"],WS={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},_j=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Ol=e=>({id:e,label:e.split("-").map($r).join(" ")}),GS=e=>({property:t,to:n})=>{if(n.value){const r=t.getOption(),o=t.getParent().getProperty(e),s=o.getUnit(),a={units:r.units||[],min:r.min,max:r.max,unit:""};(!s||(a==null?void 0:a.units.indexOf(s))<0)&&(a.unit=(a==null?void 0:a.units[0])||""),o.up(a)}},Aj=e=>{const t=`${e}-name`,n=`${e}-value`;return(r,{separatorLayers:o})=>{const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=ju(a);return{[t]:i,[n]:l}}):[]}},qS=e=>{const t={[xl]:e};if(e.indexOf("url(")>-1)t[to]=cs.Image;else if(e.indexOf("gradient(")>-1){const n=qg(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[to]=cs.Color:t[to]=cs.Gradient}else t[to]=cs.Color,t[xl]=_j(e);return t},KS=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:o}){const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=ju(a);return{[t]:i,[n]:l}}):[]},toStyle(r,{name:o}){return{[o]:`${r[t]}(${r[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:GS(n)},{property:n,type:"integer"}]}},Yu=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:ro,...t},s={property:`${e}-y`,type:"integer",units:ro,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,p]=u.getProperties(),[f,h]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||f||"",[p.getId()]:a[p.getName()]||h||f||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),p=a[u.getId()],f=a[d.getId()];return{[i]:p===f?p:`${p} ${f}`}}}}},Mj=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Ol),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Ol),["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,fixedValues:e==="background-position-x"?["left","center","right"]:["top","center","bottom"],units:["px"],default:"auto"})),Yu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Ol),EC("(?<!\\(.*[^)]),(?![^()]*\\))"),cs.Image,cs.Gradient,cs.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:ro,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:ro,default:"auto"})),Kg.map(Ol),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:ro})),["border-top-style","border-right-style","border-bottom-style","border-left-style"].map(e=>({type:"select",property:e,default:"none",options:[{id:"none",label:"None"},{id:"solid",label:"Solid"},{id:"dotted",label:"Dotted"},{id:"dashed",label:"Dashed"},{id:"double",label:"Double"},{id:"groove",label:"Groove"},{id:"ridge",label:"Ridge"},{id:"inset",label:"Inset"},{id:"outset",label:"Outset"}]})),["border-top-color","border-right-color","border-bottom-color","border-left-color"].map(e=>({type:"color",property:e,default:"currentColor"})),Yu("overflow",{x:WS,y:WS,mergable:!0}),KS(),KS("backdrop-filter"),["width","height","min-width","min-height","max-width","max-height","padding","margin","color","font-size","line-height","letter-height","border","border-radius","background","opacity","box-shadow","text-shadow","filter","backdrop-filter","transform","all"].map(Ol),Zu[0],Zu[0],Aj("transform"),Mj("transform","0"),GS("transform-value"),Yu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Yu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function ZS(e,t){return[n=>DN(n,t),...jN[e],n=>Tj(n,t),kN(e,t)]}class Lj{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,an(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield $j()).filter(o=>o.projectType.includes(t));this.setProjectPlugins(r)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const r=[...ZS(t,{appStore:n}),...this.projectPlugins||[]],o=n.sdkOptions.plugins||[];return ot(o)?o({plugins:r}):[...r,...o]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;r.includes(o)?this.pendingUninstalled=r.filter(s=>s!==o):n.includes(o)||n.push(o)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;n.includes(o)?this.pendingInstalled=n.filter(s=>s!==o):r.push(o)}setSelectedShown(t){this.selectedShown=t}}const Nj={db:cb.gjsStudio},$j=()=>new Promise(async e=>{let t=[];try{t=await Z3(Ec.Settings,"plugins",Nj)||[]}catch(n){Wn()&&console.error(n)}e(t)}),kj=g.createContext(void 0);class Ij{constructor(t){this.blockManagerStore=new Q4(this),this.appEditorStore=new $4(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new rL(t==null?void 0:t.localSettingsStore),this.toastStore=new J4(this),this.modalStore=new oL(this),this.i18nStore=new W4(this),this.pluginStore=new Lj(this),this.pointerBadgeStore=new Y4(this),this.contextMenu=new Vj(this),this.layoutStore=new K4(this),this.templatesStore=new X4(this),this.assetsStore=new z4(this),this.globalStylesStore=new RM(this),this.fontsStore=new U4(this),this.appEditorStore.init(),ed()&&(window.__gjss=this)}}const Pn=()=>{const e=g.useContext(kj);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},nh=()=>{throw new Error("Store has not been initialized")};class Vj{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=xs(function*(n,r={}){var w;if(!(n!=null&&n.em))return[];const o=n.em.getEditor(),{isSymbol:s,isRoot:a}=o.Components.getSymbolInfo(n),i=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:zo.selectParent,icon:K.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:zo.duplicate,icon:K.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:zo.symbolCreate,icon:K.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(te.symbolAdd)}},s&&a&&{id:zo.symbolDetach,icon:K.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(te.symbolDetach)}},s&&!i&&{id:zo.symbolOverride,icon:K.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(te.symbolOverride,{override:!0})}},s&&i&&{id:zo.symbolOverrideClear,icon:K.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(te.symbolOverride)}},l&&{id:zo.delete,icon:K.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),f=n.get("contextMenu"),h={...r,items:p,component:n,editor:o,type:n.get("type")||"default",source:r.source||Wp.canvas},m=yield YS(f,h),b=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield YS(b,{...h,items:m})}),this.store=t,an(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const r=t==null?void 0:t.em;if(!r)return;n.skipSelect||r.selected.hasComponent(t)||r.setSelected(t);const o=yield this.getItemsForComponent(t,n);o.length&&this.show({...n,items:o})}show({items:t,x:n,y:r,w:o,h:s}){this.isOpen=!0,this.coordinates={x:n,y:r,w:o,h:s},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const YS=async(e,t)=>ot(e)?(await e(t)).filter(Boolean):t.items,Hj=()=>Pn().contextMenu,XS=Wn()&&document.body,rh=(e={})=>({...wf,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??XS}},{name:"preventOverflow",options:{boundary:e.boundary??XS}}]}),jj=rh(),Xu="gs-ctx-menu-list",Dj=ce(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=Hj(),[d,p]=g.useState(),[f,h]=g.useState(null),m=g.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:b,attributes:v}=xi(m,f,jj),w=N(`${Xu}-wrp gs-utl-z-20`,l),y=N(`${Xu} gs-utl-z-20`),S=N(`${Xu}-body gs-utl-max-w-56`),C=N(`${Xu}-item`),E="gs-utl-max-w-40",x=P=>{const{action:_,onClick:T}=P;if(_||T)return O=>{const M={editor:u.store.appEditorStore.editor,...O};ot(_)?(_(M),u.hide()):ot(T)&&(T(M),u.hide())}};return c.jsx("div",{className:w,ref:h,style:b.popper,...v.popper,children:c.jsx(Op,{show:!!n,...JP,unmount:!1,children:c.jsx(Rn,{padding:!1,className:y,classNameBody:S,children:r.map((P,_)=>g.createElement(_a,{onItemClick:t,...P,key:P.id??_,className:C,classNameLabel:E,action:x(P),onActive:()=>p(P),active:d===P}))})})})}),oh="gs-cmp-tooltip";function Gt({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:o="bottom",children:s,title:a,onClick:i,inline:l,size:u}){const[d,p]=g.useState(!1),[f,h]=g.useState(!1),m=Ht(u),[b,v]=g.useState(null),[w,y]=g.useState(null),S=xi(b,w,{...rh(),placement:o,...r?{strategy:r}:{}});g.useEffect(()=>{var x;d&&((x=S.update)==null||x.call(S))},[d,S.update]),g.useEffect(()=>{const x=setTimeout(()=>p(f),10);return()=>clearTimeout(x)},[f]);const C=N(`${oh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),E=N(`${oh}-content`,n,"gs-utl-fixed gs-utl-z-30 gs-utl-text-sm",!m&&!n&&"gs-utl-whitespace-nowrap",u==="s"&&"gs-utl-w-60");return c.jsxs("div",{className:N(oh,"gs-utl-relative",t),children:[c.jsx("span",{ref:v,className:C,onMouseEnter:()=>a&&h(!0),onMouseLeave:()=>h(!1),children:c.jsx("div",{className:N(l&&"gs-utl-inline-block"),onClick:()=>{h(!1),i==null||i()},children:s})}),!!f&&c.jsx("div",{className:E,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(Op,{show:!!d,unmount:!1,...B1,children:c.jsx(Rn,{className:z1.txt,bg:z1.bg,size:"s",border:!1,children:a})})})]})}function wt({children:e,title:t,classNameWrp:n,tooltipProps:r,...o}){return c.jsx(Gt,{title:t,classNameWrp:n,...r,children:c.jsx(Je,{...o,children:e})})}const Ba="gs-cmp-ai-chat-assets",Fj=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},Bj=e=>e.mediaType==="application/pdf",JS=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${Ba}__asset-item`,a=N(`${Ba}__asset-image`,"gs-utl-object-cover",re.rnd,Ql.m),i=N(`${Ba}__asset-pdf`,"gs-utl-overflow-hidden",re.rnd,Ql.m),l=N(`${Ba}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",re.rnd,Ql.m,U.bgH2),u=N(`${Ba}__asset-remove`,"gs-utl-absolute gs-utl--top-2 gs-utl--right-1 gs-utl-text-white gs-utl-flex gs-utl-items-center gs-utl-justify-center gs-utl-z-10",Ql.s,re.pill,U.bgRed,U.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const p=(f,h)=>{const m={params:{num:h+1}},b=e.t(`${d}.imageAlt`,m),v=e.t(`${d}.pdfTitle`,m);return Fj(f)?c.jsx("img",{src:f.src,alt:b,className:a}):Bj(f)?c.jsx("iframe",{src:f.src,title:v,className:i}):c.jsx("div",{className:l,children:c.jsx(ne,{icon:L2,size:se.l})})};return c.jsx(I,{className:N(Ba,n),gap:"xs",wrap:"wrap",style:o,children:t.map((f,h)=>c.jsxs("div",{className:N(s,"gs-utl-relative gs-utl-inline-block"),children:[p(f,h),r&&c.jsx(wt,{title:e.t(`${d}.remove`),icon:{icon:K.close,size:se.s3x},onClick:()=>r(h),size:"x2s",border:!1,className:u})]},f.src))})},hn="gs-cmp-ai-chat-input",zj=e=>{const{className:t,style:n,editor:r,disabled:o,maxAssets:s,currentAssetsCount:a,acceptAssetType:i,onFilesSelected:l,onAssetSelected:u}=e,d=g.useRef(null);if(s<=0)return null;const p=`${hn}__attach-btn`,f=`${hn}__file-input`,h=a>=s,m="aiChat.input.attach",b=r.t(`${m}.upload`),v=r.t(`${m}.selectFromAssets`),w=r.t(`${m}.title`),y=r.t(`${m}.maxAssets`,{params:{count:s}}),S=E=>{const x=Array.from(E.target.files||[]);x.length>0&&l(x),d.current&&(d.current.value="")},C=E=>{if(!r||h)return;const x="btnAttachImages",P=()=>r.runCommand(te.layoutRemove,{id:x});r.runCommand(te.layoutToggle,{id:x,header:!1,placer:{type:"popover",target:E.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:P,items:[{id:"upload",label:b,icon:K.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:v,icon:B2,onClick:()=>{r.Assets.open({onSelect:({asset:_})=>{const T=_.getSrc();T&&u(T)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:f,style:{display:"none"}}),c.jsx(wt,{className:N(p,re.pill,t),style:n,title:h?y:w,icon:K.plus,border:!1,onClick:C,disabled:o||h,size:"s",block:!0})]})},Uj=({editor:e,className:t,style:n,contextComponents:r,disabled:o})=>{const[s,a]=g.useState(()=>e.getSelectedAll()),i="aiChat.input.context";g.useEffect(()=>{const y=e.Components.events.select,S=()=>a(e.getSelectedAll());return e.on(y,S),()=>{e.off(y,S)}},[e]),g.useEffect(()=>{r.clear(),s.forEach(y=>r.add(y))},[s,r]);const l=()=>a([]);if(s.length===0)return null;const u=`${hn}__context`,d=`${hn}__context-icon`,p=`${hn}__context-badge`,f=`${hn}__context-name`,h=`${hn}__context-divider`,m=s.length===1,b=s[0],v=e.t(`${i}.multiple`,{params:{count:s.length}}),w=m?b.getName():v;return c.jsxs(I,{className:N(u,o&&Oe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.target,size:se.sx,className:N(d,U.txtLowEmphasis)}),c.jsx(Qo,{className:N(p,q1(b).bg,Te.xyS2),s:"s",children:c.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&Ab(b),c.jsx("div",{className:N(f,Oe.txtEllips,"gs-utl-max-w-36"),children:w}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N(h,re.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(wt,{title:e.t(`${i}.clear`),icon:{icon:K.close,size:se.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function QS(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function Wj(){const[e,t]=g.useState(""),[n,r]=g.useState(!1),[o,s]=g.useState(!1),a=g.useRef();g.useEffect(()=>s(!!QS()),[]);const i=()=>{const u=QS();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>r(!0),d.onend=l,d.onresult=p=>{const h=Array.from(p.results).map(m=>m[0].transcript).join("");t(h)},d.onerror=p=>{console.error("Speech recognition error",p),l()},a.current=d,d.start()},l=()=>{var u;(u=a.current)==null||u.stop(),r(!1)};return{transcript:e,isSupported:o,isListening:n,start:i,stop:l}}const Gj=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:o,style:s})=>{const a=`${hn}__dictate`,{transcript:i,isSupported:l,isListening:u,start:d,stop:p}=Wj(),f="aiChat.input.dictate",h=e.t(`${f}.start`),m=e.t(`${f}.stop`),b=u?m:h;return g.useEffect(()=>{i&&n(i)},[i]),g.useEffect(()=>{r==null||r(u)},[u]),l?c.jsx(wt,{block:!0,size:"s",border:!1,className:N(a,re.pill,o),style:s,title:b,disabled:t,icon:u?R2:Q2,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},qj=({autoResize:e,autoFocus:t,style:n={},...r})=>{const o=g.useRef(null);return g.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[r.value,e]),g.useEffect(()=>{const s=o.current;if(s&&t){const a=setTimeout(()=>s==null?void 0:s.focus(),150);return()=>clearTimeout(a)}},[o.current,t]),c.jsx("textarea",{ref:o,style:{...n,...e?{resize:"none"}:{}},...r})},RS=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},eC=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,Kj=({className:e,style:t,chatContext:n,editor:r,maxAssets:o=5,acceptAssetType:s="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:a,layoutBefore:i,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:f,attachButtonProps:h,dictateButtonProps:m,submitButtonProps:b,value:v})=>{const[w,y]=g.useState(v||""),[S,C]=g.useState(""),[E,x]=g.useState(!1),[P,_]=g.useState([]),[T,O]=g.useState(!1),M="aiChat.input",A=r.runCommand(vr.getChatApi),$=r.runCommand(vr.getChatState),{status:j,stop:L,sendMessage:H,setError:W}=n||A,B=j==="streaming"||j==="submitted",G=P.length>0,D=S?eC(w,S):w,V=!T&&(B||D.trim()||G),k={input:D,assets:P},z=Se=>{const Ue=o-P.length,et=Se.slice(0,Ue);if(et.length===0)return;const Ct=et.map(Ne=>({src:URL.createObjectURL(Ne),file:Ne,mediaType:Ne.type}));_(Ne=>[...Ne,...Ct])},Y=Se=>{P.length>=o||_(Ue=>[...Ue,{src:Se,mediaType:"image/*"}])},X=Se=>{const Ue=P[Se];Ue!=null&&Ue.file&&RS([Ue.src]),_(et=>et.filter((Ct,Ne)=>Ne!==Se))},ee=async Se=>{if(Se.preventDefault(),B||T)return;const Ue=()=>J();if(u){u({event:Se,submit:Ue,state:k});return}Ue()},J=async()=>{if(B||T)return;const Se=D.trim();if(!Se&&!G)return;const Ue=P.filter(Ne=>Ne.file).map(Ne=>Ne.file);let Ct=P.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src.trim(),mediaType:Ne.mediaType}));if(Ue.length>0){O(!0);try{const bt=await async function(Ke){return a?await a({files:Ke}):new Promise((tn,he)=>{try{const Be={dataTransfer:{files:Ke}};r.Assets.FileUploader().uploadFile(Be,({data:ze})=>{tn(ze)})}catch(Be){he(Be)}})}(Ue),pt=P.filter(Ke=>Ke.file).map(Ke=>Ke.src);Ct=[...Ct,...bt.map(Ke=>({type:"file",url:Ke.src,mediaType:Ke.mimeType}))],RS(pt)}catch(Ne){const bt=r.t(`${M}.uploadError`);W(Ne instanceof Error?Ne:new Error(bt)),O(!1);return}finally{O(!1)}}H({text:Se,files:Ct.length>0?Ct:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},q=Se=>{Se.key==="Enter"&&!Se.shiftKey&&(Se.preventDefault(),ee(Se))};g.useEffect(()=>{E||y(Se=>eC(Se,S)),C("")},[E]);const R=`${hn}__root`,ae=`${hn}__actions`,le=`${hn}__actions-left`,me=`${hn}__actions-right`,ve=`${hn}__submit-btn`,He=N(`${hn}__textarea gs-utl-w-full`,U.bgTr,$o.inputText,Oe.noFocusOut,Oe.noResize),je=r.t(`${M}.placeholder`),it=i==null?void 0:i({state:k}),qe=l==null?void 0:l({state:k});return c.jsxs("form",{onSubmit:ee,className:N(hn,Te.s,re.bt,U.br,e),style:t,children:[it&&Qt(r,it),c.jsxs(I,{className:N(R,re.b,re.rndLg,U.br,U.bg,Te.s,"gs-utl-relative"),col:!0,gap:"s",children:[T&&c.jsx(ko,{abs:!0,full:!0,className:U.bgH25}),c.jsx(Uj,{editor:r,disabled:B,contextComponents:$.contextComponents,...d}),c.jsx(qj,{value:D,name:"prompt",onChange:Se=>y(Se.target.value),onKeyDown:q,placeholder:je,readOnly:E,disabled:B,className:He,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),c.jsx(JS,{editor:r,assets:P,onRemove:X,...f}),c.jsxs(I,{className:ae,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(I,{className:le,gap:"s",items:"center",children:c.jsx(zj,{editor:r,disabled:B,maxAssets:o,currentAssetsCount:P.length,acceptAssetType:s,onFilesSelected:z,onAssetSelected:Y,...h})}),c.jsxs(I,{className:me,gap:"s",items:"center",children:[c.jsx(Gj,{editor:r,disabled:B,onTranscript:C,onListeningChange:x,...m}),c.jsx(Je,{className:N(ve,re.pill),size:"s",type:B?"button":"submit",onClick:B?L:void 0,icon:B?K.stop:K.arrowUp,variant:B?"out-clear":"pr",disabled:!V,disabledClassName:Oe.disabledM,...b})]})]})]}),qe&&Qt(r,qe)]})},Zj="gs-cmp-ai-chat-loading-state",Yj=({className:e,chatContext:t,editor:n,...r})=>c.jsx(I,{className:N(Zj,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(ko,{})}),Xj="file-refs",tC="gs-cmp-ai-chat-markdown",St=`${tC}__el`,Jj={ul:({children:e})=>c.jsx("ul",{className:`${St}-ul ${jt.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${St}-ol ${jt.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${St}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${St}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${St}-h1 ${jt.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${St}-h2 ${jt.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${St}-h3 ${jt.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${St}-h4 ${jt.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${St}-h5 ${jt.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${St}-h6 ${jt.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${St}-a ${$o.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${St}-code-inline ${jt.codeInline}`,children:e}):c.jsx("code",{className:`${St}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${St}-pre ${jt.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${St}-blockquote ${jt.blockquote} ${U.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${St}-hr ${jt.hr} ${U.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${St}-strong ${jt.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${St}-em ${jt.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${St}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${St}-table ${jt.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${St}-thead ${jt.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${St}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${St}-tr ${jt.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${St}-th ${jt.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${St}-td ${jt.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${St}-checkbox gs-utl-mr-2`,readOnly:!0}),[Xj]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function Qj(e){return cC.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const Rj=g.memo(function({content:t}){return c.jsx(uC,{components:Jj,remarkPlugins:[dC],children:t})},(e,t)=>e.content===t.content),nC=g.memo(function({content:t,id:n,className:r}){const o=g.useMemo(()=>Qj(t),[t]);return c.jsx("div",{className:`${tC} ${r||""}`,children:o.map((s,a)=>c.jsx(Rj,{content:s},`${n}-block_${a}`))})});function sh(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function rC(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const ah="gs-cmp-ai-chat-message",za="aiChat.message",eD=g.memo(function({className:t,style:n,message:r,isStreaming:o,showSources:s=!1,editor:a,chatContext:i,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:h}){const m=r.parts||[],b=m.filter(cr.isFileUIPart),v=m.filter(T=>!cr.isFileUIPart(T)&&(s||!sh(T)&&!rC(T))),w=b.map(T=>({src:T.url,mediaType:T.mediaType??"image/*"})),y=v.length-1,S=r.role==="user",C=N(ah,`${ah}--${r.role}`,Te.s,t),E=N(`${ah}__content gs-utl-break-words`,S?N(U.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Te.xyS,re.rnd):"gs-utl-w-full"),x={editor:a,chatContext:i,message:r},P=l==null?void 0:l(x),_=u==null?void 0:u(x);return c.jsxs(I,{col:!0,gap:"s",className:C,style:n,children:[P&&Qt(a,P),c.jsxs(I,{gap:"s",className:N(E,"gs-utl-self-end"),col:!0,nowrap:!0,children:[v.map((T,O)=>c.jsx(tD,{part:T,messageId:r.id,partIndex:O,isStreamingPart:O===y&&o,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:h,layoutProps:x},`${r.id}-part-${O}`)),c.jsx(JS,{editor:a,assets:w,className:"gs-utl-justify-end"})]}),_&&Qt(a,_)]})}),Eo="gs-cmp-ai-chat-message-part",tD=g.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d,p;if(s){const f=s({...u,part:t,partIndex:r});if(f)return Qt(u.editor,f)}if(cr.isReasoningUIPart(t)){const{text:f,state:h}=t,m=f==null?void 0:f.trim(),b=o&&h==="streaming",v=`${Eo} ${Eo}__reasoning`,w=u.editor.t(`${za}.reasoning`);return!!m&&c.jsx(wo,{className:N(v,U.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(I,{className:N(`${v}-label`,bn.semibold),items:"center",gap:"s",children:[b?c.jsx(ko,{size:"xs",currentColor:!0}):c.jsx(Wa,{path:G2,size:se.s2x}),c.jsx("div",{children:w})]}),children:c.jsx("div",{className:N(`${v}-text`,U.txtLowEmphasis,vn.xs,bn.italic),children:c.jsx(nC,{id:`${n}-${r}`,content:m})})})}if(cr.isTextUIPart(t)){const f=t.text;if(!f)return null;const h=`${Eo} ${Eo}__text`;return c.jsx(nC,{content:f,id:`${n}-${r}`,className:h})}if(cr.isToolUIPart(t)){const{type:f,toolCallId:h,input:m="",output:b="",errorText:v}=t,w=f.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),S=typeof b=="string"?b:JSON.stringify(b),C=typeof t.state=="string"?t.state:void 0,E=C==="output-available",x=!!o&&(C==="input-streaming"||C==="input-available"),P=`${Eo}__tool`,_=`${Eo}__tool-result`,T=`${P}-detail`,O=N(T,"gs-utl-max-w-full"),M="gs-utl-max-w-full gs-utl-whitespace-normal",A=N(`${T}-info gs-utl-max-h-24 gs-utl-overflow-auto`,M,U.txtLowEmphasis,vn.xs),$=N(`${Eo}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,M,U.txtLowEmphasis,vn.xs),j=`${P}-section-label`,L=y&&y!=="{}",H=S&&S!=="{}",W=!!v,B=L||H||W,G=u.editor.t(`${za}.tool.input`),D=u.editor.t(`${za}.tool.output`),V=u.editor.t(`${za}.tool.error`),z=u.editor.t(`${za}.tools.${w}`,{params:m||{}})||w,X=u.editor.runCommand(vr.getChatManager).tools[w],ee={...u,part:t,partIndex:r,toolName:w,isCompleted:E,isProcessing:x,input:t.input,output:t.output},J=(a==null?void 0:a(ee))||((d=X==null?void 0:X.layoutToolLabel)==null?void 0:d.call(X,ee)),q=i==null?void 0:i(ee),R=(l==null?void 0:l(ee))||((p=X==null?void 0:X.layoutToolResult)==null?void 0:p.call(X,ee)),ae=J?Qt(u.editor,J):z,le=R?Qt(u.editor,R):null,me=q?Qt(u.editor,q):c.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[L&&c.jsxs(I,{className:N(O,`${T}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:G}),c.jsx("pre",{className:A,children:y})]}),H&&c.jsxs(I,{className:N(O,`${T}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:D}),c.jsx("pre",{className:A,children:S})]}),W&&c.jsxs(I,{className:N(O,`${T}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:V}),c.jsx("pre",{className:A,children:v})]})]});return c.jsxs(I,{className:N(`${Eo} ${P}`,U.bgH2,re.rnd,Te.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(wo,{disabled:!B&&!q,handler:c.jsxs(I,{className:N(`${P}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${P}-status`,children:E?c.jsx(Wa,{className:`${P}-status-success`,path:Ch,size:se.s2x}):x?c.jsx(ko,{className:`${P}-status-processing`,size:"xs",currentColor:!0}):c.jsx(Wa,{className:`${P}-status-error`,path:xh,size:se.s2x})}),c.jsx("div",{className:N(`${P}-name`,QP.all),children:ae})]}),children:me}),c.jsx(nD,{toolCallId:h,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:$}),!!le&&c.jsx("div",{className:_,children:le})]})}if(sh(t)||rC(t)){const f=`${Eo}__source`,m=sh(t)?t.url:void 0,b=t.title,v=u.editor.t(`${za}.source.document`),w=b||m||v,y=m?new URL(m).hostname:"",S=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${f}-title`,bn.semibold,vn.sm,"gs-utl-truncate"),children:w}),y&&c.jsx("div",{className:N(`${f}-url`,U.txtLowEmphasis,vn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(Wa,{className:N(`${f}-icon`,U.txtLowEmphasis),path:Eh,size:se.s2x})]}),C=N(f,U.bgH2,re.rnd,Te.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Oe.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:C,children:S}):c.jsx("div",{className:C,children:S})}return null}),nD=g.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:r,className:o}){const[s,a]=g.useState(""),i=g.useRef(null);return g.useEffect(()=>{if(!r||!t){a("");return}const l=n.get(t);l!=null&&l.content&&a(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&a(d.content),d!=null&&d.completed&&(clearInterval(u),a(""))},100);return()=>clearInterval(u)},[t,n,r]),g.useEffect(()=>{i.current&&s&&(i.current.scrollTop=i.current.scrollHeight)},[s]),!s||!r?null:c.jsx("pre",{ref:i,className:o,children:s})}),rD="gs-cmp-ai-chat-messages-status",oD=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=N(U.bgA,Oe.dot,Oe.bounce);return o?c.jsxs(I,{items:"center",gap:"xs",className:N(rD,e,Te.s),style:n,children:[c.jsx("div",{className:s}),c.jsx("div",{className:s,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:s,style:{animationDelay:"0.3s"}})]}):null},ih="gs-cmp-ai-chat-messages";function sD({editor:e,chatContext:t,messages:n,pluginOptions:r}){const o=g.useRef(null),[s,a]=g.useState(null),{status:i}=t,l=i==="streaming"||i==="submitted",u=N(ih,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=g.useCallback(({item:h,index:m})=>jd(e,{type:"aiChatMessage",chatContext:t,message:h,isStreaming:l&&m===n.length-1},r),[t,e,l,n.length,r]),p=g.useCallback(()=>({type:"column",className:`${ih}__footer`,children:jd(e,{type:"aiChatMessagesStatus",chatContext:t},r)}),[t,e,r]),f=h=>{requestAnimationFrame(()=>{s==null||s.scrollToIndex({index:n.length-1,align:"end",behavior:h?"smooth":void 0})})};return g.useEffect(()=>{f(!0)},[n]),g.useEffect(()=>{f()},[s]),c.jsx(I,{ref:o,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?Qt(e,{type:"aiChatEmptyState",chatContext:t},r):Qt(e,{type:"virtualList",className:`${ih}__list`,itemsPerRow:1,items:n,onRef:a,itemLayout:d,footerLayout:p})})}const oC=g.createContext(void 0),aD=({chatManager:e,children:t})=>{const n=e.currentChatState,r=g.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(oC.Provider,{value:r,children:t})},iD=()=>g.useContext(oC),lD="gs-cmp-ai-chat-panel";function cD({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=iD(),[,s]=g.useState(0),[a,i]=g.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=o;g.useEffect(()=>o.onUpdate(()=>s(x=>++x)),[]);const f=on.useChat({chat:o.chat}),{messages:h,sendMessage:m,status:b,setMessages:v,error:w}=f,y=w||a,S=g.useMemo(()=>({id:f.id,messages:h,setMessages:v,sendMessage:m,status:b,stop:()=>(l.forEach(E=>E.abort()),l.clear(),f.stop()),addToolApprovalResponse:f.addToolApprovalResponse,addToolOutput:f.addToolOutput,error:y,setError:E=>i(typeof E=="string"?new Error(E):E),clearError:()=>{f.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,b,h,y]),C=N(lD,r,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx(I,{className:C,style:n,col:!0,nowrap:!0,children:p?c.jsxs(c.Fragment,{children:[Qt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(sD,{editor:e,chatContext:S,messages:h,pluginOptions:t}),S.error&&Qt(e,{type:"aiChatError",chatContext:S},t),Qt(e,{type:"aiChatInput",chatContext:S},t)]}):Qt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const uD=(e,t,n)=>(e.runCommand(te.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(aD,{chatManager:n,children:c.jsx(cD,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:qT})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:GT})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:Yj})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:Kj})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:UT})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:eD})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:oD})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(te.layoutComponentRemove,{type:r})})}),dD={aiChat:{header:{title:"AI Chat",clear:"Clear"},emptyState:{title:"AI Assistant",subtitle:"How can I help you build your project?",suggestions:{webHero:"Create a hero section with a headline and call-to-action",webFeatures:"Add a features grid with icons",webContact:"Create a contact form",webTestimonials:"Add testimonials section",emailHeader:"Add an email header",emailCta:"Add a call-to-action button",emailFooter:"Add an email footer with links",emailProduct:"Add a product showcase section"}},error:{title:"Error"},panel:{loadError:"Failed to load messages",messagesUpdate:"Error during messages update"},input:{placeholder:"Ask anything...",uploadError:"Failed to upload images",attach:{title:"Attach images",upload:"Upload new image",selectFromAssets:"Select image from Assets",maxAssets:"Maximum {count} assets allowed"},assets:{imageAlt:"Image {num}",pdfTitle:"PDF {num}",remove:"Remove"},context:{multiple:"{count} Components",clear:"Clear"},dictate:{start:"Dictate",stop:"Stop"}},message:{reasoning:"Reasoning",tools:{webSearch:"Web search",removeComponent:"Remove component",moveComponent:"Move component",getPageContent:"Get page content",listPages:"List pages",fetchWebsite:"Fetch website",generateImage:"Generate image",runCommand:"Run command",addComponentCode:"Create component",editComponentCode:"Edit component",addPageCode:"Create page",addProjectPageCode:"Create new project page"},tool:{input:"Input",output:"Output",error:"Error",generateImage:{generating:"Generating...",imageAlt:"Generated image {num}",useImage:"Use image"},fetchWebsite:{pending:"Fetching website {url}",done:"Fetched website {url}",missingContent:"Missing website content.",defaultPageName:"Imported page"},command:{notFound:'Command "{id}" not found',missingHandler:'Command "{id}" has no execute handler',showCode:{pending:"Opening code panel",done:"Code panel opened"},importCode:{pending:"Opening import panel",done:"Import panel opened"},preview:{pending:"Opening preview",done:"Preview opened"},publish:{pending:"Opening publish dialog",done:"Publish dialog opened"},pageSettings:{pending:"Opening page settings",done:"Page settings opened"}}},source:{document:"Document"}}}},pD="aiChat",fD=Js.startup;return VC(function(e,t={}){t.getAccessToken&&(Bt.getAccessToken=t.getAccessToken),Hd();const n=new FT(e,t),{Commands:r}=e;r.add(vr.getChatManager,()=>n),r.add(vr.getChatState,()=>n.currentChatState),r.add(vr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:dD});const o=uD(e,t,n),s=()=>{delete r.commands[vr.getChatManager],delete r.commands[vr.getChatState],delete r.commands[vr.getChatApi],o(),nT()};HC({editor:e,licenseKey:t.licenseKey,plan:fD,pluginName:pD,onLicenseCheckResponse:a=>{a?Bt.license=a:Bt.license=void 0},cleanup:s})})});