@grapesjs/studio-sdk-plugins 1.0.33 → 1.0.35-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +5 -2
- package/dist/aiChat/components/AiChatHeader.d.ts +22 -2
- package/dist/aiChat/components/AiChatToolGenerateImage.d.ts +7 -0
- package/dist/aiChat/components/utils.d.ts +2 -0
- package/dist/aiChat/index.cjs.js +83 -148
- package/dist/aiChat/index.es.js +14470 -13788
- package/dist/aiChat/index.js +83 -148
- package/dist/aiChat/index.umd.js +83 -148
- package/dist/aiChat/locales/en.d.ts +38 -0
- package/dist/aiChat/server/index.cjs.js +91 -237
- package/dist/aiChat/server/index.es.js +721 -631
- package/dist/aiChat/server/index.js +91 -237
- package/dist/aiChat/server/index.umd.js +91 -237
- package/dist/aiChat/server/prompts.d.ts +15 -11
- package/dist/aiChat/server/tools.d.ts +74 -122
- package/dist/aiChat/server/types.d.ts +61 -3
- package/dist/aiChat/types.d.ts +69 -11
- package/dist/aiChat/typesSchema.d.ts +27 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +11 -11
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +11 -11
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +20 -20
- package/dist/index.es.js +208 -208
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +7 -7
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/presetPrintable/index.cjs.js +2 -2
- package/dist/presetPrintable/index.es.js +5 -5
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +12 -12
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +83 -83
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +15 -15
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/aiChat/index.umd.js
CHANGED
|
@@ -1,70 +1,10 @@
|
|
|
1
|
-
(function(Jt,Ln){typeof exports=="object"&&typeof module<"u"?module.exports=Ln(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"],Ln):(Jt=typeof globalThis<"u"?globalThis:Jt||self,Jt.StudioSdkPlugins_aiChat=Ln(Jt.AiSdkReact,Jt.Ai,Jt.jsxRuntime,Jt.React,Jt.ReactDOM,Jt.ReactDOMClient,Jt.Marked,Jt.ReactMarkdown,Jt.RemarkGfm))})(this,function(Jt,Ln,c,h,$n,Jw,Qw,Rw,eS){"use strict";function Eh(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 Xe=Eh(h),tS=Eh($n),Ph="app.grapesjs.com",_h="app-stage.grapesjs.com",Th=[Ph,"app2.grapesjs.com",_h,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Oh="license:check:start",Pu="license:check:end",vr=()=>typeof window<"u",ts=e=>e&&e.stopPropagation(),nS=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),rS=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},oS=(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)},sS=e=>rS("Escape",e),aS=(e,t={})=>{const n=rt(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var p,g;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((p=t.onScript)==null||p.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},f=document.createElement("script");f.src=i,f.onload=()=>{r(a),d()},f.onerror=()=>{o(a),d()},document.head.appendChild(f),(g=t.onScript)==null||g.call(t,f)})},iS=e=>{const t=e.map(n=>aS(n));return Promise.allSettled(t)};function lS(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 Ah(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=lS(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 Nh=e=>new DOMParser().parseFromString(e,"text/html"),cS=(e="")=>Nh(`<body>${e}</body>`).body.innerHTML,uS=(e="")=>Nh(`<head>${e}</head>`).head.innerHTML,dS=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=bS(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},_u=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?_h:Ph}`}/${n?"platform-api":"api"}`,fS=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},Mh=(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}`},pS=Mh(),Tu=()=>{const e=vr()&&window.location.hostname;return!!e&&(Th.includes(e)||Th.some(t=>e.endsWith(t)))},yr=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),hS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),gS=()=>{},mS=240,Nt=e=>typeof e<"u",rt=e=>typeof e=="string",bS=e=>typeof e=="number";function Ze(e){return typeof e=="function"}function Gr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const vS=e=>!e||Object.keys(e).length===0,Hs=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},yS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},wS=(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},SS=e=>!!e.Components.getType("mjml"),al=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),CS=(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 xS({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||_u({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}`:"",f=await fetch(`${i}${d}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}var Fs=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Fs||{}),Qt=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(Qt||{}),ae=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",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.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))(ae||{}),yn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(yn||{}),go=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(go||{}),vt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(vt||{});const Lh={[Fs.free]:0,[Fs.startup]:10,[Fs.business]:20,[Fs.enterprise]:30};function ES(e){const t=e;return t.init=n=>r=>e(r,n),t}const PS=e=>ES(e);async function _S({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i=!1;const l=Tu(),u=f=>{console.warn("Cleanup plugin:",n,"Reason:",f),s()},d=(f={})=>{var v;const{error:p,sdkLicense:g}=f,m=(v=f.plan)==null?void 0:v.category;if(!(g||f.license)||p)u(p||"Invalid license");else if(m){const w=Lh[t],y=Lh[m];w>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(Oh,f=>{a=f==null?void 0:f.baseApiUrl,i=!0}),e.on(Pu,f=>{o==null||o(f),d(f)}),setTimeout(async()=>{if(!i){if(l)return;if(r){const f=await TS({licenseKey:r,pluginName:n,baseApiUrl:a});o==null||o(f),f&&d(f)}else u("The `licenseKey` option not provided")}},2e3)}async function TS(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await xS({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}}const Gt={accessToken:""},OS=()=>{Gt.timeout&&(clearTimeout(Gt.timeout),Gt.timeout=void 0),Gt.accessToken="",Gt.license=void 0},$h=async()=>{var t;let e={accessToken:""};try{const n=await((t=Gt.getAccessToken)==null?void 0:t.call(Gt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Gt.getAccessToken&&console.error("Failed to get access token");return}if(Gt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Gt.timeout||void 0),Gt.timeout=setTimeout($h,n-Date.now()-1)}},kh=e=>{var t;return((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},AS=e=>kh(e)==="email",Bs=(e,t={})=>{var p;const{selectedComponents:n=[],withPageContent:r=!1,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=kh(e),l=MS(e),u=l.length<=1&&((p=e.getWrapper())==null?void 0:p.components().length)===0,d=s?{id:s.getId(),name:s.getName(),content:r?IS(e):void 0}:void 0,f=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:f,selectedComponents:n.map(g=>({id:g.getId(),content:""})),projectType:i,availablePages:l,globalStyles:NS(e),installedPlugins:LS(e),devices:VS(e),isEmail:i==="email",imageUrls:o}},Rt=(e,t,n)=>{const{layoutComponents:r}=n||{},o=t,s=o.type,a=s?r==null?void 0:r[s]:void 0,i=a?{...o,...a({editor:e,props:t})}:t;return e.runCommand(ae.layoutComponentRender,{components:i})};function NS(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
|
|
2
|
-
`)}const MS=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),LS=e=>{const t=kS(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},$S=e=>e.getModel().get("customData")??{},kS=e=>e&&$S(e).plugins||[];function VS(e){return e.Devices.getAll().map(t=>t.toJSON())}function $a(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const ns=(e="",t,n={})=>{!t||!e||(t.innerHTML=$a(e),!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"})})))},Vh=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function rs(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function os(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}const il=e=>{var s;const{error:t,abortMsg:n,msg:r}=e,o=t.name==="AbortError"||((s=t.message)==null?void 0:s.includes("abort"));return o||console.error(t),{error:o?n:r,abortedByUser:o?!0:void 0}};function IS(e){const t=e.getWrapper(),n=Vh(t);return`<style>${e.getCss()||""}</style>${n}`}const Ih=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 p;const i=new DOMParser,l=$a(a),u=i.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),f=e.getWrapper();return(p=f==null?void 0:f.getEl())==null||p.appendChild(o),d.forEach(g=>{var b,v;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=[((b=g.tagName)==null?void 0:b.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const w=(v=r.get(m))==null?void 0:v.newNode;w?s(g,w):(o.appendChild(g),r.set(m,{newNode:g}))}}),r}}},jh=(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)};var tr=(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.SHOW_PANEL="showPanel",e))(tr||{}),qr=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(qr||{}),wr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(wr||{});function Dh(e,t){var g;const{componentId:n,position:r}=t;rs(e);const o=document.createElement("div");o.style.display="contents";const{Components:s}=e;let i=s.getById(n)||e.getSelected(),l=i==null?void 0:i.parent();const u=i==null?void 0:i.index(),d=i==null?void 0:i.getEl();let f="afterend",p;switch(r){case"before":f="beforebegin",i=l,p=u;break;case"beforeInside":f="afterbegin",p=0;break;case"afterInside":f="beforeend";break;case"after":f="afterend",i=l,p=(u??0)+1;break}return i||(i=e.getWrapper(),l=i,p=void 0),d?d==null||d.insertAdjacentElement(f,o):(g=l==null?void 0:l.getEl())==null||g.appendChild(o),{target:i,at:p,domPosition:f,tempTargetEl:d,tempDOM:o,cleanUp(){o==null||o.remove(),os(e)}}}function Hh(e,t,n){const{target:r,at:o}=t,s=r==null?void 0:r.append(n,{at:o})[0];return s&&e.select(s),s}function jS(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:qr.ADD_COMPONENT_CODE,toolSetup:Dh(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,ns(o.content,i.toolSetup.tempDOM,{skipScroll:!0}));return}if(a==="done"&&i&&o.content){if(i.completed)return;Hh(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function DS(e){rs(e);const t=Ih(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),os(e)}}}function HS(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?jh(o,a):n==null||n.append(a)})}function FS(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:qr.EDIT_COMPONENT_CODE,toolSetup:DS(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),HS(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function BS(e,t){const{name:n}=t,{Pages:r,Components:o}=e;rs(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&&ns(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
3
|
-
Generating ${n?`"${n}" `:""}page...
|
|
4
|
-
</h1>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){os(e)}}}function zS(e,t){const{cmpRoot:n}=e;n.components(t)}function US(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:qr.ADD_PAGE_CODE,toolSetup:BS(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&ns(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;zS(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function WS(e){rs(e);const t=e.getWrapper(),n=Bs(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){os(e)}}}function GS(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}const Fh="mjml-code-to-html";function qS(e){var u;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:qr.ADD_PROJECT_PAGE_CODE,toolSetup:WS(t),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const{isEmail:d,cmpRoot:f}=i.toolSetup,p=f.getEl();let g=o.content;if(d){const m=$a(g);try{const b=(u=t.runCommand(Fh,{mjml:m}))==null?void 0:u.html;b&&(g=b)}catch{}}p&&ns(g,p,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;GS(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const Bh={[qr.ADD_COMPONENT_CODE]:jS,[qr.EDIT_COMPONENT_CODE]:FS,[qr.ADD_PAGE_CODE]:US,[qr.ADD_PROJECT_PAGE_CODE]:qS},KS=({editor:e,data:t,toolStatusProgress:n})=>{var a;if(t.type!=="data-tool-status")return;const r=t,o=((a=r.data)==null?void 0:a.name)||"",s=Bh[o];s?s({editor:e,toolStatus:r,toolStatusProgress:n}):YS({toolStatus:r,toolStatusProgress:n})};function YS({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)}const ZS={addComponent:"/api/ai/add-component-stream",editComponent:"/api/ai/edit-component-stream",addPage:"/api/ai/add-page-stream",generateProject:"/api/ai/generate-project-stream",scrapeWebsite:"/api/ai/scrape-website"};async function ll(e,t,n={}){var u;const{onContent:r,abortController:o}=n,s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:o==null?void 0:o.signal});if(!s.ok)throw new Error(`Failed to fetch: ${s.statusText}`);const a=(u=s.body)==null?void 0:u.getReader();if(!a)throw new Error("No reader available");const i=new TextDecoder;let l="";for(;;){if(o!=null&&o.signal.aborted){a.cancel();break}const{done:d,value:f}=await a.read();if(d)break;const p=i.decode(f);l+=p,r==null||r(l)}return $a(l)}function Ou({lastUserMessage:e}){return(e==null?void 0:e.parts.filter(t=>Ln.isTextUIPart(t)).map(t=>t.text).join(""))||""}function XS(e,t={}){const n={...ZS,...t},r={async execute(g,m){const{plan:b,name:v,imageUrls:w}=g,y=Ou(m);let S;try{S=Dh(e,g);const{tempDOM:C}=S,x=await ll(n.addComponent,{userPrompt:`${y}
|
|
5
|
-
${b?`
|
|
6
|
-
Plan: ${b}`:""}
|
|
7
|
-
${v?`
|
|
8
|
-
Component Name: ${v}`:""}
|
|
9
|
-
`.trim(),id:"",imageUrls:w,messages:[],trigger:m.toolCallId,projectContext:Bs(e,{imageUrls:w,withPageContent:!0})},{onContent:P=>ns(P,C,{skipScroll:!0}),abortController:m.abortController});if(!x)throw new Error("Failed to generate component content");const E=Hh(e,S,x);return{newComponentId:E==null?void 0:E.getId(),newComponentName:v}}catch(C){return il({error:C,msg:"Failed to add component",abortMsg:"Cancelled adding component"})}finally{S==null||S.cleanUp()}}},o={async execute(g,m){const{plan:b,imageUrls:v}=g,w=e.getWrapper(),y=Ih(e);let S=new Map;try{if(rs(e),await ll(n.editComponent,{userPrompt:b,projectContext:Bs(e,{imageUrls:v,withPageContent:!0}),imageUrls:v,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:C=>{S=y.update(C)}}),!S.size)throw new Error("Failed to generate component content");return S.forEach(C=>{const{cmp:x,newNode:E}=C,{outerHTML:P}=E;x?jh(x,P):w==null||w.append(P)}),{success:!0}}catch(C){return il({error:C,msg:"Failed to edit component",abortMsg:"Cancelled editing component"})}finally{y.cleanup(),os(e)}}},s={async execute(g){const{componentId:m}=g,b=e.Components.getById(m);return b?(b.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${m}'`}}},a={async execute(g){const{sourceId:m,targetId:b,targetIndex:v}=g,w=e.Components.getById(m),y=e.Components.getById(b);return w?y?(y.append(w,{at:v}),e.select(w,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${b}'`}:{success:!1,error:`Source component not found with ID '${m}'`}}},i={async execute(g,m){const{name:b,plan:v,imageUrls:w}=g,{Pages:y,Components:S}=e;try{rs(e);const C=Ou(m),x=y.add({name:b,component:"<h1></h1>"},{select:!0}),E=x.getMainComponent(),P=O=>{const _=E.getEl();ns(O,_,{skipScroll:!0})};E.once(S.events.render,()=>{P(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
10
|
-
Generating ${b?`"${b}" `:""}page...
|
|
11
|
-
</h1>`)});const T=await ll(n.addPage,{userPrompt:`${C}
|
|
12
|
-
${v?`
|
|
13
|
-
Plan: ${v}`:""}
|
|
14
|
-
`.trim(),id:"",imageUrls:w,messages:[],trigger:m.toolCallId,projectContext:Bs(e,{imageUrls:w,withPageContent:!0})},{onContent:P,abortController:m.abortController});if(!T)throw new Error("Failed to generate page content");return E.components(T),{success:!0,data:{pageId:x.getId(),pageName:b}}}catch(C){return il({error:C,msg:"Failed to create page",abortMsg:"Cancelled creating page"})}finally{os(e)}}},l={async execute(g){const{pageId:m}=g,b=e.Pages.get(m),v=b==null?void 0:b.getMainComponent();return v?{content:Vh(v)}:{success:!1,error:"Page not found"}}},u={async execute(){return{pages:e.Pages.getAll().map(m=>({id:m.getId(),name:m.getName()}))}}},d={async execute(g){const{url:m,name:b}=g,v=await fetch(n.scrapeWebsite,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:m})});if(!v.ok)return{success:!1,error:"Failed to fetch website"};const w=await v.json();return e.Pages.add({name:b,component:w.html},{select:!0}),{success:!0,data:{pageName:b,subPages:w.subPages||[]}}}},f={async execute(g){const{panelId:m}=g;await new Promise(b=>setTimeout(b,1500));try{e.runCommand(`open:${m}`)}catch{return{success:!1,error:`Panel ${m} not found`}}return{success:!0}}},p={async execute(g,m){var C;const{name:b,plan:v,imageUrls:w}=g,y=Bs(e,{imageUrls:w,withPageContent:!0}),{isEmail:S}=y;rs(e);try{const{Pages:x}=e,E=e.getWrapper(),P=Ou(m),T=_=>{var L;let N="";if(S){const k=$a(_);try{const B=(L=e.runCommand(Fh,{mjml:k}))==null?void 0:L.html;B&&(N=B)}catch{}}else N=_;ns(N,E.getEl(),{skipScroll:!0})},O=await ll(n.generateProject,{userPrompt:`${P}${v?`
|
|
15
|
-
Plan: ${v}`:""}`,projectContext:y,imageUrls:w,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:T});return e.loadProjectData({pages:[{name:b,component:O}]}),(C=x.getSelected())==null||C.setName(b),{success:!0,data:{pageName:b}}}catch(x){return il({error:x,msg:"Failed to create a project page",abortMsg:"Cancelled creating project page"})}finally{os(e)}}};return{[tr.ADD_NEW_COMPONENT]:r,[tr.EDIT_COMPONENT]:o,[tr.REMOVE_COMPONENT]:s,[tr.MOVE_COMPONENT]:a,[tr.ADD_NEW_PAGE]:i,[tr.GET_PAGE_CONTENT]:l,[tr.LIST_PAGES]:u,[tr.FETCH_WEBSITE]:d,[tr.SHOW_PANEL]:f,[tr.ADD_NEW_PROJECT_PAGE]:p}}var JS={};class QS{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=XS(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,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,{chatApi:a,onTool:i,body:l,defaultTransportOptions:u={},chatOptions:d={},onMessagesUpdate:f,messages:p}=this.options,{onFinish:g,onData:m,...b}=d,v=typeof p=="function",w=new Jt.Chat({id:t,messages:Array.isArray(p)?p:void 0,sendAutomaticallyWhen:Ln.lastAssistantMessageIsCompleteWithToolCalls,transport:new Ln.DefaultChatTransport({...u,async prepareSendMessagesRequest({headers:E,messages:P,body:T,id:O,trigger:_,credentials:N}){var V;const L={...T,id:O,trigger:_,messages:P.slice(-10),projectContext:Bs(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},k=typeof l=="function"?l({editor:n,body:L,messages:P}):l,{accessToken:B,license:$}=Gt,z=JS.NODE_ENV!=="production",K=`${_u({isDev:z,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!$||["enterprise","business"].includes(((V=$==null?void 0:$.plan)==null?void 0:V.category)??"free"))&&typeof a<"u"?typeof a=="function"?a():a:K,headers:{...E,...B?{Authorization:`Bearer ${B}`}:{}},credentials:N,body:{...L,...k}}}}),onToolCall:async({toolCall:E})=>{i==null||i({toolCall:E});const P=!!Bh[E.toolName];if(E.dynamic||P)return;const{toolName:T,input:O,toolCallId:_}=E,N=this.tools[T];if(N&&N.execute){const L=new AbortController;o.add(L);try{const{messages:k}=w,B=await Promise.race([N.execute(O||{},{editor:n,messages:k,lastUserMessage:k.findLast($=>$.role==="user"),toolCallId:_,abortController:L}),new Promise(($,z)=>{L.signal.addEventListener("abort",()=>z(new Error("Aborted")))})]);if(B&&typeof B.error=="string")throw new Error(B.error);w.addToolOutput({tool:T,toolCallId:_,output:B})}catch(k){w.addToolOutput({tool:T,toolCallId:_,state:"output-error",errorText:k instanceof Error?k.message:"Unknown error"})}finally{o.delete(L)}}},onData(E){m==null||m(E),KS({editor:n,data:E,toolStatusProgress:r})},onFinish(E){f==null||f({messages:E.messages,editor:n}),E.isAbort&&(r.forEach(P=>{"toolSetup"in P&&P.toolSetup.cleanUp()}),r.clear()),g==null||g(E)},...b}),y=new Set,S={get messages(){return w.messages},get lastMessage(){return w.lastMessage},get status(){return w.status},get error(){return w.error},sendMessage:(...E)=>w.sendMessage(...E),setMessages:E=>{w.messages=E},clearError:()=>w.clearError(),stop:()=>w.stop(),setError:E=>{const P=E instanceof Error?E:new Error(String(E));w.setStatus({status:"error",error:P})}},C={chat:w,chatApi:S,isMessagesLoaded:!v,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:E=>(y.add(E),()=>{y.delete(E)}),emitUpdate:()=>{y.forEach(E=>E())}};this.chatStates.set(w.id,C);const x=()=>{w["~registerMessagesCallback"](()=>{w.status==="ready"&&(f==null||f({messages:w.messages,editor:n}))})};return v?p({editor:n}).then(E=>{w.messages=E,x()}).catch(E=>S.setError(E)).finally(()=>{C.isMessagesLoaded=!0,C.emitUpdate()}):x(),C}}var RS="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",e2="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",t2="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",n2="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",r2="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",o2="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",s2="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",a2="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",i2="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",l2="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",c2="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",u2="M3,21V3H21V21H3M5,5V19H19V5H5Z",d2="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",f2="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",p2="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",h2="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",g2="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",zh="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",m2="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",b2="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",v2="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",y2="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",w2="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",S2="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Uh="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",x2="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",E2="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",_2="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",T2="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",O2="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",A2="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",N2="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",M2="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",L2="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",$2="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",k2="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",V2="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",I2="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",j2="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",H2="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",B2="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",z2="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",U2="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",W2="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",G2="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",q2="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",Y2="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",Z2="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",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",Q2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",R2="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",eC="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",tC="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",nC="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",rC="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",oC="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",sC="M11 15H6L13 1V9H18L11 23V15Z",aC="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",iC="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",lC="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",cC="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",uC="M7,10L12,15L17,10H7Z",dC="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",fC="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",pC="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",hC="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",gC="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",Wh="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",mC="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",bC="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",vC="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",yC="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",wC="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",SC="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",CC="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",xC="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",EC="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",PC="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",_C="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",TC="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",OC="M18,18H6V6H18V18Z",AC="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",NC="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",MC="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",LC="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",$C="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",kC="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",VC="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",IC="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",jC="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",DC="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",HC="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",FC="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",BC="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",zC="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 ue=ee;function ee(...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("!"),f=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,p=u?`!${f}`:f;return l?`${l}:${p}`:p}return s}):o).join(" ")}const I=h.forwardRef(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:f,...p},g){const m=t||"div";return c.jsx(m,{ref:g,className:ee([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",f==="start"&&"gs-utl-items-start",f==="end"&&"gs-utl-items-end",f==="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"]),...p,children:n})}),H=h.forwardRef(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:ee([n,r&&"flex-1"]),...o,children:t})});function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cl={exports:{}},ul={exports:{}},Je={};/** @license React v16.13.1
|
|
16
|
-
* react-is.production.min.js
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var Gh;function UC(){if(Gh)return Je;Gh=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,i=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function S(x){if(typeof x=="object"&&x!==null){var E=x.$$typeof;switch(E){case t:switch(x=x.type,x){case l:case u:case r:case s:case o:case f:return x;default:switch(x=x&&x.$$typeof,x){case i:case d:case m:case g:case a:return x;default:return E}}case n:return E}}}function C(x){return S(x)===u}return Je.AsyncMode=l,Je.ConcurrentMode=u,Je.ContextConsumer=i,Je.ContextProvider=a,Je.Element=t,Je.ForwardRef=d,Je.Fragment=r,Je.Lazy=m,Je.Memo=g,Je.Portal=n,Je.Profiler=s,Je.StrictMode=o,Je.Suspense=f,Je.isAsyncMode=function(x){return C(x)||S(x)===l},Je.isConcurrentMode=C,Je.isContextConsumer=function(x){return S(x)===i},Je.isContextProvider=function(x){return S(x)===a},Je.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},Je.isForwardRef=function(x){return S(x)===d},Je.isFragment=function(x){return S(x)===r},Je.isLazy=function(x){return S(x)===m},Je.isMemo=function(x){return S(x)===g},Je.isPortal=function(x){return S(x)===n},Je.isProfiler=function(x){return S(x)===s},Je.isStrictMode=function(x){return S(x)===o},Je.isSuspense=function(x){return S(x)===f},Je.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===u||x===s||x===o||x===f||x===p||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===g||x.$$typeof===a||x.$$typeof===i||x.$$typeof===d||x.$$typeof===v||x.$$typeof===w||x.$$typeof===y||x.$$typeof===b)},Je.typeOf=S,Je}var Qe={},qh;function WC(){if(qh)return Qe;qh=1;var e={};/** @license React v16.13.1
|
|
23
|
-
* react-is.development.js
|
|
24
|
-
*
|
|
25
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
|
-
*
|
|
27
|
-
* This source code is licensed under the MIT license found in the
|
|
28
|
-
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/return e.NODE_ENV!=="production"&&function(){var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,r=t?Symbol.for("react.portal"):60106,o=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,i=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,u=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,p=t?Symbol.for("react.suspense"):60113,g=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,b=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,w=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,S=t?Symbol.for("react.scope"):60119;function C(ne){return typeof ne=="string"||typeof ne=="function"||ne===o||ne===d||ne===a||ne===s||ne===p||ne===g||typeof ne=="object"&&ne!==null&&(ne.$$typeof===b||ne.$$typeof===m||ne.$$typeof===i||ne.$$typeof===l||ne.$$typeof===f||ne.$$typeof===w||ne.$$typeof===y||ne.$$typeof===S||ne.$$typeof===v)}function x(ne){if(typeof ne=="object"&&ne!==null){var Oe=ne.$$typeof;switch(Oe){case n:var Ie=ne.type;switch(Ie){case u:case d:case o:case a:case s:case p:return Ie;default:var ut=Ie&&Ie.$$typeof;switch(ut){case l:case f:case b:case m:case i:return ut;default:return Oe}}case r:return Oe}}}var E=u,P=d,T=l,O=i,_=n,N=f,L=o,k=b,B=m,$=r,z=a,K=s,F=p,V=!1;function D(ne){return V||(V=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(ne)||x(ne)===u}function A(ne){return x(ne)===d}function j(ne){return x(ne)===l}function q(ne){return x(ne)===i}function G(ne){return typeof ne=="object"&&ne!==null&&ne.$$typeof===n}function Y(ne){return x(ne)===f}function Q(ne){return x(ne)===o}function Z(ne){return x(ne)===b}function W(ne){return x(ne)===m}function R(ne){return x(ne)===r}function re(ne){return x(ne)===a}function fe(ne){return x(ne)===s}function xe(ne){return x(ne)===p}Qe.AsyncMode=E,Qe.ConcurrentMode=P,Qe.ContextConsumer=T,Qe.ContextProvider=O,Qe.Element=_,Qe.ForwardRef=N,Qe.Fragment=L,Qe.Lazy=k,Qe.Memo=B,Qe.Portal=$,Qe.Profiler=z,Qe.StrictMode=K,Qe.Suspense=F,Qe.isAsyncMode=D,Qe.isConcurrentMode=A,Qe.isContextConsumer=j,Qe.isContextProvider=q,Qe.isElement=G,Qe.isForwardRef=Y,Qe.isFragment=Q,Qe.isLazy=Z,Qe.isMemo=W,Qe.isPortal=R,Qe.isProfiler=re,Qe.isStrictMode=fe,Qe.isSuspense=xe,Qe.isValidElementType=C,Qe.typeOf=x}(),Qe}var Kh;function Yh(){if(Kh)return ul.exports;Kh=1;var e={};return e.NODE_ENV==="production"?ul.exports=UC():ul.exports=WC(),ul.exports}/*
|
|
30
|
-
object-assign
|
|
31
|
-
(c) Sindre Sorhus
|
|
32
|
-
@license MIT
|
|
33
|
-
*/var Nu,Zh;function GC(){if(Zh)return Nu;Zh=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function o(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var a={},i=0;i<10;i++)a["_"+String.fromCharCode(i)]=i;var l=Object.getOwnPropertyNames(a).map(function(d){return a[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Nu=o()?Object.assign:function(s,a){for(var i,l=r(s),u,d=1;d<arguments.length;d++){i=Object(arguments[d]);for(var f in i)t.call(i,f)&&(l[f]=i[f]);if(e){u=e(i);for(var p=0;p<u.length;p++)n.call(i,u[p])&&(l[u[p]]=i[u[p]])}}return l},Nu}var Mu,Xh;function Lu(){if(Xh)return Mu;Xh=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Mu=e,Mu}var $u,Jh;function Qh(){return Jh||(Jh=1,$u=Function.call.bind(Object.prototype.hasOwnProperty)),$u}var ku,Rh;function qC(){if(Rh)return ku;Rh=1;var e={},t=function(){};if(e.NODE_ENV!=="production"){var n=Lu(),r={},o=Qh();t=function(a){var i="Warning: "+a;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function s(a,i,l,u,d){if(e.NODE_ENV!=="production"){for(var f in a)if(o(a,f)){var p;try{if(typeof a[f]!="function"){var g=Error((u||"React class")+": "+l+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}p=a[f](i,f,u,l,null,n)}catch(b){p=b}if(p&&!(p instanceof Error)&&t((u||"React class")+": type specification of "+l+" `"+f+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in r)){r[p.message]=!0;var m=d?d():"";t("Failed "+l+" type: "+p.message+(m??""))}}}}return s.resetWarningCache=function(){e.NODE_ENV!=="production"&&(r={})},ku=s,ku}var Vu,eg;function KC(){if(eg)return Vu;eg=1;var e={},t=Yh(),n=GC(),r=Lu(),o=Qh(),s=qC(),a=function(){};e.NODE_ENV!=="production"&&(a=function(l){var u="Warning: "+l;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function i(){return null}return Vu=function(l,u){var d=typeof Symbol=="function"&&Symbol.iterator,f="@@iterator";function p(A){var j=A&&(d&&A[d]||A[f]);if(typeof j=="function")return j}var g="<<anonymous>>",m={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:S(),arrayOf:C,element:x(),elementType:E(),instanceOf:P,node:N(),objectOf:O,oneOf:T,oneOfType:_,shape:k,exact:B};function b(A,j){return A===j?A!==0||1/A===1/j:A!==A&&j!==j}function v(A,j){this.message=A,this.data=j&&typeof j=="object"?j:{},this.stack=""}v.prototype=Error.prototype;function w(A){if(e.NODE_ENV!=="production")var j={},q=0;function G(Q,Z,W,R,re,fe,xe){if(R=R||g,fe=fe||W,xe!==r){if(u){var ne=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 ne.name="Invariant Violation",ne}else if(e.NODE_ENV!=="production"&&typeof console<"u"){var Oe=R+":"+W;!j[Oe]&&q<3&&(a("You are manually calling a React.PropTypes validation function for the `"+fe+"` prop on `"+R+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),j[Oe]=!0,q++)}}return Z[W]==null?Q?Z[W]===null?new v("The "+re+" `"+fe+"` is marked as required "+("in `"+R+"`, but its value is `null`.")):new v("The "+re+" `"+fe+"` is marked as required in "+("`"+R+"`, but its value is `undefined`.")):null:A(Z,W,R,re,fe)}var Y=G.bind(null,!1);return Y.isRequired=G.bind(null,!0),Y}function y(A){function j(q,G,Y,Q,Z,W){var R=q[G],re=K(R);if(re!==A){var fe=F(R);return new v("Invalid "+Q+" `"+Z+"` of type "+("`"+fe+"` supplied to `"+Y+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return w(j)}function S(){return w(i)}function C(A){function j(q,G,Y,Q,Z){if(typeof A!="function")return new v("Property `"+Z+"` of component `"+Y+"` has invalid PropType notation inside arrayOf.");var W=q[G];if(!Array.isArray(W)){var R=K(W);return new v("Invalid "+Q+" `"+Z+"` of type "+("`"+R+"` supplied to `"+Y+"`, expected an array."))}for(var re=0;re<W.length;re++){var fe=A(W,re,Y,Q,Z+"["+re+"]",r);if(fe instanceof Error)return fe}return null}return w(j)}function x(){function A(j,q,G,Y,Q){var Z=j[q];if(!l(Z)){var W=K(Z);return new v("Invalid "+Y+" `"+Q+"` of type "+("`"+W+"` supplied to `"+G+"`, expected a single ReactElement."))}return null}return w(A)}function E(){function A(j,q,G,Y,Q){var Z=j[q];if(!t.isValidElementType(Z)){var W=K(Z);return new v("Invalid "+Y+" `"+Q+"` of type "+("`"+W+"` supplied to `"+G+"`, expected a single ReactElement type."))}return null}return w(A)}function P(A){function j(q,G,Y,Q,Z){if(!(q[G]instanceof A)){var W=A.name||g,R=D(q[G]);return new v("Invalid "+Q+" `"+Z+"` of type "+("`"+R+"` supplied to `"+Y+"`, expected ")+("instance of `"+W+"`."))}return null}return w(j)}function T(A){if(!Array.isArray(A))return e.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),i;function j(q,G,Y,Q,Z){for(var W=q[G],R=0;R<A.length;R++)if(b(W,A[R]))return null;var re=JSON.stringify(A,function(xe,ne){var Oe=F(ne);return Oe==="symbol"?String(ne):ne});return new v("Invalid "+Q+" `"+Z+"` of value `"+String(W)+"` "+("supplied to `"+Y+"`, expected one of "+re+"."))}return w(j)}function O(A){function j(q,G,Y,Q,Z){if(typeof A!="function")return new v("Property `"+Z+"` of component `"+Y+"` has invalid PropType notation inside objectOf.");var W=q[G],R=K(W);if(R!=="object")return new v("Invalid "+Q+" `"+Z+"` of type "+("`"+R+"` supplied to `"+Y+"`, expected an object."));for(var re in W)if(o(W,re)){var fe=A(W,re,Y,Q,Z+"."+re,r);if(fe instanceof Error)return fe}return null}return w(j)}function _(A){if(!Array.isArray(A))return e.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var j=0;j<A.length;j++){var q=A[j];if(typeof q!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+V(q)+" at index "+j+"."),i}function G(Y,Q,Z,W,R){for(var re=[],fe=0;fe<A.length;fe++){var xe=A[fe],ne=xe(Y,Q,Z,W,R,r);if(ne==null)return null;ne.data&&o(ne.data,"expectedType")&&re.push(ne.data.expectedType)}var Oe=re.length>0?", expected one of type ["+re.join(", ")+"]":"";return new v("Invalid "+W+" `"+R+"` supplied to "+("`"+Z+"`"+Oe+"."))}return w(G)}function N(){function A(j,q,G,Y,Q){return $(j[q])?null:new v("Invalid "+Y+" `"+Q+"` supplied to "+("`"+G+"`, expected a ReactNode."))}return w(A)}function L(A,j,q,G,Y){return new v((A||"React class")+": "+j+" type `"+q+"."+G+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+Y+"`.")}function k(A){function j(q,G,Y,Q,Z){var W=q[G],R=K(W);if(R!=="object")return new v("Invalid "+Q+" `"+Z+"` of type `"+R+"` "+("supplied to `"+Y+"`, expected `object`."));for(var re in A){var fe=A[re];if(typeof fe!="function")return L(Y,Q,Z,re,F(fe));var xe=fe(W,re,Y,Q,Z+"."+re,r);if(xe)return xe}return null}return w(j)}function B(A){function j(q,G,Y,Q,Z){var W=q[G],R=K(W);if(R!=="object")return new v("Invalid "+Q+" `"+Z+"` of type `"+R+"` "+("supplied to `"+Y+"`, expected `object`."));var re=n({},q[G],A);for(var fe in re){var xe=A[fe];if(o(A,fe)&&typeof xe!="function")return L(Y,Q,Z,fe,F(xe));if(!xe)return new v("Invalid "+Q+" `"+Z+"` key `"+fe+"` supplied to `"+Y+"`.\nBad object: "+JSON.stringify(q[G],null," ")+`
|
|
34
|
-
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var ne=xe(W,fe,Y,Q,Z+"."+fe,r);if(ne)return ne}return null}return w(j)}function $(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every($);if(A===null||l(A))return!0;var j=p(A);if(j){var q=j.call(A),G;if(j!==A.entries){for(;!(G=q.next()).done;)if(!$(G.value))return!1}else for(;!(G=q.next()).done;){var Y=G.value;if(Y&&!$(Y[1]))return!1}}else return!1;return!0;default:return!1}}function z(A,j){return A==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function K(A){var j=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":z(j,A)?"symbol":j}function F(A){if(typeof A>"u"||A===null)return""+A;var j=K(A);if(j==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return j}function V(A){var j=F(A);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function D(A){return!A.constructor||!A.constructor.name?g:A.constructor.name}return m.checkPropTypes=s,m.resetWarningCache=s.resetWarningCache,m.PropTypes=m,m},Vu}var Iu,tg;function YC(){if(tg)return Iu;tg=1;var e=Lu();function t(){}function n(){}return n.resetWarningCache=t,Iu=function(){function r(a,i,l,u,d,f){if(f!==e){var p=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 p.name="Invariant Violation",p}}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},Iu}var ng;function ZC(){if(ng)return cl.exports;ng=1;var e={};if(e.NODE_ENV!=="production"){var t=Yh(),n=!0;cl.exports=KC()(t.isElement,n)}else cl.exports=YC()();return cl.exports}var XC=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=ZC()},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 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,x=C===void 0?null:C,E=m.color,P=E===void 0?"currentColor":E,T=m.horizontal,O=T===void 0?null:T,_=m.vertical,N=_===void 0?null:_,L=m.rotate,k=L===void 0?null:L,B=m.spin,$=B===void 0?null:B,z=m.style,K=z===void 0?{}:z,F=m.children,V=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var D,A=$!==null&&$,j=r.Children.map(F,function(Q){var Z=Q;A!==!0&&(A=($===null?Z.props.spin:$)===!0);var W=Z.props.size;typeof x=="number"&&typeof Z.props.size=="number"&&(W=Z.props.size/x);var R={size:W,color:P===null?Z.props.color:P,horizontal:O===null?Z.props.horizontal:O,vertical:N===null?Z.props.vertical:N,rotate:k===null?Z.props.rotate:k,spin:$===null?Z.props.spin:$,inStack:!0};return r.cloneElement(Z,R)});x!==null&&(K.width=typeof x=="string"?x:1.5*x+"rem");var q,G="stack_labelledby_"+i,Y="stack_describedby_"+i;if(w)D=S?G+" "+Y:G;else if(q="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:K,role:q,"aria-labelledby":D},V),w&&r.createElement("title",{id:G},w),S&&r.createElement("desc",{id:Y},S),A&&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) } }"),j)});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 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)},f=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},p=0,g=r.forwardRef(function(m,b){var v=m.path,w=m.id,y=w===void 0?++p:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,P=m.size,T=P===void 0?null:P,O=m.color,_=O===void 0?"currentColor":O,N=m.horizontal,L=N!==void 0&&N,k=m.vertical,B=k!==void 0&&k,$=m.rotate,z=$===void 0?0:$,K=m.spin,F=K!==void 0&&K,V=m.style,D=V===void 0?{}:V,A=m.inStack,j=A!==void 0&&A,q=f(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),G={},Y=[];T!==null&&(j?Y.push("scale("+T+")"):(D.width=typeof T=="string"?T:1.5*T+"rem",D.height=D.width)),L&&Y.push("scaleX(-1)"),B&&Y.push("scaleY(-1)"),z!==0&&Y.push("rotate("+z+"deg)"),_!==null&&(G.fill=_);var Q=r.createElement("path",d({d:v,style:G},j?q:{})),Z=Q;Y.length>0&&(D.transform=Y.join(" "),D.transformOrigin="center",j&&(Z=r.createElement("g",{style:D},Q,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var W,R=Z,re=F===!0||typeof F!="number"?2:F,fe=!j&&(L||B);if(re<0&&(fe=!fe),F&&(R=r.createElement("g",{style:{animation:"spin"+(fe?"-inverse":"")+" linear "+Math.abs(re)+"s infinite",transformOrigin:"center"}},Z,!(L||B||z!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),j)return R;var xe,ne="icon_labelledby_"+y,Oe="icon_describedby_"+y;if(C)W=E?ne+" "+Oe:ne;else if(xe="presentation",E)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:xe,"aria-labelledby":W},q),C&&r.createElement("title",{id:ne},C),E&&r.createElement("desc",{id:Oe},E),!j&&F&&(fe?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)});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 ka=Au(XC);var rg={exports:{}};/*!
|
|
1
|
+
(function(rn,sr){typeof exports=="object"&&typeof module<"u"?module.exports=sr(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"],sr):(rn=typeof globalThis<"u"?globalThis:rn||self,rn.StudioSdkPlugins_aiChat=sr(rn.AiSdkReact,rn.Ai,rn.jsxRuntime,rn.React,rn.ReactDOM,rn.ReactDOMClient,rn.Marked,rn.ReactMarkdown,rn.RemarkGfm))})(this,function(rn,sr,c,h,Fn,_S,AS,LS,MS){"use strict";function Kh(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=Kh(h),NS=Kh(Fn),Zh="app.grapesjs.com",Yh="app-stage.grapesjs.com",Xh=[Zh,"app2.grapesjs.com",Yh,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Jh="license:check:start",Fu="license:check:end",Tr=()=>typeof window<"u",ps=e=>e&&e.stopPropagation(),$S=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),kS=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},IS=(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)},VS=e=>kS("Escape",e),HS=(e,t={})=>{const n=ct(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var p,g;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((p=t.onScript)==null||p.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},f=document.createElement("script");f.src=i,f.onload=()=>{r(a),d()},f.onerror=()=>{o(a),d()},document.head.appendChild(f),(g=t.onScript)==null||g.call(t,f)})},jS=e=>{const t=e.map(n=>HS(n));return Promise.allSettled(t)};function DS(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 Qh(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=DS(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 Rh=e=>new DOMParser().parseFromString(e,"text/html"),FS=(e="")=>Rh(`<body>${e}</body>`).body.innerHTML,BS=(e="")=>Rh(`<head>${e}</head>`).head.innerHTML,zS=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=ZS(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},Bu=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?Yh:Zh}`}/${n?"platform-api":"api"}`,US=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},eg=(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}`},WS=eg(),zu=()=>{const e=Tr()&&window.location.hostname;return!!e&&(Xh.includes(e)||Xh.some(t=>e.endsWith(t)))},Pr=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),GS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),qS=()=>{},KS=240,Ht=e=>typeof e<"u",ct=e=>typeof e=="string",ZS=e=>typeof e=="number";function et(e){return typeof e=="function"}function Rr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const YS=e=>!e||Object.keys(e).length===0,Zs=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},XS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},JS=(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},QS=e=>!!e.Components.getType("mjml"),Sl=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),RS=(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 eC({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||Bu({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}`:"",f=await fetch(`${i}${d}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}var Ys=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Ys||{}),on=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(on||{}),re=(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.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))(re||{}),Pn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Pn||{}),So=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(So||{}),xt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(xt||{});const tg={[Ys.free]:0,[Ys.startup]:10,[Ys.business]:20,[Ys.enterprise]:30};function tC(e){const t=e;return t.init=n=>r=>e(r,n),t}const nC=e=>tC(e);async function rC({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i=!1;const l=zu(),u=f=>{console.warn("Cleanup plugin:",n,"Reason:",f),s()},d=(f={})=>{var b;const{error:p,sdkLicense:g}=f,m=(b=f.plan)==null?void 0:b.category;if(!(g||f.license)||p)u(p||"Invalid license");else if(m){const w=tg[t],y=tg[m];w>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(Jh,f=>{a=f==null?void 0:f.baseApiUrl,i=!0}),e.on(Fu,f=>{o==null||o(f),d(f)}),setTimeout(async()=>{if(!i){if(l)return;if(r){const f=await oC({licenseKey:r,pluginName:n,baseApiUrl:a});o==null||o(f),f&&d(f)}else u("The `licenseKey` option not provided")}},2e3)}async function oC(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await eC({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 sC="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",aC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",iC="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",lC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",cC="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",uC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",dC="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",fC="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",pC="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",hC="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",gC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",mC="M3,21V3H21V21H3M5,5V19H19V5H5Z",vC="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",bC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",yC="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",wC="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",SC="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",ng="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",CC="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",xC="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",EC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",TC="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",PC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",OC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",rg="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",_C="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",AC="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",LC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",MC="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",NC="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",$C="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",kC="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",IC="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",VC="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",HC="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",jC="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",DC="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",FC="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",BC="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",zC="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",UC="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",WC="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",GC="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",qC="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",KC="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",ZC="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",YC="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",XC="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",JC="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",QC="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",RC="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",e2="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",t2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",n2="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",r2="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",o2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",s2="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",a2="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",i2="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",l2="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",c2="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",u2="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",d2="M11 15H6L13 1V9H18L11 23V15Z",f2="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",p2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",h2="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",g2="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",m2="M7,10L12,15L17,10H7Z",v2="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",b2="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",y2="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",w2="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",S2="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",og="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",C2="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",x2="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",E2="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",T2="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",P2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",O2="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",_2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",A2="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",L2="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",M2="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",N2="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",$2="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",k2="M18,18H6V6H18V18Z",I2="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",V2="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",H2="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",j2="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",D2="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",F2="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",B2="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",z2="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",U2="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",W2="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",G2="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",q2="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",K2="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",Z2="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=Z;function Z(...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("!"),f=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,p=u?`!${f}`:f;return l?`${l}:${p}`:p}return s}):o).join(" ")}const I=h.forwardRef(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:f,...p},g){const m=t||"div";return c.jsx(m,{ref:g,className:Z([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",f==="start"&&"gs-utl-items-start",f==="end"&&"gs-utl-items-end",f==="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"]),...p,children:n})}),B=h.forwardRef(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:Z([n,r&&"flex-1"]),...o,children:t})});function Uu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wu={exports:{}},Gu,sg;function Y2(){if(sg)return Gu;sg=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Gu=e,Gu}var qu,ag;function X2(){if(ag)return qu;ag=1;var e=Y2();function t(){}function n(){}return n.resetWarningCache=t,qu=function(){function r(a,i,l,u,d,f){if(f!==e){var p=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 p.name="Invariant Violation",p}}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},qu}var ig;function J2(){return ig||(ig=1,Wu.exports=X2()()),Wu.exports}var Q2=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=J2()},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,T=E===void 0?"currentColor":E,_=m.horizontal,O=_===void 0?null:_,P=m.vertical,A=P===void 0?null:P,M=m.rotate,$=M===void 0?null:M,j=m.spin,L=j===void 0?null:j,D=m.style,W=D===void 0?{}:D,F=m.children,k=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var H,V=L!==null&&L,U=r.Children.map(F,function(Q){var ee=Q;V!==!0&&(V=(L===null?ee.props.spin:L)===!0);var G=ee.props.size;typeof x=="number"&&typeof ee.props.size=="number"&&(G=ee.props.size/x);var R={size:G,color:T===null?ee.props.color:T,horizontal:O===null?ee.props.horizontal:O,vertical:A===null?ee.props.vertical:A,rotate:$===null?ee.props.rotate:$,spin:L===null?ee.props.spin:L,inStack:!0};return r.cloneElement(ee,R)});x!==null&&(W.width=typeof x=="string"?x:1.5*x+"rem");var J,Y="stack_labelledby_"+i,X="stack_describedby_"+i;if(w)H=S?Y+" "+X:Y;else if(J="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:J,"aria-labelledby":H},k),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) } }"),U)});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)},f=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},p=0,g=r.forwardRef(function(m,v){var b=m.path,w=m.id,y=w===void 0?++p:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,T=m.size,_=T===void 0?null:T,O=m.color,P=O===void 0?"currentColor":O,A=m.horizontal,M=A!==void 0&&A,$=m.vertical,j=$!==void 0&&$,L=m.rotate,D=L===void 0?0:L,W=m.spin,F=W!==void 0&&W,k=m.style,H=k===void 0?{}:k,V=m.inStack,U=V!==void 0&&V,J=f(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},X=[];_!==null&&(U?X.push("scale("+_+")"):(H.width=typeof _=="string"?_:1.5*_+"rem",H.height=H.width)),M&&X.push("scaleX(-1)"),j&&X.push("scaleY(-1)"),D!==0&&X.push("rotate("+D+"deg)"),P!==null&&(Y.fill=P);var Q=r.createElement("path",d({d:b,style:Y},U?J:{})),ee=Q;X.length>0&&(H.transform=X.join(" "),H.transformOrigin="center",U&&(ee=r.createElement("g",{style:H},Q,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var G,R=ee,le=F===!0||typeof F!="number"?2:F,ge=!U&&(M||j);if(le<0&&(ge=!ge),F&&(R=r.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(le)+"s infinite",transformOrigin:"center"}},ee,!(M||j||D!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),U)return R;var Ee,Ce="icon_labelledby_"+y,tt="icon_describedby_"+y;if(C)G=E?Ce+" "+tt:Ce;else if(Ee="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:H,role:Ee,"aria-labelledby":G},J),C&&r.createElement("title",{id:Ce},C),E&&r.createElement("desc",{id:tt},E),!U&&F&&(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) } }")),R)});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 Ba=Uu(Q2);var lg={exports:{}};/*!
|
|
35
2
|
Copyright (c) 2018 Jed Watson.
|
|
36
3
|
Licensed under the MIT License (MIT), see
|
|
37
4
|
http://jedwatson.github.io/classnames
|
|
38
|
-
*/(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})()})(
|
|
39
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
40
|
-
The field is already decorated with '@`+o+"'.")+`
|
|
41
|
-
Re-decorating fields is not allowed.
|
|
42
|
-
Use '@override' decorator for methods overridden by subclass.`)}}function dx(e){return kn(e,ln)||ja(e,ln,Yr({},e[ln])),e[ln]}function Ha(e){return typeof e=="object"&&typeof e.kind=="string"}function gl(e,t){te.NODE_ENV!=="production"&&!t.includes(e.kind)&&me("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ce=Symbol("mobx administration"),bo=function(){function e(n){n===void 0&&(n=te.NODE_ENV!=="production"?"Atom@"+nr():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.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 Mg(this)},t.reportChanged=function(){jn(),Lg(this),Dn()},t.toString=function(){return this.name_},Gs(e,[{key:"isBeingObserved",get:function(){return Sn(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Sn(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Sn(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Cn(this.flags_,e.diffValueMask_,r===1)}}])}();bo.isBeingObservedMask_=1,bo.isPendingUnobservationMask_=2,bo.diffValueMask_=4;var Fu=mo("Atom",bo);function pg(e,t,n){t===void 0&&(t=zs),n===void 0&&(n=zs);var r=new bo(e);return t!==zs&&_E(r,t),n!==zs&&Hg(r,n),r}function fx(e,t){return e===t}function px(e,t){return sd(e,t)}function hx(e,t){return sd(e,t,1)}function gx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ml={identity:fx,structural:px,default:gx,shallow:hx};function as(e,t,n){return Zs(e)?e:Array.isArray(e)?Ft.array(e,{name:n}):wn(e)?Ft.object(e,void 0,{name:n}):Us(e)?Ft.map(e,{name:n}):Kr(e)?Ft.set(e,{name:n}):typeof e=="function"&&!Ys(e)&&!Wa(e)?ig(e)?us(e):Ua(n,e):e}function mx(e,t,n){if(e==null||ps(e)||Ka(e)||Qr(e)||ir(e))return e;if(Array.isArray(e))return Ft.array(e,{name:n,deep:!1});if(wn(e))return Ft.object(e,void 0,{name:n,deep:!1});if(Us(e))return Ft.map(e,{name:n,deep:!1});if(Kr(e))return Ft.set(e,{name:n,deep:!1});te.NODE_ENV!=="production"&&me("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function bl(e){return e}function bx(e,t){return te.NODE_ENV!=="production"&&Zs(e)&&me("observable.struct should not be used with observable values"),sd(e,t)?t:e}var vx="override";function vl(e){return e.annotationType_===vx}function Fa(e,t){return{annotationType_:e,options_:t,make_:yx,extend_:wx,decorate_20223_:Sx}}function yx(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(Ys(n.value))return 1;var s=hg(e,this,t,n,!1);return Sr(r,t,s),2}function wx(e,t,n,r){var o=hg(e,this,t,n);return e.defineProperty_(t,o,r)}function Sx(e,t){te.NODE_ENV!=="production"&&gl(t,["method","field"]);var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,f,p,g;return is((d=(f=s.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(p=(g=s.options_)==null?void 0:g.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,d=l;return Ys(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Ys(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}me("Cannot apply '"+s.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
|
|
43
|
-
'`+s.annotationType_+"' can only be used on properties with a function value."))}function Cx(e,t,n,r){var o=t.annotationType_,s=r.value;te.NODE_ENV!=="production"&&!Mt(s)&&me("Cannot apply '"+o+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
44
|
-
'`+o+"' can only be used on properties with a function value."))}function hg(e,t,n,r,o){var s,a,i,l,u,d,f;o===void 0&&(o=ce.safeDescriptors),Cx(e,t,n,r);var p=r.value;if((s=t.options_)!=null&&s.bound){var g;p=p.bind((g=e.proxy_)!=null?g:e.target_)}return{value:is((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function gg(e,t){return{annotationType_:e,options_:t,make_:xx,extend_:Ex,decorate_20223_:Px}}function xx(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&&(!kn(e.target_,t)||!Wa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Wa(n.value))return 1;var s=mg(e,this,t,n,!1,!1);return Sr(r,t,s),2}function Ex(e,t,n,r){var o,s=mg(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function Px(e,t){var n;te.NODE_ENV!=="production"&&gl(t,["method"]);var r=t.name,o=t.addInitializer;return Wa(e)||(e=us(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 _x(e,t,n,r){var o=t.annotationType_,s=r.value;te.NODE_ENV!=="production"&&!Mt(s)&&me("Cannot apply '"+o+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
45
|
-
'`+o+"' can only be used on properties with a generator function value."))}function mg(e,t,n,r,o,s){s===void 0&&(s=ce.safeDescriptors),_x(e,t,n,r);var a=r.value;if(Wa(a)||(a=us(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 Bu(e,t){return{annotationType_:e,options_:t,make_:Tx,extend_:Ox,decorate_20223_:Ax}}function Tx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Ox(e,t,n,r){return Nx(e,this,t,n),e.defineComputedProperty_(t,Yr({},this.options_,{get:n.get,set:n.set}),r)}function Ax(e,t){te.NODE_ENV!=="production"&&gl(t,["getter"]);var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=fs(this)[Ce],a=Yr({},n.options_,{get:e,context:this});a.name||(a.name=te.NODE_ENV!=="production"?s.name_+"."+r.toString():"ObservableObject."+r.toString()),s.values_.set(r,new Vn(a))}),function(){return this[Ce].getObservablePropValue_(r)}}function Nx(e,t,n,r){var o=t.annotationType_,s=r.get;te.NODE_ENV!=="production"&&!s&&me("Cannot apply '"+o+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
46
|
-
'`+o+"' can only be used on getter(+setter) properties."))}function yl(e,t){return{annotationType_:e,options_:t,make_:Mx,extend_:Lx,decorate_20223_:$x}}function Mx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Lx(e,t,n,r){var o,s;return kx(e,this,t,n),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:as,r)}function $x(e,t){if(te.NODE_ENV!=="production"){if(t.kind==="field")throw me("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");gl(t,["accessor"])}var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,f=fs(i)[Ce],p=new vo(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:as,te.NODE_ENV!=="production"?f.name_+"."+o.toString():"ObservableObject."+o.toString(),!1);f.values_.set(o,p),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[Ce].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[Ce].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function kx(e,t,n,r){var o=t.annotationType_;te.NODE_ENV!=="production"&&!("value"in r)&&me("Cannot apply '"+o+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
47
|
-
'`+o+"' cannot be used on getter/setter properties"))}var Vx="true",Ix=bg();function bg(e){return{annotationType_:Vx,options_:e,make_:jx,extend_:Dx,decorate_20223_:Hx}}function jx(e,t,n,r){var o,s;if(n.get)return Cl.make_(e,t,n,r);if(n.set){var a=is(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:ce.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Sr(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if(ig(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?us.bound:us;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Ua.bound:Ua;return d.make_(e,t,n,r)}var f=((o=this.options_)==null?void 0:o.deep)===!1?Ft.ref:Ft;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return f.make_(e,t,n,r)}function Dx(e,t,n,r){var o,s;if(n.get)return Cl.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:ce.safeDescriptors?e.isPlainObject_:!0,set:is(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?Ft.ref:Ft;return i.extend_(e,t,n,r)}function Hx(e,t){me("'"+this.annotationType_+"' cannot be used as a decorator")}var Fx="observable",Bx="observable.ref",zx="observable.shallow",Ux="observable.struct",vg={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(vg);function wl(e){return e||vg}var zu=yl(Fx),Wx=yl(Bx,{enhancer:bl}),Gx=yl(zx,{enhancer:mx}),qx=yl(Ux,{enhancer:bx}),yg=Cr(zu);function Sl(e){return e.deep===!0?as:e.deep===!1?bl:Yx(e.defaultDecorator)}function Kx(e){var t;return e?(t=e.defaultDecorator)!=null?t:bg(e):void 0}function Yx(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:as}function wg(e,t,n){if(Ha(t))return zu.decorate_20223_(e,t);if(ss(t)){Da(e,t,zu);return}return Zs(e)?e:wn(e)?Ft.object(e,t,n):Array.isArray(e)?Ft.array(e,t):Us(e)?Ft.map(e,t):Kr(e)?Ft.set(e,t):typeof e=="object"&&e!==null?e:Ft.box(e,t)}og(wg,yg);var Zx={box:function(t,n){var r=wl(n);return new vo(t,Sl(r),r.name,!0,r.equals)},array:function(t,n){var r=wl(n);return(ce.useProxies===!1||r.proxy===!1?QE:zE)(t,Sl(r),r.name)},map:function(t,n){var r=wl(n);return new Yg(t,Sl(r),r.name)},set:function(t,n){var r=wl(n);return new Xg(t,Sl(r),r.name)},object:function(t,n,r){return So(function(){return Bg(ce.useProxies===!1||(r==null?void 0:r.proxy)===!1?fs({},r):DE({},r),t,n)})},ref:Cr(Wx),shallow:Cr(Gx),deep:yg,struct:Cr(qx)},Ft=og(wg,Zx),Sg="computed",Xx="computed.struct",Uu=Bu(Sg),Jx=Bu(Xx,{equals:ml.structural}),Cl=function(t,n){if(Ha(n))return Uu.decorate_20223_(t,n);if(ss(n))return Da(t,n,Uu);if(wn(t))return Cr(Bu(Sg,t));te.NODE_ENV!=="production"&&(Mt(t)||me("First argument to `computed` should be an expression."),Mt(n)&&me("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var r=wn(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Vn(r)};Object.assign(Cl,Uu),Cl.struct=Cr(Jx);var Cg,xg,xl=0,Qx=1,Rx=(Cg=(xg=fl(function(){},"name"))==null?void 0:xg.configurable)!=null?Cg:!1,Eg={value:"action",configurable:!0,writable:!1,enumerable:!1};function is(e,t,n,r){n===void 0&&(n=!1),te.NODE_ENV!=="production"&&(Mt(t)||me("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&me("actions should have valid names, got: '"+e+"'"));function o(){return eE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},Rx&&(Eg.value=e,Sr(o,"name",Eg)),o}function eE(e,t,n,r,o){var s=tE(e,t,r,o);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{nE(s)}}function tE(e,t,n,r){var o=te.NODE_ENV!=="production"&&Bt()&&!!e,s=0;if(te.NODE_ENV!=="production"&&o){s=Date.now();var a=r?Array.from(r):pl;xn({type:Xu,name:e,object:n,arguments:a})}var i=ce.trackingDerivation,l=!t||!i;jn();var u=ce.allowStateChanges;l&&(ls(),u=Wu(!0));var d=Yu(!0),f={runAsAction_:l,prevDerivation_:i,prevAllowStateChanges_:u,prevAllowStateReads_:d,notifySpy_:o,startTime_:s,actionId_:Qx++,parentActionId_:xl};return xl=f.actionId_,f}function nE(e){xl!==e.actionId_&&me(30),xl=e.parentActionId_,e.error_!==void 0&&(ce.suppressReactionErrors=!0),Gu(e.prevAllowStateChanges_),za(e.prevAllowStateReads_),Dn(),e.runAsAction_&&Zr(e.prevDerivation_),te.NODE_ENV!=="production"&&e.notifySpy_&&En({time:Date.now()-e.startTime_}),ce.suppressReactionErrors=!1}function Wu(e){var t=ce.allowStateChanges;return ce.allowStateChanges=e,t}function Gu(e){ce.allowStateChanges=e}var rE="create",vo=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s=te.NODE_ENV!=="production"?"ObservableValue@"+nr():"ObservableValue"),a===void 0&&(a=!0),i===void 0&&(i=ml.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),te.NODE_ENV!=="production"&&a&&Bt()&&cs({type:rE,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}fg(t,e);var n=t.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){var s=this.value_;if(o=this.prepareNewValue_(o),o!==ce.UNCHANGED){var a=Bt();te.NODE_ENV!=="production"&&a&&xn({type:sr,object:this,observableKind:"value",debugObjectName:this.name_,newValue:o,oldValue:s}),this.setNewValue_(o),te.NODE_ENV!=="production"&&a&&En()}},n.prepareNewValue_=function(o){if(xr(this),Hn(this)){var s=Fn(this,{object:this,type:sr,newValue:o});if(!s)return ce.UNCHANGED;o=s.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?ce.UNCHANGED:o},n.setNewValue_=function(o){var s=this.value_;this.value_=o,this.reportChanged(),rr(this)&&or(this,{type:sr,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Ga(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:sr,newValue:this.value_,oldValue:void 0}),qa(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 ug(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(bo),oE=mo("ObservableValue",vo),Vn=function(){function e(n){this.dependenciesState_=Ge.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new El(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=In.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||me(31),this.derivation=n.get,this.name_=n.name||(te.NODE_ENV!=="production"?"ComputedValue@"+nr():"ComputedValue"),n.set&&(this.setter_=is(te.NODE_ENV!=="production"?this.name_+"-setter":"ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?ml.structural:ml.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){dE(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&&me(32,this.name_,this.derivation),ce.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)qu(this)&&(this.warnAboutUntrackedRead_(),jn(),this.value_=this.computeValue_(!1),Dn());else if(Mg(this),qu(this)){var r=ce.trackingContext;this.keepAlive_&&!r&&(ce.trackingContext=this),this.trackAndCompute()&&uE(this),ce.trackingContext=r}var o=this.value_;if(Pl(o))throw o.cause;return o},t.set=function(r){if(this.setter_){this.isRunningSetter&&me(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else me(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===Ge.NOT_TRACKING_,s=this.computeValue_(!0),a=o||Pl(r)||Pl(s)||!this.equals_(r,s);return a&&(this.value_=s,te.NODE_ENV!=="production"&&Bt()&&cs({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:s})),a},t.computeValue_=function(r){this.isComputing=!0;var o=Wu(!1),s;if(r)s=Pg(this,this.derivation,this.scope_);else if(ce.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(a){s=new El(a)}return Gu(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(Ku(this),this.value_=void 0,te.NODE_ENV!=="production"&&this.isTracing_!==In.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return SE(function(){var l=s.get();if(!a||o){var u=ls();r({observableKind:"computed",debugObjectName:s.name_,type:sr,object:s,newValue:l,oldValue:i}),Zr(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){te.NODE_ENV!=="production"&&(this.isTracing_!==In.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:ce.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return ug(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Gs(e,[{key:"isComputing",get:function(){return Sn(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Sn(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Sn(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Sn(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Sn(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Cn(this.flags_,e.diffValueMask_,r===1)}}])}();Vn.isComputingMask_=1,Vn.isRunningSetterMask_=2,Vn.isBeingObservedMask_=4,Vn.isPendingUnobservationMask_=8,Vn.diffValueMask_=16;var Ba=mo("ComputedValue",Vn),Ge;(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_"})(Ge||(Ge={}));var In;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(In||(In={}));var El=function(t){this.cause=void 0,this.cause=t};function Pl(e){return e instanceof El}function qu(e){switch(e.dependenciesState_){case Ge.UP_TO_DATE_:return!1;case Ge.NOT_TRACKING_:case Ge.STALE_:return!0;case Ge.POSSIBLY_STALE_:{for(var t=Yu(!0),n=ls(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Ba(a)){if(ce.disableErrorBoundaries)a.get();else try{a.get()}catch{return Zr(n),za(t),!0}if(e.dependenciesState_===Ge.STALE_)return Zr(n),za(t),!0}}return Tg(e),Zr(n),za(t),!1}}}function xr(e){if(te.NODE_ENV!=="production"){var t=e.observers_.size>0;!ce.allowStateChanges&&(t||ce.enforceActions==="always")&&console.warn("[MobX] "+(ce.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}}function sE(e){te.NODE_ENV!=="production"&&!ce.allowStateReads&&ce.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Pg(e,t,n){var r=Yu(!0);Tg(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ce.runId;var o=ce.trackingDerivation;ce.trackingDerivation=e,ce.inBatch++;var s;if(ce.disableErrorBoundaries===!0)s=t.call(n);else try{s=t.call(n)}catch(a){s=new El(a)}return ce.inBatch--,ce.trackingDerivation=o,iE(e),aE(e),za(r),s}function aE(e){te.NODE_ENV!=="production"&&e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:ce.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function iE(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Ge.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&&Ag(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,cE(u,e))}r!==Ge.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Ku(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Ag(t[n],e);e.dependenciesState_=Ge.NOT_TRACKING_}function _g(e){var t=ls();try{return e()}finally{Zr(t)}}function ls(){var e=ce.trackingDerivation;return ce.trackingDerivation=null,e}function Zr(e){ce.trackingDerivation=e}function Yu(e){var t=ce.allowStateReads;return ce.allowStateReads=e,t}function za(e){ce.allowStateReads=e}function Tg(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Ge.UP_TO_DATE_}}var _l=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},Tl=!0,Og=!1,ce=function(){var e=dl();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Tl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new _l().version&&(Tl=!1),Tl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new _l):(setTimeout(function(){Og||me(35)},1),new _l)}();function lE(){if((ce.pendingReactions.length||ce.inBatch||ce.isRunningReactions)&&me(36),Og=!0,Tl){var e=dl();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ce=new _l}}function cE(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Ag(e,t){e.observers_.delete(t),e.observers_.size===0&&Ng(e)}function Ng(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ce.pendingUnobservations.push(e))}function jn(){ce.inBatch++}function Dn(){if(--ce.inBatch===0){Ig();for(var e=ce.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 Vn&&n.suspend_())}ce.pendingUnobservations=[]}}function Mg(e){sE(e);var t=ce.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ce.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ce.inBatch>0&&Ng(e),!1)}function Lg(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ge.UP_TO_DATE_&&(te.NODE_ENV!=="production"&&t.isTracing_!==In.NONE&&$g(t,e),t.onBecomeStale_()),t.dependenciesState_=Ge.STALE_}))}function uE(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ge.POSSIBLY_STALE_?(t.dependenciesState_=Ge.STALE_,te.NODE_ENV!=="production"&&t.isTracing_!==In.NONE&&$g(t,e)):t.dependenciesState_===Ge.UP_TO_DATE_&&(e.lowestObserverState_=Ge.UP_TO_DATE_)}))}function dE(e){e.lowestObserverState_===Ge.UP_TO_DATE_&&(e.lowestObserverState_=Ge.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ge.UP_TO_DATE_&&(t.dependenciesState_=Ge.POSSIBLY_STALE_,t.onBecomeStale_())}))}function $g(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===In.BREAK){var n=[];kg(zg(e),n,1),new Function(`debugger;
|
|
48
|
-
/*
|
|
49
|
-
Tracing '`+e.name_+`'
|
|
50
|
-
|
|
51
|
-
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
52
|
-
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
53
|
-
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
54
|
-
|
|
55
|
-
`+(e instanceof Vn?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
56
|
-
|
|
57
|
-
The dependencies for this derivation are:
|
|
58
|
-
|
|
59
|
-
`+n.join(`
|
|
60
|
-
`)+`
|
|
61
|
-
*/
|
|
62
|
-
`)()}}function kg(e,t,n){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(r){return kg(r,t,n+1)})}var Xr=function(){function e(n,r,o,s){n===void 0&&(n=te.NODE_ENV!=="production"?"Reaction@"+nr():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=In.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,ce.pendingReactions.push(this),Ig())},t.runReaction_=function(){if(!this.isDisposed){jn(),this.isScheduled=!1;var r=ce.trackingContext;if(ce.trackingContext=this,qu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),te.NODE_ENV!=="production"&&this.isTrackPending&&Bt()&&cs({name:this.name_,type:"scheduled-reaction"})}catch(o){this.reportExceptionInDerivation_(o)}}ce.trackingContext=r,Dn()}},t.track=function(r){if(!this.isDisposed){jn();var o=Bt(),s;te.NODE_ENV!=="production"&&o&&(s=Date.now(),xn({name:this.name_,type:"reaction"})),this.isRunning=!0;var a=ce.trackingContext;ce.trackingContext=this;var i=Pg(this,r,void 0);ce.trackingContext=a,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ku(this),Pl(i)&&this.reportExceptionInDerivation_(i.cause),te.NODE_ENV!=="production"&&o&&En({time:Date.now()-s}),Dn()}},t.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(ce.disableErrorBoundaries)throw r;var s=te.NODE_ENV!=="production"?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";ce.suppressReactionErrors?te.NODE_ENV!=="production"&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(s,r),te.NODE_ENV!=="production"&&Bt()&&cs({type:"error",name:this.name_,message:s,error:""+r}),ce.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(jn(),Ku(this),Dn()))},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[Ce]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),VE(this,r)},Gs(e,[{key:"isDisposed",get:function(){return Sn(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Sn(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Sn(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Sn(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Cn(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Sn(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Cn(this.flags_,e.diffValueMask_,r===1)}}])}();Xr.isDisposedMask_=1,Xr.isScheduledMask_=2,Xr.isTrackPendingMask_=4,Xr.isRunningMask_=8,Xr.diffValueMask_=16;var Vg=100,Zu=function(t){return t()};function Ig(){ce.inBatch>0||ce.isRunningReactions||Zu(fE)}function fE(){ce.isRunningReactions=!0;for(var e=ce.pendingReactions,t=0;e.length>0;){++t===Vg&&(console.error(te.NODE_ENV!=="production"?"Reaction doesn't converge to a stable state after "+Vg+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0]):"[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_()}ce.isRunningReactions=!1}var Ol=mo("Reaction",Xr);function pE(e){var t=Zu;Zu=function(r){return e(function(){return t(r)})}}function Bt(){return te.NODE_ENV!=="production"&&!!ce.spyListeners.length}function cs(e){if(te.NODE_ENV!=="production"&&ce.spyListeners.length)for(var t=ce.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function xn(e){if(te.NODE_ENV!=="production"){var t=Yr({},e,{spyReportStart:!0});cs(t)}}var hE={type:"report-end",spyReportEnd:!0};function En(e){te.NODE_ENV!=="production"&&cs(e?Yr({},e,{type:"report-end",spyReportEnd:!0}):hE)}function gE(e){return te.NODE_ENV==="production"?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(ce.spyListeners.push(e),ju(function(){ce.spyListeners=ce.spyListeners.filter(function(t){return t!==e})}))}var Xu="action",mE="action.bound",jg="autoAction",bE="autoAction.bound",vE="<unnamed action>",Ju=Fa(Xu),yE=Fa(mE,{bound:!0}),Qu=Fa(jg,{autoAction:!0}),wE=Fa(bE,{autoAction:!0,bound:!0});function Dg(e){var t=function(r,o){if(Mt(r))return is(r.name||vE,r,e);if(Mt(o))return is(r,o,e);if(Ha(o))return(e?Qu:Ju).decorate_20223_(r,o);if(ss(o))return Da(r,o,e?Qu:Ju);if(ss(r))return Cr(Fa(e?jg:Xu,{name:r,autoAction:e}));te.NODE_ENV!=="production"&&me("Invalid arguments for `action`")};return t}var Ks=Dg(!1);Object.assign(Ks,Ju);var Ua=Dg(!0);Object.assign(Ua,Qu),Ks.bound=Cr(yE),Ua.bound=Cr(wE);function Ys(e){return Mt(e)&&e.isMobxAction===!0}function SE(e,t){var n,r,o,s;t===void 0&&(t=sg),te.NODE_ENV!=="production"&&(Mt(e)||me("Autorun expects a function as first argument"),Ys(e)&&me("Autorun does not accept actions since actions are untrackable"));var a=(n=(r=t)==null?void 0:r.name)!=null?n:te.NODE_ENV!=="production"?e.name||"Autorun@"+nr():"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new Xr(a,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=xE(t),d=!1;l=new Xr(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(f)}))},t.onError,t.requiresObservable)}function f(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var CE=function(t){return t()};function xE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:CE}var EE="onBO",PE="onBUO";function _E(e,t,n){return Fg(EE,e,t,n)}function Hg(e,t,n){return Fg(PE,e,t,n)}function Fg(e,t,n,r){var o=Js(t),s=Mt(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 TE="never",Al="always",OE="observed";function AE(e){e.isolateGlobalState===!0&&lE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ce.useProxies=t===Al?!0:t===TE?!1:typeof Proxy<"u"),t==="ifavailable"&&(ce.verifyProxies=!0),n!==void 0){var r=n===Al?Al:n===OE;ce.enforceActions=r,ce.allowStateChanges=!(r===!0||r===Al)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(ce[o]=!!e[o])}),ce.allowStateReads=!ce.observableRequiresReaction,te.NODE_ENV!=="production"&&ce.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&pE(e.reactionScheduler)}function Bg(e,t,n,r){te.NODE_ENV!=="production"&&(arguments.length>4&&me("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&me("'extendObservable' expects an object as first argument"),Qr(e)&&me("'extendObservable' should not be used on maps, use map.merge instead"),wn(t)||me("'extendObservable' only accepts plain objects as second argument"),(Zs(t)||Zs(n))&&me("Extending an object with another observable (object) is not supported"));var o=sx(t);return So(function(){var s=fs(e,r)[Ce];Ws(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function zg(e,t){return Ug(Js(e,t))}function Ug(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=NE(e.observing_).map(Ug)),t}function NE(e){return Array.from(new Set(e))}var ME=0;function Wg(){this.message="FLOW_CANCELLED"}Wg.prototype=Object.create(Error.prototype);var Ru=gg("flow"),LE=gg("flow.bound",{bound:!0}),us=Object.assign(function(t,n){if(Ha(n))return Ru.decorate_20223_(t,n);if(ss(n))return Da(t,n,Ru);te.NODE_ENV!=="production"&&arguments.length!==1&&me("Flow expects single argument with generator function");var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++ME,d=Ks(o+" - runid: "+u+" - init",r).apply(i,l),f,p=void 0,g=new Promise(function(m,b){var v=0;f=b;function w(C){p=void 0;var x;try{x=Ks(o+" - runid: "+u+" - yield "+v++,d.next).call(d,C)}catch(E){return b(E)}S(x)}function y(C){p=void 0;var x;try{x=Ks(o+" - runid: "+u+" - yield "+v++,d.throw).call(d,C)}catch(E){return b(E)}S(x)}function S(C){if(Mt(C==null?void 0:C.then)){C.then(S,b);return}return C.done?m(C.value):(p=Promise.resolve(C.value),p.then(w,y))}w(void 0)});return g.cancel=Ks(o+" - runid: "+u+" - cancel",function(){try{p&&Gg(p);var m=d.return(void 0),b=Promise.resolve(m.value);b.then(zs,zs),Gg(b),f(new Wg)}catch(v){f(v)}}),g};return s.isMobXFlow=!0,s},Ru);us.bound=Cr(LE);function Gg(e){Mt(e.cancel)&&e.cancel()}function Wa(e){return(e==null?void 0:e.isMobXFlow)===!0}function $E(e,t){return e?ps(e)||!!e[Ce]||Fu(e)||Ol(e)||Ba(e):!1}function Zs(e){return te.NODE_ENV!=="production"&&arguments.length!==1&&me("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),$E(e)}function kE(e){if(ps(e))return e[Ce].ownKeys_();me(38)}function Nl(e,t,n){return e.set(t,n),n}function Xs(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Zs(e))return e;if(oE(e)||Ba(e))return Xs(e.get(),t);if(t.has(e))return t.get(e);if(Ka(e)){var n=Nl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=Xs(a,t)}),n}if(ir(e)){var r=Nl(t,e,new Set);return e.forEach(function(a){r.add(Xs(a,t))}),r}if(Qr(e)){var o=Nl(t,e,new Map);return e.forEach(function(a,i){o.set(i,Xs(a,t))}),o}else{var s=Nl(t,e,{});return kE(e).forEach(function(a){Va.propertyIsEnumerable.call(e,a)&&(s[a]=Xs(e[a],t))}),s}}function yo(e,t){return te.NODE_ENV!=="production"&&t&&me("toJS no longer supports options"),Xs(e,new Map)}function VE(){if(te.NODE_ENV!=="production"){for(var e=!1,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];typeof n[n.length-1]=="boolean"&&(e=n.pop());var o=IE(n);if(!o)return me("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");o.isTracing_===In.NONE&&console.log("[mobx.trace] '"+o.name_+"' tracing enabled"),o.isTracing_=e?In.BREAK:In.LOG}}function IE(e){switch(e.length){case 0:return ce.trackingDerivation;case 1:return Js(e[0]);case 2:return Js(e[0],e[1])}}function Jr(e,t){t===void 0&&(t=void 0),jn();try{return e.apply(t)}finally{Dn()}}function ds(e){return e[Ce]}var jE={has:function(t,n){return te.NODE_ENV!=="production"&&ce.trackingDerivation&&Ia("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),ds(t).has_(n)},get:function(t,n){return ds(t).get_(n)},set:function(t,n,r){var o;return ss(n)?(te.NODE_ENV!=="production"&&!ds(t).values_.has(n)&&Ia("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(o=ds(t).set_(n,r,!0))!=null?o:!0):!1},deleteProperty:function(t,n){var r;return te.NODE_ENV!=="production"&&Ia("delete properties from an observable object. Use 'remove' from 'mobx' instead."),ss(n)?(r=ds(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return te.NODE_ENV!=="production"&&Ia("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(o=ds(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return te.NODE_ENV!=="production"&&ce.trackingDerivation&&Ia("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),ds(t).ownKeys_()},preventExtensions:function(t){me(13)}};function DE(e,t){var n,r;return ag(),e=fs(e,t),(r=(n=e[Ce]).proxy_)!=null?r:n.proxy_=new Proxy(e,jE)}function Hn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Ga(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),ju(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Fn(e,t){var n=ls();try{for(var r=[].concat(e.interceptors_||[]),o=0,s=r.length;o<s&&(t=r[o](t),t&&!t.type&&me(14),!!t);o++);return t}finally{Zr(n)}}function rr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function qa(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),ju(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function or(e,t){var n=ls(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);Zr(n)}}function HE(e,t,n){return So(function(){var r,o=fs(e,n)[Ce];te.NODE_ENV!=="production"&&t&&e[ln]&&me("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(r=t)!=null||(t=dx(e)),Ws(t).forEach(function(s){return o.make_(s,t[s])})}),e}var ed=Symbol("mobx-keys");function en(e,t,n){return te.NODE_ENV!=="production"&&(!wn(e)&&!wn(Object.getPrototypeOf(e))&&me("'makeAutoObservable' can only be used for classes that don't have a superclass"),ps(e)&&me("makeAutoObservable can only be used on objects not already made observable")),wn(e)?Bg(e,e,t,n):(So(function(){var r=fs(e,n)[Ce];if(!e[ed]){var o=Object.getPrototypeOf(e),s=new Set([].concat(Ws(e),Ws(o)));s.delete("constructor"),s.delete(Ce),ja(o,ed,s)}e[ed].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var qg="splice",sr="update",FE=1e4,BE={get:function(t,n){var r=t[Ce];return n===Ce?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):kn(Ml,n)?Ml[n]:t[n]},set:function(t,n,r){var o=t[Ce];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){me(15)}},td=function(){function e(n,r,o,s){n===void 0&&(n=te.NODE_ENV!=="production"?"ObservableArray@"+nr():"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 bo(n),this.enhancer_=function(a,i){return r(a,i,te.NODE_ENV!=="production"?n+"[..]":"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 Ga(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}),qa(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&me("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_&&me(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&s1(r+o+1)},t.spliceWithArray_=function(r,o,s){var a=this;xr(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=pl),Hn(this)){var l=Fn(this,{object:this.proxy_,type:qg,index:r,removedCount:o,added:s});if(!l)return pl;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(f){return a.enhancer_(f,void 0)}),this.legacyMode_||te.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<FE){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_&&Bt(),i=rr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:sr,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;te.NODE_ENV!=="production"&&a&&xn(l),this.atom_.reportChanged(),i&&or(this,l),te.NODE_ENV!=="production"&&a&&En()},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&Bt(),i=rr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:qg,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;te.NODE_ENV!=="production"&&a&&xn(l),this.atom_.reportChanged(),i&&or(this,l),te.NODE_ENV!=="production"&&a&&En()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn(te.NODE_ENV!=="production"?"[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[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&&me(17,r,s.length),r<s.length){xr(this.atom_);var a=s[r];if(Hn(this)){var i=Fn(this,{type:sr,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 zE(e,t,n,r){return n===void 0&&(n=te.NODE_ENV!=="production"?"ObservableArray@"+nr():"ObservableArray"),r===void 0&&(r=!1),ag(),So(function(){var o=new td(n,t,r,!1);lg(o.values_,Ce,o);var s=new Proxy(o.values_,BE);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Ml={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ce];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[Ce];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[Ce].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Ce],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[Ce].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ce],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 ce.trackingDerivation&&me(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ce.trackingDerivation&&me(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ce],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};ft("at",Pn),ft("concat",Pn),ft("flat",Pn),ft("includes",Pn),ft("indexOf",Pn),ft("join",Pn),ft("lastIndexOf",Pn),ft("slice",Pn),ft("toString",Pn),ft("toLocaleString",Pn),ft("toSorted",Pn),ft("toSpliced",Pn),ft("with",Pn),ft("every",ar),ft("filter",ar),ft("find",ar),ft("findIndex",ar),ft("findLast",ar),ft("findLastIndex",ar),ft("flatMap",ar),ft("forEach",ar),ft("map",ar),ft("some",ar),ft("toReversed",ar),ft("reduce",Kg),ft("reduceRight",Kg);function ft(e,t){typeof Array.prototype[e]=="function"&&(Ml[e]=t(e))}function Pn(e){return function(){var t=this[Ce];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function ar(e){return function(t,n){var r=this,o=this[Ce];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function Kg(e){return function(){var t=this,n=this[Ce];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 UE=mo("ObservableArrayAdministration",td);function Ka(e){return hl(e)&&UE(e[Ce])}var WE={},wo="add",Ll="delete",Yg=function(){function e(n,r,o){var s=this;r===void 0&&(r=as),o===void 0&&(o=te.NODE_ENV!=="production"?"ObservableMap@"+nr():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ce]=WE,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,Mt(Map)||me(18),So(function(){s.keysAtom_=pg(te.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(!ce.trackingDerivation)return this.has_(r);var s=this.hasMap_.get(r);if(!s){var a=s=new vo(this.has_(r),bl,te.NODE_ENV!=="production"?this.name_+"."+Du(r)+"?":"ObservableMap.key?",!1);this.hasMap_.set(r,a),Hg(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(Hn(this)){var a=Fn(this,{type:s?sr:wo,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(xr(this.keysAtom_),Hn(this)){var s=Fn(this,{type:Ll,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=Bt(),i=rr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Ll,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return te.NODE_ENV!=="production"&&a&&xn(l),Jr(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&&or(this,l),te.NODE_ENV!=="production"&&a&&En(),!0}return!1},t.updateValue_=function(r,o){var s=this.data_.get(r);if(o=s.prepareNewValue_(o),o!==ce.UNCHANGED){var a=Bt(),i=rr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:sr,object:this,oldValue:s.value_,name:r,newValue:o}:null;te.NODE_ENV!=="production"&&a&&xn(l),s.setNewValue_(o),i&&or(this,l),te.NODE_ENV!=="production"&&a&&En()}},t.addValue_=function(r,o){var s=this;xr(this.keysAtom_),Jr(function(){var u,d=new vo(o,s.enhancer_,te.NODE_ENV!=="production"?s.name_+"."+Du(r):"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=Bt(),i=rr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:wo,object:this,name:r,newValue:o}:null;te.NODE_ENV!=="production"&&a&&xn(l),i&&or(this,l),te.NODE_ENV!=="production"&&a&&En()},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 Zg({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 Zg({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=qs(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 Qr(r)&&(r=new Map(r)),Jr(function(){wn(r)?ox(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)}):Us(r)?(rx(r)||me(19,r),r.forEach(function(s,a){return o.set(a,s)})):r!=null&&me(20,r)}),this},t.clear=function(){var r=this;Jr(function(){_g(function(){for(var o=qs(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return Jr(function(){for(var s=GE(r),a=new Map,i=!1,l=qs(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var f=o.delete(d);if(f)i=!0;else{var p=o.data_.get(d);a.set(d,p)}}}for(var g=qs(s.entries()),m;!(m=g()).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(),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 te.NODE_ENV!=="production"&&o===!0&&me("`observe` doesn't support fireImmediately=true in combination with maps."),qa(this,r)},t.intercept_=function(r){return Ga(this,r)},Gs(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Qr=mo("ObservableMap",Yg);function Zg(e){return e[Symbol.toStringTag]="MapIterator",id(e)}function GE(e){if(Us(e)||Qr(e))return e;if(Array.isArray(e))return new Map(e);if(wn(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return me(21,e)}var qE={},Xg=function(){function e(n,r,o){var s=this;r===void 0&&(r=as),o===void 0&&(o=te.NODE_ENV!=="production"?"ObservableSet@"+nr():"ObservableSet"),this.name_=void 0,this[Ce]=qE,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,Mt(Set)||me(22),this.enhancer_=function(a,i){return r(a,i,o)},So(function(){s.atom_=pg(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;Jr(function(){_g(function(){for(var o=qs(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=qs(this),a;!(a=s()).done;){var i=a.value;r.call(o,i,i,this)}},t.add=function(r){var o=this;if(xr(this.atom_),Hn(this)){var s=Fn(this,{type:wo,object:this,newValue:r});if(!s)return this}if(!this.has(r)){Jr(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=te.NODE_ENV!=="production"&&Bt(),i=rr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:wo,object:this,newValue:r}:null;a&&te.NODE_ENV!=="production"&&xn(l),i&&or(this,l),a&&te.NODE_ENV!=="production"&&En()}return this},t.delete=function(r){var o=this;if(Hn(this)){var s=Fn(this,{type:Ll,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=te.NODE_ENV!=="production"&&Bt(),i=rr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Ll,object:this,oldValue:r}:null;return a&&te.NODE_ENV!=="production"&&xn(l),Jr(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&or(this,l),a&&te.NODE_ENV!=="production"&&En(),!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 Jg({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 Jg({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(Kr(r)&&!ir(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(Kr(r)&&!ir(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(Kr(r)&&!ir(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(Kr(r)&&!ir(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return ir(r)&&(r=new Set(r)),Jr(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):Kr(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):r!=null&&me("Cannot initialize set from "+r)}),this},t.observe_=function(r,o){return te.NODE_ENV!=="production"&&o===!0&&me("`observe` doesn't support fireImmediately=true in combination with sets."),qa(this,r)},t.intercept_=function(r){return Ga(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Gs(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),ir=mo("ObservableSet",Xg);function Jg(e){return e[Symbol.toStringTag]="SetIterator",id(e)}var Qg=Object.create(null),Rg="remove",nd=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=Ix),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 bo(te.NODE_ENV!=="production"?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=wn(this.target_),te.NODE_ENV!=="production"&&!u1(this.defaultAnnotation_)&&me("defaultAnnotation must be valid annotation"),te.NODE_ENV!=="production"&&(this.appliedAnnotations_={})}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 Vn)return s.set(o),!0;if(Hn(this)){var a=Fn(this,{type:sr,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=s.prepareNewValue_(o),o!==ce.UNCHANGED){var i=rr(this),l=te.NODE_ENV!=="production"&&Bt(),u=i||l?{type:sr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;te.NODE_ENV!=="production"&&l&&xn(u),s.setNewValue_(o),i&&or(this,u),te.NODE_ENV!=="production"&&l&&En()}return!0},t.get_=function(r){return ce.trackingDerivation&&!kn(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),kn(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(!ce.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new vo(r in this.target_,bl,te.NODE_ENV!=="production"?this.name_+"."+Du(r)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},t.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(n1(this,o,r),!(r in this.target_)){var s;if((s=this.target_[ln])!=null&&s[r])return;me(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==Va;){var i=fl(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}t1(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);n1(this,s,r);var i=s.extend_(this,r,o,a);return i&&t1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),xr(this.keysAtom_);try{jn();var a=this.delete_(r);if(!a)return a;if(Hn(this)){var i=Fn(this,{object:this.proxy_||this.target_,name:r,type:wo,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=Yr({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else Sr(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{Dn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),xr(this.keysAtom_);try{jn();var i=this.delete_(r);if(!i)return i;if(Hn(this)){var l=Fn(this,{object:this.proxy_||this.target_,name:r,type:wo,newValue:o});if(!l)return null;o=l.newValue}var u=e1(r),d={configurable:ce.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Sr(this.target_,r,d);var f=new vo(o,s,te.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Dn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),xr(this.keysAtom_);try{jn();var a=this.delete_(r);if(!a)return a;if(Hn(this)){var i=Fn(this,{object:this.proxy_||this.target_,name:r,type:wo,newValue:void 0});if(!i)return null}o.name||(o.name=te.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=e1(r),u={configurable:ce.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Sr(this.target_,r,u);this.values_.set(r,new Vn(o)),this.notifyPropertyAddition_(r,void 0)}finally{Dn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),xr(this.keysAtom_),!kn(this.target_,r))return!0;if(Hn(this)){var s=Fn(this,{object:this.proxy_||this.target_,name:r,type:Rg});if(!s)return null}try{var a;jn();var i=rr(this),l=te.NODE_ENV!=="production"&&Bt(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var f;d=(f=fl(this.target_,r))==null?void 0:f.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(te.NODE_ENV!=="production"&&delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof vo&&(d=u.value_),Lg(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var p={type:Rg,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};te.NODE_ENV!=="production"&&l&&xn(p),i&&or(this,p),te.NODE_ENV!=="production"&&l&&En()}}finally{Dn()}return!0},t.observe_=function(r,o){return te.NODE_ENV!=="production"&&o===!0&&me("`observe` doesn't support the fire immediately property for observable objects."),qa(this,r)},t.intercept_=function(r){return Ga(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=rr(this),i=te.NODE_ENV!=="production"&&Bt();if(a||i){var l=a||i?{type:wo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;te.NODE_ENV!=="production"&&i&&xn(l),a&&or(this,l),te.NODE_ENV!=="production"&&i&&En()}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ws(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function fs(e,t){var n;if(te.NODE_ENV!=="production"&&t&&ps(e)&&me("Options can't be provided for already observable objects."),kn(e,Ce))return te.NODE_ENV!=="production"&&!(a1(e)instanceof nd)&&me("Cannot convert '"+$l(e)+`' into observable object:
|
|
63
|
-
The target is already observable of different type.
|
|
64
|
-
Extending builtins is not supported.`),e;te.NODE_ENV!=="production"&&!Object.isExtensible(e)&&me("Cannot make the designated object observable; it is not extensible");var r=(n=t==null?void 0:t.name)!=null?n:te.NODE_ENV!=="production"?(wn(e)?"ObservableObject":e.constructor.name)+"@"+nr():"ObservableObject",o=new nd(e,new Map,String(r),Kx(t));return ja(e,Ce,o),e}var KE=mo("ObservableObjectAdministration",nd);function e1(e){return Qg[e]||(Qg[e]={get:function(){return this[Ce].getObservablePropValue_(e)},set:function(n){return this[Ce].setObservablePropValue_(e,n)}})}function ps(e){return hl(e)?KE(e[Ce]):!1}function t1(e,t,n){var r;te.NODE_ENV!=="production"&&(e.appliedAnnotations_[n]=t),(r=e.target_[ln])==null||delete r[n]}function n1(e,t,n){if(te.NODE_ENV!=="production"&&!u1(t)&&me("Cannot annotate '"+e.name_+"."+n.toString()+"': Invalid annotation."),te.NODE_ENV!=="production"&&!vl(t)&&kn(e.appliedAnnotations_,n)){var r=e.name_+"."+n.toString(),o=e.appliedAnnotations_[n].annotationType_,s=t.annotationType_;me("Cannot apply '"+s+"' to '"+r+"':"+(`
|
|
65
|
-
The field is already annotated with '`+o+"'.")+`
|
|
66
|
-
Re-annotating fields is not allowed.
|
|
67
|
-
Use 'override' annotation for methods overridden by subclass.`)}}var YE=o1(0),ZE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),rd=0,r1=function(){};function XE(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}XE(r1,Array.prototype);var od=function(e){function t(r,o,s,a){var i;return s===void 0&&(s=te.NODE_ENV!=="production"?"ObservableArray@"+nr():"ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,So(function(){var l=new td(s,o,a,!0);l.proxy_=i,lg(i,Ce,l),r&&r.length&&i.spliceWithArray(0,0,r),ZE&&Object.defineProperty(i,"0",YE)}),i}fg(t,e);var n=t.prototype;return n.concat=function(){this[Ce].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 Ka(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return id({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},Gs(t,[{key:"length",get:function(){return this[Ce].getArrayLength_()},set:function(o){this[Ce].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(r1);Object.entries(Ml).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&ja(od.prototype,t,n)});function o1(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ce].get_(e)},set:function(n){this[Ce].set_(e,n)}}}function JE(e){Sr(od.prototype,""+e,o1(e))}function s1(e){if(e>rd){for(var t=rd;t<e+100;t++)JE(t);rd=e}}s1(1e3);function QE(e,t,n){return new od(e,t,n)}function Js(e,t){if(typeof e=="object"&&e!==null){if(Ka(e))return t!==void 0&&me(23),e[Ce].atom_;if(ir(e))return e.atom_;if(Qr(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||me(25,t,$l(e)),n}if(ps(e)){if(!t)return me(26);var r=e[Ce].values_.get(t);return r||me(27,t,$l(e)),r}if(Fu(e)||Ba(e)||Ol(e))return e}else if(Mt(e)&&Ol(e[Ce]))return e[Ce];me(28)}function a1(e,t){if(e||me(29),Fu(e)||Ba(e)||Ol(e)||Qr(e)||ir(e))return e;if(e[Ce])return e[Ce];me(24,e)}function $l(e,t){var n;if(t!==void 0)n=Js(e,t);else{if(Ys(e))return e.name;ps(e)||Qr(e)||ir(e)?n=a1(e):n=Js(e)}return n.name_}function So(e){var t=ls(),n=Wu(!0);jn();try{return e()}finally{Dn(),Gu(n),Zr(t)}}var i1=Va.toString;function sd(e,t,n){return n===void 0&&(n=-1),ad(e,t,n)}function ad(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=i1.call(e);if(a!==i1.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=l1(e),t=l1(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&&!(Mt(l)&&l instanceof l&&Mt(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(!ad(e[d],t[d],n-1,r,o))return!1}else{var f=Object.keys(e),p;if(d=f.length,Object.keys(t).length!==d)return!1;for(;d--;)if(p=f[d],!(kn(t,p)&&ad(e[p],t[p],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function l1(e){return Ka(e)?e.slice():Us(e)||Qr(e)||Kr(e)||ir(e)?Array.from(e.entries()):e}var c1,RE=((c1=dl().Iterator)==null?void 0:c1.prototype)||{};function id(e){return e[Symbol.iterator]=eP,Object.assign(Object.create(RE),e)}function eP(){return this}function u1(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Mt(e.make_)&&Mt(e.extend_)}if(["Symbol","Map","Set"].forEach(function(e){var t=dl();typeof t[e]>"u"&&me("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:gE,extras:{getDebugName:$l},$mobx:Ce}),!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!HE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var tP={};function nP(e){e()}function rP(e){e||(e=nP,tP.NODE_ENV!=="production"&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),AE({reactionScheduler:e})}function oP(e){return zg(e)}var sP=1e4,aP=1e4,iP=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=sP),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,aP))}}),e}(),lP=typeof FinalizationRegistry<"u"?FinalizationRegistry:iP,ld=new lP(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),cd={exports:{}},ud={};/**
|
|
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})()})(lg);var R2=lg.exports;const N=Uu(R2);var Yt={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 ex={};function Cl(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:ex}var cg=Object.assign,xl=Object.getOwnPropertyDescriptor,Or=Object.defineProperty,za=Object.prototype,Ku=[];Object.freeze(Ku);var ug={};Object.freeze(ug);var tx=typeof Proxy<"u",nx=Object.toString();function dg(){tx||We("Proxy not available")}function fg(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Xs=function(){};function ar(e){return typeof e=="function"}function hs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function El(e){return e!==null&&typeof e=="object"}function eo(e){if(!El(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()===nx}function pg(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ua(e,t,n){Or(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function hg(e,t,n){Or(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Co(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return El(r)&&r[n]===!0}}function Js(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function rx(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function to(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var gg=typeof Object.getOwnPropertySymbols<"u";function ox(e){var t=Object.keys(e);if(!gg)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return za.propertyIsEnumerable.call(e,r)})):t}var Qs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:gg?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function mg(e){return e===null?null:typeof e=="object"?""+e:e}function no(e,t){return za.hasOwnProperty.call(e,t)}var sx=Object.getOwnPropertyDescriptors||function(t){var n={};return Qs(t).forEach(function(r){n[r]=xl(t,r)}),n};function On(e,t){return!!(e&t)}function _n(e,t,n){return n?e|=t:e&=~t,e}function vg(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 ax(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 Rs(e,t,n){return t&&ax(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ea(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=cx(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 gs(){return gs=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},gs.apply(null,arguments)}function bg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Zu(e,t)}function Zu(e,t){return Zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Zu(e,t)}function ix(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=ix(e,"string");return typeof t=="symbol"?t:t+""}function cx(e,t){if(e){if(typeof e=="string")return vg(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)?vg(e,t):void 0}}var ir=Symbol("mobx-stored-annotations");function _r(e){function t(n,r){if(Ga(r))return e.decorate_20223_(n,r);Wa(n,r,e)}return Object.assign(t,e)}function Wa(e,t,n){no(e,ir)||Ua(e,ir,gs({},e[ir])),bx(n)||(e[ir][t]=n)}function ux(e){return no(e,ir)||Ua(e,ir,gs({},e[ir])),e[ir]}function Ga(e){return typeof e=="object"&&typeof e.kind=="string"}var xe=Symbol("mobx administration"),xo=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 Hg(this)},t.reportChanged=function(){Bn(),jg(this),zn()},t.toString=function(){return this.name_},Rs(e,[{key:"isBeingObserved",get:function(){return On(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return On(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=_n(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();xo.isBeingObservedMask_=1,xo.isPendingUnobservationMask_=2,xo.diffValueMask_=4;var Yu=Co("Atom",xo);function yg(e,t,n){t===void 0&&(t=Xs),n===void 0&&(n=Xs);var r=new xo(e);return t!==Xs&&xE(r,t),n!==Xs&&Ug(r,n),r}function dx(e,t){return e===t}function fx(e,t){return hd(e,t)}function px(e,t){return hd(e,t,1)}function hx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Tl={identity:dx,structural:fx,default:hx,shallow:px};function ms(e,t,n){return ld(e)?e:Array.isArray(e)?qt.array(e,{name:n}):eo(e)?qt.object(e,void 0,{name:n}):Js(e)?qt.map(e,{name:n}):to(e)?qt.set(e,{name:n}):typeof e=="function"&&!Xa(e)&&!Ja(e)?pg(e)?ws(e):Ya(n,e):e}function gx(e,t,n){if(e==null||ti(e)||ei(e)||Oo(e)||fr(e))return e;if(Array.isArray(e))return qt.array(e,{name:n,deep:!1});if(eo(e))return qt.object(e,void 0,{name:n,deep:!1});if(Js(e))return qt.map(e,{name:n,deep:!1});if(to(e))return qt.set(e,{name:n,deep:!1})}function Pl(e){return e}function mx(e,t){return hd(e,t)?t:e}var vx="override";function bx(e){return e.annotationType_===vx}function qa(e,t){return{annotationType_:e,options_:t,make_:yx,extend_:wx,decorate_20223_:Sx}}function yx(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(Xa(n.value))return 1;var s=wg(e,this,t,n,!1);return Or(r,t,s),2}function wx(e,t,n,r){var o=wg(e,this,t,n);return e.defineProperty_(t,o,r)}function Sx(e,t){var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,f,p,g;return vs((d=(f=s.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(p=(g=s.options_)==null?void 0:g.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,d=l;return Xa(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Xa(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 Cx(e,t,n,r){t.annotationType_,r.value}function wg(e,t,n,r,o){var s,a,i,l,u,d,f;o===void 0&&(o=fe.safeDescriptors),Cx(e,t,n,r);var p=r.value;if((s=t.options_)!=null&&s.bound){var g;p=p.bind((g=e.proxy_)!=null?g:e.target_)}return{value:vs((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Sg(e,t){return{annotationType_:e,options_:t,make_:xx,extend_:Ex,decorate_20223_:Tx}}function xx(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&&(!no(e.target_,t)||!Ja(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Ja(n.value))return 1;var s=Cg(e,this,t,n,!1,!1);return Or(r,t,s),2}function Ex(e,t,n,r){var o,s=Cg(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function Tx(e,t){var n,r=t.name,o=t.addInitializer;return Ja(e)||(e=ws(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 Px(e,t,n,r){t.annotationType_,r.value}function Cg(e,t,n,r,o,s){s===void 0&&(s=fe.safeDescriptors),Px(e,t,n,r);var a=r.value;if(Ja(a)||(a=ws(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 Xu(e,t){return{annotationType_:e,options_:t,make_:Ox,extend_:_x,decorate_20223_:Ax}}function Ox(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function _x(e,t,n,r){return Lx(e,this,t,n),e.defineComputedProperty_(t,gs({},this.options_,{get:n.get,set:n.set}),r)}function Ax(e,t){var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=Ss(this)[xe],a=gs({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),s.values_.set(r,new lr(a))}),function(){return this[xe].getObservablePropValue_(r)}}function Lx(e,t,n,r){t.annotationType_,r.get}function Ol(e,t){return{annotationType_:e,options_:t,make_:Mx,extend_:Nx,decorate_20223_:$x}}function Mx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Nx(e,t,n,r){var o,s;return kx(e,this),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:ms,r)}function $x(e,t){var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,f=Ss(i)[xe],p=new Eo(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:ms,"ObservableObject."+o.toString(),!1);f.values_.set(o,p),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[xe].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[xe].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function kx(e,t,n,r){t.annotationType_}var Ix="true",Vx=xg();function xg(e){return{annotationType_:Ix,options_:e,make_:Hx,extend_:jx,decorate_20223_:Dx}}function Hx(e,t,n,r){var o,s;if(n.get)return Ll.make_(e,t,n,r);if(n.set){var a=vs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Or(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?ws.bound:ws;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Ya.bound:Ya;return d.make_(e,t,n,r)}var f=((o=this.options_)==null?void 0:o.deep)===!1?qt.ref:qt;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return f.make_(e,t,n,r)}function jx(e,t,n,r){var o,s;if(n.get)return Ll.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:vs(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?qt.ref:qt;return i.extend_(e,t,n,r)}function Dx(e,t){We("'"+this.annotationType_+"' cannot be used as a decorator")}var Fx="observable",Bx="observable.ref",zx="observable.shallow",Ux="observable.struct",Eg={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Eg);function _l(e){return e||Eg}var Ju=Ol(Fx),Wx=Ol(Bx,{enhancer:Pl}),Gx=Ol(zx,{enhancer:gx}),qx=Ol(Ux,{enhancer:mx}),Tg=_r(Ju);function Al(e){return e.deep===!0?ms:e.deep===!1?Pl:Zx(e.defaultDecorator)}function Kx(e){var t;return e?(t=e.defaultDecorator)!=null?t:xg(e):void 0}function Zx(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:ms}function Pg(e,t,n){if(Ga(t))return Ju.decorate_20223_(e,t);if(hs(t)){Wa(e,t,Ju);return}return ld(e)?e:eo(e)?qt.object(e,t,n):Array.isArray(e)?qt.array(e,t):Js(e)?qt.map(e,t):to(e)?qt.set(e,t):typeof e=="object"&&e!==null?e:qt.box(e,t)}cg(Pg,Tg);var Yx={box:function(t,n){var r=_l(n);return new Eo(t,Al(r),r.name,!0,r.equals)},array:function(t,n){var r=_l(n);return(fe.useProxies===!1||r.proxy===!1?ZE:jE)(t,Al(r),r.name)},map:function(t,n){var r=_l(n);return new Jg(t,Al(r),r.name)},set:function(t,n){var r=_l(n);return new Rg(t,Al(r),r.name)},object:function(t,n,r){return _o(function(){return Gg(fe.useProxies===!1||(r==null?void 0:r.proxy)===!1?Ss({},r):kE({},r),t,n)})},ref:_r(Wx),shallow:_r(Gx),deep:Tg,struct:_r(qx)},qt=cg(Pg,Yx),Og="computed",Xx="computed.struct",Qu=Xu(Og),Jx=Xu(Xx,{equals:Tl.structural}),Ll=function(t,n){if(Ga(n))return Qu.decorate_20223_(t,n);if(hs(n))return Wa(t,n,Qu);if(eo(t))return _r(Xu(Og,t));var r=eo(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new lr(r)};Object.assign(Ll,Qu),Ll.struct=_r(Jx);var _g,Ag,Ml=0,Qx=1,Rx=(_g=(Ag=xl(function(){},"name"))==null?void 0:Ag.configurable)!=null?_g:!1,Lg={value:"action",configurable:!0,writable:!1,enumerable:!1};function vs(e,t,n,r){n===void 0&&(n=!1);function o(){return eE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},Rx&&(Lg.value=e,Or(o,"name",Lg)),o}function eE(e,t,n,r,o){var s=tE(e,t);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{nE(s)}}function tE(e,t,n,r){var o=Yt.NODE_ENV!=="production",s=0,a=fe.trackingDerivation,i=!t||!a;Bn();var l=fe.allowStateChanges;i&&(bs(),l=Ru(!0));var u=rd(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:o,startTime_:s,actionId_:Qx++,parentActionId_:Ml};return Ml=d.actionId_,d}function nE(e){Ml!==e.actionId_&&We(30),Ml=e.parentActionId_,e.error_!==void 0&&(fe.suppressReactionErrors=!0),ed(e.prevAllowStateChanges_),Za(e.prevAllowStateReads_),zn(),e.runAsAction_&&ro(e.prevDerivation_),fe.suppressReactionErrors=!1}function Ru(e){var t=fe.allowStateChanges;return fe.allowStateChanges=e,t}function ed(e){fe.allowStateChanges=e}var Eo=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s="ObservableValue"),i===void 0&&(i=Tl.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}bg(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(Un(this)){var s=Wn(this,{object:this,type:Ar,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(),cr(this)&&ur(this,{type:Ar,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Qa(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:Ar,newValue:this.value_,oldValue:void 0}),Ra(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 mg(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(xo),rE=Co("ObservableValue",Eo),lr=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 $l(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Nl.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_=vs("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Tl.structural:Tl.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),fe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)td(this)&&(this.warnAboutUntrackedRead_(),Bn(),this.value_=this.computeValue_(!1),zn());else if(Hg(this),td(this)){var r=fe.trackingContext;this.keepAlive_&&!r&&(fe.trackingContext=this),this.trackAndCompute()&&iE(this),fe.trackingContext=r}var o=this.value_;if(kl(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||kl(r)||kl(s)||!this.equals_(r,s);return a&&(this.value_=s),a},t.computeValue_=function(r){this.isComputing=!0;var o=Ru(!1),s;if(r)s=Mg(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 $l(a)}return ed(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(nd(this),this.value_=void 0)},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return bE(function(){var l=s.get();if(!a||o){var u=bs();r({observableKind:"computed",debugObjectName:s.name_,type:Ar,object:s,newValue:l,oldValue:i}),ro(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return mg(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Rs(e,[{key:"isComputing",get:function(){return On(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=_n(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return On(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=_n(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return On(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return On(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=_n(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();lr.isComputingMask_=1,lr.isRunningSetterMask_=2,lr.isBeingObservedMask_=4,lr.isPendingUnobservationMask_=8,lr.diffValueMask_=16;var Ka=Co("ComputedValue",lr),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 Nl;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Nl||(Nl={}));var $l=function(t){this.cause=void 0,this.cause=t};function kl(e){return e instanceof $l}function td(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=rd(!0),n=bs(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Ka(a)){if(fe.disableErrorBoundaries)a.get();else try{a.get()}catch{return ro(n),Za(t),!0}if(e.dependenciesState_===Xe.STALE_)return ro(n),Za(t),!0}}return $g(e),ro(n),Za(t),!1}}}function QH(e){}function Mg(e,t,n){var r=rd(!0);$g(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 $l(a)}return fe.inBatch--,fe.trackingDerivation=o,oE(e),Za(r),s}function oE(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&&Ig(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,aE(u,e))}r!==Xe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function nd(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Ig(t[n],e);e.dependenciesState_=Xe.NOT_TRACKING_}function Ng(e){var t=bs();try{return e()}finally{ro(t)}}function bs(){var e=fe.trackingDerivation;return fe.trackingDerivation=null,e}function ro(e){fe.trackingDerivation=e}function rd(e){var t=fe.allowStateReads;return fe.allowStateReads=e,t}function Za(e){fe.allowStateReads=e}function $g(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 Il=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},Vl=!0,kg=!1,fe=function(){var e=Cl();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Vl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Il().version&&(Vl=!1),Vl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Il):(setTimeout(function(){kg||We(35)},1),new Il)}();function sE(){if((fe.pendingReactions.length||fe.inBatch||fe.isRunningReactions)&&We(36),kg=!0,Vl){var e=Cl();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),fe=new Il}}function aE(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Ig(e,t){e.observers_.delete(t),e.observers_.size===0&&Vg(e)}function Vg(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,fe.pendingUnobservations.push(e))}function Bn(){fe.inBatch++}function zn(){if(--fe.inBatch===0){Dg();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 lr&&n.suspend_())}fe.pendingUnobservations=[]}}function Hg(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&&Vg(e),!1)}function jg(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 iE(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 oo=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_=Nl.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),Dg())},t.runReaction_=function(){if(!this.isDisposed){Bn(),this.isScheduled=!1;var r=fe.trackingContext;if(fe.trackingContext=this,td(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Yt.NODE_ENV!=="production"&&this.isTrackPending&&ys()}catch(o){this.reportExceptionInDerivation_(o)}}fe.trackingContext=r,zn()}},t.track=function(r){if(!this.isDisposed){Bn(),this.isRunning=!0;var o=fe.trackingContext;fe.trackingContext=this;var s=Mg(this,r,void 0);fe.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&nd(this),kl(s)&&this.reportExceptionInDerivation_(s.cause),zn()}},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||(Bn(),nd(this),zn()))},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[xe]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Rs(e,[{key:"isDisposed",get:function(){return On(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return On(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=_n(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return On(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=_n(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return On(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=_n(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();oo.isDisposedMask_=1,oo.isScheduledMask_=2,oo.isTrackPendingMask_=4,oo.isRunningMask_=8,oo.diffValueMask_=16;var cE=100,od=function(t){return t()};function Dg(){fe.inBatch>0||fe.isRunningReactions||od(uE)}function uE(){fe.isRunningReactions=!0;for(var e=fe.pendingReactions,t=0;e.length>0;){++t===cE&&(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 Hl=Co("Reaction",oo);function dE(e){var t=od;od=function(r){return e(function(){return t(r)})}}function ys(){return Yt.NODE_ENV!=="production"}function RH(e){}function ej(e){}function tj(e){}function fE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Fg="action",pE="action.bound",Bg="autoAction",hE="autoAction.bound",gE="<unnamed action>",sd=qa(Fg),mE=qa(pE,{bound:!0}),ad=qa(Bg,{autoAction:!0}),vE=qa(hE,{autoAction:!0,bound:!0});function zg(e){var t=function(r,o){if(ar(r))return vs(r.name||gE,r,e);if(ar(o))return vs(r,o,e);if(Ga(o))return(e?ad:sd).decorate_20223_(r,o);if(hs(o))return Wa(r,o,e?ad:sd);if(hs(r))return _r(qa(e?Bg:Fg,{name:r,autoAction:e}))};return t}var ta=zg(!1);Object.assign(ta,sd);var Ya=zg(!0);Object.assign(Ya,ad),ta.bound=_r(mE),Ya.bound=_r(vE);function Xa(e){return ar(e)&&e.isMobxAction===!0}function bE(e,t){var n,r,o,s;t===void 0&&(t=ug);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new oo(a,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=wE(t),d=!1;l=new oo(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(f)}))},t.onError,t.requiresObservable)}function f(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var yE=function(t){return t()};function wE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:yE}var SE="onBO",CE="onBUO";function xE(e,t,n){return Wg(SE,e,t,n)}function Ug(e,t,n){return Wg(CE,e,t,n)}function Wg(e,t,n,r){var o=zl(t),s=ar(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 EE="never",jl="always",TE="observed";function PE(e){e.isolateGlobalState===!0&&sE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(fe.useProxies=t===jl?!0:t===EE?!1:typeof Proxy<"u"),t==="ifavailable"&&(fe.verifyProxies=!0),n!==void 0){var r=n===jl?jl:n===TE;fe.enforceActions=r,fe.allowStateChanges=!(r===!0||r===jl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(fe[o]=!!e[o])}),fe.allowStateReads=!fe.observableRequiresReaction,e.reactionScheduler&&dE(e.reactionScheduler)}function Gg(e,t,n,r){var o=sx(t);return _o(function(){var s=Ss(e,r)[xe];Qs(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function OE(e,t){return qg(zl(e,t))}function qg(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=_E(e.observing_).map(qg)),t}function _E(e){return Array.from(new Set(e))}var AE=0;function Kg(){this.message="FLOW_CANCELLED"}Kg.prototype=Object.create(Error.prototype);var id=Sg("flow"),LE=Sg("flow.bound",{bound:!0}),ws=Object.assign(function(t,n){if(Ga(n))return id.decorate_20223_(t,n);if(hs(n))return Wa(t,n,id);var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++AE,d=ta(o+" - runid: "+u+" - init",r).apply(i,l),f,p=void 0,g=new Promise(function(m,v){var b=0;f=v;function w(C){p=void 0;var x;try{x=ta(o+" - runid: "+u+" - yield "+b++,d.next).call(d,C)}catch(E){return v(E)}S(x)}function y(C){p=void 0;var x;try{x=ta(o+" - runid: "+u+" - yield "+b++,d.throw).call(d,C)}catch(E){return v(E)}S(x)}function S(C){if(ar(C==null?void 0:C.then)){C.then(S,v);return}return C.done?m(C.value):(p=Promise.resolve(C.value),p.then(w,y))}w(void 0)});return g.cancel=ta(o+" - runid: "+u+" - cancel",function(){try{p&&Zg(p);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(Xs,Xs),Zg(v),f(new Kg)}catch(b){f(b)}}),g};return s.isMobXFlow=!0,s},id);ws.bound=_r(LE);function Zg(e){ar(e.cancel)&&e.cancel()}function Ja(e){return(e==null?void 0:e.isMobXFlow)===!0}function ME(e,t){return e?ti(e)||!!e[xe]||Yu(e)||Hl(e)||Ka(e):!1}function ld(e){return ME(e)}function NE(e){if(ti(e))return e[xe].ownKeys_();We(38)}function Dl(e,t,n){return e.set(t,n),n}function na(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ld(e))return e;if(rE(e)||Ka(e))return na(e.get(),t);if(t.has(e))return t.get(e);if(ei(e)){var n=Dl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=na(a,t)}),n}if(fr(e)){var r=Dl(t,e,new Set);return e.forEach(function(a){r.add(na(a,t))}),r}if(Oo(e)){var o=Dl(t,e,new Map);return e.forEach(function(a,i){o.set(i,na(a,t))}),o}else{var s=Dl(t,e,{});return NE(e).forEach(function(a){za.propertyIsEnumerable.call(e,a)&&(s[a]=na(e[a],t))}),s}}function To(e,t){return na(e,new Map)}function so(e,t){t===void 0&&(t=void 0),Bn();try{return e.apply(t)}finally{zn()}}function ra(e){return e[xe]}var $E={has:function(t,n){return ra(t).has_(n)},get:function(t,n){return ra(t).get_(n)},set:function(t,n,r){var o;return hs(n)?(o=ra(t).set_(n,r,!0))!=null?o:!0:!1},deleteProperty:function(t,n){var r;return hs(n)?(r=ra(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return(o=ra(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return ra(t).ownKeys_()},preventExtensions:function(t){We(13)}};function kE(e,t){var n,r;return dg(),e=Ss(e,t),(r=(n=e[xe]).proxy_)!=null?r:n.proxy_=new Proxy(e,$E)}function Un(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Qa(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),fg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Wn(e,t){var n=bs();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{ro(n)}}function cr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Ra(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),fg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function ur(e,t){var n=bs(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);ro(n)}}function IE(e,t,n){return _o(function(){var r,o=Ss(e,n)[xe];Yt.NODE_ENV!=="production"&&t&&e[ir],(r=t)!=null||(t=ux(e)),Qs(t).forEach(function(s){return o.make_(s,t[s])})}),e}var cd=Symbol("mobx-keys");function sn(e,t,n){return eo(e)?Gg(e,e,t,n):(_o(function(){var r=Ss(e,n)[xe];if(!e[cd]){var o=Object.getPrototypeOf(e),s=new Set([].concat(Qs(e),Qs(o)));s.delete("constructor"),s.delete(xe),Ua(o,cd,s)}e[cd].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var Yg="splice",Ar="update",VE=1e4,HE={get:function(t,n){var r=t[xe];return n===xe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):no(Fl,n)?Fl[n]:t[n]},set:function(t,n,r){var o=t[xe];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){We(15)}},ud=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 xo(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 Qa(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}),Ra(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&&l1(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=Ku),Un(this)){var l=Wn(this,{object:this.proxy_,type:Yg,index:r,removedCount:o,added:s});if(!l)return Ku;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(f){return a.enhancer_(f,void 0)}),this.legacyMode_||Yt.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<VE){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_&&ys(),i=cr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:Ar,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;this.atom_.reportChanged(),i&&ur(this,l)},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&ys(),i=cr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Yg,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;this.atom_.reportChanged(),i&&ur(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(Un(this)){var i=Wn(this,{type:Ar,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 jE(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),dg(),_o(function(){var o=new ud(n,t,r,!1);hg(o.values_,xe,o);var s=new Proxy(o.values_,HE);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Fl={clear:function(){return this.splice(0)},replace:function(t){var n=this[xe];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[xe];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[xe].spliceWithArray_(t,n,r)},push:function(){for(var t=this[xe],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[xe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[xe],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&&We(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){fe.trackingDerivation&&We(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[xe],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};vt("at",An),vt("concat",An),vt("flat",An),vt("includes",An),vt("indexOf",An),vt("join",An),vt("lastIndexOf",An),vt("slice",An),vt("toString",An),vt("toLocaleString",An),vt("toSorted",An),vt("toSpliced",An),vt("with",An),vt("every",dr),vt("filter",dr),vt("find",dr),vt("findIndex",dr),vt("findLast",dr),vt("findLastIndex",dr),vt("flatMap",dr),vt("forEach",dr),vt("map",dr),vt("some",dr),vt("toReversed",dr),vt("reduce",Xg),vt("reduceRight",Xg);function vt(e,t){typeof Array.prototype[e]=="function"&&(Fl[e]=t(e))}function An(e){return function(){var t=this[xe];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function dr(e){return function(t,n){var r=this,o=this[xe];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function Xg(e){return function(){var t=this,n=this[xe];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 DE=Co("ObservableArrayAdministration",ud);function ei(e){return El(e)&&DE(e[xe])}var FE={},Po="add",Bl="delete",Jg=function(){function e(n,r,o){var s=this;r===void 0&&(r=ms),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[xe]=FE,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,ar(Map)||We(18),_o(function(){s.keysAtom_=yg(Yt.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 Eo(this.has_(r),Pl,"ObservableMap.key?",!1);this.hasMap_.set(r,a),Ug(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(Un(this)){var a=Wn(this,{type:s?Ar:Po,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_,Un(this)){var s=Wn(this,{type:Bl,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Bl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return so(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&&ur(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=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&ur(this,l)}},t.addValue_=function(r,o){var s=this;this.keysAtom_,so(function(){var u,d=new Eo(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=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Po,object:this,name:r,newValue:o}:null;i&&ur(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 Qg({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 Qg({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=ea(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 Oo(r)&&(r=new Map(r)),so(function(){eo(r)?ox(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)}):Js(r)?(rx(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;so(function(){Ng(function(){for(var o=ea(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return so(function(){for(var s=BE(r),a=new Map,i=!1,l=ea(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var f=o.delete(d);if(f)i=!0;else{var p=o.data_.get(d);a.set(d,p)}}}for(var g=ea(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(),T=x.next();!E.done;){if(E.value!==T.value){o.keysAtom_.reportChanged();break}E=C.next(),T=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 Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},Rs(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Oo=Co("ObservableMap",Jg);function Qg(e){return e[Symbol.toStringTag]="MapIterator",md(e)}function BE(e){if(Js(e)||Oo(e))return e;if(Array.isArray(e))return new Map(e);if(eo(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return We(21,e)}var zE={},Rg=function(){function e(n,r,o){var s=this;r===void 0&&(r=ms),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[xe]=zE,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,ar(Set)||We(22),this.enhancer_=function(a,i){return r(a,i,o)},_o(function(){s.atom_=yg(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;so(function(){Ng(function(){for(var o=ea(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=ea(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_,Un(this)){var s=Wn(this,{type:Po,object:this,newValue:r});if(!s)return this}if(!this.has(r)){so(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=Yt.NODE_ENV!=="production",i=cr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Po,object:this,newValue:r}:null;i&&ur(this,l)}return this},t.delete=function(r){var o=this;if(Un(this)){var s=Wn(this,{type:Bl,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=Yt.NODE_ENV!=="production",i=cr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Bl,object:this,oldValue:r}:null;return so(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&ur(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 e1({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 e1({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(to(r)&&!fr(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(to(r)&&!fr(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(to(r)&&!fr(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(to(r)&&!fr(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return fr(r)&&(r=new Set(r)),so(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):to(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 Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Rs(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),fr=Co("ObservableSet",Rg);function e1(e){return e[Symbol.toStringTag]="SetIterator",md(e)}var t1=Object.create(null),n1="remove",r1=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=Vx),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 xo("ObservableObject.keys"),this.isPlainObject_=eo(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 lr)return s.set(o),!0;if(Un(this)){var a=Wn(this,{type:Ar,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=cr(this),l=Yt.NODE_ENV!=="production",u=i||l?{type:Ar,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&ur(this,u)}return!0},t.get_=function(r){return fe.trackingDerivation&&!no(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),no(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 Eo(r in this.target_,Pl,"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_[ir])!=null&&s[r])return;We(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==za;){var i=xl(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}s1(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&&s1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Bn();var a=this.delete_(r);if(!a)return a;if(Un(this)){var i=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=gs({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else Or(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{zn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),this.keysAtom_;try{Bn();var i=this.delete_(r);if(!i)return i;if(Un(this)){var l=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:o});if(!l)return null;o=l.newValue}var u=o1(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 Or(this.target_,r,d);var f=new Eo(o,s,Yt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{zn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Bn();var a=this.delete_(r);if(!a)return a;if(Un(this)){var i=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:void 0});if(!i)return null}o.name||(o.name=Yt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=o1(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 Or(this.target_,r,u);this.values_.set(r,new lr(o)),this.notifyPropertyAddition_(r,void 0)}finally{zn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),this.keysAtom_,!no(this.target_,r))return!0;if(Un(this)){var s=Wn(this,{object:this.proxy_||this.target_,name:r,type:n1});if(!s)return null}try{var a;Bn();var i=cr(this),l=Yt.NODE_ENV!=="production"&&ys(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var f;d=(f=xl(this.target_,r))==null?void 0:f.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Yt.NODE_ENV,u&&(this.values_.delete(r),u instanceof Eo&&(d=u.value_),jg(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var p={type:n1,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Yt.NODE_ENV,i&&ur(this,p),Yt.NODE_ENV}}finally{zn()}return!0},t.observe_=function(r,o){return Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=cr(this),i=Yt.NODE_ENV!=="production";if(a||i){var l=a||i?{type:Po,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;a&&ur(this,l)}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Qs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ss(e,t){var n;if(no(e,xe))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",o=new r1(e,new Map,String(r),Kx(t));return Ua(e,xe,o),e}var UE=Co("ObservableObjectAdministration",r1);function o1(e){return t1[e]||(t1[e]={get:function(){return this[xe].getObservablePropValue_(e)},set:function(n){return this[xe].setObservablePropValue_(e,n)}})}function ti(e){return El(e)?UE(e[xe]):!1}function s1(e,t,n){var r;(r=e.target_[ir])==null||delete r[n]}var WE=i1(0),GE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),dd=0,a1=function(){};function qE(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}qE(a1,Array.prototype);var fd=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,_o(function(){var l=new ud(s,o,a,!0);l.proxy_=i,hg(i,xe,l),r&&r.length&&i.spliceWithArray(0,0,r),GE&&Object.defineProperty(i,"0",WE)}),i}bg(t,e);var n=t.prototype;return n.concat=function(){this[xe].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 ei(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return md({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},Rs(t,[{key:"length",get:function(){return this[xe].getArrayLength_()},set:function(o){this[xe].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(a1);Object.entries(Fl).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Ua(fd.prototype,t,n)});function i1(e){return{enumerable:!1,configurable:!0,get:function(){return this[xe].get_(e)},set:function(n){this[xe].set_(e,n)}}}function KE(e){Or(fd.prototype,""+e,i1(e))}function l1(e){if(e>dd){for(var t=dd;t<e+100;t++)KE(t);dd=e}}l1(1e3);function ZE(e,t,n){return new fd(e,t,n)}function zl(e,t){if(typeof e=="object"&&e!==null){if(ei(e))return t!==void 0&&We(23),e[xe].atom_;if(fr(e))return e.atom_;if(Oo(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||We(25,t,pd(e)),n}if(ti(e)){if(!t)return We(26);var r=e[xe].values_.get(t);return r||We(27,t,pd(e)),r}if(Yu(e)||Ka(e)||Hl(e))return e}else if(ar(e)&&Hl(e[xe]))return e[xe];We(28)}function YE(e,t){if(e||We(29),Yu(e)||Ka(e)||Hl(e)||Oo(e)||fr(e))return e;if(e[xe])return e[xe];We(24,e)}function pd(e,t){var n;if(t!==void 0)n=zl(e,t);else{if(Xa(e))return e.name;ti(e)||Oo(e)||fr(e)?n=YE(e):n=zl(e)}return n.name_}function _o(e){var t=bs(),n=Ru(!0);Bn();try{return e()}finally{zn(),ed(n),ro(t)}}var c1=za.toString;function hd(e,t,n){return n===void 0&&(n=-1),gd(e,t,n)}function gd(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=c1.call(e);if(a!==c1.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=u1(e),t=u1(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&&!(ar(l)&&l instanceof l&&ar(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(!gd(e[d],t[d],n-1,r,o))return!1}else{var f=Object.keys(e),p;if(d=f.length,Object.keys(t).length!==d)return!1;for(;d--;)if(p=f[d],!(no(t,p)&&gd(e[p],t[p],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function u1(e){return ei(e)?e.slice():Js(e)||Oo(e)||to(e)||fr(e)?Array.from(e.entries()):e}var d1,XE=((d1=Cl().Iterator)==null?void 0:d1.prototype)||{};function md(e){return e[Symbol.iterator]=JE,Object.assign(Object.create(XE),e)}function JE(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=Cl();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:fE,extras:{getDebugName:pd},$mobx:xe}),!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!IE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function QE(e){e()}function RE(e){e||(e=QE),PE({reactionScheduler:e})}function eT(e){return OE(e)}var tT=1e4,nT=1e4,rT=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=tT),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,nT))}}),e}(),oT=typeof FinalizationRegistry<"u"?FinalizationRegistry:rT,vd=new oT(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),f1={exports:{}},bd={};/**
|
|
68
8
|
* @license React
|
|
69
9
|
* use-sync-external-store-shim.production.min.js
|
|
70
10
|
*
|
|
@@ -72,43 +12,38 @@ Use 'override' annotation for methods overridden by subclass.`)}}var YE=o1(0),ZE
|
|
|
72
12
|
*
|
|
73
13
|
* This source code is licensed under the MIT license found in the
|
|
74
14
|
* LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/var d1;function cP(){if(d1)return ud;d1=1;var e=h;function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(f,p){var g=p(),m=r({inst:{value:g,getSnapshot:p}}),b=m[0].inst,v=m[1];return s(function(){b.value=g,b.getSnapshot=p,l(b)&&v({inst:b})},[f,g,p]),o(function(){return l(b)&&v({inst:b}),f(function(){l(b)&&v({inst:b})})},[f]),a(g),g}function l(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function u(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return ud.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,ud}var dd={},f1;function uP(){if(f1)return dd;f1=1;var e={};/**
|
|
76
|
-
* @license React
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the MIT license found in the
|
|
82
|
-
* LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/return e.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=h,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(C){{for(var x=arguments.length,E=new Array(x>1?x-1:0),P=1;P<x;P++)E[P-1]=arguments[P];o("error",C,E)}}function o(C,x,E){{var P=n.ReactDebugCurrentFrame,T=P.getStackAddendum();T!==""&&(x+="%s",E=E.concat([T]));var O=E.map(function(_){return String(_)});O.unshift("Warning: "+x),Function.prototype.apply.call(console[C],console,O)}}function s(C,x){return C===x&&(C!==0||1/C===1/x)||C!==C&&x!==x}var a=typeof Object.is=="function"?Object.is:s,i=t.useState,l=t.useEffect,u=t.useLayoutEffect,d=t.useDebugValue,f=!1,p=!1;function g(C,x,E){f||t.startTransition!==void 0&&(f=!0,r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var P=x();if(!p){var T=x();a(P,T)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}var O=i({inst:{value:P,getSnapshot:x}}),_=O[0].inst,N=O[1];return u(function(){_.value=P,_.getSnapshot=x,m(_)&&N({inst:_})},[C,P,x]),l(function(){m(_)&&N({inst:_});var L=function(){m(_)&&N({inst:_})};return C(L)},[C]),d(P),P}function m(C){var x=C.getSnapshot,E=C.value;try{var P=x();return!a(E,P)}catch{return!0}}function b(C,x,E){return x()}var v=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",w=!v,y=w?b:g,S=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y;dd.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),dd}var dP={};dP.NODE_ENV==="production"?cd.exports=cP():cd.exports=uP();var fP=cd.exports;function p1(e){e.reaction=new Xr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function pP(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 ld.unregister(r),r.onStoreChange=i,r.reaction||(p1(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||(p1(o),ld.register(n,o,o)),h.useDebugValue(o.reaction,oP),fP.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 h1={},fd,pd,g1=!0,m1=typeof Symbol=="function"&&Symbol.for,hP=(pd=(fd=Object.getOwnPropertyDescriptor(function(){},"name"))===null||fd===void 0?void 0:fd.configurable)!==null&&pd!==void 0?pd:!1,b1=m1?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,v1=m1?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function de(e,t){var n;if(h1.NODE_ENV!=="production"&&g1&&t&&(g1=!1,console.warn("[mobx-react-lite] `observer(fn, { forwardRef: true })` is deprecated, use `observer(React.forwardRef(fn))`")),v1&&e.$$typeof===v1)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(b1&&e.$$typeof===b1&&(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 pP(function(){return o(i,l)},s)};return a.displayName=e.displayName,hP&&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),mP(e,a),h1.NODE_ENV!=="production"&&Object.defineProperty(a,"contextTypes",{set:function(){var i,l;throw new Error("[mobx-react-lite] `".concat(this.displayName||((i=this.type)===null||i===void 0?void 0:i.displayName)||((l=this.type)===null||l===void 0?void 0:l.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),a}var gP={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function mP(e,t){Object.keys(e).forEach(function(n){gP[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var hd;rP($n.unstable_batchedUpdates),hd=ld.finalizeAllImmediately;const y1=new Map,bP=(e,t)=>`${t}-${e}`,w1=h.forwardRef(function({svg:t,iconSize:n,...r},o){const s=bP(t,n);let a=y1.get(s);return a||(a=dS(t,n),y1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let S1;const vP=e=>{S1=e},yP=()=>S1;var X=(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))(X||{});const kl={alertRhombus:RS,alignHorizontalCenter:e2,alignHorizontalLeft:t2,alignHorizontalRight:n2,applicationBracketsOutline:r2,arrowDown:o2,arrowExpandAll:s2,arrowRight:a2,arrowULeftTop:i2,arrowURightTop:l2,borderAllVariant:u2,borderRadius:d2,borderStyle:f2,calendar:p2,cellphoneLink:h2,check:zh,checkBold:m2,checkboxBlank:b2,chevronUp:S2,chevronDown:v2,chevronLeft:y2,chevronRight:w2,close:Uh,codeBraces:x2,cog:_2,contentCopy:T2,contentSave:O2,delete:V2,dotsVertical:I2,email:j2,emailOutline:D2,eye:H2,eyedropperVariant:U2,eyeOff:F2,eyeOffOutline:B2,eyeOutline:z2,fire:G2,flare:q2,floppy:K2,folder:Y2,fullscreen:Z2,gradientVertical:X2,helpCircle:J2,home:Q2,image:R2,information:tC,informationVariant:nC,layers:rC,link:aC,lock:lC,lockOpenVariant:cC,menuDown:uC,newspaperVariantOutline:pC,openInNew:Wh,paletteSwatch:mC,panVertical:bC,pencil:vC,phone:yC,plus:wC,plusBox:SC,powerPlug:CC,refresh:xC,rhombusOutline:EC,rhombusSplit:PC,rhombusSplitOutline:_C,tag:AC,target:NC,targetVariant:MC,textBoxMultiple:LC,trayArrowDown:VC,unfoldLessHorizontal:IC,unfoldMoreHorizontal:jC,viewDayOutline:HC,viewGridPlus:FC,web:BC,xml:zC,database:N2,databaseOutline:$2,databaseOutlineOn:L2,databaseOutlineOff:M2,databaseOutlineRemove:k2,codeBrackets:E2,toggleSwitchOutline:kC,toggleSwitchOffOutline:$C,null:hC,string:P2,number:gC,cloudUpload:C2,chat:g2,creation:A2,viewDashboard:DC,rocketLaunch:TC,lightningBolt:sC,stop:OC,arrowUp:c2},wP="gs-cmp-icon",se=de(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=yP(),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(f=>!!f).join(" ");if(!l)return null;const d=M(wP,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(w1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(ka,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),gd=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"},C1={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"},SP={...{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"}},Ee={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},x1={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"},oe={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"},Ya={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"},le={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Pe={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"},Co={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"},cn={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"},Rr="gs-utl-my-2",CP="gs-utl-my-3",E1=` gs-utl-rounded ${Bn.xs} ${cn.mono} ${U.bgH25}`,P1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${Rr} gs-utl-ml-1`,Lt={h1:`${Bn.xl2} ${cn.bold} ${CP}`,h2:`${Bn.xl} ${cn.bold} ${Rr}`,h3:`${Bn.lg} ${cn.semibold} ${Rr}`,h4:`${Bn.base} ${cn.semibold} ${Rr}`,h5:`${Bn.sm} ${cn.semibold} ${Rr}`,h6:`${Bn.xs} ${cn.semibold} ${Rr}`,strong:cn.bold,em:cn.italic,ul:`gs-utl-list-disc ${P1}`,ol:`gs-utl-list-decimal ${P1}`,codeInline:`${E1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${E1} gs-utl-p-3 gs-utl-overflow-x-auto ${Rr}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${Rr} ${cn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${Rr}`,thead:`${U.bgH2}`,tr:`gs-utl-border-b ${U.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${cn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Vl={s:"gs-utl-size-5",m:"gs-utl-size-10"},bd={itemList:({index:e=0,open:t=!1,length:n=0}={})=>ee(U.bgH2,Ee.xyS,U.br,e&&oe.bt,(t||e===n-1)&&oe.bb)},_1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),T1=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},O1=({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 f=e==="pr",p=e==="out",g=e==="out-clear",m=e==="warn",b=e==="danger",v=s&&(p||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&&oe.rnd,l&&U.bg,v?ee(oe.b,U.br,p&&U.bA,p&&U.tAo,!i&&U.hBgH):ee(oe.b,oe.bT),m&&ee(U.bgW,!i&&U.hBgW,"gs-utl-text-white"),b&&ee(U.bgRed,!i&&U.hBgRed,"gs-utl-text-white"),f&&ee(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",Ya.focus]};function qe({children:e,...t}){const{variant:n,size:r,active:o,border:s,rounded:a,block:i,full:l,className:u,icon:d,loading:f,withBg:p,disabled:g,type:m="button",disabledClassName:b,...v}=t,w=f?{icon:iC,size:"18px",className:ee("animate-spin-fast")}:rt(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:ee(O1(t)),disabled:g||f,type:m,...v,children:w?c.jsxs(I,{className:ee("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(H,{children:c.jsx(se,{...w})}),e&&c.jsx(H,{children:e})]}):e})}const xP=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],EP=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Qs="gs-cmp-ai-chat-empty",PP=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=M(Qs,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=AS(r)?EP:xP,f=o??d;return c.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(I,{className:`${Qs}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:M(`${Qs}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:M(`${Qs}__subtitle`,U.txtLowEmphasis),children:u})]}),c.jsx(I,{col:!0,className:`${Qs}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:f.map(p=>{const g=r.t(`${a}.suggestions.${p.id}`)||p.label,m=p.prompt??g;return c.jsx(qe,{className:`${Qs}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},p.id)})})]})},Za="gs-cmp-ai-chat-error",_P=({className:e,style:t,chatContext:n,editor:r})=>{var i;const o=M(Za,e,U.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${Za}__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(I,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(I,{className:`${Za}__header`,items:"center",gap:"xs",children:[c.jsx(H,{className:`${Za}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),c.jsx(qe,{className:`${Za}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(H,{className:s,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},vd="gs-cmp-ai-chat-header",TP=({className:e,chatContext:t,editor:n,...r})=>{const{messages:o,setMessages:s}=t,a=M(vd,e,oe.bb,U.br,Ee.s),i="aiChat.header";return c.jsxs(I,{className:a,items:"center",gap:"xs",...r,children:[c.jsx(H,{className:`${vd}__title`,grow:!0,children:n.t(`${i}.title`)}),o.length>0&&c.jsx(qe,{className:M(`${vd}__btn-clear`,Pe.hover,oe.none,Ee.xS),onClick:()=>s([]),size:"xs",border:!1,icon:"delete",children:n.t(`${i}.clear`)})]})};function hs({full:e,abs:t,small:n,size:r,className:o,bg:s,currentColor:a}){const i=M(e&&"gs-utl-w-full gs-utl-h-full",t?Pe.coverAbs:"gs-utl-relative",o),l=M(!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",oe.pill,oe.bS,a?"gs-utl-border-current":oe.bA);return c.jsxs(I,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:M(Pe.coverAbs,U.bg,Pe.disabled)}),c.jsx("div",{className:l})]})}function Rs(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 p;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(p=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()-p)*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(g,5)} ms`,`
|
|
15
|
+
*/var p1;function sT(){if(p1)return bd;p1=1;var e=h;function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(f,p){var g=p(),m=r({inst:{value:g,getSnapshot:p}}),v=m[0].inst,b=m[1];return s(function(){v.value=g,v.getSnapshot=p,l(v)&&b({inst:v})},[f,g,p]),o(function(){return l(v)&&b({inst:v}),f(function(){l(v)&&b({inst:v})})},[f]),a(g),g}function l(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function u(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return bd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,bd}f1.exports=sT();var aT=f1.exports;function h1(e){e.reaction=new oo("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function iT(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 vd.unregister(r),r.onStoreChange=i,r.reaction||(h1(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||(h1(o),vd.register(n,o,o)),h.useDebugValue(o.reaction,eT),aT.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 yd,wd,g1=typeof Symbol=="function"&&Symbol.for,lT=(wd=(yd=Object.getOwnPropertyDescriptor(function(){},"name"))===null||yd===void 0?void 0:yd.configurable)!==null&&wd!==void 0?wd:!1,m1=g1?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,v1=g1?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(v1&&e.$$typeof===v1)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(m1&&e.$$typeof===m1&&(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 iT(function(){return o(i,l)},s)};return a.displayName=e.displayName,lT&&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),uT(e,a),a}var cT={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function uT(e,t){Object.keys(e).forEach(function(n){cT[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Sd;RE(Fn.unstable_batchedUpdates),Sd=vd.finalizeAllImmediately;const b1=new Map,dT=(e,t)=>`${t}-${e}`,y1=h.forwardRef(function({svg:t,iconSize:n,...r},o){const s=dT(t,n);let a=b1.get(s);return a||(a=zS(t,n),b1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let w1;const fT=e=>{w1=e},pT=()=>w1;var q=(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))(q||{});const Ul={alertRhombus:sC,alignHorizontalCenter:aC,alignHorizontalLeft:iC,alignHorizontalRight:lC,applicationBracketsOutline:cC,arrowDown:uC,arrowExpandAll:dC,arrowRight:fC,arrowULeftTop:pC,arrowURightTop:hC,borderAllVariant:mC,borderRadius:vC,borderStyle:bC,calendar:yC,cellphoneLink:wC,check:ng,checkBold:CC,checkboxBlank:xC,chevronUp:OC,chevronDown:EC,chevronLeft:TC,chevronRight:PC,close:rg,codeBraces:AC,cog:NC,contentCopy:$C,contentSave:kC,delete:BC,dotsVertical:zC,email:UC,emailOutline:WC,eye:GC,eyedropperVariant:YC,eyeOff:qC,eyeOffOutline:KC,eyeOutline:ZC,fire:JC,flare:QC,floppy:RC,folder:e2,fullscreen:t2,gradientVertical:n2,helpCircle:r2,home:o2,image:s2,information:i2,informationVariant:l2,layers:c2,link:f2,lock:h2,lockOpenVariant:g2,menuDown:m2,newspaperVariantOutline:y2,openInNew:og,paletteSwatch:C2,panVertical:x2,pencil:E2,phone:T2,plus:P2,plusBox:O2,powerPlug:_2,refresh:A2,rhombusOutline:L2,rhombusSplit:M2,rhombusSplitOutline:N2,tag:I2,target:V2,targetVariant:H2,textBoxMultiple:j2,trayArrowDown:B2,unfoldLessHorizontal:z2,unfoldMoreHorizontal:U2,viewDayOutline:G2,viewGridPlus:q2,web:K2,xml:Z2,database:VC,databaseOutline:DC,databaseOutlineOn:jC,databaseOutlineOff:HC,databaseOutlineRemove:FC,codeBrackets:LC,toggleSwitchOutline:F2,toggleSwitchOffOutline:D2,null:w2,string:MC,number:S2,cloudUpload:_C,chat:SC,creation:IC,viewDashboard:W2,rocketLaunch:$2,lightningBolt:d2,stop:k2,arrowUp:gC},hT="gs-cmp-icon",ne=ce(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=pT(),l=(i==null?void 0:i[n])||(Ul==null?void 0:Ul[n])||n,u=[s&&"scaleX(-1)",a&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(f=>!!f).join(" ");if(!l)return null;const d=N(hT,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(y1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(Ba,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),Cd=150,z={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"},S1={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"},gT={...{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"},xd={bg:z.bg,bgH:z.bgH},C1={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"},ni={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"},Pe={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"},Ao={link:z.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},mn={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"},mT={all:"gs-utl-break-all"},ao="gs-utl-my-2",vT="gs-utl-my-3",x1=` gs-utl-rounded ${vn.xs} ${mn.mono} ${z.bgH25}`,E1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${ao} gs-utl-ml-1`,jt={h1:`${vn.xl2} ${mn.bold} ${vT}`,h2:`${vn.xl} ${mn.bold} ${ao}`,h3:`${vn.lg} ${mn.semibold} ${ao}`,h4:`${vn.base} ${mn.semibold} ${ao}`,h5:`${vn.sm} ${mn.semibold} ${ao}`,h6:`${vn.xs} ${mn.semibold} ${ao}`,strong:mn.bold,em:mn.italic,ul:`gs-utl-list-disc ${E1}`,ol:`gs-utl-list-decimal ${E1}`,codeInline:`${x1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${x1} gs-utl-p-3 gs-utl-overflow-x-auto ${ao}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${ao} ${mn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${ao}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${mn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Wl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Ed={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Z(z.bgH2,Te.xyS,z.br,e&&te.bt,(t||e===n-1)&&te.bb)},T1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),P1=e=>{let t={isSymbol:!1,bg:z.cmp,bgSoft:`${z.cmpBgSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSoftX,border:z.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:z.cmpSymbol,bgSoft:`${z.cmpBgSymbolSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSymbolSoftX,border:z.cmpSymbolBr,txt:""}),t},O1=({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 f=e==="pr",p=e==="out",g=e==="out-clear",m=e==="warn",v=e==="danger",b=s&&(p||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&&z.bg,b?Z(te.b,z.br,p&&z.bA,p&&z.tAo,!i&&z.hBgH):Z(te.b,te.bT),m&&Z(z.bgW,!i&&z.hBgW,"gs-utl-text-white"),v&&Z(z.bgRed,!i&&z.hBgRed,"gs-utl-text-white"),f&&Z(z.bgA2,!i&&z.hBgAct),o&&z.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",ni.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:f,withBg:p,disabled:g,type:m="button",disabledClassName:v,...b}=t,w=f?{icon:p2,size:"18px",className:Z("animate-spin-fast")}:ct(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:Z(O1(t)),disabled:g||f,type:m,...b,children:w?c.jsxs(I,{className:Z("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(B,{children:c.jsx(ne,{...w})}),e&&c.jsx(B,{children:e})]}):e})}function Lo({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?Pe.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(I,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:N(Pe.coverAbs,z.bg,Pe.disabled)}),c.jsx("div",{className:l})]})}const Xt={accessToken:""},bT=()=>{Xt.timeout&&(clearTimeout(Xt.timeout),Xt.timeout=void 0),Xt.accessToken="",Xt.license=void 0},_1=async()=>{var t;let e={accessToken:""};try{const n=await((t=Xt.getAccessToken)==null?void 0:t.call(Xt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Xt.getAccessToken&&console.error("Failed to get access token");return}if(Xt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Xt.timeout||void 0),Xt.timeout=setTimeout(_1,n-Date.now()-1)}},A1=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},oa=e=>A1(e)==="email",yT=e=>{var o;const t=M1(e),n=oa(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},L1=(e,t={})=>{const{selectedComponents:n=[],withPageContent:r,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=A1(e),l=M1(e),u=yT(e),d=s?{id:s.getId(),name:s.getName(),content:r?TT(e):void 0}:void 0,f=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:f,selectedComponents:n.map(p=>({id:p.getId(),content:""})),projectType:i,availablePages:l,globalStyles:wT(e),installedPlugins:ST(e),devices:ET(e),isEmail:i==="email",imageUrls:o}},Td=(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},Jt=(e,t,n)=>{const r=Td(e,t,n);return e.runCommand(re.layoutComponentRender,{components:r})};function wT(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
|
|
16
|
+
`)}const M1=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),ST=e=>{const t=xT(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},CT=e=>e.getModel().get("customData")??{},xT=e=>e&&CT(e).plugins||[];function ET(e){return e.Devices.getAll().map(t=>t.toJSON())}function Gl(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const ql=(e="",t,n={})=>{!t||!e||(t.innerHTML=Gl(e),!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"})})))},N1=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Kl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Zl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function TT(e){const t=e.getWrapper(),n=N1(t);return`${oa(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const PT=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 p;const i=new DOMParser,l=Gl(a),u=i.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),f=e.getWrapper();return(p=f==null?void 0:f.getEl())==null||p.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}}},OT=(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 _T(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Gn="gs-cmp-ai-chat-tool-generate-image",AT=e=>{var x;const{editor:t,part:n,chatContext:r,isProcessing:o}=e,s=(E,T)=>t.t(`aiChat.message.tool.generateImage.${E}`,T),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),f=_T(n.output),p=oa(t),g=E=>{const T=t.getSelected(),_=p?"mj-image":"image",O={type:_,attributes:{src:E}};let P;if(T!=null&&T.is(_)){T.addAttributes({src:E});return}if(T&&t.Components.canMove(T,O))P=T.append(O)[0];else if(!T){const A=t.getWrapper(),M=p?A==null?void 0:A.findFirstType("mj-column"):A;P=M==null?void 0:M.append(O)[0]}P&&t.select(P,{scroll:!0})},m=E=>{t.Canvas.startDrag({content:{type:p?"mj-image":"image",attributes:{src:E}}})},v=()=>{t.Canvas.endDrag()},b=N(`${Gn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),w=N(`${Gn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=N(`${Gn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),S=N(`${Gn}__item-actions`,Pe.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(`${Gn}__status`,vn.xs,z.txtLowEmphasis),children:u}),c.jsx("div",{className:N(`${Gn}__placeholders`,b),children:Array.from({length:d}).map((E,T)=>c.jsx(I,{className:N(`${Gn}__placeholder`,w,z.bgH50,z.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Lo,{className:`${Gn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${T}`))})]}):f.length?C=c.jsx("div",{className:N(`${Gn}__output`,b),children:f.map((E,T)=>c.jsxs("div",{className:w,children:[c.jsx("img",{className:y,src:E,alt:s("imageAlt",{num:T+1}),draggable:!0,onDragStart:()=>m(E),onDragEnd:v}),c.jsx(I,{className:S,children:c.jsx(Ke,{full:!0,variant:"pr",className:N(`${Gn}__btn-use`),onClick:()=>g(E),children:s("useImage")})})]},E))}):l&&(C=c.jsx("div",{className:N(`${Gn}__status`,vn.xs,z.txtLowEmphasis),children:l})),c.jsx(I,{className:Gn,col:!0,gap:"xs",children:C})};function LT(e){return{type:"custom",component:()=>c.jsx(AT,{...e})}}var Cs=(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))(Cs||{}),io=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(io||{}),ri=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(ri||{}),pr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(pr||{});function MT(e){const t=oa(e),n=o=>e.t(`aiChat.message.tool.command.${o}`),r={[ri.SHOW_CODE]:{label:({isExecuted:o})=>n(o?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(re.dialogExportCode)},[ri.IMPORT_CODE]:{label:({isExecuted:o})=>n(o?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(re.dialogImportCode)},[ri.PREVIEW]:{label:({isExecuted:o})=>n(o?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(r[ri.PAGE_SETTINGS]={label:({isExecuted:o})=>n(o?"pageSettings.done":"pageSettings.pending"),execute:()=>{const o=e.Pages.getSelected();e.runCommand(re.setPageSettings,{page:o,isOpen:!0})}}),r}function $1(e,t={}){const{skipDefault:n,commands:r={}}=t,o=new Map(Object.entries(n?{}:MT(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 NT(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,f=e.Components.getById(l),p=e.Components.getById(u);return f?p?(p.append(f,{at:d}),e.select(f,{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:N1(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=>LT(i)},a=$1(e);return{[Cs.REMOVE_COMPONENT]:t,[Cs.MOVE_COMPONENT]:n,[Cs.GET_PAGE_CONTENT]:r,[Cs.LIST_PAGES]:o,[Cs.GENERATE_IMAGE]:s,[Cs.RUN_COMMAND]:a}}function $T(e,t){var w;const{componentId:n,position:r}=t,o=oa(e),s=e.getWrapper(),a=o?s.findFirstType("mj-body"):s;Kl(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 f=d==null?void 0:d.parent(),p=d==null?void 0:d.index(),g=d==null?void 0:d.getEl();let m="afterend",v;switch(r){case"before":f?(m="beforebegin",d=f,v=p):(m="afterbegin",v=0);break;case"beforeInside":m="afterbegin",v=0;break;case"afterInside":m="beforeend";break;case"after":f?(m="afterend",d=f,v=(p??0)+1):m="beforeend";break}return g?g==null||g.insertAdjacentElement(m,i):(w=f==null?void 0:f.getEl())==null||w.appendChild(i),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:i,updatePreview:y=>{let S=y;o&&(S=HT(e,d,y,v)),ql(S,i,{skipScroll:!0})},cleanUp(){i==null||i.remove(),Zl(e)}}}const Yl="mjml",kT="mj-head",Pd="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 IT(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 VT(e,t,n){var p,g;const r=e.closestType(Yl),o=((p=r==null?void 0:r.findFirstType(kT))==null?void 0:p.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!==Yl;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>k1(m)).join(""),f=l.map(m=>`</${m.tagName}>`).join("");return`<${Yl}>${o}${d}${k1(e)}${i}</${e.tagName}>${f}</${Yl}>`}function HT(e,t,n,r){var s;const o=Gl(n);if(!(o!=null&&o.trim()))return"";try{const a=IT(o,Pd),i=VT(t,a,r),l=(s=e.runCommand(I1,{mjml:i}))==null?void 0:s.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),f=Array.from(d.querySelectorAll(`.${Pd}`));return f.length?f.map(p=>(p.classList.remove(Pd),p.outerHTML)).join(""):""}catch{return""}}function jT(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 DT(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:io.ADD_COMPONENT_CODE,toolSetup:$T(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;jT(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function FT(e){Kl(e);const t=PT(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Zl(e)}}}function BT(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?OT(o,a):n==null||n.append(a)})}function zT(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:io.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),BT(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function UT(e,t){const{name:n}=t,{Pages:r,Components:o}=e;Kl(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&&ql(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
17
|
+
Generating ${n?`"${n}" `:""}page...
|
|
18
|
+
</h1>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){Zl(e)}}}function WT(e,t){const{cmpRoot:n}=e;n.components(t)}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"){if(i||(i={type:io.ADD_PAGE_CODE,toolSetup:UT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&ql(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;WT(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function qT(e){Kl(e);const t=e.getWrapper(),n=L1(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){Zl(e)}}}function KT(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}const I1="mjml-code-to-html";function ZT(e){var u;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:io.ADD_PROJECT_PAGE_CODE,toolSetup:qT(t),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const{isEmail:d,cmpRoot:f}=i.toolSetup,p=f.getEl();let g=o.content;if(d){const m=Gl(g);try{const v=(u=t.runCommand(I1,{mjml:m}))==null?void 0:u.html;v&&(g=v)}catch{}}p&&ql(g,p,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;KT(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const V1={[io.ADD_COMPONENT_CODE]:DT,[io.EDIT_COMPONENT_CODE]:zT,[io.ADD_PAGE_CODE]:GT,[io.ADD_PROJECT_PAGE_CODE]:ZT},YT=({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=V1[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 JT={NODE_ENV:"production"};class QT{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=NT(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,createCommandTool:a=>$1(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:f={},onMessagesUpdate:p,messages:g}=this.options,{onFinish:m,onData:v,...b}=f,w=typeof g=="function",y=[],S=new rn.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:sr.lastAssistantMessageIsCompleteWithToolCalls,transport:new sr.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:O,messages:P,body:A,id:M,trigger:$,credentials:j}){var U;const L={...A,id:M,trigger:$,messages:P.slice(-10),projectContext:L1(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},D=typeof u=="function"?u({editor:n,body:L,messages:P}):u,{accessToken:W,license:F}=Xt,k=JT.NODE_ENV!=="production",H=`${Bu({isDev:k,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!F||["enterprise","business"].includes(((U=F==null?void 0:F.plan)==null?void 0:U.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:H,headers:{...O,...W?{Authorization:`Bearer ${W}`}:{}},credentials:j,body:{...L,...D}}}}),onToolCall:async({toolCall:O})=>{l==null||l({toolCall:O});const P=!!V1[O.toolName];if(O.dynamic||P)return;const{toolName:A,input:M,toolCallId:$}=O,j=a[A];if(j&&j.execute){const L=new AbortController;o.add(L);try{const{messages:D}=S,W=await Promise.race([j.execute(M||{},{editor:n,messages:D,lastUserMessage:D.findLast(F=>F.role==="user"),toolCallId:$,abortController:L}),new Promise((F,k)=>{L.signal.addEventListener("abort",()=>k(new Error("Aborted")))})]);if(W&&typeof W.error=="string")throw new Error(W.error);S.addToolOutput({tool:A,toolCallId:$,output:W})}catch(D){S.addToolOutput({tool:A,toolCallId:$,state:"output-error",errorText:D instanceof Error?D.message:"Unknown error"})}finally{o.delete(L)}}},onData(O){v==null||v(O),YT({editor:n,data:O,toolStatusProgress:r,tools:a,chatApi:x})},onFinish(O){p==null||p({messages:O.messages,editor:n}),O.isAbort&&(r.forEach(P=>{"toolSetup"in P&&P.toolSetup.cleanUp()}),r.clear()),m==null||m(O)},...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:(...O)=>E.isMessagesLoaded?S.sendMessage(...O):(y.push(O),Promise.resolve()),setMessages:O=>{S.messages=O},clearError:()=>S.clearError(),stop:()=>S.stop(),setError:O=>{const P=O instanceof Error?O:new Error(String(O));S.setStatus({status:"error",error:P})}},E={chat:S,chatApi:x,isMessagesLoaded:!w,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:O=>(C.add(O),()=>{C.delete(O)}),emitUpdate:()=>{C.forEach(O=>O())}},T=async()=>{if(!E.isMessagesLoaded||y.length===0)return;const O=y.splice(0);for(const P of O)await S.sendMessage(...P)};this.chatStates.set(S.id,E);const _=()=>{S["~registerMessagesCallback"](()=>{S.status==="ready"&&(p==null||p({messages:S.messages,editor:n}))})};return w?g({editor:n}).then(O=>{S.messages=O,_()}).catch(O=>x.setError(O)).finally(()=>{E.isMessagesLoaded=!0,T().catch(O=>x.setError(O)),E.emitUpdate()}):_(),E}}const RT=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],e5=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],sa="gs-cmp-ai-chat-empty",t5=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=N(sa,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=oa(r)?e5:RT,f=o??d;return c.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(I,{className:`${sa}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${sa}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${sa}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx(I,{col:!0,className:`${sa}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:f.map(p=>{const g=r.t(`${a}.suggestions.${p.id}`)||p.label,m=p.prompt??g;return c.jsx(Ke,{className:`${sa}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},p.id)})})]})},oi="gs-cmp-ai-chat-error",n5=({className:e,style:t,chatContext:n,editor:r})=>{var i;const o=N(oi,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${oi}__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(I,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(I,{className:`${oi}__header`,items:"center",gap:"xs",children:[c.jsx(B,{className:`${oi}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),c.jsx(Ke,{className:`${oi}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(B,{className:s,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},Od="gs-cmp-ai-chat-header",r5=({className:e,chatContext:t,title:n,editor:r,layoutBefore:o,layoutAfter:s,clearButtonProps:a,onClear:i,...l})=>{const[u,d]=h.useState(!1),{messages:f,setMessages:p,status:g}=t,m=N(Od,e,te.bb,z.br,Te.s),v=g==="streaming"||g==="submitted",b="aiChat.header",w=r.runCommand(pr.getChatApi),y={isClearing:u,setIsClearing:d},S=()=>{d(!0),p([])},{className:C,children:x,...E}=a||{},T={chatApi:w,messages:f,state:y},_=o==null?void 0:o(T),O=s==null?void 0:s(T),P=async A=>{if(!u)try{i?await i({...T,clear:S,event:A}):S()}catch(M){t.setError(M instanceof Error?M:new Error(String(M)))}finally{d(!1)}};return c.jsxs(I,{className:m,items:"center",gap:"s",...l,children:[_&&Jt(r,_),c.jsx(B,{className:`${Od}__title`,grow:!0,children:n??r.t(`${b}.title`)}),f.length>0&&c.jsx(Ke,{className:N(`${Od}__btn-clear`,C,Pe.hover,te.none),onClick:P,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...E,children:x??r.t(`${b}.clear`)}),O&&Jt(r,O)]})};function aa(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 p;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(p=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()-p)*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`,`
|
|
84
19
|
font-size: .6rem;
|
|
85
20
|
font-weight: bold;
|
|
86
|
-
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 yd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const OP=(e,t)=>Math.abs(e-t)<1,AP=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var ea={};const NP=e=>e,MP=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},LP=(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)}},A1={passive:!0},$P=typeof window>"u"?!0:"onscrollend"in window,kP=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=$P?()=>{}:AP(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:f}=e.options;o=d?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,A1),n.addEventListener("scrollend",l,A1),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},VP=(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"])},IP=(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 jP{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:NP,rangeExtractor:MP,onChange:()=>{},measureElement:VP,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=Rs(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:ea.NODE_ENV!=="production"&&"maybeNotify",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=Rs(()=>[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=Rs(()=>[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 f=s(d),p=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=p?p.end+this.options.gap:r+o,m=i.get(f),b=typeof m=="number"?m:this.options.estimateSize(d),v=g+b,w=p?p.lane:d%this.options.lanes;u[d]={index:d,start:g,size:b,end:v,key:f,lane:w}}return this.measurementsCache=u,u},{key:ea.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Rs(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?DP({measurements:n,outerSize:r,scrollOffset:o}):null,{key:ea.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=Rs(()=>[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:ea.NODE_ENV!=="production"&&"getIndexes",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)&&(ea.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),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=Rs(()=>[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:ea.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return yd(r[N1(0,r.length-1,o=>yd(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]=yd(this.getOffsetForIndex(n,i));OP(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 N1=(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 DP({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=N1(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 HP=typeof document<"u"?Xe.useLayoutEffect:Xe.useEffect;function FP(e){const t=Xe.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?$n.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=Xe.useState(()=>new jP(n));return r.setOptions(n),Xe.useEffect(()=>r._didMount(),[]),HP(()=>r._willUpdate()),r}function BP(e){return FP({observeElementRect:LP,observeElementOffset:kP,scrollToFn:IP,...e})}var zP=Object.defineProperty,UP=(e,t,n)=>t in e?zP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wd=(e,t,n)=>(UP(e,typeof t!="symbol"?t+"":t,n),n);let WP=class{constructor(){wd(this,"current",this.detect()),wd(this,"handoffState","pending"),wd(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"}},eo=new WP,Ue=(e,t)=>{eo.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function $t(e){let t=h.useRef(e);return Ue(()=>{t.current=e},[e]),t}function Xa(e,t){let[n,r]=h.useState(e),o=$t(e);return Ue(()=>r(o.current),[o,r,...t]),n}let ie=function(e){let t=$t(e);return h.useCallback((...n)=>t.current(...n),[t])};function Il(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,ie(u=>(s||o(u),t==null?void 0:t(u)))]}function Sd(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Er(){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 Sd(()=>{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=Er();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 lr(){let[e]=h.useState(Er);return h.useEffect(()=>()=>e.dispose(),[e]),e}function GP(){let e=typeof document>"u";return"useSyncExternalStore"in Xe?(t=>t.useSyncExternalStore)(Xe)(()=>()=>{},()=>!1,()=>!e):!1}function jl(){let e=GP(),[t,n]=Xe.useState(eo.isHandoffComplete);return t&&eo.isHandoffComplete===!1&&n(!1),Xe.useEffect(()=>{t!==!0&&n(!0)},[t]),Xe.useEffect(()=>eo.handoff(),[]),e?!1:t}var M1;let yt=(M1=h.useId)!=null?M1:function(){let e=jl(),[t,n]=h.useState(e?()=>eo.nextId():null);return Ue(()=>{t===null&&n(eo.nextId())},[t]),t!=null?""+t:void 0};function Le(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,Le),r}function xo(e){return eo.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Cd=["[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 St=(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))(St||{}),Pr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Pr||{}),qP=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(qP||{});function Dl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Cd)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Hl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Hl||{});function xd(e,t=0){var n;return e===((n=xo(e))==null?void 0:n.body)?!1:Le(t,{0(){return e.matches(Cd)},1(){let r=e;for(;r!==null;){if(r.matches(Cd))return!0;r=r.parentElement}return!1}})}var KP=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(KP||{});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 YP=["textarea","input"].join(",");function ZP(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,YP))!=null?n:!1}function to(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 tn(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?to(e):e:Dl(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,f=a.length,p;do{if(d>=f||d+f<=0)return 0;let g=l+d;if(t&16)g=(g+f)%f;else{if(g<0)return 3;if(g>=f)return 1}p=a[g],p==null||p.focus(u),d+=i}while(p!==s.activeElement);return t&6&&ZP(p)&&p.select(),2}function XP(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function JP(){return/Android/gi.test(window.navigator.userAgent)}function L1(){return XP()||JP()}function Fl(e,t,n){let r=$t(t);h.useEffect(()=>{function o(s){r.current(s)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function $1(e,t,n){let r=$t(t);h.useEffect(()=>{function o(s){r.current(s)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function Ed(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(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let d of u){if(d===null)continue;let f=d instanceof HTMLElement?d:d.current;if(f!=null&&f.contains(l)||a.composed&&a.composedPath().includes(f))return}return!xd(l,Hl.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=h.useRef(null);Fl("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),Fl("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),Fl("click",a=>{L1()||s.current&&(o(a,()=>s.current),s.current=null)},!0),Fl("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),$1("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function gs(...e){return h.useMemo(()=>xo(...e),[...e])}function k1(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 ta(e,t){let[n,r]=h.useState(()=>k1(e));return Ue(()=>{r(k1(e))},[e.type,e.as]),Ue(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let V1=Symbol();function Pd(e,t=!0){return Object.assign(e,{[V1]:t})}function We(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=ie(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[V1]))?void 0:n}function I1(e){return[e.screenX,e.screenY]}function j1(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=I1(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=I1(t)}}}function D1({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]),Ue(()=>{if(!e||!r)return;let a=xo(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(f=>i(f),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function H1(e,t){let n=h.useRef([]),r=ie(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 Bl(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var un=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(un||{}),Eo=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Eo||{});function De({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??QP;let l=F1(t,e);if(s)return zl(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...f}=l;if(d)return zl(f,n,r,a,i)}if(u&1){let{unmount:d=!0,...f}=l;return Le(d?0:1,{0(){return null},1(){return zl({...f,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return zl(l,n,r,a,i)}function zl(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Td(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 f={};if(t){let p=!1,g=[];for(let[m,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&g.push(m);p&&(f["data-headlessui-state"]=g.join(" "))}if(s===h.Fragment&&Object.keys(na(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(b=>` - ${b}`).join(`
|
|
87
|
-
`),"","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(
|
|
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 _d(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const o5=(e,t)=>Math.abs(e-t)<1,s5=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var si={NODE_ENV:"production"};const a5=e=>e,i5=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},l5=(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)}},H1={passive:!0},c5=typeof window>"u"?!0:"onscrollend"in window,u5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=c5?()=>{}:s5(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:f}=e.options;o=d?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,H1),n.addEventListener("scrollend",l,H1),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},d5=(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"])},f5=(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 p5{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:a5,rangeExtractor:i5,onChange:()=>{},measureElement:d5,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=aa(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:si.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=aa(()=>[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=aa(()=>[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 f=s(d),p=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=p?p.end+this.options.gap:r+o,m=i.get(f),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,w=p?p.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:f,lane:w}}return this.measurementsCache=u,u},{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=aa(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?h5({measurements:n,outerSize:r,scrollOffset:o}):null,{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=aa(()=>[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:si.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=aa(()=>[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:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return _d(r[j1(0,r.length-1,o=>_d(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]=_d(this.getOffsetForIndex(n,i));o5(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 j1=(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 h5({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=j1(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 g5=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function m5(e){const t=nt.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?Fn.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=nt.useState(()=>new p5(n));return r.setOptions(n),nt.useEffect(()=>r._didMount(),[]),g5(()=>r._willUpdate()),r}function v5(e){return m5({observeElementRect:l5,observeElementOffset:u5,scrollToFn:f5,...e})}var b5=Object.defineProperty,y5=(e,t,n)=>t in e?b5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ad=(e,t,n)=>(y5(e,typeof t!="symbol"?t+"":t,n),n);let w5=class{constructor(){Ad(this,"current",this.detect()),Ad(this,"handoffState","pending"),Ad(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"}},lo=new w5,Ze=(e,t)=>{lo.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 ai(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 Xl(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 Ld(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Lr(){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 Ld(()=>{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=Lr();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 hr(){let[e]=h.useState(Lr);return h.useEffect(()=>()=>e.dispose(),[e]),e}function S5(){let e=typeof document>"u";return"useSyncExternalStore"in nt?(t=>t.useSyncExternalStore)(nt)(()=>()=>{},()=>!1,()=>!e):!1}function Jl(){let e=S5(),[t,n]=nt.useState(lo.isHandoffComplete);return t&&lo.isHandoffComplete===!1&&n(!1),nt.useEffect(()=>{t!==!0&&n(!0)},[t]),nt.useEffect(()=>lo.handoff(),[]),e?!1:t}var D1;let Et=(D1=h.useId)!=null?D1:function(){let e=Jl(),[t,n]=h.useState(e?()=>lo.nextId():null);return Ze(()=>{t===null&&n(lo.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 Mo(e){return lo.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Md=["[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||{}),Mr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Mr||{}),C5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(C5||{});function Ql(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Md)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Rl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Rl||{});function Nd(e,t=0){var n;return e===((n=Mo(e))==null?void 0:n.body)?!1:ke(t,{0(){return e.matches(Md)},1(){let r=e;for(;r!==null;){if(r.matches(Md))return!0;r=r.parentElement}return!1}})}var x5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(x5||{});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 E5=["textarea","input"].join(",");function T5(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,E5))!=null?n:!1}function co(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 an(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?co(e):e:Ql(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,f=a.length,p;do{if(d>=f||d+f<=0)return 0;let g=l+d;if(t&16)g=(g+f)%f;else{if(g<0)return 3;if(g>=f)return 1}p=a[g],p==null||p.focus(u),d+=i}while(p!==s.activeElement);return t&6&&T5(p)&&p.select(),2}function P5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function O5(){return/Android/gi.test(window.navigator.userAgent)}function F1(){return P5()||O5()}function ec(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 B1(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 $d(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(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let d of u){if(d===null)continue;let f=d instanceof HTMLElement?d:d.current;if(f!=null&&f.contains(l)||a.composed&&a.composedPath().includes(f))return}return!Nd(l,Rl.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=h.useRef(null);ec("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),ec("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),ec("click",a=>{F1()||s.current&&(o(a,()=>s.current),s.current=null)},!0),ec("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),B1("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function xs(...e){return h.useMemo(()=>Mo(...e),[...e])}function z1(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 ia(e,t){let[n,r]=h.useState(()=>z1(e));return Ze(()=>{r(z1(e))},[e.type,e.as]),Ze(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let U1=Symbol();function kd(e,t=!0){return Object.assign(e,{[U1]: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[U1]))?void 0:n}function W1(e){return[e.screenX,e.screenY]}function G1(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=W1(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=W1(t)}}}function q1({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=Mo(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(f=>i(f),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function K1(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 tc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var bn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(bn||{}),No=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(No||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??_5;let l=Z1(t,e);if(s)return nc(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...f}=l;if(d)return nc(f,n,r,a,i)}if(u&1){let{unmount:d=!0,...f}=l;return ke(d?0:1,{0(){return null},1(){return nc({...f,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return nc(l,n,r,a,i)}function nc(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Vd(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 f={};if(t){let p=!1,g=[];for(let[m,v]of Object.entries(t))typeof v=="boolean"&&(p=!0),v===!0&&g.push(m);p&&(f["data-headlessui-state"]=g.join(" "))}if(s===h.Fragment&&Object.keys(la(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(`
|
|
88
23
|
`)].join(`
|
|
89
|
-
`));let p=d.props,g=typeof(p==null?void 0:p.className)=="function"?(...b)=>Bl(p==null?void 0:p.className(...b),l.className):Bl(p==null?void 0:p.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},F1(d.props,na(Td(l,["ref"]))),f,u,{ref:o(d.ref,u.ref)},m))}return h.createElement(s,Object.assign({},Td(l,["ref"]),s!==h.Fragment&&u,s!==h.Fragment&&f),d)}function _d(){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 QP(...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 F1(...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 He(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function na(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Td(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let RP="div";var cr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(cr||{});function e_(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 De({ourProps:s,theirProps:o,slot:{},defaultTag:RP,name:"Hidden"})}let ur=He(e_),Od=h.createContext(null);Od.displayName="OpenClosedContext";var at=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(at||{});function ms(){return h.useContext(Od)}function Ja({value:e,children:t}){return h.createElement(Od.Provider,{value:e},t)}function t_(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let bs=[];t_(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&bs[0]!==t.target&&(bs.unshift(t.target),bs=bs.filter(n=>n!=null&&n.isConnected),bs.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 Po(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&&n_(n)?!1:r}function n_(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function r_(e){throw new Error("Unexpected object: "+e)}var Ke=(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))(Ke||{});function Ad(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:r_(e)}}function Ul(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))z1(n,B1(t,r),o);return n}function B1(e,t){return e?e+"["+t+"]":t}function z1(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())z1(e,B1(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,""]):Ul(n,t,e)}function U1(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 be=(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))(be||{}),o_={},s_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(s_||{}),a_=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(a_||{}),i_=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(i_||{}),l_=(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))(l_||{});function Nd(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):to(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let c_={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===Ke.Specific?t.idx:Ad(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let i=Nd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===Ke.Specific?t.idx:Ad(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=Nd(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=Nd(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})}}},Md=h.createContext(null);Md.displayName="ComboboxActionsContext";function Qa(e){let t=h.useContext(Md);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qa),n}return t}let W1=h.createContext(null);function u_(e){var t;let n=vs("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=BP({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 Ue(()=>{i(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(W1.Provider,{value:s},h.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&o_.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 Ld=h.createContext(null);Ld.displayName="ComboboxDataContext";function vs(e){let t=h.useContext(Ld);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,vs),n}return t}function d_(e,t){return Le(t.type,c_,e,t)}let f_=h.Fragment;function p_(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:f=!1,immediate:p=!1,virtual:g=null,...m}=e,b=!1,v=null,[w=f?[]:void 0,y]=Il(n,o,r),[S,C]=h.useReducer(d_,{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),T=h.useRef(null),O=h.useRef(null),_=h.useRef(null),N=ie(typeof i=="string"?(R,re)=>{let fe=i;return(R==null?void 0:R[fe])===(re==null?void 0:re[fe])}:i??((R,re)=>R===re)),L=ie(R=>S.options.findIndex(re=>N(re.dataRef.current.value,R))),k=h.useCallback(R=>Le($.mode,{1:()=>w.some(re=>N(re,R)),0:()=>N(w,R)}),[w]),B=ie(R=>S.activeOptionIndex===L(R)),$=h.useMemo(()=>({...S,immediate:b,optionsPropsRef:E,labelRef:P,inputRef:T,buttonRef:O,optionsRef:_,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let R=S.options.findIndex(re=>!re.dataRef.current.disabled);if(R!==-1)return R}return S.activeOptionIndex},calculateIndex:L,compare:N,isSelected:k,isActive:B,nullable:d,__demoMode:u}),[w,r,l,f,d,u,S,v]);Ue(()=>{},[v,void 0]),Ue(()=>{S.dataRef.current=$},[$]),Ed([$.buttonRef,$.inputRef,$.optionsRef],()=>Y.closeCombobox(),$.comboboxState===0);let z=h.useMemo(()=>{var R,re,fe;return{open:$.comboboxState===0,disabled:l,activeIndex:$.activeOptionIndex,activeOption:$.activeOptionIndex===null?null:$.virtual?$.virtual.options[(R=$.activeOptionIndex)!=null?R:0]:(fe=(re=$.options[$.activeOptionIndex])==null?void 0:re.dataRef.current.value)!=null?fe:null,value:w}},[$,l,w]),K=ie(()=>{if($.activeOptionIndex!==null){if($.virtual)q($.virtual.options[$.activeOptionIndex]);else{let{dataRef:R}=$.options[$.activeOptionIndex];q(R.current.value)}Y.goToOption(Ke.Specific,$.activeOptionIndex)}}),F=ie(()=>{C({type:0}),x.current=!0}),V=ie(()=>{C({type:1}),x.current=!1}),D=ie((R,re,fe)=>(x.current=!1,R===Ke.Specific?C({type:2,focus:Ke.Specific,idx:re,trigger:fe}):C({type:2,focus:R,trigger:fe}))),A=ie((R,re)=>(C({type:3,payload:{id:R,dataRef:re}}),()=>{$.isActive(re.current.value)&&(x.current=!0),C({type:4,id:R})})),j=ie(R=>(C({type:5,id:R}),()=>C({type:5,id:null}))),q=ie(R=>Le($.mode,{0(){return y==null?void 0:y(R)},1(){let re=$.value.slice(),fe=re.findIndex(xe=>N(xe,R));return fe===-1?re.push(R):re.splice(fe,1),y==null?void 0:y(re)}})),G=ie(R=>{C({type:6,trigger:R})}),Y=h.useMemo(()=>({onChange:q,registerOption:A,registerLabel:j,goToOption:D,closeCombobox:V,openCombobox:F,setActivationTrigger:G,selectActiveOption:K}),[]),Q=t===null?{}:{ref:t},Z=h.useRef(null),W=lr();return h.useEffect(()=>{Z.current&&r!==void 0&&W.addEventListener(Z.current,"reset",()=>{y==null||y(r)})},[Z,y]),h.createElement(Md.Provider,{value:Y},h.createElement(Ld.Provider,{value:$},h.createElement(Ja,{value:Le($.comboboxState,{0:at.Open,1:at.Closed})},a!=null&&w!=null&&Ul({[a]:w}).map(([R,re],fe)=>h.createElement(ur,{features:cr.Hidden,ref:fe===0?xe=>{var ne;Z.current=(ne=xe==null?void 0:xe.closest("form"))!=null?ne:null}:void 0,...na({key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:R,value:re})})),De({ourProps:Q,theirProps:m,slot:z,defaultTag:f_,name:"Combobox"}))))}let h_="input";function g_(e,t){var n,r,o,s,a;let i=yt(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:f="text",...p}=e,g=vs("Combobox.Input"),m=Qa("Combobox.Input"),b=We(g.inputRef,t),v=gs(g.inputRef),w=h.useRef(!1),y=lr(),S=ie(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Ke.Nothing)}),C=function(){var $;return typeof d=="function"&&g.value!==void 0?($=d(g.value))!=null?$:"":typeof g.value=="string"?g.value:""}();H1(([$,z],[K,F])=>{if(w.current)return;let V=g.inputRef.current;V&&((F===0&&z===1||$!==K)&&(V.value=$),requestAnimationFrame(()=>{if(w.current||!V||(v==null?void 0:v.activeElement)!==V)return;let{selectionStart:D,selectionEnd:A}=V;Math.abs((A??0)-(D??0))===0&&D===0&&V.setSelectionRange(V.value.length,V.value.length)}))},[C,g.comboboxState,v]),H1(([$],[z])=>{if($===0&&z===1){if(w.current)return;let K=g.inputRef.current;if(!K)return;let F=K.value,{selectionStart:V,selectionEnd:D,selectionDirection:A}=K;K.value="",K.value=F,A!==null?K.setSelectionRange(V,D,A):K.setSelectionRange(V,D)}},[g.comboboxState]);let x=h.useRef(!1),E=ie(()=>{x.current=!0}),P=ie(()=>{y.nextFrame(()=>{x.current=!1})}),T=ie($=>{switch(w.current=!0,$.key){case be.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if($.preventDefault(),$.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case be.ArrowDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),Le(g.comboboxState,{0:()=>m.goToOption(Ke.Next),1:()=>m.openCombobox()});case be.ArrowUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),Le(g.comboboxState,{0:()=>m.goToOption(Ke.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Ke.Last)})}});case be.Home:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),m.goToOption(Ke.First);case be.PageUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),m.goToOption(Ke.First);case be.End:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),m.goToOption(Ke.Last);case be.PageDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),m.goToOption(Ke.Last);case be.Escape:return w.current=!1,g.comboboxState!==0?void 0:($.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&$.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&S(),m.closeCombobox());case be.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),O=ie($=>{u==null||u($),g.nullable&&g.mode===0&&$.target.value===""&&S(),m.openCombobox()}),_=ie($=>{var z,K,F;let V=(z=$.relatedTarget)!=null?z:bs.find(D=>D!==$.currentTarget);if(w.current=!1,!((K=g.optionsRef.current)!=null&&K.contains(V))&&!((F=g.buttonRef.current)!=null&&F.contains(V))&&g.comboboxState===0)return $.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),N=ie($=>{var z,K,F;let V=(z=$.relatedTarget)!=null?z:bs.find(D=>D!==$.currentTarget);(K=g.buttonRef.current)!=null&&K.contains(V)||(F=g.optionsRef.current)!=null&&F.contains(V)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),L=Xa(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),k=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),B={ref:b,id:l,role:"combobox",type:f,"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($=>{var z;return!((z=g.virtual)!=null&&z.disabled($.dataRef.current.value))&&g.compare($.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":L,"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:T,onChange:O,onFocus:N,onBlur:_};return De({ourProps:B,theirProps:p,slot:k,defaultTag:h_,name:"Combobox.Input"})}let m_="button";function b_(e,t){var n;let r=vs("Combobox.Button"),o=Qa("Combobox.Button"),s=We(r.buttonRef,t),a=yt(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=lr(),d=ie(b=>{switch(b.key){case be.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 be.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),u.nextFrame(()=>{r.value||o.goToOption(Ke.Last)})),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case be.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}}),f=ie(b=>{if(Po(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})})}),p=Xa(()=>{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:ta(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":p,disabled:r.disabled,onClick:f,onKeyDown:d};return De({ourProps:m,theirProps:l,slot:g,defaultTag:m_,name:"Combobox.Button"})}let v_="label";function y_(e,t){let n=yt(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=vs("Combobox.Label"),a=Qa("Combobox.Label"),i=We(s.labelRef,t);Ue(()=>a.registerLabel(r),[r]);let l=ie(()=>{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 De({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:v_,name:"Combobox.Label"})}let w_="ul",S_=un.RenderStrategy|un.Static;function C_(e,t){let n=yt(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=vs("Combobox.Options"),i=We(a.optionsRef,t),l=ms(),u=l!==null?(l&at.Open)===at.Open:a.comboboxState===0;Ue(()=>{var g;a.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[a.optionsPropsRef,e.static]),Ue(()=>{a.optionsPropsRef.current.hold=o},[a.optionsPropsRef,o]),D1({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=Xa(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),f=h.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),p={"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(u_,null,s.children)}),De({ourProps:p,theirProps:s,slot:f,defaultTag:w_,features:S_,visible:u,name:"Combobox.Options"})}let x_="li";function E_(e,t){var n;let r=yt(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=vs("Combobox.Option"),d=Qa("Combobox.Option"),f=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,p=u.isSelected(a),g=h.useRef(null),m=$t({disabled:s,value:a,domRef:g,order:i}),b=h.useContext(W1),v=We(t,g,b?b.measureElement:null),w=ie(()=>d.onChange(a));Ue(()=>d.registerOption(o,m),[m,o]);let y=h.useRef(!(u.virtual||u.__demoMode));Ue(()=>{if(!u.virtual||!u.__demoMode)return;let _=Er();return _.requestAnimationFrame(()=>{y.current=!0}),_.dispose},[u.virtual,u.__demoMode]),Ue(()=>{if(!y.current||u.comboboxState!==0||!f||u.activationTrigger===0)return;let _=Er();return _.requestAnimationFrame(()=>{var N,L;(L=(N=g.current)==null?void 0:N.scrollIntoView)==null||L.call(N,{block:"nearest"})}),_.dispose},[g,f,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=ie(_=>{var N;if(s||(N=u.virtual)!=null&&N.disabled(a))return _.preventDefault();w(),L1()||requestAnimationFrame(()=>{var L;return(L=u.inputRef.current)==null?void 0:L.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=ie(()=>{var _;if(s||(_=u.virtual)!=null&&_.disabled(a))return d.goToOption(Ke.Nothing);let N=u.calculateIndex(a);d.goToOption(Ke.Specific,N)}),x=j1(),E=ie(_=>x.update(_)),P=ie(_=>{var N;if(!x.wasMoved(_)||s||(N=u.virtual)!=null&&N.disabled(a)||f)return;let L=u.calculateIndex(a);d.goToOption(Ke.Specific,L,0)}),T=ie(_=>{var N;x.wasMoved(_)&&(s||(N=u.virtual)!=null&&N.disabled(a)||f&&(u.optionsPropsRef.current.hold||d.goToOption(Ke.Nothing)))}),O=h.useMemo(()=>({active:f,selected:p,disabled:s}),[f,p,s]);return De({ourProps:{id:o,ref:v,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:P,onMouseMove:P,onPointerLeave:T,onMouseLeave:T},theirProps:l,slot:O,defaultTag:x_,name:"Combobox.Option"})}let P_=He(p_),__=He(b_),T_=He(g_),O_=He(y_),A_=He(C_),N_=He(E_),ra=Object.assign(P_,{Input:T_,Button:__,Label:O_,Options:A_,Option:N_});function M_(e,t,n,r){let o=$t(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 Wl(){let e=h.useRef(!1);return Ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function L_(e){let t=ie(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Sd(()=>{n.current&&t()})}),[t])}var no=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(no||{});function G1(){let e=h.useRef(0);return $1("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let $_=h.createContext(!1);function k_(){return h.useContext($_)}function V_(e){let t=k_(),n=h.useContext(q1),r=gs(e),[o,s]=h.useState(()=>{if(!t&&n!==null||eo.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 I_=h.Fragment;function j_(e,t){let n=e,r=h.useRef(null),o=We(Pd(d=>{r.current=d}),t),s=gs(r),a=V_(r),[i]=h.useState(()=>{var d;return eo.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=h.useContext($d),u=jl();return Ue(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Ue(()=>{if(i&&l)return l.register(i)},[l,i]),L_(()=>{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:$n.createPortal(De({ourProps:{ref:o},theirProps:n,defaultTag:I_,name:"Portal"}),i):null}let D_=h.Fragment,q1=h.createContext(null);function H_(e,t){let{target:n,...r}=e,o={ref:We(t)};return h.createElement(q1.Provider,{value:n},De({ourProps:o,theirProps:r,defaultTag:D_,name:"Popover.Group"}))}let $d=h.createContext(null);function F_(){let e=h.useContext($d),t=h.useRef([]),n=ie(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=ie(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($d.Provider,{value:o},s)},[o])]}let B_=He(j_),z_=He(H_);Object.assign(B_,{Group:z_});function U_({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=h.useRef((r=n==null?void 0:n.current)!=null?r:null),s=gs(o),a=ie(()=>{var i,l,u;let d=[];for(let f of e)f!==null&&(f instanceof HTMLElement?d.push(f):"current"in f&&f.current instanceof HTMLElement&&d.push(f.current));if(t!=null&&t.current)for(let f of t.current)d.push(f);for(let f of(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])f!==document.body&&f!==document.head&&f instanceof HTMLElement&&f.id!=="headlessui-portal-root"&&(f.contains(o.current)||f.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(p=>f.contains(p))||d.push(f));return d});return{resolveContainers:a,contains:ie(i=>a().some(l=>l.contains(i))),mainTreeNodeRef:o,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(ur,{features:cr.Hidden,ref:o})},[o,n])}}function W_(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(ur,{features:cr.Hidden,ref:e})},[e])}}let K1=h.createContext(null);function Y1(){let e=h.useContext(K1);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,Y1),t}return e}function kd(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=ie(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(K1.Provider,{value:o},n.children)},[t])]}let G_="p";function q_(e,t){let n=yt(),{id:r=`headlessui-description-${n}`,...o}=e,s=Y1(),a=We(t);Ue(()=>s.register(r),[r,s.register]);let i={ref:a,...s.props,id:r};return De({ourProps:i,theirProps:o,slot:s.slot||{},defaultTag:G_,name:s.name||"Description"})}let K_=He(q_),Z1=Object.assign(K_,{});var X1;let Y_=(X1=h.startTransition)!=null?X1:function(e){e()};var Z_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Z_||{}),X_=(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))(X_||{});let J_={0:e=>({...e,disclosureState:Le(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}}},Vd=h.createContext(null);Vd.displayName="DisclosureContext";function Id(e){let t=h.useContext(Vd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Id),n}return t}let jd=h.createContext(null);jd.displayName="DisclosureAPIContext";function J1(e){let t=h.useContext(jd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,J1),n}return t}let Dd=h.createContext(null);Dd.displayName="DisclosurePanelContext";function Q_(){return h.useContext(Dd)}function R_(e,t){return Le(t.type,J_,e,t)}let eT=h.Fragment;function tT(e,t){let{defaultOpen:n=!1,...r}=e,o=h.useRef(null),s=We(t,Pd(v=>{o.current=v},e.as===void 0||e.as===h.Fragment)),a=h.useRef(null),i=h.useRef(null),l=h.useReducer(R_,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},f]=l,p=ie(v=>{f({type:1});let w=xo(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()}),g=h.useMemo(()=>({close:p}),[p]),m=h.useMemo(()=>({open:u===0,close:p}),[u,p]),b={ref:s};return h.createElement(Vd.Provider,{value:l},h.createElement(jd.Provider,{value:g},h.createElement(Ja,{value:Le(u,{0:at.Open,1:at.Closed})},De({ourProps:b,theirProps:r,slot:m,defaultTag:eT,name:"Disclosure"}))))}let nT="button";function rT(e,t){let n=yt(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=Id("Disclosure.Button"),i=Q_(),l=i===null?!1:i===s.panelId,u=h.useRef(null),d=We(u,t,l?null:s.buttonRef),f=_d();h.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let p=ie(y=>{var S;if(l){if(s.disclosureState===1)return;switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=s.buttonRef.current)==null||S.focus();break}}else switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),g=ie(y=>{switch(y.key){case be.Space:y.preventDefault();break}}),m=ie(y=>{var S;Po(y.currentTarget)||e.disabled||(l?(a({type:0}),(S=s.buttonRef.current)==null||S.focus()):a({type:0}))}),b=h.useMemo(()=>({open:s.disclosureState===0}),[s]),v=ta(e,u),w=l?{ref:d,type:v,onKeyDown:p,onClick:m}:{ref:d,id:r,type:v,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:p,onKeyUp:g,onClick:m};return De({mergeRefs:f,ourProps:w,theirProps:o,slot:b,defaultTag:nT,name:"Disclosure.Button"})}let oT="div",sT=un.RenderStrategy|un.Static;function aT(e,t){let n=yt(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=Id("Disclosure.Panel"),{close:i}=J1("Disclosure.Panel"),l=_d(),u=We(t,s.panelRef,m=>{Y_(()=>a({type:m?4:5}))});h.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=ms(),f=d!==null?(d&at.Open)===at.Open:s.disclosureState===0,p=h.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),g={ref:u,id:r};return h.createElement(Dd.Provider,{value:s.panelId},De({mergeRefs:l,ourProps:g,theirProps:o,slot:p,defaultTag:oT,features:sT,visible:f,name:"Disclosure.Panel"}))}let iT=He(tT),lT=He(rT),cT=He(aT),Hd=Object.assign(iT,{Button:lT,Panel:cT}),Q1=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function R1(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 Q1.test(a)&&(a=a.replace(Q1,"")),a}function uT(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():R1(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return R1(e).trim()}function dT(e){let t=h.useRef(""),n=h.useRef("");return ie(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=uT(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var fT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fT||{}),pT=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(pT||{}),hT=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(hT||{}),gT=(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))(gT||{});function Fd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=to(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 mT={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=Fd(e),o=Ad(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=Fd(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=Fd(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})},Bd=h.createContext(null);Bd.displayName="ListboxActionsContext";function Ra(e){let t=h.useContext(Bd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ra),n}return t}let zd=h.createContext(null);zd.displayName="ListboxDataContext";function ei(e){let t=h.useContext(zd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ei),n}return t}function bT(e,t){return Le(t.type,mT,e,t)}let vT=h.Fragment;function yT(e,t){let{value:n,defaultValue:r,form:o,name:s,onChange:a,by:i=(G,Y)=>G===Y,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...f}=e;const p=u?"horizontal":"vertical";let g=We(t),[m=d?[]:void 0,b]=Il(n,a,r),[v,w]=h.useReducer(bT,{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=ie(typeof i=="string"?(G,Y)=>{let Q=i;return(G==null?void 0:G[Q])===(Y==null?void 0:Y[Q])}:i),P=h.useCallback(G=>Le(T.mode,{1:()=>m.some(Y=>E(Y,G)),0:()=>E(m,G)}),[m]),T=h.useMemo(()=>({...v,value:m,disabled:l,mode:d?1:0,orientation:p,compare:E,isSelected:P,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,l,d,v]);Ue(()=>{v.dataRef.current=T},[T]),Ed([T.buttonRef,T.optionsRef],(G,Y)=>{var Q;w({type:1}),xd(Y,Hl.Loose)||(G.preventDefault(),(Q=T.buttonRef.current)==null||Q.focus())},T.listboxState===0);let O=h.useMemo(()=>({open:T.listboxState===0,disabled:l,value:m}),[T,l,m]),_=ie(G=>{let Y=T.options.find(Q=>Q.id===G);Y&&K(Y.dataRef.current.value)}),N=ie(()=>{if(T.activeOptionIndex!==null){let{dataRef:G,id:Y}=T.options[T.activeOptionIndex];K(G.current.value),w({type:2,focus:Ke.Specific,id:Y})}}),L=ie(()=>w({type:0})),k=ie(()=>w({type:1})),B=ie((G,Y,Q)=>G===Ke.Specific?w({type:2,focus:Ke.Specific,id:Y,trigger:Q}):w({type:2,focus:G,trigger:Q})),$=ie((G,Y)=>(w({type:5,id:G,dataRef:Y}),()=>w({type:6,id:G}))),z=ie(G=>(w({type:7,id:G}),()=>w({type:7,id:null}))),K=ie(G=>Le(T.mode,{0(){return b==null?void 0:b(G)},1(){let Y=T.value.slice(),Q=Y.findIndex(Z=>E(Z,G));return Q===-1?Y.push(G):Y.splice(Q,1),b==null?void 0:b(Y)}})),F=ie(G=>w({type:3,value:G})),V=ie(()=>w({type:4})),D=h.useMemo(()=>({onChange:K,registerOption:$,registerLabel:z,goToOption:B,closeListbox:k,openListbox:L,selectActiveOption:N,selectOption:_,search:F,clearSearch:V}),[]),A={ref:g},j=h.useRef(null),q=lr();return h.useEffect(()=>{j.current&&r!==void 0&&q.addEventListener(j.current,"reset",()=>{b==null||b(r)})},[j,b]),h.createElement(Bd.Provider,{value:D},h.createElement(zd.Provider,{value:T},h.createElement(Ja,{value:Le(T.listboxState,{0:at.Open,1:at.Closed})},s!=null&&m!=null&&Ul({[s]:m}).map(([G,Y],Q)=>h.createElement(ur,{features:cr.Hidden,ref:Q===0?Z=>{var W;j.current=(W=Z==null?void 0:Z.closest("form"))!=null?W:null}:void 0,...na({key:G,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:G,value:Y})})),De({ourProps:A,theirProps:f,slot:O,defaultTag:vT,name:"Listbox"}))))}let wT="button";function ST(e,t){var n;let r=yt(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=ei("Listbox.Button"),i=Ra("Listbox.Button"),l=We(a.buttonRef,t),u=lr(),d=ie(v=>{switch(v.key){case be.Space:case be.Enter:case be.ArrowDown:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Ke.First)});break;case be.ArrowUp:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Ke.Last)});break}}),f=ie(v=>{switch(v.key){case be.Space:v.preventDefault();break}}),p=ie(v=>{if(Po(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())}),g=Xa(()=>{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]),b={ref:l,id:o,type:ta(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:f,onClick:p};return De({ourProps:b,theirProps:s,slot:m,defaultTag:wT,name:"Listbox.Button"})}let CT="label";function xT(e,t){let n=yt(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=ei("Listbox.Label"),a=Ra("Listbox.Label"),i=We(s.labelRef,t);Ue(()=>a.registerLabel(r),[r]);let l=ie(()=>{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 De({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:CT,name:"Listbox.Label"})}let ET="ul",PT=un.RenderStrategy|un.Static;function _T(e,t){var n;let r=yt(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=ei("Listbox.Options"),i=Ra("Listbox.Options"),l=We(a.optionsRef,t),u=lr(),d=lr(),f=ms(),p=f!==null?(f&at.Open)===at.Open:a.listboxState===0;h.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=xo(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let g=ie(w=>{switch(d.dispose(),w.key){case be.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case be.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(),Er().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Le(a.orientation,{vertical:be.ArrowDown,horizontal:be.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Ke.Next);case Le(a.orientation,{vertical:be.ArrowUp,horizontal:be.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Ke.Previous);case be.Home:case be.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(Ke.First);case be.End:case be.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(Ke.Last);case be.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 be.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=Xa(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),b=h.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:g,role:"listbox",tabIndex:0,ref:l};return De({ourProps:v,theirProps:s,slot:b,defaultTag:ET,features:PT,visible:p,name:"Listbox.Options"})}let TT="li";function OT(e,t){let n=yt(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=ei("Listbox.Option"),l=Ra("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),f=h.useRef(null),p=dT(f),g=$t({disabled:o,value:s,domRef:f,get textValue(){return p()}}),m=We(t,f);Ue(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=Er();return E.requestAnimationFrame(()=>{var P,T;(T=(P=f.current)==null?void 0:P.scrollIntoView)==null||T.call(P,{block:"nearest"})}),E.dispose},[f,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Ue(()=>l.registerOption(r,g),[g,r]);let b=ie(E=>{if(o)return E.preventDefault();l.onChange(s),i.mode===0&&(l.closeListbox(),Er().nextFrame(()=>{var P;return(P=i.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})}))}),v=ie(()=>{if(o)return l.goToOption(Ke.Nothing);l.goToOption(Ke.Specific,r)}),w=j1(),y=ie(E=>w.update(E)),S=ie(E=>{w.wasMoved(E)&&(o||u||l.goToOption(Ke.Specific,r,0))}),C=ie(E=>{w.wasMoved(E)&&(o||u&&l.goToOption(Ke.Nothing))}),x=h.useMemo(()=>({active:u,selected:d,disabled:o}),[u,d,o]);return De({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:x,defaultTag:TT,name:"Listbox.Option"})}let AT=He(yT),NT=He(ST),MT=He(xT),LT=He(_T),$T=He(OT),ti=Object.assign(AT,{Button:NT,Label:MT,Options:LT,Option:$T});var kT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(kT||{}),VT=(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))(VT||{});let IT={0:e=>{let t={...e,popoverState:Le(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}}},Ud=h.createContext(null);Ud.displayName="PopoverContext";function Gl(e){let t=h.useContext(Ud);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gl),n}return t}let Wd=h.createContext(null);Wd.displayName="PopoverAPIContext";function Gd(e){let t=h.useContext(Wd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gd),n}return t}let qd=h.createContext(null);qd.displayName="PopoverGroupContext";function em(){return h.useContext(qd)}let ql=h.createContext(null);ql.displayName="PopoverPanelContext";function jT(){return h.useContext(ql)}function DT(e,t){return Le(t.type,IT,e,t)}let HT="div";function FT(e,t){var n;let{__demoMode:r=!1,...o}=e,s=h.useRef(null),a=We(t,Pd(z=>{s.current=z})),i=h.useRef([]),l=h.useReducer(DT,{__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:f,panel:p,panelId:g,beforePanelSentinel:m,afterPanelSentinel:b},v]=l,w=gs((n=s.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!p)return!1;for(let j of document.querySelectorAll("body > *"))if(Number(j==null?void 0:j.contains(d))^Number(j==null?void 0:j.contains(p)))return!0;let z=Dl(),K=z.indexOf(d),F=(K+z.length-1)%z.length,V=(K+1)%z.length,D=z[F],A=z[V];return!p.contains(D)&&!p.contains(A)},[d,p]),S=$t(f),C=$t(g),x=h.useMemo(()=>({buttonId:S,panelId:C,close:()=>v({type:1})}),[S,C,v]),E=em(),P=E==null?void 0:E.registerPopover,T=ie(()=>{var z;return(z=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?z:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(p==null?void 0:p.contains(w.activeElement)))});h.useEffect(()=>P==null?void 0:P(x),[P,x]);let[O,_]=F_(),N=U_({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:O,defaultContainers:[d,p]});M_(w==null?void 0:w.defaultView,"focus",z=>{var K,F,V,D;z.target!==window&&z.target instanceof HTMLElement&&u===0&&(T()||d&&p&&(N.contains(z.target)||(F=(K=m.current)==null?void 0:K.contains)!=null&&F.call(K,z.target)||(D=(V=b.current)==null?void 0:V.contains)!=null&&D.call(V,z.target)||v({type:1})))},!0),Ed(N.resolveContainers,(z,K)=>{v({type:1}),xd(K,Hl.Loose)||(z.preventDefault(),d==null||d.focus())},u===0);let L=ie(z=>{v({type:1});let K=z?z instanceof HTMLElement?z:"current"in z&&z.current instanceof HTMLElement?z.current:d:d;K==null||K.focus()}),k=h.useMemo(()=>({close:L,isPortalled:y}),[L,y]),B=h.useMemo(()=>({open:u===0,close:L}),[u,L]),$={ref:a};return h.createElement(ql.Provider,{value:null},h.createElement(Ud.Provider,{value:l},h.createElement(Wd.Provider,{value:k},h.createElement(Ja,{value:Le(u,{0:at.Open,1:at.Closed})},h.createElement(_,null,De({ourProps:$,theirProps:o,slot:B,defaultTag:HT,name:"Popover"}),h.createElement(N.MainTreeNode,null))))))}let BT="button";function zT(e,t){let n=yt(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=Gl("Popover.Button"),{isPortalled:i}=Gd("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${yt()}`,d=em(),f=d==null?void 0:d.closeOthers,p=jT()!==null;h.useEffect(()=>{if(!p)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[p,r,a]);let[g]=h.useState(()=>Symbol()),m=We(l,t,p?null:N=>{if(N)s.buttons.current.push(g);else{let L=s.buttons.current.indexOf(g);L!==-1&&s.buttons.current.splice(L,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),N&&a({type:2,button:N})}),b=We(l,t),v=gs(l),w=ie(N=>{var L,k,B;if(p){if(s.popoverState===1)return;switch(N.key){case be.Space:case be.Enter:N.preventDefault(),(k=(L=N.target).click)==null||k.call(L),a({type:1}),(B=s.button)==null||B.focus();break}}else switch(N.key){case be.Space:case be.Enter:N.preventDefault(),N.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0});break;case be.Escape:if(s.popoverState!==0)return f==null?void 0:f(s.buttonId);if(!l.current||v!=null&&v.activeElement&&!l.current.contains(v.activeElement))return;N.preventDefault(),N.stopPropagation(),a({type:1});break}}),y=ie(N=>{p||N.key===be.Space&&N.preventDefault()}),S=ie(N=>{var L,k;Po(N.currentTarget)||e.disabled||(p?(a({type:1}),(L=s.button)==null||L.focus()):(N.preventDefault(),N.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0}),(k=s.button)==null||k.focus()))}),C=ie(N=>{N.preventDefault(),N.stopPropagation()}),x=s.popoverState===0,E=h.useMemo(()=>({open:x}),[x]),P=ta(e,l),T=p?{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},O=G1(),_=ie(()=>{let N=s.panel;if(!N)return;function L(){Le(O.current,{[no.Forwards]:()=>tn(N,St.First),[no.Backwards]:()=>tn(N,St.Last)})===Pr.Error&&tn(Dl().filter(k=>k.dataset.headlessuiFocusGuard!=="true"),Le(O.current,{[no.Forwards]:St.Next,[no.Backwards]:St.Previous}),{relativeTo:s.button})}L()});return h.createElement(h.Fragment,null,De({ourProps:T,theirProps:o,slot:E,defaultTag:BT,name:"Popover.Button"}),x&&!p&&i&&h.createElement(ur,{id:u,features:cr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:_}))}let UT="div",WT=un.RenderStrategy|un.Static;function GT(e,t){let n=yt(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=Gl("Popover.Overlay"),i=We(t),l=ms(),u=l!==null?(l&at.Open)===at.Open:s===0,d=ie(p=>{if(Po(p.currentTarget))return p.preventDefault();a({type:1})}),f=h.useMemo(()=>({open:s===0}),[s]);return De({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:f,defaultTag:UT,features:WT,visible:u,name:"Popover.Overlay"})}let qT="div",KT=un.RenderStrategy|un.Static;function YT(e,t){let n=yt(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=Gl("Popover.Panel"),{close:l,isPortalled:u}=Gd("Popover.Panel"),d=`headlessui-focus-sentinel-before-${yt()}`,f=`headlessui-focus-sentinel-after-${yt()}`,p=h.useRef(null),g=We(p,t,T=>{i({type:4,panel:T})}),m=gs(p),b=_d();Ue(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let v=ms(),w=v!==null?(v&at.Open)===at.Open:a.popoverState===0,y=ie(T=>{var O;switch(T.key){case be.Escape:if(a.popoverState!==0||!p.current||m!=null&&m.activeElement&&!p.current.contains(m.activeElement))return;T.preventDefault(),T.stopPropagation(),i({type:1}),(O=a.button)==null||O.focus();break}});h.useEffect(()=>{var T;e.static||a.popoverState===1&&((T=e.unmount)==null||T)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),h.useEffect(()=>{if(a.__demoMode||!o||a.popoverState!==0||!p.current)return;let T=m==null?void 0:m.activeElement;p.current.contains(T)||tn(p.current,St.First)},[a.__demoMode,o,p,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?T=>{var O,_,N,L,k;let B=T.relatedTarget;B&&p.current&&((O=p.current)!=null&&O.contains(B)||(i({type:1}),((N=(_=a.beforePanelSentinel.current)==null?void 0:_.contains)!=null&&N.call(_,B)||(k=(L=a.afterPanelSentinel.current)==null?void 0:L.contains)!=null&&k.call(L,B))&&B.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=G1(),E=ie(()=>{let T=p.current;if(!T)return;function O(){Le(x.current,{[no.Forwards]:()=>{var _;tn(T,St.First)===Pr.Error&&((_=a.afterPanelSentinel.current)==null||_.focus())},[no.Backwards]:()=>{var _;(_=a.button)==null||_.focus({preventScroll:!0})}})}O()}),P=ie(()=>{let T=p.current;if(!T)return;function O(){Le(x.current,{[no.Forwards]:()=>{var _;if(!a.button)return;let N=Dl(),L=N.indexOf(a.button),k=N.slice(0,L+1),B=[...N.slice(L+1),...k];for(let $ of B.slice())if($.dataset.headlessuiFocusGuard==="true"||(_=a.panel)!=null&&_.contains($)){let z=B.indexOf($);z!==-1&&B.splice(z,1)}tn(B,St.First,{sorted:!1})},[no.Backwards]:()=>{var _;tn(T,St.Previous)===Pr.Error&&((_=a.button)==null||_.focus())}})}O()});return h.createElement(ql.Provider,{value:r},w&&u&&h.createElement(ur,{id:d,ref:a.beforePanelSentinel,features:cr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),De({mergeRefs:b,ourProps:C,theirProps:s,slot:S,defaultTag:qT,features:KT,visible:w,name:"Popover.Panel"}),w&&u&&h.createElement(ur,{id:f,ref:a.afterPanelSentinel,features:cr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let ZT="div";function XT(e,t){let n=h.useRef(null),r=We(n,t),[o,s]=h.useState([]),a=W_(),i=ie(b=>{s(v=>{let w=v.indexOf(b);if(w!==-1){let y=v.slice();return y.splice(w,1),y}return v})}),l=ie(b=>(s(v=>[...v,b]),()=>i(b))),u=ie(()=>{var b;let v=xo(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=ie(b=>{for(let v of o)v.buttonId.current!==b&&v.close()}),f=h.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),p=h.useMemo(()=>({}),[]),g=e,m={ref:r};return h.createElement(qd.Provider,{value:f},De({ourProps:m,theirProps:g,slot:p,defaultTag:ZT,name:"Popover.Group"}),h.createElement(a.MainTreeNode,null))}let JT=He(FT),QT=He(zT),RT=He(GT),e5=He(YT),t5=He(XT),Kd=Object.assign(JT,{Button:QT,Overlay:RT,Panel:e5,Group:t5}),tm=h.createContext(null);function nm(){let e=h.useContext(tm);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,nm),t}return e}function Yd(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=ie(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(tm.Provider,{value:o},n.children)},[t])]}let n5="label";function r5(e,t){let n=yt(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=nm(),i=We(t);Ue(()=>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),De({ourProps:l,theirProps:s,slot:a.slot||{},defaultTag:n5,name:a.name||"Label"})}let o5=He(r5),rm=Object.assign(o5,{});function om(e=0){let[t,n]=h.useState(e),r=Wl(),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 s5=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(s5||{});let a5={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:to(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})}},Zd=h.createContext(null);Zd.displayName="RadioGroupDataContext";function sm(e){let t=h.useContext(Zd);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sm),n}return t}let Xd=h.createContext(null);Xd.displayName="RadioGroupActionsContext";function am(e){let t=h.useContext(Xd);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,am),n}return t}function i5(e,t){return Le(t.type,a5,e,t)}let l5="div";function c5(e,t){let n=yt(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=(V,D)=>V===D,disabled:d=!1,...f}=e,p=ie(typeof u=="string"?(V,D)=>{let A=u;return(V==null?void 0:V[A])===(D==null?void 0:D[A])}:u),[g,m]=h.useReducer(i5,{options:[]}),b=g.options,[v,w]=Yd(),[y,S]=kd(),C=h.useRef(null),x=We(C,t),[E,P]=Il(o,l,s),T=h.useMemo(()=>b.find(V=>!V.propsRef.current.disabled),[b]),O=h.useMemo(()=>b.some(V=>p(V.propsRef.current.value,E)),[b,E]),_=ie(V=>{var D;if(d||p(V,E))return!1;let A=(D=b.find(j=>p(j.propsRef.current.value,V)))==null?void 0:D.propsRef.current;return A!=null&&A.disabled?!1:(P==null||P(V),!0)});D1({container:C.current,accept(V){return V.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:V.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(V){V.setAttribute("role","none")}});let N=ie(V=>{let D=C.current;if(!D)return;let A=xo(D),j=b.filter(q=>q.propsRef.current.disabled===!1).map(q=>q.element.current);switch(V.key){case be.Enter:U1(V.currentTarget);break;case be.ArrowLeft:case be.ArrowUp:if(V.preventDefault(),V.stopPropagation(),tn(j,St.Previous|St.WrapAround)===Pr.Success){let q=b.find(G=>G.element.current===(A==null?void 0:A.activeElement));q&&_(q.propsRef.current.value)}break;case be.ArrowRight:case be.ArrowDown:if(V.preventDefault(),V.stopPropagation(),tn(j,St.Next|St.WrapAround)===Pr.Success){let q=b.find(G=>G.element.current===(A==null?void 0:A.activeElement));q&&_(q.propsRef.current.value)}break;case be.Space:{V.preventDefault(),V.stopPropagation();let q=b.find(G=>G.element.current===(A==null?void 0:A.activeElement));q&&_(q.propsRef.current.value)}break}}),L=ie(V=>(m({type:0,...V}),()=>m({type:1,id:V.id}))),k=h.useMemo(()=>({value:E,firstOption:T,containsCheckedOption:O,disabled:d,compare:p,...g}),[E,T,O,d,p,g]),B=h.useMemo(()=>({registerOption:L,change:_}),[L,_]),$={ref:x,id:r,role:"radiogroup","aria-labelledby":v,"aria-describedby":y,onKeyDown:N},z=h.useMemo(()=>({value:E}),[E]),K=h.useRef(null),F=lr();return h.useEffect(()=>{K.current&&s!==void 0&&F.addEventListener(K.current,"reset",()=>{_(s)})},[K,_]),h.createElement(S,{name:"RadioGroup.Description"},h.createElement(w,{name:"RadioGroup.Label"},h.createElement(Xd.Provider,{value:B},h.createElement(Zd.Provider,{value:k},i!=null&&E!=null&&Ul({[i]:E}).map(([V,D],A)=>h.createElement(ur,{features:cr.Hidden,ref:A===0?j=>{var q;K.current=(q=j==null?void 0:j.closest("form"))!=null?q:null}:void 0,...na({key:V,as:"input",type:"radio",checked:D!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:V,value:D})})),De({ourProps:$,theirProps:f,slot:z,defaultTag:l5,name:"RadioGroup"})))))}var u5=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(u5||{});let d5="div";function f5(e,t){var n;let r=yt(),{id:o=`headlessui-radiogroup-option-${r}`,value:s,disabled:a=!1,...i}=e,l=h.useRef(null),u=We(l,t),[d,f]=Yd(),[p,g]=kd(),{addFlag:m,removeFlag:b,hasFlag:v}=om(1),w=$t({value:s,disabled:a}),y=sm("RadioGroup.Option"),S=am("RadioGroup.Option");Ue(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=ie(L=>{var k;if(Po(L.currentTarget))return L.preventDefault();S.change(s)&&(m(2),(k=l.current)==null||k.focus())}),x=ie(L=>{if(Po(L.currentTarget))return L.preventDefault();m(2)}),E=ie(()=>b(2)),P=((n=y.firstOption)==null?void 0:n.id)===o,T=y.disabled||a,O=y.compare(y.value,s),_={ref:u,id:o,role:"radio","aria-checked":O?"true":"false","aria-labelledby":d,"aria-describedby":p,"aria-disabled":T?!0:void 0,tabIndex:T?-1:O||!y.containsCheckedOption&&P?0:-1,onClick:T?void 0:C,onFocus:T?void 0:x,onBlur:T?void 0:E},N=h.useMemo(()=>({checked:O,disabled:T,active:v(2)}),[O,T,v]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(f,{name:"RadioGroup.Label"},De({ourProps:_,theirProps:i,slot:N,defaultTag:d5,name:"RadioGroup.Option"})))}let p5=He(c5),h5=He(f5),im=Object.assign(p5,{Option:h5,Label:rm,Description:Z1}),Jd=h.createContext(null);Jd.displayName="GroupContext";let g5=h.Fragment;function m5(e){var t;let[n,r]=h.useState(null),[o,s]=Yd(),[a,i]=kd(),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(f){n&&(f.currentTarget.tagName==="LABEL"&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(Jd.Provider,{value:l},De({ourProps:u,theirProps:d,defaultTag:g5,name:"Switch.Group"}))))}let b5="button";function v5(e,t){var n;let r=yt(),{id:o=`headlessui-switch-${r}`,checked:s,defaultChecked:a=!1,onChange:i,disabled:l=!1,name:u,value:d,form:f,...p}=e,g=h.useContext(Jd),m=h.useRef(null),b=We(m,t,g===null?null:g.setSwitch),[v,w]=Il(s,i,a),y=ie(()=>w==null?void 0:w(!v)),S=ie(O=>{if(Po(O.currentTarget))return O.preventDefault();O.preventDefault(),y()}),C=ie(O=>{O.key===be.Space?(O.preventDefault(),y()):O.key===be.Enter&&U1(O.currentTarget)}),x=ie(O=>O.preventDefault()),E=h.useMemo(()=>({checked:v}),[v]),P={id:o,ref:b,role:"switch",type:ta(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":v,"aria-labelledby":g==null?void 0:g.labelledby,"aria-describedby":g==null?void 0:g.describedby,disabled:l,onClick:S,onKeyUp:C,onKeyPress:x},T=lr();return h.useEffect(()=>{var O;let _=(O=m.current)==null?void 0:O.closest("form");_&&a!==void 0&&T.addEventListener(_,"reset",()=>{w(a)})},[m,w]),h.createElement(h.Fragment,null,u!=null&&v&&h.createElement(ur,{features:cr.Hidden,...na({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:f,checked:v,name:u,value:d})}),De({ourProps:P,theirProps:p,slot:E,defaultTag:b5,name:"Switch"}))}let y5=He(v5),w5=m5,Qd=Object.assign(y5,{Group:w5,Label:rm,Description:Z1});function S5({onFocus:e}){let[t,n]=h.useState(!0),r=Wl();return t?h.createElement(ur,{as:"button",type:"button",features:cr.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 lm=Xe.createContext(null);function C5(){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 x5({children:e}){let t=Xe.useRef(C5());return Xe.createElement(lm.Provider,{value:t},e)}function cm(e){let t=Xe.useContext(lm);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=E5(),[r,o]=t.current.get(e,n);return Xe.useEffect(()=>o,[]),r}function E5(){var e,t,n;let r=(n=(t=(e=Xe.__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 P5=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(P5||{}),_5=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(_5||{}),T5=(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))(T5||{});let O5={0(e,t){var n;let r=to(e.tabs,d=>d.current),o=to(e.panels,d=>d.current),s=r.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),a={...e,tabs:r,panels:o};if(t.index<0||t.index>r.length-1){let d=Le(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Le(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(s.length===0)return a;let f=Le(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:f===-1?e.selectedIndex:f}}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=to([...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:to([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},Rd=h.createContext(null);Rd.displayName="TabsDataContext";function oa(e){let t=h.useContext(Rd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,oa),n}return t}let ef=h.createContext(null);ef.displayName="TabsActionsContext";function tf(e){let t=h.useContext(ef);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,tf),n}return t}function A5(e,t){return Le(t.type,O5,e,t)}let N5=h.Fragment;function M5(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,f=$t({isControlled:d}),p=We(t),[g,m]=h.useReducer(A5,{info:f,selectedIndex:a??n,tabs:[],panels:[]}),b=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),v=$t(s||(()=>{})),w=$t(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),S=ie(O=>(m({type:1,tab:O}),()=>m({type:2,tab:O}))),C=ie(O=>(m({type:3,panel:O}),()=>m({type:4,panel:O}))),x=ie(O=>{E.current!==O&&v.current(O),d||m({type:0,index:O})}),E=$t(d?e.selectedIndex:g.selectedIndex),P=h.useMemo(()=>({registerTab:S,registerPanel:C,change:x}),[]);Ue(()=>{m({type:0,index:a??n})},[a]),Ue(()=>{if(E.current===void 0||g.tabs.length<=0)return;let O=to(g.tabs,_=>_.current);O.some((_,N)=>g.tabs[N]!==_)&&x(O.indexOf(g.tabs[E.current]))});let T={ref:p};return h.createElement(x5,null,h.createElement(ef.Provider,{value:P},h.createElement(Rd.Provider,{value:y},y.tabs.length<=0&&h.createElement(S5,{onFocus:()=>{var O,_;for(let N of w.current)if(((O=N.current)==null?void 0:O.tabIndex)===0)return(_=N.current)==null||_.focus(),!0;return!1}}),De({ourProps:T,theirProps:i,slot:b,defaultTag:N5,name:"Tabs"}))))}let L5="div";function $5(e,t){let{orientation:n,selectedIndex:r}=oa("Tab.List"),o=We(t);return De({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:L5,name:"Tabs.List"})}let k5="button";function V5(e,t){var n,r;let o=yt(),{id:s=`headlessui-tabs-tab-${o}`,...a}=e,{orientation:i,activation:l,selectedIndex:u,tabs:d,panels:f}=oa("Tab"),p=tf("Tab"),g=oa("Tab"),m=h.useRef(null),b=We(m,t);Ue(()=>p.registerTab(m),[p,m]);let v=cm("tabs"),w=d.indexOf(m);w===-1&&(w=v);let y=w===u,S=ie(_=>{var N;let L=_();if(L===Pr.Success&&l==="auto"){let k=(N=xo(m))==null?void 0:N.activeElement,B=g.tabs.findIndex($=>$.current===k);B!==-1&&p.change(B)}return L}),C=ie(_=>{let N=d.map(L=>L.current).filter(Boolean);if(_.key===be.Space||_.key===be.Enter){_.preventDefault(),_.stopPropagation(),p.change(w);return}switch(_.key){case be.Home:case be.PageUp:return _.preventDefault(),_.stopPropagation(),S(()=>tn(N,St.First));case be.End:case be.PageDown:return _.preventDefault(),_.stopPropagation(),S(()=>tn(N,St.Last))}if(S(()=>Le(i,{vertical(){return _.key===be.ArrowUp?tn(N,St.Previous|St.WrapAround):_.key===be.ArrowDown?tn(N,St.Next|St.WrapAround):Pr.Error},horizontal(){return _.key===be.ArrowLeft?tn(N,St.Previous|St.WrapAround):_.key===be.ArrowRight?tn(N,St.Next|St.WrapAround):Pr.Error}}))===Pr.Success)return _.preventDefault()}),x=h.useRef(!1),E=ie(()=>{var _;x.current||(x.current=!0,(_=m.current)==null||_.focus({preventScroll:!0}),p.change(w),Sd(()=>{x.current=!1}))}),P=ie(_=>{_.preventDefault()}),T=h.useMemo(()=>{var _;return{selected:y,disabled:(_=e.disabled)!=null?_:!1}},[y,e.disabled]),O={ref:b,onKeyDown:C,onMouseDown:P,onClick:E,id:s,role:"tab",type:ta(e,m),"aria-controls":(r=(n=f[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return De({ourProps:O,theirProps:a,slot:T,defaultTag:k5,name:"Tabs.Tab"})}let I5="div";function j5(e,t){let{selectedIndex:n}=oa("Tab.Panels"),r=We(t),o=h.useMemo(()=>({selectedIndex:n}),[n]);return De({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:I5,name:"Tabs.Panels"})}let D5="div",H5=un.RenderStrategy|un.Static;function F5(e,t){var n,r,o,s;let a=yt(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=oa("Tab.Panel"),g=tf("Tab.Panel"),m=h.useRef(null),b=We(m,t);Ue(()=>g.registerPanel(m),[g,m,i]);let v=cm("panels"),w=p.indexOf(m);w===-1&&(w=v);let y=w===d,S=h.useMemo(()=>({selected:y}),[y]),C={ref:b,id:i,role:"tabpanel","aria-labelledby":(r=(n=f[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(ur,{as:"span","aria-hidden":"true",...C}):De({ourProps:C,theirProps:u,slot:S,defaultTag:D5,features:H5,visible:y,name:"Tabs.Panel"})}let B5=He(V5),z5=He(M5),U5=He($5),W5=He(j5),G5=He(F5),ni=Object.assign(B5,{Group:z5,List:U5,Panels:W5,Panel:G5});function q5(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function nf(e,...t){e&&t.length>0&&e.classList.add(...t)}function rf(e,...t){e&&t.length>0&&e.classList.remove(...t)}function K5(e,t){let n=Er();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,f)=>f-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 Y5(e,t,n,r){let o=n?"enter":"leave",s=Er(),a=r!==void 0?q5(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=Le(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Le(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Le(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return rf(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),nf(e,...t.base,...i,...u),s.nextFrame(()=>{rf(e,...t.base,...i,...u),nf(e,...t.base,...i,...l),K5(e,()=>(rf(e,...t.base,...i),nf(e,...t.base,...t.entered),a()))}),s.dispose}function Z5({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=Wl(),i=lr(),l=$t(n);Ue(()=>{e&&(l.current="enter")},[e]),Ue(()=>{let u=Er();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(Y5(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function _o(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Kl=h.createContext(null);Kl.displayName="TransitionContext";var X5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(X5||{});function J5(){let e=h.useContext(Kl);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Q5(){let e=h.useContext(Yl);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Yl=h.createContext(null);Yl.displayName="NestingContext";function Zl(e){return"children"in e?Zl(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function um(e,t){let n=$t(e),r=h.useRef([]),o=Wl(),s=lr(),a=ie((g,m=Eo.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===g);b!==-1&&(Le(m,{[Eo.Unmount](){r.current.splice(b,1)},[Eo.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var v;!Zl(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),i=ie(g=>{let m=r.current.find(({el:b})=>b===g);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:g,state:"visible"}),()=>a(g,Eo.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),f=ie((g,m,b)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==g)),t==null||t.chains.current[m].push([g,new Promise(v=>{l.current.push(v)})]),t==null||t.chains.current[m].push([g,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)}),p=ie((g,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 h.useMemo(()=>({children:r,register:i,unregister:a,onStart:f,onStop:p,wait:u,chains:d}),[i,a,r,f,p,d,u])}function R5(){}let eO=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function dm(e){var t;let n={};for(let r of eO)n[r]=(t=e[r])!=null?t:R5;return n}function tO(e){let t=h.useRef(dm(e));return h.useEffect(()=>{t.current=dm(e)},[e]),t}let nO="div",fm=un.RenderStrategy;function rO(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:f,leave:p,leaveFrom:g,leaveTo:m,...b}=e,v=h.useRef(null),w=We(v,t),y=(n=b.unmount)==null||n?Eo.Unmount:Eo.Hidden,{show:S,appear:C,initial:x}=J5(),[E,P]=h.useState(S?"visible":"hidden"),T=Q5(),{register:O,unregister:_}=T;h.useEffect(()=>O(v),[O,v]),h.useEffect(()=>{if(y===Eo.Hidden&&v.current){if(S&&E!=="visible"){P("visible");return}return Le(E,{hidden:()=>_(v),visible:()=>O(v)})}},[E,v,O,_,S,y]);let N=$t({base:_o(b.className),enter:_o(l),enterFrom:_o(u),enterTo:_o(d),entered:_o(f),leave:_o(p),leaveFrom:_o(g),leaveTo:_o(m)}),L=tO({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),k=jl();h.useEffect(()=>{if(k&&E==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,E,k]);let B=x&&!C,$=C&&S&&x,z=!k||B?"idle":S?"enter":"leave",K=om(0),F=ie(G=>Le(G,{enter:()=>{K.addFlag(at.Opening),L.current.beforeEnter()},leave:()=>{K.addFlag(at.Closing),L.current.beforeLeave()},idle:()=>{}})),V=ie(G=>Le(G,{enter:()=>{K.removeFlag(at.Opening),L.current.afterEnter()},leave:()=>{K.removeFlag(at.Closing),L.current.afterLeave()},idle:()=>{}})),D=um(()=>{P("hidden"),_(v)},T),A=h.useRef(!1);Z5({immediate:$,container:v,classes:N,direction:z,onStart:$t(G=>{A.current=!0,D.onStart(v,G,F)}),onStop:$t(G=>{A.current=!1,D.onStop(v,G,V),G==="leave"&&!Zl(D)&&(P("hidden"),_(v))})});let j=b,q={ref:w};return $?j={...j,className:Bl(b.className,...N.current.enter,...N.current.enterFrom)}:A.current&&(j.className=Bl(b.className,(r=v.current)==null?void 0:r.className),j.className===""&&delete j.className),h.createElement(Yl.Provider,{value:D},h.createElement(Ja,{value:Le(E,{visible:at.Open,hidden:at.Closed})|K.flags},De({ourProps:q,theirProps:j,defaultTag:nO,features:fm,visible:E==="visible",name:"Transition.Child"})))}function oO(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=h.useRef(null),i=We(a,t);jl();let l=ms();if(n===void 0&&l!==null&&(n=(l&at.Open)===at.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"),f=um(()=>{d("hidden")}),[p,g]=h.useState(!0),m=h.useRef([n]);Ue(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let b=h.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);h.useEffect(()=>{if(n)d("visible");else if(!Zl(f))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,f]);let v={unmount:o},w=ie(()=>{var S;p&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=ie(()=>{var S;p&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return h.createElement(Yl.Provider,{value:f},h.createElement(Kl.Provider,{value:b},De({ourProps:{...v,as:h.Fragment,children:h.createElement(pm,{ref:i,...v,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:fm,visible:u==="visible",name:"Transition"})))}function sO(e,t){let n=h.useContext(Kl)!==null,r=ms()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(of,{ref:t,...e}):h.createElement(pm,{ref:t,...e}))}let of=He(oO),pm=He(rO),aO=He(sO),sf=Object.assign(of,{Child:aO,Root:of});var hm=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},gm=typeof window<"u"&&window.document&&window.document.createElement?Xe.useLayoutEffect:Xe.useEffect,dn="top",zn="bottom",Un="right",fn="left",af="auto",ri=[dn,zn,Un,fn],sa="start",oi="end",iO="clippingParents",mm="viewport",si="popper",lO="reference",bm=ri.reduce(function(e,t){return e.concat([t+"-"+sa,t+"-"+oi])},[]),vm=[].concat(ri,[af]).reduce(function(e,t){return e.concat([t,t+"-"+sa,t+"-"+oi])},[]),cO="beforeRead",uO="read",dO="afterRead",fO="beforeMain",pO="main",hO="afterMain",gO="beforeWrite",mO="write",bO="afterWrite",vO=[cO,uO,dO,fO,pO,hO,gO,mO,bO];function _r(e){return e?(e.nodeName||"").toLowerCase():null}function _n(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ys(e){var t=_n(e).Element;return e instanceof t||e instanceof Element}function Wn(e){var t=_n(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lf(e){if(typeof ShadowRoot>"u")return!1;var t=_n(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function yO(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];!Wn(s)||!_r(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 wO(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},{});!Wn(o)||!_r(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const SO={name:"applyStyles",enabled:!0,phase:"write",fn:yO,effect:wO,requires:["computeStyles"]};function Tr(e){return e.split("-")[0]}var ws=Math.max,Xl=Math.min,aa=Math.round;function cf(){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 ym(){return!/^((?!chrome|android).)*safari/i.test(cf())}function ia(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Wn(e)&&(o=e.offsetWidth>0&&aa(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&aa(r.height)/e.offsetHeight||1);var a=ys(e)?_n(e):window,i=a.visualViewport,l=!ym()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,f=r.width/o,p=r.height/s;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function uf(e){var t=ia(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 wm(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lf(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ro(e){return _n(e).getComputedStyle(e)}function CO(e){return["table","td","th"].indexOf(_r(e))>=0}function To(e){return((ys(e)?e.ownerDocument:e.document)||window.document).documentElement}function Jl(e){return _r(e)==="html"?e:e.assignedSlot||e.parentNode||(lf(e)?e.host:null)||To(e)}function Sm(e){return!Wn(e)||ro(e).position==="fixed"?null:e.offsetParent}function xO(e){var t=/firefox/i.test(cf()),n=/Trident/i.test(cf());if(n&&Wn(e)){var r=ro(e);if(r.position==="fixed")return null}var o=Jl(e);for(lf(o)&&(o=o.host);Wn(o)&&["html","body"].indexOf(_r(o))<0;){var s=ro(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 ai(e){for(var t=_n(e),n=Sm(e);n&&CO(n)&&ro(n).position==="static";)n=Sm(n);return n&&(_r(n)==="html"||_r(n)==="body"&&ro(n).position==="static")?t:n||xO(e)||t}function df(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ii(e,t,n){return ws(e,Xl(t,n))}function EO(e,t,n){var r=ii(e,t,n);return r>n?n:r}function Cm(){return{top:0,right:0,bottom:0,left:0}}function xm(e){return Object.assign({},Cm(),e)}function Em(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var PO=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,xm(typeof t!="number"?t:Em(t,ri))};function _O(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=Tr(n.placement),l=df(i),u=[fn,Un].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var f=PO(o.padding,n),p=uf(s),g=l==="y"?dn:fn,m=l==="y"?zn:Un,b=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],v=a[l]-n.rects.reference[l],w=ai(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=b/2-v/2,C=f[g],x=y-p[d]-f[m],E=y/2-p[d]/2+S,P=ii(C,E,x),T=l;n.modifiersData[r]=(t={},t[T]=P,t.centerOffset=P-E,t)}}function TO(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)||wm(t.elements.popper,o)&&(t.elements.arrow=o))}const OO={name:"arrow",enabled:!0,phase:"main",fn:_O,effect:TO,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function la(e){return e.split("-")[1]}var AO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NO(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:aa(n*o)/o||0,y:aa(r*o)/o||0}}function Pm(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,f=e.isFixed,p=a.x,g=p===void 0?0:p,m=a.y,b=m===void 0?0:m,v=typeof d=="function"?d({x:g,y:b}):{x:g,y:b};g=v.x,b=v.y;var w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=fn,C=dn,x=window;if(u){var E=ai(n),P="clientHeight",T="clientWidth";if(E===_n(n)&&(E=To(n),ro(E).position!=="static"&&i==="absolute"&&(P="scrollHeight",T="scrollWidth")),E=E,o===dn||(o===fn||o===Un)&&s===oi){C=zn;var O=f&&E===x&&x.visualViewport?x.visualViewport.height:E[P];b-=O-r.height,b*=l?1:-1}if(o===fn||(o===dn||o===zn)&&s===oi){S=Un;var _=f&&E===x&&x.visualViewport?x.visualViewport.width:E[T];g-=_-r.width,g*=l?1:-1}}var N=Object.assign({position:i},u&&AO),L=d===!0?NO({x:g,y:b},_n(n)):{x:g,y:b};if(g=L.x,b=L.y,l){var k;return Object.assign({},N,(k={},k[C]=y?"0":"",k[S]=w?"0":"",k.transform=(x.devicePixelRatio||1)<=1?"translate("+g+"px, "+b+"px)":"translate3d("+g+"px, "+b+"px, 0)",k))}return Object.assign({},N,(t={},t[C]=y?b+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function MO(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:Tr(t.placement),variation:la(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,Pm(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,Pm(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 LO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:MO,data:{}};var Ql={passive:!0};function $O(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=_n(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,Ql)}),i&&l.addEventListener("resize",n.update,Ql),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Ql)}),i&&l.removeEventListener("resize",n.update,Ql)}}const kO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:$O,data:{}};var VO={left:"right",right:"left",bottom:"top",top:"bottom"};function Rl(e){return e.replace(/left|right|bottom|top/g,function(t){return VO[t]})}var IO={start:"end",end:"start"};function _m(e){return e.replace(/start|end/g,function(t){return IO[t]})}function ff(e){var t=_n(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function pf(e){return ia(To(e)).left+ff(e).scrollLeft}function jO(e,t){var n=_n(e),r=To(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=ym();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+pf(e),y:l}}function DO(e){var t,n=To(e),r=ff(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=ws(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=ws(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+pf(e),l=-r.scrollTop;return ro(o||n).direction==="rtl"&&(i+=ws(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function hf(e){var t=ro(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Tm(e){return["html","body","#document"].indexOf(_r(e))>=0?e.ownerDocument.body:Wn(e)&&hf(e)?e:Tm(Jl(e))}function li(e,t){var n;t===void 0&&(t=[]);var r=Tm(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=_n(r),a=o?[s].concat(s.visualViewport||[],hf(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(li(Jl(a)))}function gf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function HO(e,t){var n=ia(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 Om(e,t,n){return t===mm?gf(jO(e,n)):ys(t)?HO(t,n):gf(DO(To(e)))}function FO(e){var t=li(Jl(e)),n=["absolute","fixed"].indexOf(ro(e).position)>=0,r=n&&Wn(e)?ai(e):e;return ys(r)?t.filter(function(o){return ys(o)&&wm(o,r)&&_r(o)!=="body"}):[]}function BO(e,t,n,r){var o=t==="clippingParents"?FO(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=Om(e,u,r);return l.top=ws(d.top,l.top),l.right=Xl(d.right,l.right),l.bottom=Xl(d.bottom,l.bottom),l.left=ws(d.left,l.left),l},Om(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 Am(e){var t=e.reference,n=e.element,r=e.placement,o=r?Tr(r):null,s=r?la(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case dn:l={x:a,y:t.y-n.height};break;case zn:l={x:a,y:t.y+t.height};break;case Un:l={x:t.x+t.width,y:i};break;case fn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?df(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case sa:l[u]=l[u]-(t[d]/2-n[d]/2);break;case oi: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?iO:i,u=n.rootBoundary,d=u===void 0?mm:u,f=n.elementContext,p=f===void 0?si:f,g=n.altBoundary,m=g===void 0?!1:g,b=n.padding,v=b===void 0?0:b,w=xm(typeof v!="number"?v:Em(v,ri)),y=p===si?lO:si,S=e.rects.popper,C=e.elements[m?y:p],x=BO(ys(C)?C:C.contextElement||To(e.elements.popper),l,d,a),E=ia(e.elements.reference),P=Am({reference:E,element:S,strategy:"absolute",placement:o}),T=gf(Object.assign({},S,P)),O=p===si?T:E,_={top:x.top-O.top+w.top,bottom:O.bottom-x.bottom+w.bottom,left:x.left-O.left+w.left,right:O.right-x.right+w.right},N=e.modifiersData.offset;if(p===si&&N){var L=N[o];Object.keys(_).forEach(function(k){var B=[Un,zn].indexOf(k)>=0?1:-1,$=[dn,zn].indexOf(k)>=0?"y":"x";_[k]+=L[$]*B})}return _}function zO(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?vm:l,d=la(r),f=d?i?bm:bm.filter(function(m){return la(m)===d}):ri,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var g=p.reduce(function(m,b){return m[b]=ci(e,{placement:b,boundary:o,rootBoundary:s,padding:a})[Tr(b)],m},{});return Object.keys(g).sort(function(m,b){return g[m]-g[b]})}function UO(e){if(Tr(e)===af)return[];var t=Rl(e);return[_m(e),t,_m(t)]}function WO(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,f=n.rootBoundary,p=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,b=n.allowedAutoPlacements,v=t.options.placement,w=Tr(v),y=w===v,S=l||(y||!m?[Rl(v)]:UO(v)),C=[v].concat(S).reduce(function(G,Y){return G.concat(Tr(Y)===af?zO(t,{placement:Y,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:b}):Y)},[]),x=t.rects.reference,E=t.rects.popper,P=new Map,T=!0,O=C[0],_=0;_<C.length;_++){var N=C[_],L=Tr(N),k=la(N)===sa,B=[dn,zn].indexOf(L)>=0,$=B?"width":"height",z=ci(t,{placement:N,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),K=B?k?Un:fn:k?zn:dn;x[$]>E[$]&&(K=Rl(K));var F=Rl(K),V=[];if(s&&V.push(z[L]<=0),i&&V.push(z[K]<=0,z[F]<=0),V.every(function(G){return G})){O=N,T=!1;break}P.set(N,V)}if(T)for(var D=m?3:1,A=function(Y){var Q=C.find(function(Z){var W=P.get(Z);if(W)return W.slice(0,Y).every(function(R){return R})});if(Q)return O=Q,"break"},j=D;j>0;j--){var q=A(j);if(q==="break")break}t.placement!==O&&(t.modifiersData[r]._skip=!0,t.placement=O,t.reset=!0)}}const GO={name:"flip",enabled:!0,phase:"main",fn:WO,requiresIfExists:["offset"],data:{_skip:!1}};function Nm(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 Mm(e){return[dn,Un,zn,fn].some(function(t){return e[t]>=0})}function qO(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=Nm(a,r),u=Nm(i,o,s),d=Mm(l),f=Mm(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const KO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:qO};function YO(e,t,n){var r=Tr(e),o=[fn,dn].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,[fn,Un].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function ZO(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=vm.reduce(function(d,f){return d[f]=YO(f,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 XO={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ZO};function JO(e){var t=e.state,n=e.name;t.modifiersData[n]=Am({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const QO={name:"popperOffsets",enabled:!0,phase:"read",fn:JO,data:{}};function RO(e){return e==="x"?"y":"x"}function eA(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,f=n.padding,p=n.tether,g=p===void 0?!0:p,m=n.tetherOffset,b=m===void 0?0:m,v=ci(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),w=Tr(t.placement),y=la(t.placement),S=!y,C=df(w),x=RO(C),E=t.modifiersData.popperOffsets,P=t.rects.reference,T=t.rects.popper,O=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,_=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(E){if(s){var k,B=C==="y"?dn:fn,$=C==="y"?zn:Un,z=C==="y"?"height":"width",K=E[C],F=K+v[B],V=K-v[$],D=g?-T[z]/2:0,A=y===sa?P[z]:T[z],j=y===sa?-T[z]:-P[z],q=t.elements.arrow,G=g&&q?uf(q):{width:0,height:0},Y=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Cm(),Q=Y[B],Z=Y[$],W=ii(0,P[z],G[z]),R=S?P[z]/2-D-W-Q-_.mainAxis:A-W-Q-_.mainAxis,re=S?-P[z]/2+D+W+Z+_.mainAxis:j+W+Z+_.mainAxis,fe=t.elements.arrow&&ai(t.elements.arrow),xe=fe?C==="y"?fe.clientTop||0:fe.clientLeft||0:0,ne=(k=N==null?void 0:N[C])!=null?k:0,Oe=K+R-ne-xe,Ie=K+re-ne,ut=ii(g?Xl(F,Oe):F,K,g?ws(V,Ie):V);E[C]=ut,L[C]=ut-K}if(i){var ot,we=C==="x"?dn:fn,et=C==="x"?zn:Un,tt=E[x],gt=x==="y"?"height":"width",Ne=tt+v[we],dt=tt-v[et],st=[dn,fn].indexOf(w)!==-1,Fe=(ot=N==null?void 0:N[x])!=null?ot:0,Yt=st?Ne:tt-P[gt]-T[gt]-Fe+_.altAxis,ge=st?tt+P[gt]+T[gt]-Fe-_.altAxis:dt,Ve=g&&st?EO(Yt,tt,ge):ii(g?Yt:Ne,tt,g?ge:dt);E[x]=Ve,L[x]=Ve-tt}t.modifiersData[r]=L}}const tA={name:"preventOverflow",enabled:!0,phase:"main",fn:eA,requiresIfExists:["offset"]};function nA(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function rA(e){return e===_n(e)||!Wn(e)?ff(e):nA(e)}function oA(e){var t=e.getBoundingClientRect(),n=aa(t.width)/e.offsetWidth||1,r=aa(t.height)/e.offsetHeight||1;return n!==1||r!==1}function sA(e,t,n){n===void 0&&(n=!1);var r=Wn(t),o=Wn(t)&&oA(t),s=To(t),a=ia(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((_r(t)!=="body"||hf(s))&&(i=rA(t)),Wn(t)?(l=ia(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=pf(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function aA(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 iA(e){var t=aA(e);return vO.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function lA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function cA(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 Lm={placement:"bottom",modifiers:[],strategy:"absolute"};function $m(){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 uA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?Lm:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Lm,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},f=[],p=!1,g={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:ys(i)?li(i):i.contextElement?li(i.contextElement):[],popper:li(l)};var S=iA(cA([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!p){var w=d.elements,y=w.reference,S=w.popper;if($m(y,S)){d.rects={reference:sA(y,ai(S),d.options.strategy==="fixed"),popper:uf(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(_){return d.modifiersData[_.name]=Object.assign({},_.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,T=P===void 0?{}:P,O=x.name;typeof E=="function"&&(d=E({state:d,options:T,name:O,instance:g})||d)}}}},update:lA(function(){return new Promise(function(v){g.forceUpdate(),v(d)})}),destroy:function(){b(),p=!0}};if(!$m(i,l))return g;g.setOptions(u).then(function(v){!p&&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 x=C({state:d,name:w,instance:g,options:S}),E=function(){};f.push(x||E)}})}function b(){f.forEach(function(v){return v()}),f=[]}return g}}var dA=[kO,QO,LO,SO,XO,GO,tA,OO,KO],fA=uA({defaultModifiers:dA}),pA=typeof Element<"u",hA=typeof Map=="function",gA=typeof Set=="function",mA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ec(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(!ec(e[r],t[r]))return!1;return!0}var s;if(hA&&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(!ec(r.value[1],t.get(r.value[0])))return!1;return!0}if(gA&&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(mA&&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(pA&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!ec(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var bA=function(t,n){try{return ec(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 vA=Au(bA);var yA=[],ui=function(t,n,r){r===void 0&&(r={});var o=Xe.useRef(null),s={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||yA},a=Xe.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],l=a[1],u=Xe.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,b=Object.keys(m.elements);tS.flushSync(function(){l({styles:hm(b.map(function(v){return[v,m.styles[v]||{}]})),attributes:hm(b.map(function(v){return[v,m.attributes[v]]}))})})},requires:["computeStyles"]}},[]),d=Xe.useMemo(function(){var p={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return vA(o.current,p)?o.current||p:(o.current=p,p)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),f=Xe.useRef();return gm(function(){f.current&&f.current.setOptions(d)},[d]),gm(function(){if(!(t==null||n==null)){var p=r.createPopper||fA,g=p(t,n,d);return f.current=g,function(){g.destroy(),f.current=null}}},[t,n,r.createPopper]),{state:f.current?f.current.state:null,styles:i.styles,attributes:i.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const Gn=h.forwardRef(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:f,size:p="m",titleClass:g=ee("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:b,...v},w){const y=Gr(o)?o:{};return c.jsxs("div",{...v,ref:w,style:m,className:ee(["gs-utl-card",d,b||md.bg,oe.b,u&&oe.rnd,l?U.br:oe.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&p==="l"&&"gs-utl-p-5",i&&p==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&p==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&p==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&p==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(I,{className:ee("gs-utl-card-title",g),items:"center",children:[c.jsx(H,{className:ee("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(H,{onClick:r,className:ee("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(se,{icon:(rt(o)?o:"")||X.close,size:"18px",...y})})]}),c.jsx("div",{className:ee("gs-utl-card-body",f),children:t})]})});var tc,wA=new Uint8Array(16);function SA(){if(!tc&&(tc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!tc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tc(wA)}const CA=/^(?:[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 xA(e){return typeof e=="string"&&CA.test(e)}for(var zt=[],mf=0;mf<256;++mf)zt.push((mf+256).toString(16).substr(1));function EA(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(!xA(n))throw TypeError("Stringified UUID is invalid");return n}function km(e,t,n){e=e||{};var r=e.random||(e.rng||SA)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,EA(r)}class PA extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const di=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 f=await u.json();throw new PA(f.error||"Request failed!",f.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 Or{static async get(t,n){return di(t,{...n,method:"GET"})}static async post(t,n){return di(t,{...n,method:"POST"})}static async put(t,n){return di(t,{...n,method:"PUT"})}static async patch(t,n){return di(t,{...n,method:"PATCH"})}static async delete(t,n){return di(t,{...n,method:"DELETE"})}}var nc=(e=>(e.Projects="projects",e.Settings="settings",e))(nc||{}),Vm=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(Vm||{});const Im={},_A=1,TA=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?_A:1,s=Im[r];if(s)t(s);else{if(!vr())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,Im[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),bf=async(e,t)=>(await TA(t)).transaction([e],"readwrite").objectStore(e),OA=async(e,t)=>{const n=await bf(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,f=u.value;s.push({key:d,data:f}),u.continue()}else r(s)}})},AA=async(e,t,n)=>{const r=await bf(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},NA=async(e,t,n)=>{const r=await bf(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var fi=(e=>(e.Existing="existing",e.Templates="templates",e))(fi||{});const MA=e=>{const t=bN();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},LA=(e,t)=>Or.get(MA(e),{...t}),$A=async e=>{try{const t=await LA(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},jm=async(e=vt.web)=>typeof window>"u"?[]:(await OA(nc.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}),Dm=new Set,Tn=new WeakMap,ca=new WeakMap,Ss=new WeakMap,vf=new WeakMap,kA=new WeakMap,ua=new WeakMap,rc=new WeakMap;let Oo;const Cs="__aa_tgt",yf="__aa_del",VA=e=>{const t=FA(e);t&&t.forEach(n=>BA(n))},IA=e=>{e.forEach(t=>{t.target===Oo&&DA(),Tn.has(t.target)&&xs(t.target)})};function jA(e){const t=vf.get(e);t==null||t.disconnect();let n=Tn.get(e),r=0;const o=5;n||(n=fa(e),Tn.set(e,n));const{offsetWidth:s,offsetHeight:a}=Oo,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&&xs(e)},{root:Oo,threshold:1,rootMargin:l});u.observe(e),vf.set(e,u)}function xs(e){clearTimeout(rc.get(e));const t=oc(e),n=typeof t=="function"?500:t.duration;rc.set(e,setTimeout(()=>{const r=Ss.get(e);(!r||r.finished)&&(Tn.set(e,fa(e)),jA(e))},n))}function DA(){clearTimeout(rc.get(Oo)),rc.set(Oo,setTimeout(()=>{Dm.forEach(e=>Bm(e,t=>Hm(()=>xs(t))))},100))}function HA(e){setTimeout(()=>{kA.set(e,setInterval(()=>Hm(xs.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Hm(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let wf,da;typeof window<"u"&&(Oo=document.documentElement,wf=new MutationObserver(VA),da=new ResizeObserver(IA),da.observe(Oo));function FA(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Sf(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(yf in o)return!1;Sf(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(yf in o)return!1;o instanceof Element&&(t.add(o),Sf(n.target,o),ca.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Sf(e,t){!t&&!(Cs in e)?Object.defineProperty(e,Cs,{value:e}):t&&!(Cs in t)&&Object.defineProperty(t,Cs,{value:e})}function BA(e){var t;const n=Oo.contains(e),r=Tn.has(e);n&&ca.has(e)&&ca.delete(e),Ss.has(e)&&((t=Ss.get(e))===null||t===void 0||t.cancel()),r&&n?zA(e):r&&!n?WA(e):UA(e)}function Ar(e){return Number(e.replace(/[^0-9.\-]/g,""))}function fa(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function Fm(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=Ar(i.paddingTop)+Ar(i.paddingBottom)+Ar(i.borderTopWidth)+Ar(i.borderBottomWidth),d=Ar(i.paddingLeft)+Ar(i.paddingRight)+Ar(i.borderRightWidth)+Ar(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function oc(e){return Cs in e&&ua.has(e[Cs])?ua.get(e[Cs]):{duration:250,easing:"ease-in-out"}}function Bm(e,...t){t.forEach(n=>n(e,ua.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,ua.has(r)))}}function zA(e){const t=Tn.get(e),n=fa(e);let r;if(!t)return;const o=oc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=Fm(e,t,n),f={transform:`translate(${s}px, ${a}px)`},p={transform:"translate(0, 0)"};i!==l&&(f.width=`${i}px`,p.width=`${l}px`),u!==d&&(f.height=`${u}px`,p.height=`${d}px`),r=e.animate([f,p],o)}else r=new Animation(o(e,"remain",t,n)),r.play();Ss.set(e,r),Tn.set(e,n),r.addEventListener("finish",xs.bind(null,e))}function UA(e){const t=fa(e);Tn.set(e,t);const n=oc(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()),Ss.set(e,r),r.addEventListener("finish",xs.bind(null,e))}function WA(e){if(!ca.has(e)||!Tn.has(e))return;const[t,n]=ca.get(e);Object.defineProperty(e,yf,{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]=GA(e),i=oc(e),l=Tn.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()),Ss.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Tn.delete(e),ca.delete(e),Ss.delete(e),(d=vf.get(e))===null||d===void 0||d.disconnect()})}function GA(e){const t=Tn.get(e),[n,,r]=Fm(e,t,fa(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=Tn.get(o)||fa(o),i=Math.round(t.top-a.top)-Ar(s.borderTopWidth),l=Math.round(t.left-a.left)-Ar(s.borderLeftWidth);return[i,l,n,r]}function qA(e,t={}){wf&&da&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Bm(e,xs,HA,n=>da==null?void 0:da.observe(n)),typeof t=="function"?ua.set(e,t):ua.set(e,{duration:250,easing:"ease-in-out",...t}),wf.observe(e,{childList:!0}),Dm.add(e))}function KA(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&qA(t.current,e)},[t]),t}const YA={[Qt.Info]:U.bgA,[Qt.Error]:"bg-red-500",[Qt.Success]:"bg-green-500",[Qt.Warning]:"bg-orange-400"},ZA=h.forwardRef(function(t,n){const r={[Qt.Info]:X.informationVariant,[Qt.Error]:X.fire,[Qt.Success]:X.checkBold,[Qt.Warning]:X.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=Qt.Info,autoHideTimeout:d=3e3}=t,f=h.useRef(null),p=h.useRef(),g=r[u],m=YA[u];h.useImperativeHandle(n,()=>f.current,[]);const b=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},v=()=>{d&&(p.current=setTimeout(b,d))},w=()=>p.current&&clearTimeout(p.current);h.useEffect(()=>(v(),w),[]);const y=a||o;return c.jsx(Gn,{className:ue(s,"overflow-hidden relative"),ref:f,onPointerEnter:w,onPointerLeave:v,children:c.jsxs(I,{space:"m",items:"center",className:ue(Ee.y),children:[c.jsx(H,{className:ue(m,oe.pill,"text-white gjs-p-1"),children:c.jsx(se,{icon:g,size:le.s})}),c.jsx(H,{grow:!0,className:ue("gjs-pr-3"),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(H,{className:ue("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(H,{className:ue(U.txtLowEmphasis),children:y}),!!l.length&&c.jsx(I,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(qe,{...C},S))})]})}),c.jsx(H,{className:ue("absolute top-1 right-1"),children:c.jsx(bt,{onClick:b,border:!1,children:c.jsx(se,{icon:X.close,size:le.s})})})]})})});de(h.forwardRef(function({className:t,toasts:n,onDismiss:r,...o},s){const a=KA({});return c.jsx("div",{className:ue(t,"w-80 gs-utl-z-30"),...o,ref:a,children:n.map(i=>c.jsx(ZA,{...i,className:ue("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Cf=(e=>(e.self="self",e.cloud="cloud",e))(Cf||{}),Es=(e=>(e.image="image",e.video="video",e))(Es||{}),dr=(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))(dr||{}),xf=(e=>(e.canvas="canvas",e.layers="layers",e))(xf||{}),Ao=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Ao||{}),Vt=(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))(Vt||{}),Ef=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(Ef||{});const pi=e=>e.replaceAll('"',"").replaceAll("'",""),Ps=e=>e.includes(",")?e:/\s/.test(e)?`'${pi(e)}'`:pi(e),zm=(e,t,n)=>({family:e,variant:t,...n}),hi=(e,t)=>{e=Ps(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:pi(e),menuVariant:n&&zm(Ps(`menuFont-${pi(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:zm(e,o,s)})))}},Pf=(e,t)=>{var i;const n=hi(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=pi(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 Ps(a)},Nr=", sans-serif",Um=["Arial, Helvetica"+Nr,"Arial Black, Gadget"+Nr,"Brush Script MT"+Nr,"Comic Sans MS, cursive"+Nr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Nr,"Impact, Charcoal"+Nr,"Lucida Sans Unicode, Lucida Grande"+Nr,"Tahoma, Geneva"+Nr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Nr,"Verdana, Geneva"+Nr].map(e=>({id:e,label:e.split(",")[0]})),XA=String.raw,oo=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},JA=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:f}=n??{},p=[oo`font-ascent-override: ${o};`,oo`font-display: ${r};`,oo`font-descent-override: ${s};`,oo`font-feature-settings: ${a};`,oo`font-line-gap-override: ${i};`,oo`font-stretch: ${l};`,oo`font-style: ${u};`,oo`font-unicode-range: ${d};`,oo`font-weight: ${f};`].filter(Boolean);return XA`
|
|
24
|
+
`));let p=d.props,g=typeof(p==null?void 0:p.className)=="function"?(...v)=>tc(p==null?void 0:p.className(...v),l.className):tc(p==null?void 0:p.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},Z1(d.props,la(Vd(l,["ref"]))),f,u,{ref:o(d.ref,u.ref)},m))}return h.createElement(s,Object.assign({},Vd(l,["ref"]),s!==h.Fragment&&u,s!==h.Fragment&&f),d)}function Id(){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 _5(...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 Z1(...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 la(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Vd(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let A5="div";var gr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(gr||{});function L5(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:A5,name:"Hidden"})}let mr=ze(L5),Hd=h.createContext(null);Hd.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 Es(){return h.useContext(Hd)}function ii({value:e,children:t}){return h.createElement(Hd.Provider,{value:e},t)}function M5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ts=[];M5(()=>{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 $o(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&&N5(n)?!1:r}function N5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function $5(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 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:$5(e)}}function rc(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))X1(n,Y1(t,r),o);return n}function Y1(e,t){return e?e+"["+t+"]":t}function X1(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())X1(e,Y1(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,""]):rc(n,t,e)}function J1(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||{}),k5={NODE_ENV:"production"},I5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(I5||{}),V5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(V5||{}),H5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(H5||{}),j5=(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))(j5||{});function Dd(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):co(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let D5={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:jd(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let i=Dd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===Je.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=Dd(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=Dd(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})}}},Fd=h.createContext(null);Fd.displayName="ComboboxActionsContext";function li(e){let t=h.useContext(Fd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,li),n}return t}let Q1=h.createContext(null);function F5(e){var t;let n=Ps("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=v5({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(Q1.Provider,{value:s},h.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&k5.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 Bd=h.createContext(null);Bd.displayName="ComboboxDataContext";function Ps(e){let t=h.useContext(Bd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ps),n}return t}function B5(e,t){return ke(t.type,D5,e,t)}let z5=h.Fragment;function U5(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:f=!1,immediate:p=!1,virtual:g=null,...m}=e,v=!1,b=null,[w=f?[]:void 0,y]=Xl(n,o,r),[S,C]=h.useReducer(B5,{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}),T=h.useRef(null),_=h.useRef(null),O=h.useRef(null),P=h.useRef(null),A=oe(typeof i=="string"?(R,le)=>{let ge=i;return(R==null?void 0:R[ge])===(le==null?void 0:le[ge])}:i??((R,le)=>R===le)),M=oe(R=>S.options.findIndex(le=>A(le.dataRef.current.value,R))),$=h.useCallback(R=>ke(L.mode,{1:()=>w.some(le=>A(le,R)),0:()=>A(w,R)}),[w]),j=oe(R=>S.activeOptionIndex===M(R)),L=h.useMemo(()=>({...S,immediate:v,optionsPropsRef:E,labelRef:T,inputRef:_,buttonRef:O,optionsRef:P,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let R=S.options.findIndex(le=>!le.dataRef.current.disabled);if(R!==-1)return R}return S.activeOptionIndex},calculateIndex:M,compare:A,isSelected:$,isActive:j,nullable:d,__demoMode:u}),[w,r,l,f,d,u,S,b]);Ze(()=>{},[b,void 0]),Ze(()=>{S.dataRef.current=L},[L]),$d([L.buttonRef,L.inputRef,L.optionsRef],()=>X.closeCombobox(),L.comboboxState===0);let D=h.useMemo(()=>{var R,le,ge;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]:(ge=(le=L.options[L.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ge:null,value:w}},[L,l,w]),W=oe(()=>{if(L.activeOptionIndex!==null){if(L.virtual)J(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:R}=L.options[L.activeOptionIndex];J(R.current.value)}X.goToOption(Je.Specific,L.activeOptionIndex)}}),F=oe(()=>{C({type:0}),x.current=!0}),k=oe(()=>{C({type:1}),x.current=!1}),H=oe((R,le,ge)=>(x.current=!1,R===Je.Specific?C({type:2,focus:Je.Specific,idx:le,trigger:ge}):C({type:2,focus:R,trigger:ge}))),V=oe((R,le)=>(C({type:3,payload:{id:R,dataRef:le}}),()=>{L.isActive(le.current.value)&&(x.current=!0),C({type:4,id:R})})),U=oe(R=>(C({type:5,id:R}),()=>C({type:5,id:null}))),J=oe(R=>ke(L.mode,{0(){return y==null?void 0:y(R)},1(){let le=L.value.slice(),ge=le.findIndex(Ee=>A(Ee,R));return ge===-1?le.push(R):le.splice(ge,1),y==null?void 0:y(le)}})),Y=oe(R=>{C({type:6,trigger:R})}),X=h.useMemo(()=>({onChange:J,registerOption:V,registerLabel:U,goToOption:H,closeCombobox:k,openCombobox:F,setActivationTrigger:Y,selectActiveOption:W}),[]),Q=t===null?{}:{ref:t},ee=h.useRef(null),G=hr();return h.useEffect(()=>{ee.current&&r!==void 0&&G.addEventListener(ee.current,"reset",()=>{y==null||y(r)})},[ee,y]),h.createElement(Fd.Provider,{value:X},h.createElement(Bd.Provider,{value:L},h.createElement(ii,{value:ke(L.comboboxState,{0:ft.Open,1:ft.Closed})},a!=null&&w!=null&&rc({[a]:w}).map(([R,le],ge)=>h.createElement(mr,{features:gr.Hidden,ref:ge===0?Ee=>{var Ce;ee.current=(Ce=Ee==null?void 0:Ee.closest("form"))!=null?Ce:null}:void 0,...la({key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:R,value:le})})),Be({ourProps:Q,theirProps:m,slot:D,defaultTag:z5,name:"Combobox"}))))}let W5="input";function G5(e,t){var n,r,o,s,a;let i=Et(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:f="text",...p}=e,g=Ps("Combobox.Input"),m=li("Combobox.Input"),v=Ye(g.inputRef,t),b=xs(g.inputRef),w=h.useRef(!1),y=hr(),S=oe(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),C=function(){var L;return typeof d=="function"&&g.value!==void 0?(L=d(g.value))!=null?L:"":typeof g.value=="string"?g.value:""}();K1(([L,D],[W,F])=>{if(w.current)return;let k=g.inputRef.current;k&&((F===0&&D===1||L!==W)&&(k.value=L),requestAnimationFrame(()=>{if(w.current||!k||(b==null?void 0:b.activeElement)!==k)return;let{selectionStart:H,selectionEnd:V}=k;Math.abs((V??0)-(H??0))===0&&H===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[C,g.comboboxState,b]),K1(([L],[D])=>{if(L===0&&D===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let F=W.value,{selectionStart:k,selectionEnd:H,selectionDirection:V}=W;W.value="",W.value=F,V!==null?W.setSelectionRange(k,H,V):W.setSelectionRange(k,H)}},[g.comboboxState]);let x=h.useRef(!1),E=oe(()=>{x.current=!0}),T=oe(()=>{y.nextFrame(()=>{x.current=!1})}),_=oe(L=>{switch(w.current=!0,L.key){case ve.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if(L.preventDefault(),L.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case ve.ArrowDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case ve.ArrowUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case ve.Home:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.PageUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.End:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.PageDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.Escape:return w.current=!1,g.comboboxState!==0?void 0:(L.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&L.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}}),O=oe(L=>{u==null||u(L),g.nullable&&g.mode===0&&L.target.value===""&&S(),m.openCombobox()}),P=oe(L=>{var D,W,F;let k=(D=L.relatedTarget)!=null?D:Ts.find(H=>H!==L.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains(k))&&!((F=g.buttonRef.current)!=null&&F.contains(k))&&g.comboboxState===0)return L.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=oe(L=>{var D,W,F;let k=(D=L.relatedTarget)!=null?D:Ts.find(H=>H!==L.currentTarget);(W=g.buttonRef.current)!=null&&W.contains(k)||(F=g.optionsRef.current)!=null&&F.contains(k)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),M=ai(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),$=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),j={ref:v,id:l,role:"combobox",type:f,"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(L=>{var D;return!((D=g.virtual)!=null&&D.disabled(L.dataRef.current.value))&&g.compare(L.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":M,"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:T,onKeyDown:_,onChange:O,onFocus:A,onBlur:P};return Be({ourProps:j,theirProps:p,slot:$,defaultTag:W5,name:"Combobox.Input"})}let q5="button";function K5(e,t){var n;let r=Ps("Combobox.Button"),o=li("Combobox.Button"),s=Ye(r.buttonRef,t),a=Et(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=hr(),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}}),f=oe(v=>{if($o(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})})}),p=ai(()=>{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:ia(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":p,disabled:r.disabled,onClick:f,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:q5,name:"Combobox.Button"})}let Z5="label";function Y5(e,t){let n=Et(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=Ps("Combobox.Label"),a=li("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:Z5,name:"Combobox.Label"})}let X5="ul",J5=bn.RenderStrategy|bn.Static;function Q5(e,t){let n=Et(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=Ps("Combobox.Options"),i=Ye(a.optionsRef,t),l=Es(),u=l!==null?(l&ft.Open)===ft.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]),q1({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=ai(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),f=h.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),p={"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:p,theirProps:s,slot:f,defaultTag:X5,features:J5,visible:u,name:"Combobox.Options"})}let R5="li";function eP(e,t){var n;let r=Et(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=Ps("Combobox.Option"),d=li("Combobox.Option"),f=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,p=u.isSelected(a),g=h.useRef(null),m=Dt({disabled:s,value:a,domRef:g,order:i}),v=h.useContext(Q1),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 P=Lr();return P.requestAnimationFrame(()=>{y.current=!0}),P.dispose},[u.virtual,u.__demoMode]),Ze(()=>{if(!y.current||u.comboboxState!==0||!f||u.activationTrigger===0)return;let P=Lr();return P.requestAnimationFrame(()=>{var A,M;(M=(A=g.current)==null?void 0:A.scrollIntoView)==null||M.call(A,{block:"nearest"})}),P.dispose},[g,f,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=oe(P=>{var A;if(s||(A=u.virtual)!=null&&A.disabled(a))return P.preventDefault();w(),F1()||requestAnimationFrame(()=>{var M;return(M=u.inputRef.current)==null?void 0:M.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=oe(()=>{var P;if(s||(P=u.virtual)!=null&&P.disabled(a))return d.goToOption(Je.Nothing);let A=u.calculateIndex(a);d.goToOption(Je.Specific,A)}),x=G1(),E=oe(P=>x.update(P)),T=oe(P=>{var A;if(!x.wasMoved(P)||s||(A=u.virtual)!=null&&A.disabled(a)||f)return;let M=u.calculateIndex(a);d.goToOption(Je.Specific,M,0)}),_=oe(P=>{var A;x.wasMoved(P)&&(s||(A=u.virtual)!=null&&A.disabled(a)||f&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),O=h.useMemo(()=>({active:f,selected:p,disabled:s}),[f,p,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":p,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:T,onMouseMove:T,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:O,defaultTag:R5,name:"Combobox.Option"})}let tP=ze(U5),nP=ze(K5),rP=ze(G5),oP=ze(Y5),sP=ze(Q5),aP=ze(eP),ca=Object.assign(tP,{Input:rP,Button:nP,Label:oP,Options:sP,Option:aP});function iP(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 oc(){let e=h.useRef(!1);return Ze(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function lP(e){let t=oe(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ld(()=>{n.current&&t()})}),[t])}var uo=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(uo||{});function R1(){let e=h.useRef(0);return B1("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let cP=h.createContext(!1);function uP(){return h.useContext(cP)}function dP(e){let t=uP(),n=h.useContext(em),r=xs(e),[o,s]=h.useState(()=>{if(!t&&n!==null||lo.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 fP=h.Fragment;function pP(e,t){let n=e,r=h.useRef(null),o=Ye(kd(d=>{r.current=d}),t),s=xs(r),a=dP(r),[i]=h.useState(()=>{var d;return lo.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=h.useContext(zd),u=Jl();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]),lP(()=>{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:Fn.createPortal(Be({ourProps:{ref:o},theirProps:n,defaultTag:fP,name:"Portal"}),i):null}let hP=h.Fragment,em=h.createContext(null);function gP(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return h.createElement(em.Provider,{value:n},Be({ourProps:o,theirProps:r,defaultTag:hP,name:"Popover.Group"}))}let zd=h.createContext(null);function mP(){let e=h.useContext(zd),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(zd.Provider,{value:o},s)},[o])]}let vP=ze(pP),bP=ze(gP);Object.assign(vP,{Group:bP});function yP({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=h.useRef((r=n==null?void 0:n.current)!=null?r:null),s=xs(o),a=oe(()=>{var i,l,u;let d=[];for(let f of e)f!==null&&(f instanceof HTMLElement?d.push(f):"current"in f&&f.current instanceof HTMLElement&&d.push(f.current));if(t!=null&&t.current)for(let f of t.current)d.push(f);for(let f of(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])f!==document.body&&f!==document.head&&f instanceof HTMLElement&&f.id!=="headlessui-portal-root"&&(f.contains(o.current)||f.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(p=>f.contains(p))||d.push(f));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(mr,{features:gr.Hidden,ref:o})},[o,n])}}function wP(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(mr,{features:gr.Hidden,ref:e})},[e])}}let tm=h.createContext(null);function nm(){let e=h.useContext(tm);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,nm),t}return e}function Ud(){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(tm.Provider,{value:o},n.children)},[t])]}let SP="p";function CP(e,t){let n=Et(),{id:r=`headlessui-description-${n}`,...o}=e,s=nm(),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:SP,name:s.name||"Description"})}let xP=ze(CP),rm=Object.assign(xP,{});var om;let EP=(om=h.startTransition)!=null?om:function(e){e()};var TP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(TP||{}),PP=(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))(PP||{});let OP={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}}},Wd=h.createContext(null);Wd.displayName="DisclosureContext";function Gd(e){let t=h.useContext(Wd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gd),n}return t}let qd=h.createContext(null);qd.displayName="DisclosureAPIContext";function sm(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,sm),n}return t}let Kd=h.createContext(null);Kd.displayName="DisclosurePanelContext";function _P(){return h.useContext(Kd)}function AP(e,t){return ke(t.type,OP,e,t)}let LP=h.Fragment;function MP(e,t){let{defaultOpen:n=!1,...r}=e,o=h.useRef(null),s=Ye(t,kd(b=>{o.current=b},e.as===void 0||e.as===h.Fragment)),a=h.useRef(null),i=h.useRef(null),l=h.useReducer(AP,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},f]=l,p=oe(b=>{f({type:1});let w=Mo(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:p}),[p]),m=h.useMemo(()=>({open:u===0,close:p}),[u,p]),v={ref:s};return h.createElement(Wd.Provider,{value:l},h.createElement(qd.Provider,{value:g},h.createElement(ii,{value:ke(u,{0:ft.Open,1:ft.Closed})},Be({ourProps:v,theirProps:r,slot:m,defaultTag:LP,name:"Disclosure"}))))}let NP="button";function $P(e,t){let n=Et(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=Gd("Disclosure.Button"),i=_P(),l=i===null?!1:i===s.panelId,u=h.useRef(null),d=Ye(u,t,l?null:s.buttonRef),f=Id();h.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let p=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;$o(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=ia(e,u),w=l?{ref:d,type:b,onKeyDown:p,onClick:m}:{ref:d,id:r,type:b,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:p,onKeyUp:g,onClick:m};return Be({mergeRefs:f,ourProps:w,theirProps:o,slot:v,defaultTag:NP,name:"Disclosure.Button"})}let kP="div",IP=bn.RenderStrategy|bn.Static;function VP(e,t){let n=Et(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=Gd("Disclosure.Panel"),{close:i}=sm("Disclosure.Panel"),l=Id(),u=Ye(t,s.panelRef,m=>{EP(()=>a({type:m?4:5}))});h.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=Es(),f=d!==null?(d&ft.Open)===ft.Open:s.disclosureState===0,p=h.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),g={ref:u,id:r};return h.createElement(Kd.Provider,{value:s.panelId},Be({mergeRefs:l,ourProps:g,theirProps:o,slot:p,defaultTag:kP,features:IP,visible:f,name:"Disclosure.Panel"}))}let HP=ze(MP),jP=ze($P),DP=ze(VP),Zd=Object.assign(HP,{Button:jP,Panel:DP}),am=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function im(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 am.test(a)&&(a=a.replace(am,"")),a}function FP(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():im(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return im(e).trim()}function BP(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=FP(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var zP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(zP||{}),UP=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(UP||{}),WP=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(WP||{}),GP=(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))(GP||{});function Yd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=co(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 qP={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=Yd(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=Yd(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=Yd(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})},Xd=h.createContext(null);Xd.displayName="ListboxActionsContext";function ci(e){let t=h.useContext(Xd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ci),n}return t}let Jd=h.createContext(null);Jd.displayName="ListboxDataContext";function ui(e){let t=h.useContext(Jd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ui),n}return t}function KP(e,t){return ke(t.type,qP,e,t)}let ZP=h.Fragment;function YP(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,...f}=e;const p=u?"horizontal":"vertical";let g=Ye(t),[m=d?[]:void 0,v]=Xl(n,a,r),[b,w]=h.useReducer(KP,{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,X)=>{let Q=i;return(Y==null?void 0:Y[Q])===(X==null?void 0:X[Q])}:i),T=h.useCallback(Y=>ke(_.mode,{1:()=>m.some(X=>E(X,Y)),0:()=>E(m,Y)}),[m]),_=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:p,compare:E,isSelected:T,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,l,d,b]);Ze(()=>{b.dataRef.current=_},[_]),$d([_.buttonRef,_.optionsRef],(Y,X)=>{var Q;w({type:1}),Nd(X,Rl.Loose)||(Y.preventDefault(),(Q=_.buttonRef.current)==null||Q.focus())},_.listboxState===0);let O=h.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),P=oe(Y=>{let X=_.options.find(Q=>Q.id===Y);X&&W(X.dataRef.current.value)}),A=oe(()=>{if(_.activeOptionIndex!==null){let{dataRef:Y,id:X}=_.options[_.activeOptionIndex];W(Y.current.value),w({type:2,focus:Je.Specific,id:X})}}),M=oe(()=>w({type:0})),$=oe(()=>w({type:1})),j=oe((Y,X,Q)=>Y===Je.Specific?w({type:2,focus:Je.Specific,id:X,trigger:Q}):w({type:2,focus:Y,trigger:Q})),L=oe((Y,X)=>(w({type:5,id:Y,dataRef:X}),()=>w({type:6,id:Y}))),D=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 X=_.value.slice(),Q=X.findIndex(ee=>E(ee,Y));return Q===-1?X.push(Y):X.splice(Q,1),v==null?void 0:v(X)}})),F=oe(Y=>w({type:3,value:Y})),k=oe(()=>w({type:4})),H=h.useMemo(()=>({onChange:W,registerOption:L,registerLabel:D,goToOption:j,closeListbox:$,openListbox:M,selectActiveOption:A,selectOption:P,search:F,clearSearch:k}),[]),V={ref:g},U=h.useRef(null),J=hr();return h.useEffect(()=>{U.current&&r!==void 0&&J.addEventListener(U.current,"reset",()=>{v==null||v(r)})},[U,v]),h.createElement(Xd.Provider,{value:H},h.createElement(Jd.Provider,{value:_},h.createElement(ii,{value:ke(_.listboxState,{0:ft.Open,1:ft.Closed})},s!=null&&m!=null&&rc({[s]:m}).map(([Y,X],Q)=>h.createElement(mr,{features:gr.Hidden,ref:Q===0?ee=>{var G;U.current=(G=ee==null?void 0:ee.closest("form"))!=null?G:null}:void 0,...la({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Y,value:X})})),Be({ourProps:V,theirProps:f,slot:O,defaultTag:ZP,name:"Listbox"}))))}let XP="button";function JP(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=ui("Listbox.Button"),i=ci("Listbox.Button"),l=Ye(a.buttonRef,t),u=hr(),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}}),f=oe(b=>{switch(b.key){case ve.Space:b.preventDefault();break}}),p=oe(b=>{if($o(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=ai(()=>{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:ia(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:f,onClick:p};return Be({ourProps:v,theirProps:s,slot:m,defaultTag:XP,name:"Listbox.Button"})}let QP="label";function RP(e,t){let n=Et(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=ui("Listbox.Label"),a=ci("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:QP,name:"Listbox.Label"})}let eO="ul",tO=bn.RenderStrategy|bn.Static;function nO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=ui("Listbox.Options"),i=ci("Listbox.Options"),l=Ye(a.optionsRef,t),u=hr(),d=hr(),f=Es(),p=f!==null?(f&ft.Open)===ft.Open:a.listboxState===0;h.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=Mo(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(),Lr().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=ai(()=>{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:eO,features:tO,visible:p,name:"Listbox.Options"})}let rO="li";function oO(e,t){let n=Et(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=ui("Listbox.Option"),l=ci("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),f=h.useRef(null),p=BP(f),g=Dt({disabled:o,value:s,domRef:f,get textValue(){return p()}}),m=Ye(t,f);Ze(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=Lr();return E.requestAnimationFrame(()=>{var T,_;(_=(T=f.current)==null?void 0:T.scrollIntoView)==null||_.call(T,{block:"nearest"})}),E.dispose},[f,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(),Lr().nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}))}),b=oe(()=>{if(o)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,r)}),w=G1(),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:rO,name:"Listbox.Option"})}let sO=ze(YP),aO=ze(JP),iO=ze(RP),lO=ze(nO),cO=ze(oO),di=Object.assign(sO,{Button:aO,Label:iO,Options:lO,Option:cO});var uO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(uO||{}),dO=(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))(dO||{});let fO={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}}},Qd=h.createContext(null);Qd.displayName="PopoverContext";function sc(e){let t=h.useContext(Qd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sc),n}return t}let Rd=h.createContext(null);Rd.displayName="PopoverAPIContext";function ef(e){let t=h.useContext(Rd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ef),n}return t}let tf=h.createContext(null);tf.displayName="PopoverGroupContext";function lm(){return h.useContext(tf)}let ac=h.createContext(null);ac.displayName="PopoverPanelContext";function pO(){return h.useContext(ac)}function hO(e,t){return ke(t.type,fO,e,t)}let gO="div";function mO(e,t){var n;let{__demoMode:r=!1,...o}=e,s=h.useRef(null),a=Ye(t,kd(D=>{s.current=D})),i=h.useRef([]),l=h.useReducer(hO,{__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:f,panel:p,panelId:g,beforePanelSentinel:m,afterPanelSentinel:v},b]=l,w=xs((n=s.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!p)return!1;for(let U of document.querySelectorAll("body > *"))if(Number(U==null?void 0:U.contains(d))^Number(U==null?void 0:U.contains(p)))return!0;let D=Ql(),W=D.indexOf(d),F=(W+D.length-1)%D.length,k=(W+1)%D.length,H=D[F],V=D[k];return!p.contains(H)&&!p.contains(V)},[d,p]),S=Dt(f),C=Dt(g),x=h.useMemo(()=>({buttonId:S,panelId:C,close:()=>b({type:1})}),[S,C,b]),E=lm(),T=E==null?void 0:E.registerPopover,_=oe(()=>{var D;return(D=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?D:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(p==null?void 0:p.contains(w.activeElement)))});h.useEffect(()=>T==null?void 0:T(x),[T,x]);let[O,P]=mP(),A=yP({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:O,defaultContainers:[d,p]});iP(w==null?void 0:w.defaultView,"focus",D=>{var W,F,k,H;D.target!==window&&D.target instanceof HTMLElement&&u===0&&(_()||d&&p&&(A.contains(D.target)||(F=(W=m.current)==null?void 0:W.contains)!=null&&F.call(W,D.target)||(H=(k=v.current)==null?void 0:k.contains)!=null&&H.call(k,D.target)||b({type:1})))},!0),$d(A.resolveContainers,(D,W)=>{b({type:1}),Nd(W,Rl.Loose)||(D.preventDefault(),d==null||d.focus())},u===0);let M=oe(D=>{b({type:1});let W=D?D instanceof HTMLElement?D:"current"in D&&D.current instanceof HTMLElement?D.current:d:d;W==null||W.focus()}),$=h.useMemo(()=>({close:M,isPortalled:y}),[M,y]),j=h.useMemo(()=>({open:u===0,close:M}),[u,M]),L={ref:a};return h.createElement(ac.Provider,{value:null},h.createElement(Qd.Provider,{value:l},h.createElement(Rd.Provider,{value:$},h.createElement(ii,{value:ke(u,{0:ft.Open,1:ft.Closed})},h.createElement(P,null,Be({ourProps:L,theirProps:o,slot:j,defaultTag:gO,name:"Popover"}),h.createElement(A.MainTreeNode,null))))))}let vO="button";function bO(e,t){let n=Et(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=sc("Popover.Button"),{isPortalled:i}=ef("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Et()}`,d=lm(),f=d==null?void 0:d.closeOthers,p=pO()!==null;h.useEffect(()=>{if(!p)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[p,r,a]);let[g]=h.useState(()=>Symbol()),m=Ye(l,t,p?null:A=>{if(A)s.buttons.current.push(g);else{let M=s.buttons.current.indexOf(g);M!==-1&&s.buttons.current.splice(M,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&a({type:2,button:A})}),v=Ye(l,t),b=xs(l),w=oe(A=>{var M,$,j;if(p){if(s.popoverState===1)return;switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),($=(M=A.target).click)==null||$.call(M),a({type:1}),(j=s.button)==null||j.focus();break}}else switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0});break;case ve.Escape:if(s.popoverState!==0)return f==null?void 0:f(s.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;A.preventDefault(),A.stopPropagation(),a({type:1});break}}),y=oe(A=>{p||A.key===ve.Space&&A.preventDefault()}),S=oe(A=>{var M,$;$o(A.currentTarget)||e.disabled||(p?(a({type:1}),(M=s.button)==null||M.focus()):(A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0}),($=s.button)==null||$.focus()))}),C=oe(A=>{A.preventDefault(),A.stopPropagation()}),x=s.popoverState===0,E=h.useMemo(()=>({open:x}),[x]),T=ia(e,l),_=p?{ref:v,type:T,onKeyDown:w,onClick:S}:{ref:m,id:s.buttonId,type:T,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},O=R1(),P=oe(()=>{let A=s.panel;if(!A)return;function M(){ke(O.current,{[uo.Forwards]:()=>an(A,_t.First),[uo.Backwards]:()=>an(A,_t.Last)})===Mr.Error&&an(Ql().filter($=>$.dataset.headlessuiFocusGuard!=="true"),ke(O.current,{[uo.Forwards]:_t.Next,[uo.Backwards]:_t.Previous}),{relativeTo:s.button})}M()});return h.createElement(h.Fragment,null,Be({ourProps:_,theirProps:o,slot:E,defaultTag:vO,name:"Popover.Button"}),x&&!p&&i&&h.createElement(mr,{id:u,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let yO="div",wO=bn.RenderStrategy|bn.Static;function SO(e,t){let n=Et(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=sc("Popover.Overlay"),i=Ye(t),l=Es(),u=l!==null?(l&ft.Open)===ft.Open:s===0,d=oe(p=>{if($o(p.currentTarget))return p.preventDefault();a({type:1})}),f=h.useMemo(()=>({open:s===0}),[s]);return Be({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:f,defaultTag:yO,features:wO,visible:u,name:"Popover.Overlay"})}let CO="div",xO=bn.RenderStrategy|bn.Static;function EO(e,t){let n=Et(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=sc("Popover.Panel"),{close:l,isPortalled:u}=ef("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Et()}`,f=`headlessui-focus-sentinel-after-${Et()}`,p=h.useRef(null),g=Ye(p,t,_=>{i({type:4,panel:_})}),m=xs(p),v=Id();Ze(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let b=Es(),w=b!==null?(b&ft.Open)===ft.Open:a.popoverState===0,y=oe(_=>{var O;switch(_.key){case ve.Escape:if(a.popoverState!==0||!p.current||m!=null&&m.activeElement&&!p.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1}),(O=a.button)==null||O.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||!p.current)return;let _=m==null?void 0:m.activeElement;p.current.contains(_)||an(p.current,_t.First)},[a.__demoMode,o,p,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 O,P,A,M,$;let j=_.relatedTarget;j&&p.current&&((O=p.current)!=null&&O.contains(j)||(i({type:1}),((A=(P=a.beforePanelSentinel.current)==null?void 0:P.contains)!=null&&A.call(P,j)||($=(M=a.afterPanelSentinel.current)==null?void 0:M.contains)!=null&&$.call(M,j))&&j.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=R1(),E=oe(()=>{let _=p.current;if(!_)return;function O(){ke(x.current,{[uo.Forwards]:()=>{var P;an(_,_t.First)===Mr.Error&&((P=a.afterPanelSentinel.current)==null||P.focus())},[uo.Backwards]:()=>{var P;(P=a.button)==null||P.focus({preventScroll:!0})}})}O()}),T=oe(()=>{let _=p.current;if(!_)return;function O(){ke(x.current,{[uo.Forwards]:()=>{var P;if(!a.button)return;let A=Ql(),M=A.indexOf(a.button),$=A.slice(0,M+1),j=[...A.slice(M+1),...$];for(let L of j.slice())if(L.dataset.headlessuiFocusGuard==="true"||(P=a.panel)!=null&&P.contains(L)){let D=j.indexOf(L);D!==-1&&j.splice(D,1)}an(j,_t.First,{sorted:!1})},[uo.Backwards]:()=>{var P;an(_,_t.Previous)===Mr.Error&&((P=a.button)==null||P.focus())}})}O()});return h.createElement(ac.Provider,{value:r},w&&u&&h.createElement(mr,{id:d,ref:a.beforePanelSentinel,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),Be({mergeRefs:v,ourProps:C,theirProps:s,slot:S,defaultTag:CO,features:xO,visible:w,name:"Popover.Panel"}),w&&u&&h.createElement(mr,{id:f,ref:a.afterPanelSentinel,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let TO="div";function PO(e,t){let n=h.useRef(null),r=Ye(n,t),[o,s]=h.useState([]),a=wP(),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=Mo(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()}),f=h.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),p=h.useMemo(()=>({}),[]),g=e,m={ref:r};return h.createElement(tf.Provider,{value:f},Be({ourProps:m,theirProps:g,slot:p,defaultTag:TO,name:"Popover.Group"}),h.createElement(a.MainTreeNode,null))}let OO=ze(mO),_O=ze(bO),AO=ze(SO),LO=ze(EO),MO=ze(PO),nf=Object.assign(OO,{Button:_O,Overlay:AO,Panel:LO,Group:MO}),cm=h.createContext(null);function um(){let e=h.useContext(cm);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,um),t}return e}function rf(){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(cm.Provider,{value:o},n.children)},[t])]}let NO="label";function $O(e,t){let n=Et(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=um(),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:NO,name:a.name||"Label"})}let kO=ze($O),dm=Object.assign(kO,{});function fm(e=0){let[t,n]=h.useState(e),r=oc(),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 IO=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(IO||{});let VO={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:co(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})}},of=h.createContext(null);of.displayName="RadioGroupDataContext";function pm(e){let t=h.useContext(of);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 sf=h.createContext(null);sf.displayName="RadioGroupActionsContext";function hm(e){let t=h.useContext(sf);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hm),n}return t}function HO(e,t){return ke(t.type,VO,e,t)}let jO="div";function DO(e,t){let n=Et(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=(k,H)=>k===H,disabled:d=!1,...f}=e,p=oe(typeof u=="string"?(k,H)=>{let V=u;return(k==null?void 0:k[V])===(H==null?void 0:H[V])}:u),[g,m]=h.useReducer(HO,{options:[]}),v=g.options,[b,w]=rf(),[y,S]=Ud(),C=h.useRef(null),x=Ye(C,t),[E,T]=Xl(o,l,s),_=h.useMemo(()=>v.find(k=>!k.propsRef.current.disabled),[v]),O=h.useMemo(()=>v.some(k=>p(k.propsRef.current.value,E)),[v,E]),P=oe(k=>{var H;if(d||p(k,E))return!1;let V=(H=v.find(U=>p(U.propsRef.current.value,k)))==null?void 0:H.propsRef.current;return V!=null&&V.disabled?!1:(T==null||T(k),!0)});q1({container:C.current,accept(k){return k.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:k.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(k){k.setAttribute("role","none")}});let A=oe(k=>{let H=C.current;if(!H)return;let V=Mo(H),U=v.filter(J=>J.propsRef.current.disabled===!1).map(J=>J.element.current);switch(k.key){case ve.Enter:J1(k.currentTarget);break;case ve.ArrowLeft:case ve.ArrowUp:if(k.preventDefault(),k.stopPropagation(),an(U,_t.Previous|_t.WrapAround)===Mr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.ArrowRight:case ve.ArrowDown:if(k.preventDefault(),k.stopPropagation(),an(U,_t.Next|_t.WrapAround)===Mr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.Space:{k.preventDefault(),k.stopPropagation();let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break}}),M=oe(k=>(m({type:0,...k}),()=>m({type:1,id:k.id}))),$=h.useMemo(()=>({value:E,firstOption:_,containsCheckedOption:O,disabled:d,compare:p,...g}),[E,_,O,d,p,g]),j=h.useMemo(()=>({registerOption:M,change:P}),[M,P]),L={ref:x,id:r,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:A},D=h.useMemo(()=>({value:E}),[E]),W=h.useRef(null),F=hr();return h.useEffect(()=>{W.current&&s!==void 0&&F.addEventListener(W.current,"reset",()=>{P(s)})},[W,P]),h.createElement(S,{name:"RadioGroup.Description"},h.createElement(w,{name:"RadioGroup.Label"},h.createElement(sf.Provider,{value:j},h.createElement(of.Provider,{value:$},i!=null&&E!=null&&rc({[i]:E}).map(([k,H],V)=>h.createElement(mr,{features:gr.Hidden,ref:V===0?U=>{var J;W.current=(J=U==null?void 0:U.closest("form"))!=null?J:null}:void 0,...la({key:k,as:"input",type:"radio",checked:H!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:k,value:H})})),Be({ourProps:L,theirProps:f,slot:D,defaultTag:jO,name:"RadioGroup"})))))}var FO=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(FO||{});let BO="div";function zO(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,f]=rf(),[p,g]=Ud(),{addFlag:m,removeFlag:v,hasFlag:b}=fm(1),w=Dt({value:s,disabled:a}),y=pm("RadioGroup.Option"),S=hm("RadioGroup.Option");Ze(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=oe(M=>{var $;if($o(M.currentTarget))return M.preventDefault();S.change(s)&&(m(2),($=l.current)==null||$.focus())}),x=oe(M=>{if($o(M.currentTarget))return M.preventDefault();m(2)}),E=oe(()=>v(2)),T=((n=y.firstOption)==null?void 0:n.id)===o,_=y.disabled||a,O=y.compare(y.value,s),P={ref:u,id:o,role:"radio","aria-checked":O?"true":"false","aria-labelledby":d,"aria-describedby":p,"aria-disabled":_?!0:void 0,tabIndex:_?-1:O||!y.containsCheckedOption&&T?0:-1,onClick:_?void 0:C,onFocus:_?void 0:x,onBlur:_?void 0:E},A=h.useMemo(()=>({checked:O,disabled:_,active:b(2)}),[O,_,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(f,{name:"RadioGroup.Label"},Be({ourProps:P,theirProps:i,slot:A,defaultTag:BO,name:"RadioGroup.Option"})))}let UO=ze(DO),WO=ze(zO),gm=Object.assign(UO,{Option:WO,Label:dm,Description:rm}),af=h.createContext(null);af.displayName="GroupContext";let GO=h.Fragment;function qO(e){var t;let[n,r]=h.useState(null),[o,s]=rf(),[a,i]=Ud(),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(f){n&&(f.currentTarget.tagName==="LABEL"&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(af.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:GO,name:"Switch.Group"}))))}let KO="button";function ZO(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:f,...p}=e,g=h.useContext(af),m=h.useRef(null),v=Ye(m,t,g===null?null:g.setSwitch),[b,w]=Xl(s,i,a),y=oe(()=>w==null?void 0:w(!b)),S=oe(O=>{if($o(O.currentTarget))return O.preventDefault();O.preventDefault(),y()}),C=oe(O=>{O.key===ve.Space?(O.preventDefault(),y()):O.key===ve.Enter&&J1(O.currentTarget)}),x=oe(O=>O.preventDefault()),E=h.useMemo(()=>({checked:b}),[b]),T={id:o,ref:v,role:"switch",type:ia(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},_=hr();return h.useEffect(()=>{var O;let P=(O=m.current)==null?void 0:O.closest("form");P&&a!==void 0&&_.addEventListener(P,"reset",()=>{w(a)})},[m,w]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(mr,{features:gr.Hidden,...la({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:f,checked:b,name:u,value:d})}),Be({ourProps:T,theirProps:p,slot:E,defaultTag:KO,name:"Switch"}))}let YO=ze(ZO),XO=qO,lf=Object.assign(YO,{Group:XO,Label:dm,Description:rm});function JO({onFocus:e}){let[t,n]=h.useState(!0),r=oc();return t?h.createElement(mr,{as:"button",type:"button",features:gr.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 mm=nt.createContext(null);function QO(){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 RO({children:e}){let t=nt.useRef(QO());return nt.createElement(mm.Provider,{value:t},e)}function vm(e){let t=nt.useContext(mm);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=e_(),[r,o]=t.current.get(e,n);return nt.useEffect(()=>o,[]),r}function e_(){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 t_=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(t_||{}),n_=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(n_||{}),r_=(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))(r_||{});let o_={0(e,t){var n;let r=co(e.tabs,d=>d.current),o=co(e.panels,d=>d.current),s=r.filter(d=>{var f;return!((f=d.current)!=null&&f.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 f=ke(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:f===-1?e.selectedIndex:f}}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=co([...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:co([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},cf=h.createContext(null);cf.displayName="TabsDataContext";function ua(e){let t=h.useContext(cf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ua),n}return t}let uf=h.createContext(null);uf.displayName="TabsActionsContext";function df(e){let t=h.useContext(uf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,df),n}return t}function s_(e,t){return ke(t.type,o_,e,t)}let a_=h.Fragment;function i_(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,f=Dt({isControlled:d}),p=Ye(t),[g,m]=h.useReducer(s_,{info:f,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(O=>(m({type:1,tab:O}),()=>m({type:2,tab:O}))),C=oe(O=>(m({type:3,panel:O}),()=>m({type:4,panel:O}))),x=oe(O=>{E.current!==O&&b.current(O),d||m({type:0,index:O})}),E=Dt(d?e.selectedIndex:g.selectedIndex),T=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 O=co(g.tabs,P=>P.current);O.some((P,A)=>g.tabs[A]!==P)&&x(O.indexOf(g.tabs[E.current]))});let _={ref:p};return h.createElement(RO,null,h.createElement(uf.Provider,{value:T},h.createElement(cf.Provider,{value:y},y.tabs.length<=0&&h.createElement(JO,{onFocus:()=>{var O,P;for(let A of w.current)if(((O=A.current)==null?void 0:O.tabIndex)===0)return(P=A.current)==null||P.focus(),!0;return!1}}),Be({ourProps:_,theirProps:i,slot:v,defaultTag:a_,name:"Tabs"}))))}let l_="div";function c_(e,t){let{orientation:n,selectedIndex:r}=ua("Tab.List"),o=Ye(t);return Be({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:l_,name:"Tabs.List"})}let u_="button";function d_(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:f}=ua("Tab"),p=df("Tab"),g=ua("Tab"),m=h.useRef(null),v=Ye(m,t);Ze(()=>p.registerTab(m),[p,m]);let b=vm("tabs"),w=d.indexOf(m);w===-1&&(w=b);let y=w===u,S=oe(P=>{var A;let M=P();if(M===Mr.Success&&l==="auto"){let $=(A=Mo(m))==null?void 0:A.activeElement,j=g.tabs.findIndex(L=>L.current===$);j!==-1&&p.change(j)}return M}),C=oe(P=>{let A=d.map(M=>M.current).filter(Boolean);if(P.key===ve.Space||P.key===ve.Enter){P.preventDefault(),P.stopPropagation(),p.change(w);return}switch(P.key){case ve.Home:case ve.PageUp:return P.preventDefault(),P.stopPropagation(),S(()=>an(A,_t.First));case ve.End:case ve.PageDown:return P.preventDefault(),P.stopPropagation(),S(()=>an(A,_t.Last))}if(S(()=>ke(i,{vertical(){return P.key===ve.ArrowUp?an(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowDown?an(A,_t.Next|_t.WrapAround):Mr.Error},horizontal(){return P.key===ve.ArrowLeft?an(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowRight?an(A,_t.Next|_t.WrapAround):Mr.Error}}))===Mr.Success)return P.preventDefault()}),x=h.useRef(!1),E=oe(()=>{var P;x.current||(x.current=!0,(P=m.current)==null||P.focus({preventScroll:!0}),p.change(w),Ld(()=>{x.current=!1}))}),T=oe(P=>{P.preventDefault()}),_=h.useMemo(()=>{var P;return{selected:y,disabled:(P=e.disabled)!=null?P:!1}},[y,e.disabled]),O={ref:v,onKeyDown:C,onMouseDown:T,onClick:E,id:s,role:"tab",type:ia(e,m),"aria-controls":(r=(n=f[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:O,theirProps:a,slot:_,defaultTag:u_,name:"Tabs.Tab"})}let f_="div";function p_(e,t){let{selectedIndex:n}=ua("Tab.Panels"),r=Ye(t),o=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:f_,name:"Tabs.Panels"})}let h_="div",g_=bn.RenderStrategy|bn.Static;function m_(e,t){var n,r,o,s;let a=Et(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=ua("Tab.Panel"),g=df("Tab.Panel"),m=h.useRef(null),v=Ye(m,t);Ze(()=>g.registerPanel(m),[g,m,i]);let b=vm("panels"),w=p.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=f[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(mr,{as:"span","aria-hidden":"true",...C}):Be({ourProps:C,theirProps:u,slot:S,defaultTag:h_,features:g_,visible:y,name:"Tabs.Panel"})}let v_=ze(d_),b_=ze(i_),y_=ze(c_),w_=ze(p_),S_=ze(m_),fi=Object.assign(v_,{Group:b_,List:y_,Panels:w_,Panel:S_});function C_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ff(e,...t){e&&t.length>0&&e.classList.add(...t)}function pf(e,...t){e&&t.length>0&&e.classList.remove(...t)}function x_(e,t){let n=Lr();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,f)=>f-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 E_(e,t,n,r){let o=n?"enter":"leave",s=Lr(),a=r!==void 0?C_(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 pf(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ff(e,...t.base,...i,...u),s.nextFrame(()=>{pf(e,...t.base,...i,...u),ff(e,...t.base,...i,...l),x_(e,()=>(pf(e,...t.base,...i),ff(e,...t.base,...t.entered),a()))}),s.dispose}function T_({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=oc(),i=hr(),l=Dt(n);Ze(()=>{e&&(l.current="enter")},[e]),Ze(()=>{let u=Lr();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(E_(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function ko(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let ic=h.createContext(null);ic.displayName="TransitionContext";var P_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(P_||{});function O_(){let e=h.useContext(ic);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function __(){let e=h.useContext(lc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let lc=h.createContext(null);lc.displayName="NestingContext";function cc(e){return"children"in e?cc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function bm(e,t){let n=Dt(e),r=h.useRef([]),o=oc(),s=hr(),a=oe((g,m=No.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===g);v!==-1&&(ke(m,{[No.Unmount](){r.current.splice(v,1)},[No.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!cc(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,No.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),f=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)}),p=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:f,onStop:p,wait:u,chains:d}),[i,a,r,f,p,d,u])}function A_(){}let L_=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function ym(e){var t;let n={};for(let r of L_)n[r]=(t=e[r])!=null?t:A_;return n}function M_(e){let t=h.useRef(ym(e));return h.useEffect(()=>{t.current=ym(e)},[e]),t}let N_="div",wm=bn.RenderStrategy;function $_(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:f,leave:p,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),w=Ye(b,t),y=(n=v.unmount)==null||n?No.Unmount:No.Hidden,{show:S,appear:C,initial:x}=O_(),[E,T]=h.useState(S?"visible":"hidden"),_=__(),{register:O,unregister:P}=_;h.useEffect(()=>O(b),[O,b]),h.useEffect(()=>{if(y===No.Hidden&&b.current){if(S&&E!=="visible"){T("visible");return}return ke(E,{hidden:()=>P(b),visible:()=>O(b)})}},[E,b,O,P,S,y]);let A=Dt({base:ko(v.className),enter:ko(l),enterFrom:ko(u),enterTo:ko(d),entered:ko(f),leave:ko(p),leaveFrom:ko(g),leaveTo:ko(m)}),M=M_({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),$=Jl();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 j=x&&!C,L=C&&S&&x,D=!$||j?"idle":S?"enter":"leave",W=fm(0),F=oe(Y=>ke(Y,{enter:()=>{W.addFlag(ft.Opening),M.current.beforeEnter()},leave:()=>{W.addFlag(ft.Closing),M.current.beforeLeave()},idle:()=>{}})),k=oe(Y=>ke(Y,{enter:()=>{W.removeFlag(ft.Opening),M.current.afterEnter()},leave:()=>{W.removeFlag(ft.Closing),M.current.afterLeave()},idle:()=>{}})),H=bm(()=>{T("hidden"),P(b)},_),V=h.useRef(!1);T_({immediate:L,container:b,classes:A,direction:D,onStart:Dt(Y=>{V.current=!0,H.onStart(b,Y,F)}),onStop:Dt(Y=>{V.current=!1,H.onStop(b,Y,k),Y==="leave"&&!cc(H)&&(T("hidden"),P(b))})});let U=v,J={ref:w};return L?U={...U,className:tc(v.className,...A.current.enter,...A.current.enterFrom)}:V.current&&(U.className=tc(v.className,(r=b.current)==null?void 0:r.className),U.className===""&&delete U.className),h.createElement(lc.Provider,{value:H},h.createElement(ii,{value:ke(E,{visible:ft.Open,hidden:ft.Closed})|W.flags},Be({ourProps:J,theirProps:U,defaultTag:N_,features:wm,visible:E==="visible",name:"Transition.Child"})))}function k_(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=h.useRef(null),i=Ye(a,t);Jl();let l=Es();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]=h.useState(n?"visible":"hidden"),f=bm(()=>{d("hidden")}),[p,g]=h.useState(!0),m=h.useRef([n]);Ze(()=>{p!==!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:p}),[n,r,p]);h.useEffect(()=>{if(n)d("visible");else if(!cc(f))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,f]);let b={unmount:o},w=oe(()=>{var S;p&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=oe(()=>{var S;p&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return h.createElement(lc.Provider,{value:f},h.createElement(ic.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement(Sm,{ref:i,...b,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:wm,visible:u==="visible",name:"Transition"})))}function I_(e,t){let n=h.useContext(ic)!==null,r=Es()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(hf,{ref:t,...e}):h.createElement(Sm,{ref:t,...e}))}let hf=ze(k_),Sm=ze($_),V_=ze(I_),gf=Object.assign(hf,{Child:V_,Root:hf});var Cm=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},xm=typeof window<"u"&&window.document&&window.document.createElement?nt.useLayoutEffect:nt.useEffect,yn="top",qn="bottom",Kn="right",wn="left",mf="auto",pi=[yn,qn,Kn,wn],da="start",hi="end",H_="clippingParents",Em="viewport",gi="popper",j_="reference",Tm=pi.reduce(function(e,t){return e.concat([t+"-"+da,t+"-"+hi])},[]),Pm=[].concat(pi,[mf]).reduce(function(e,t){return e.concat([t,t+"-"+da,t+"-"+hi])},[]),D_="beforeRead",F_="read",B_="afterRead",z_="beforeMain",U_="main",W_="afterMain",G_="beforeWrite",q_="write",K_="afterWrite",Z_=[D_,F_,B_,z_,U_,W_,G_,q_,K_];function Nr(e){return e?(e.nodeName||"").toLowerCase():null}function Ln(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Os(e){var t=Ln(e).Element;return e instanceof t||e instanceof Element}function Zn(e){var t=Ln(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function vf(e){if(typeof ShadowRoot>"u")return!1;var t=Ln(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Y_(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];!Zn(s)||!Nr(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 X_(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},{});!Zn(o)||!Nr(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const J_={name:"applyStyles",enabled:!0,phase:"write",fn:Y_,effect:X_,requires:["computeStyles"]};function $r(e){return e.split("-")[0]}var _s=Math.max,uc=Math.min,fa=Math.round;function bf(){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 Om(){return!/^((?!chrome|android).)*safari/i.test(bf())}function pa(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Zn(e)&&(o=e.offsetWidth>0&&fa(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&fa(r.height)/e.offsetHeight||1);var a=Os(e)?Ln(e):window,i=a.visualViewport,l=!Om()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,f=r.width/o,p=r.height/s;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function yf(e){var t=pa(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 _m(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&vf(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fo(e){return Ln(e).getComputedStyle(e)}function Q_(e){return["table","td","th"].indexOf(Nr(e))>=0}function Io(e){return((Os(e)?e.ownerDocument:e.document)||window.document).documentElement}function dc(e){return Nr(e)==="html"?e:e.assignedSlot||e.parentNode||(vf(e)?e.host:null)||Io(e)}function Am(e){return!Zn(e)||fo(e).position==="fixed"?null:e.offsetParent}function R_(e){var t=/firefox/i.test(bf()),n=/Trident/i.test(bf());if(n&&Zn(e)){var r=fo(e);if(r.position==="fixed")return null}var o=dc(e);for(vf(o)&&(o=o.host);Zn(o)&&["html","body"].indexOf(Nr(o))<0;){var s=fo(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 mi(e){for(var t=Ln(e),n=Am(e);n&&Q_(n)&&fo(n).position==="static";)n=Am(n);return n&&(Nr(n)==="html"||Nr(n)==="body"&&fo(n).position==="static")?t:n||R_(e)||t}function wf(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function vi(e,t,n){return _s(e,uc(t,n))}function eA(e,t,n){var r=vi(e,t,n);return r>n?n:r}function Lm(){return{top:0,right:0,bottom:0,left:0}}function Mm(e){return Object.assign({},Lm(),e)}function Nm(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var tA=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Mm(typeof t!="number"?t:Nm(t,pi))};function nA(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=$r(n.placement),l=wf(i),u=[wn,Kn].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var f=tA(o.padding,n),p=yf(s),g=l==="y"?yn:wn,m=l==="y"?qn:Kn,v=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],b=a[l]-n.rects.reference[l],w=mi(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=v/2-b/2,C=f[g],x=y-p[d]-f[m],E=y/2-p[d]/2+S,T=vi(C,E,x),_=l;n.modifiersData[r]=(t={},t[_]=T,t.centerOffset=T-E,t)}}function rA(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)||_m(t.elements.popper,o)&&(t.elements.arrow=o))}const oA={name:"arrow",enabled:!0,phase:"main",fn:nA,effect:rA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ha(e){return e.split("-")[1]}var sA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function aA(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 $m(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,f=e.isFixed,p=a.x,g=p===void 0?0:p,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=wn,C=yn,x=window;if(u){var E=mi(n),T="clientHeight",_="clientWidth";if(E===Ln(n)&&(E=Io(n),fo(E).position!=="static"&&i==="absolute"&&(T="scrollHeight",_="scrollWidth")),E=E,o===yn||(o===wn||o===Kn)&&s===hi){C=qn;var O=f&&E===x&&x.visualViewport?x.visualViewport.height:E[T];v-=O-r.height,v*=l?1:-1}if(o===wn||(o===yn||o===qn)&&s===hi){S=Kn;var P=f&&E===x&&x.visualViewport?x.visualViewport.width:E[_];g-=P-r.width,g*=l?1:-1}}var A=Object.assign({position:i},u&&sA),M=d===!0?aA({x:g,y:v},Ln(n)):{x:g,y:v};if(g=M.x,v=M.y,l){var $;return Object.assign({},A,($={},$[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({},A,(t={},t[C]=y?v+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function iA(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:$r(t.placement),variation:ha(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,$m(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,$m(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 lA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:iA,data:{}};var fc={passive:!0};function cA(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=Ln(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,fc)}),i&&l.addEventListener("resize",n.update,fc),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,fc)}),i&&l.removeEventListener("resize",n.update,fc)}}const uA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cA,data:{}};var dA={left:"right",right:"left",bottom:"top",top:"bottom"};function pc(e){return e.replace(/left|right|bottom|top/g,function(t){return dA[t]})}var fA={start:"end",end:"start"};function km(e){return e.replace(/start|end/g,function(t){return fA[t]})}function Sf(e){var t=Ln(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Cf(e){return pa(Io(e)).left+Sf(e).scrollLeft}function pA(e,t){var n=Ln(e),r=Io(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=Om();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+Cf(e),y:l}}function hA(e){var t,n=Io(e),r=Sf(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=_s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=_s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+Cf(e),l=-r.scrollTop;return fo(o||n).direction==="rtl"&&(i+=_s(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function xf(e){var t=fo(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Im(e){return["html","body","#document"].indexOf(Nr(e))>=0?e.ownerDocument.body:Zn(e)&&xf(e)?e:Im(dc(e))}function bi(e,t){var n;t===void 0&&(t=[]);var r=Im(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Ln(r),a=o?[s].concat(s.visualViewport||[],xf(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(bi(dc(a)))}function Ef(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function gA(e,t){var n=pa(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 Vm(e,t,n){return t===Em?Ef(pA(e,n)):Os(t)?gA(t,n):Ef(hA(Io(e)))}function mA(e){var t=bi(dc(e)),n=["absolute","fixed"].indexOf(fo(e).position)>=0,r=n&&Zn(e)?mi(e):e;return Os(r)?t.filter(function(o){return Os(o)&&_m(o,r)&&Nr(o)!=="body"}):[]}function vA(e,t,n,r){var o=t==="clippingParents"?mA(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=Vm(e,u,r);return l.top=_s(d.top,l.top),l.right=uc(d.right,l.right),l.bottom=uc(d.bottom,l.bottom),l.left=_s(d.left,l.left),l},Vm(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 Hm(e){var t=e.reference,n=e.element,r=e.placement,o=r?$r(r):null,s=r?ha(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case yn:l={x:a,y:t.y-n.height};break;case qn:l={x:a,y:t.y+t.height};break;case Kn:l={x:t.x+t.width,y:i};break;case wn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?wf(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case da:l[u]=l[u]-(t[d]/2-n[d]/2);break;case hi:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function yi(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?H_:i,u=n.rootBoundary,d=u===void 0?Em:u,f=n.elementContext,p=f===void 0?gi:f,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,w=Mm(typeof b!="number"?b:Nm(b,pi)),y=p===gi?j_:gi,S=e.rects.popper,C=e.elements[m?y:p],x=vA(Os(C)?C:C.contextElement||Io(e.elements.popper),l,d,a),E=pa(e.elements.reference),T=Hm({reference:E,element:S,strategy:"absolute",placement:o}),_=Ef(Object.assign({},S,T)),O=p===gi?_:E,P={top:x.top-O.top+w.top,bottom:O.bottom-x.bottom+w.bottom,left:x.left-O.left+w.left,right:O.right-x.right+w.right},A=e.modifiersData.offset;if(p===gi&&A){var M=A[o];Object.keys(P).forEach(function($){var j=[Kn,qn].indexOf($)>=0?1:-1,L=[yn,qn].indexOf($)>=0?"y":"x";P[$]+=M[L]*j})}return P}function bA(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?Pm:l,d=ha(r),f=d?i?Tm:Tm.filter(function(m){return ha(m)===d}):pi,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var g=p.reduce(function(m,v){return m[v]=yi(e,{placement:v,boundary:o,rootBoundary:s,padding:a})[$r(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function yA(e){if($r(e)===mf)return[];var t=pc(e);return[km(e),t,km(t)]}function wA(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,f=n.rootBoundary,p=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,v=n.allowedAutoPlacements,b=t.options.placement,w=$r(b),y=w===b,S=l||(y||!m?[pc(b)]:yA(b)),C=[b].concat(S).reduce(function(Y,X){return Y.concat($r(X)===mf?bA(t,{placement:X,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:v}):X)},[]),x=t.rects.reference,E=t.rects.popper,T=new Map,_=!0,O=C[0],P=0;P<C.length;P++){var A=C[P],M=$r(A),$=ha(A)===da,j=[yn,qn].indexOf(M)>=0,L=j?"width":"height",D=yi(t,{placement:A,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),W=j?$?Kn:wn:$?qn:yn;x[L]>E[L]&&(W=pc(W));var F=pc(W),k=[];if(s&&k.push(D[M]<=0),i&&k.push(D[W]<=0,D[F]<=0),k.every(function(Y){return Y})){O=A,_=!1;break}T.set(A,k)}if(_)for(var H=m?3:1,V=function(X){var Q=C.find(function(ee){var G=T.get(ee);if(G)return G.slice(0,X).every(function(R){return R})});if(Q)return O=Q,"break"},U=H;U>0;U--){var J=V(U);if(J==="break")break}t.placement!==O&&(t.modifiersData[r]._skip=!0,t.placement=O,t.reset=!0)}}const SA={name:"flip",enabled:!0,phase:"main",fn:wA,requiresIfExists:["offset"],data:{_skip:!1}};function jm(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 Dm(e){return[yn,Kn,qn,wn].some(function(t){return e[t]>=0})}function CA(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=yi(t,{elementContext:"reference"}),i=yi(t,{altBoundary:!0}),l=jm(a,r),u=jm(i,o,s),d=Dm(l),f=Dm(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const xA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:CA};function EA(e,t,n){var r=$r(e),o=[wn,yn].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,[wn,Kn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function TA(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=Pm.reduce(function(d,f){return d[f]=EA(f,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 PA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:TA};function OA(e){var t=e.state,n=e.name;t.modifiersData[n]=Hm({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const _A={name:"popperOffsets",enabled:!0,phase:"read",fn:OA,data:{}};function AA(e){return e==="x"?"y":"x"}function LA(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,f=n.padding,p=n.tether,g=p===void 0?!0:p,m=n.tetherOffset,v=m===void 0?0:m,b=yi(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),w=$r(t.placement),y=ha(t.placement),S=!y,C=wf(w),x=AA(C),E=t.modifiersData.popperOffsets,T=t.rects.reference,_=t.rects.popper,O=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,P=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(E){if(s){var $,j=C==="y"?yn:wn,L=C==="y"?qn:Kn,D=C==="y"?"height":"width",W=E[C],F=W+b[j],k=W-b[L],H=g?-_[D]/2:0,V=y===da?T[D]:_[D],U=y===da?-_[D]:-T[D],J=t.elements.arrow,Y=g&&J?yf(J):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Lm(),Q=X[j],ee=X[L],G=vi(0,T[D],Y[D]),R=S?T[D]/2-H-G-Q-P.mainAxis:V-G-Q-P.mainAxis,le=S?-T[D]/2+H+G+ee+P.mainAxis:U+G+ee+P.mainAxis,ge=t.elements.arrow&&mi(t.elements.arrow),Ee=ge?C==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ce=($=A==null?void 0:A[C])!=null?$:0,tt=W+R-Ce-Ee,Qe=W+le-Ce,Ot=vi(g?uc(F,tt):F,W,g?_s(k,Qe):k);E[C]=Ot,M[C]=Ot-W}if(i){var ut,Se=C==="x"?yn:wn,ot=C==="x"?qn:Kn,st=E[x],wt=x==="y"?"height":"width",Ne=st+b[Se],mt=st-b[ot],dt=[yn,wn].indexOf(w)!==-1,Ue=(ut=A==null?void 0:A[x])!=null?ut:0,en=dt?Ne:st-T[wt]-_[wt]-Ue+P.altAxis,he=dt?st+T[wt]+_[wt]-Ue-P.altAxis:mt,De=g&&dt?eA(en,st,he):vi(g?en:Ne,st,g?he:mt);E[x]=De,M[x]=De-st}t.modifiersData[r]=M}}const MA={name:"preventOverflow",enabled:!0,phase:"main",fn:LA,requiresIfExists:["offset"]};function NA(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $A(e){return e===Ln(e)||!Zn(e)?Sf(e):NA(e)}function kA(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 IA(e,t,n){n===void 0&&(n=!1);var r=Zn(t),o=Zn(t)&&kA(t),s=Io(t),a=pa(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Nr(t)!=="body"||xf(s))&&(i=$A(t)),Zn(t)?(l=pa(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=Cf(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function VA(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 HA(e){var t=VA(e);return Z_.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function jA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function DA(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 Fm={placement:"bottom",modifiers:[],strategy:"absolute"};function Bm(){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 FA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?Fm:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Fm,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},f=[],p=!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:Os(i)?bi(i):i.contextElement?bi(i.contextElement):[],popper:bi(l)};var S=HA(DA([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!p){var w=d.elements,y=w.reference,S=w.popper;if(Bm(y,S)){d.rects={reference:IA(y,mi(S),d.options.strategy==="fixed"),popper:yf(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(P){return d.modifiersData[P.name]=Object.assign({},P.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,T=x.options,_=T===void 0?{}:T,O=x.name;typeof E=="function"&&(d=E({state:d,options:_,name:O,instance:g})||d)}}}},update:jA(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),p=!0}};if(!Bm(i,l))return g;g.setOptions(u).then(function(b){!p&&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(){};f.push(x||E)}})}function v(){f.forEach(function(b){return b()}),f=[]}return g}}var BA=[uA,_A,lA,J_,PA,SA,MA,oA,xA],zA=FA({defaultModifiers:BA}),UA=typeof Element<"u",WA=typeof Map=="function",GA=typeof Set=="function",qA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function hc(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(!hc(e[r],t[r]))return!1;return!0}var s;if(WA&&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(!hc(r.value[1],t.get(r.value[0])))return!1;return!0}if(GA&&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(qA&&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(UA&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!hc(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var KA=function(t,n){try{return hc(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 ZA=Uu(KA);var YA=[],wi=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||YA},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);NS.flushSync(function(){l({styles:Cm(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:Cm(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=nt.useMemo(function(){var p={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return ZA(o.current,p)?o.current||p:(o.current=p,p)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),f=nt.useRef();return xm(function(){f.current&&f.current.setOptions(d)},[d]),xm(function(){if(!(t==null||n==null)){var p=r.createPopper||zA,g=p(t,n,d);return f.current=g,function(){g.destroy(),f.current=null}}},[t,n,r.createPopper]),{state:f.current?f.current.state:null,styles:i.styles,attributes:i.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const Yn=h.forwardRef(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:f,size:p="m",titleClass:g=Z("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},w){const y=Rr(o)?o:{};return c.jsxs("div",{...b,ref:w,style:m,className:Z(["gs-utl-card",d,v||xd.bg,te.b,u&&te.rnd,l?z.br:te.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&p==="l"&&"gs-utl-p-5",i&&p==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&p==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&p==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&p==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(I,{className:Z("gs-utl-card-title",g),items:"center",children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(B,{onClick:r,className:Z("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(ne,{icon:(ct(o)?o:"")||q.close,size:"18px",...y})})]}),c.jsx("div",{className:Z("gs-utl-card-body",f),children:t})]})});var gc,XA=new Uint8Array(16);function JA(){if(!gc&&(gc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!gc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gc(XA)}const QA=/^(?:[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 RA(e){return typeof e=="string"&&QA.test(e)}for(var Kt=[],Tf=0;Tf<256;++Tf)Kt.push((Tf+256).toString(16).substr(1));function e3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Kt[e[t+0]]+Kt[e[t+1]]+Kt[e[t+2]]+Kt[e[t+3]]+"-"+Kt[e[t+4]]+Kt[e[t+5]]+"-"+Kt[e[t+6]]+Kt[e[t+7]]+"-"+Kt[e[t+8]]+Kt[e[t+9]]+"-"+Kt[e[t+10]]+Kt[e[t+11]]+Kt[e[t+12]]+Kt[e[t+13]]+Kt[e[t+14]]+Kt[e[t+15]]).toLowerCase();if(!RA(n))throw TypeError("Stringified UUID is invalid");return n}function zm(e,t,n){e=e||{};var r=e.random||(e.rng||JA)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,e3(r)}class t3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Si=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 f=await u.json();throw new t3(f.error||"Request failed!",f.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 kr{static async get(t,n){return Si(t,{...n,method:"GET"})}static async post(t,n){return Si(t,{...n,method:"POST"})}static async put(t,n){return Si(t,{...n,method:"PUT"})}static async patch(t,n){return Si(t,{...n,method:"PATCH"})}static async delete(t,n){return Si(t,{...n,method:"DELETE"})}}var mc=(e=>(e.Projects="projects",e.Settings="settings",e))(mc||{}),Um=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(Um||{});const Wm={},n3=1,r3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?n3:1,s=Wm[r];if(s)t(s);else{if(!Tr())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,Wm[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),Pf=async(e,t)=>(await r3(t)).transaction([e],"readwrite").objectStore(e),o3=async(e,t)=>{const n=await Pf(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,f=u.value;s.push({key:d,data:f}),u.continue()}else r(s)}})},s3=async(e,t,n)=>{const r=await Pf(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},a3=async(e,t,n)=>{const r=await Pf(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var Ci=(e=>(e.Existing="existing",e.Templates="templates",e))(Ci||{});const i3=e=>{const t=K3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},l3=(e,t)=>kr.get(i3(e),{...t}),c3=async e=>{try{const t=await l3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},Gm=async(e=xt.web)=>typeof window>"u"?[]:(await o3(mc.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}),qm=new Set,Mn=new WeakMap,ga=new WeakMap,As=new WeakMap,Of=new WeakMap,u3=new WeakMap,ma=new WeakMap,vc=new WeakMap;let Vo;const Ls="__aa_tgt",_f="__aa_del",d3=e=>{const t=m3(e);t&&t.forEach(n=>v3(n))},f3=e=>{e.forEach(t=>{t.target===Vo&&h3(),Mn.has(t.target)&&Ms(t.target)})};function p3(e){const t=Of.get(e);t==null||t.disconnect();let n=Mn.get(e),r=0;const o=5;n||(n=ba(e),Mn.set(e,n));const{offsetWidth:s,offsetHeight:a}=Vo,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&&Ms(e)},{root:Vo,threshold:1,rootMargin:l});u.observe(e),Of.set(e,u)}function Ms(e){clearTimeout(vc.get(e));const t=bc(e),n=typeof t=="function"?500:t.duration;vc.set(e,setTimeout(()=>{const r=As.get(e);(!r||r.finished)&&(Mn.set(e,ba(e)),p3(e))},n))}function h3(){clearTimeout(vc.get(Vo)),vc.set(Vo,setTimeout(()=>{qm.forEach(e=>Ym(e,t=>Km(()=>Ms(t))))},100))}function g3(e){setTimeout(()=>{u3.set(e,setInterval(()=>Km(Ms.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Km(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Af,va;typeof window<"u"&&(Vo=document.documentElement,Af=new MutationObserver(d3),va=new ResizeObserver(f3),va.observe(Vo));function m3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Lf(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(_f in o)return!1;Lf(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(_f in o)return!1;o instanceof Element&&(t.add(o),Lf(n.target,o),ga.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Lf(e,t){!t&&!(Ls in e)?Object.defineProperty(e,Ls,{value:e}):t&&!(Ls in t)&&Object.defineProperty(t,Ls,{value:e})}function v3(e){var t;const n=Vo.contains(e),r=Mn.has(e);n&&ga.has(e)&&ga.delete(e),As.has(e)&&((t=As.get(e))===null||t===void 0||t.cancel()),r&&n?b3(e):r&&!n?w3(e):y3(e)}function Ir(e){return Number(e.replace(/[^0-9.\-]/g,""))}function ba(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function Zm(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=Ir(i.paddingTop)+Ir(i.paddingBottom)+Ir(i.borderTopWidth)+Ir(i.borderBottomWidth),d=Ir(i.paddingLeft)+Ir(i.paddingRight)+Ir(i.borderRightWidth)+Ir(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function bc(e){return Ls in e&&ma.has(e[Ls])?ma.get(e[Ls]):{duration:250,easing:"ease-in-out"}}function Ym(e,...t){t.forEach(n=>n(e,ma.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,ma.has(r)))}}function b3(e){const t=Mn.get(e),n=ba(e);let r;if(!t)return;const o=bc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=Zm(e,t,n),f={transform:`translate(${s}px, ${a}px)`},p={transform:"translate(0, 0)"};i!==l&&(f.width=`${i}px`,p.width=`${l}px`),u!==d&&(f.height=`${u}px`,p.height=`${d}px`),r=e.animate([f,p],o)}else r=new Animation(o(e,"remain",t,n)),r.play();As.set(e,r),Mn.set(e,n),r.addEventListener("finish",Ms.bind(null,e))}function y3(e){const t=ba(e);Mn.set(e,t);const n=bc(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()),As.set(e,r),r.addEventListener("finish",Ms.bind(null,e))}function w3(e){if(!ga.has(e)||!Mn.has(e))return;const[t,n]=ga.get(e);Object.defineProperty(e,_f,{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]=S3(e),i=bc(e),l=Mn.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()),As.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Mn.delete(e),ga.delete(e),As.delete(e),(d=Of.get(e))===null||d===void 0||d.disconnect()})}function S3(e){const t=Mn.get(e),[n,,r]=Zm(e,t,ba(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=Mn.get(o)||ba(o),i=Math.round(t.top-a.top)-Ir(s.borderTopWidth),l=Math.round(t.left-a.left)-Ir(s.borderLeftWidth);return[i,l,n,r]}function C3(e,t={}){Af&&va&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Ym(e,Ms,g3,n=>va==null?void 0:va.observe(n)),typeof t=="function"?ma.set(e,t):ma.set(e,{duration:250,easing:"ease-in-out",...t}),Af.observe(e,{childList:!0}),qm.add(e))}function x3(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&C3(t.current,e)},[t]),t}const E3={[on.Info]:z.bgA,[on.Error]:"bg-red-500",[on.Success]:"bg-green-500",[on.Warning]:"bg-orange-400"},T3=h.forwardRef(function(t,n){const r={[on.Info]:q.informationVariant,[on.Error]:q.fire,[on.Success]:q.checkBold,[on.Warning]:q.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=on.Info,autoHideTimeout:d=3e3}=t,f=h.useRef(null),p=h.useRef(),g=r[u],m=E3[u];h.useImperativeHandle(n,()=>f.current,[]);const v=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},b=()=>{d&&(p.current=setTimeout(v,d))},w=()=>p.current&&clearTimeout(p.current);h.useEffect(()=>(b(),w),[]);const y=a||o;return c.jsx(Yn,{className:ae(s,"overflow-hidden relative"),ref:f,onPointerEnter:w,onPointerLeave:b,children:c.jsxs(I,{space:"m",items:"center",className:ae(Te.y),children:[c.jsx(B,{className:ae(m,te.pill,"text-white gjs-p-1"),children:c.jsx(ne,{icon:g,size:se.s})}),c.jsx(B,{grow:!0,className:ae("gjs-pr-3"),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(B,{className:ae("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(B,{className:ae(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx(I,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(Ke,{...C},S))})]})}),c.jsx(B,{className:ae("absolute top-1 right-1"),children:c.jsx(Ct,{onClick:v,border:!1,children:c.jsx(ne,{icon:q.close,size:se.s})})})]})})});ce(h.forwardRef(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(T3,{...i,className:ae("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Mf=(e=>(e.self="self",e.cloud="cloud",e))(Mf||{}),Ns=(e=>(e.image="image",e.video="video",e))(Ns||{}),vr=(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))(vr||{}),Nf=(e=>(e.canvas="canvas",e.layers="layers",e))(Nf||{}),Ho=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Ho||{}),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||{}),$f=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))($f||{});const xi=e=>e.replaceAll('"',"").replaceAll("'",""),$s=e=>e.includes(",")?e:/\s/.test(e)?`'${xi(e)}'`:xi(e),Xm=(e,t,n)=>({family:e,variant:t,...n}),Ei=(e,t)=>{e=$s(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:xi(e),menuVariant:n&&Xm($s(`menuFont-${xi(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:Xm(e,o,s)})))}},kf=(e,t)=>{var i;const n=Ei(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=xi(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 $s(a)},Vr=", sans-serif",Jm=["Arial, Helvetica"+Vr,"Arial Black, Gadget"+Vr,"Brush Script MT"+Vr,"Comic Sans MS, cursive"+Vr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Vr,"Impact, Charcoal"+Vr,"Lucida Sans Unicode, Lucida Grande"+Vr,"Tahoma, Geneva"+Vr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Vr,"Verdana, Geneva"+Vr].map(e=>({id:e,label:e.split(",")[0]})),P3=String.raw,po=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},O3=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:f}=n??{},p=[po`font-ascent-override: ${o};`,po`font-display: ${r};`,po`font-descent-override: ${s};`,po`font-feature-settings: ${a};`,po`font-line-gap-override: ${i};`,po`font-stretch: ${l};`,po`font-style: ${u};`,po`font-unicode-range: ${d};`,po`font-weight: ${f};`].filter(Boolean);return P3`
|
|
90
25
|
@font-face {
|
|
91
26
|
font-family: ${e};
|
|
92
27
|
src: url('${t}');
|
|
93
28
|
${p.join(`
|
|
94
29
|
`)}
|
|
95
30
|
}
|
|
96
|
-
`},
|
|
97
|
-
`;return n.trim()},
|
|
31
|
+
`},Qm=(e={})=>{const t=Object.entries(e).map(([r,o])=>Ei(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=O3(o)+`
|
|
32
|
+
`;return n.trim()},Rm="data-project-fonts",ev="true",_3=`${Rm}="${ev}"`,tv=(e={})=>{const t=Qm(e);return t?`<style ${_3}>
|
|
98
33
|
${t}
|
|
99
|
-
</style>`:""},
|
|
100
|
-
`);a.innerHTML=u,
|
|
101
|
-
`))}if(n.customCodeBody=rb(e,n.customCodeBody).html,t.replaceDataSources&&lc(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];rt(u)&&(n[l]=ob(u,a))})}return n},ob=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const o=t[r.trim()];return o!==void 0?String(o):""}),sb=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",o=nn({page:e,key:"slug"})??"",s=n?ob(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}},cN=(e,t)=>e.get(`${ic}${t}`)||"",uN=(e,t,n)=>{e.set({[`${ic}${t}`]:n})},dN=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${sN}${n}`]=r})},fN=(e,t)=>{e.getModel().set("customData",{...ga(e),...t})},ga=e=>e.getModel().get("customData")??{},Of=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},nn=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?lN(t,a)[n]??s:Of(r)[n]??o},Mo=(e,t,n)=>{const r=e.em.getEditor(),s=ga(r).globalPageSettings||{};return nn({page:e,key:t,opts:n})||s[t]},ab=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:nn({...r,key:"slug",defPage:al(n)}),title:nn({...r,key:"title",defPage:n}),description:nn({...r,key:"description"}),favicon:nn({...r,key:"favicon"}),keywords:nn({...r,key:"keywords"}),socialTitle:nn({...r,key:"socialTitle",defPage:n}),socialImage:nn({...r,key:"socialImage"}),socialDescription:nn({...r,key:"socialDescription"}),customCodeHead:nn({...r,key:"customCodeHead"}),customCodeBody:nn({...r,key:"customCodeBody"})}},uc=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${yn.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(ae.layoutRemove,{id:i,force:o})),a.runCommand(ae.layoutToggle,{...t})}}),ib={type:"static",layoutId:"leftPanelsContainer"},lb={width:240,overflow:"hidden"};uc({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:lb,placer:ib}}),uc({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:lb,placer:ib}}),uc({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),uc({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 pN={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var hN={};class gN{constructor(t,n){var s,a;this.projectType=vt.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=hN.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=vr()?window.location.search:"";this.queryParams=yS(r),en(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&vP(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return _u({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)||pN;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===vt.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)===Ef.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Ef.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 f,p;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:o}=t.localSettingsStore,s=(f=n.project)==null?void 0:f.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(p=(yield jm(o)).find(m=>m.id===r))==null?void 0:p.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}__${wS()}`:r;this._projectId=i,a.key=i,vS(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||vt.web,this.editor&&fN(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(mN(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(Oh,{baseApiUrl:r});const s=yield Or.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}=a;l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Pu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Pu,{}))}}*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 mN=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||vt.web},ye=()=>bn().appEditorStore,cb=()=>yh().appEditorStore,bN=()=>{try{return yh().appEditorStore}catch{}},Af=()=>{const[e,t]=h.useState(0),n=bn().appEditorStore,{transitionTime:r}=n;return h.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},Nf=()=>{const{baseApiUrl:e}=cb();return`${e}/assets/sdk`},vN=e=>`${Nf()}/${e}`,yN=async(e,t,n)=>{const r=await Or.get(Nf(),{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}))},wN=async(e,t,n,r)=>{const o=await Or.post(Nf(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},SN=async(e,t)=>await Or.put(t,{body:e,rawText:!0}),CN=async(e,t,n,r)=>Promise.all(e.map(o=>wN({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 SN(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:Es.image}}))),xN=async(e,t,n,r)=>{const o=await Or.delete(vN(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},ub=async(e,t,n,r)=>Promise.all(e.map(o=>xN(o.id||o.src,t,n,r)));function Lo(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const f=Date.now()-a;f<l&&f>=0?r=setTimeout(u,l-f):(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 db{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,en(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Lo(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(Es.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 f=a.map(n.toAssetProps);this.setCustomAssetProps(f)}else{const f={...a,items:a.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],f])}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 fb=e=>bn().assetsStore.assetPanelStores[e];class EN{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${km()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new db(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),en(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Cf.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Cf.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})=>CN(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 ub(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:Es.image,onLoad:()=>yN(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:f}=u;await ub(d,s,r,o),this.deleteFromProjectAssets(u),await f({clearExisting:!1})}}}onEditor(){const t=Lo(()=>!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=Ze(t)?t({providers:yo(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=>rt(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new db(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)),Qm(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),Qm(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()??Es.image,asset:r}}return{...t,type:t.type||Es.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 vi=()=>bn().assetsStore;class PN{constructor(t){var r;this.store=t,this.fonts={},en(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=Ze(n)?n({baseDefault:Um}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>rt(t)?{id:t,label:t}:Ym(t)?t:null).filter(t=>!!t):Um}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!rt(n)&&!Ym(n)).map(n=>hi(n.family,n)):[]}get sortedFonts(){return RA(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return eN([...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 Nt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Nt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=ga(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=hi(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=Ps(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=hi(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=Ps(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...ga(t).globalPageSettings,fonts:yo(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),tb(t),t.trigger(yn.pageSettingsUpdate,{data:r})}}const yi=()=>bn().fontsStore;class _N{constructor(t){this.store=t,en(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=()=>bn().i18nStore,qn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),pb="gs-custom-layout",TN=h.forwardRef(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=ye(),d=h.useRef(null),f=n,p=f&&u?c.jsx(f,{...a,editor:u}):null,g=M(pb,o&&`${pb}__${o}`,t),m=r&&!s;return h.useImperativeHandle(l,()=>d.current,[]),h.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(rt(y))b.innerHTML=y;else{if(y instanceof HTMLElement)return v(y),()=>{w(y)};if(Ze(y))return()=>{y()}}},[s,u,d.current]),m?p:c.jsx("div",{className:g,ref:d,...i,children:p})}),Mf=de(TN);class ON{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,en(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${yn.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(`${yn.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=qn(t,Mf))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const hb=()=>bn().layoutStore,AN=()=>yh().layoutStore;class NN{constructor(t){this.isActive=!1,this.content="",this.store=t,en(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class MN{constructor(t){this.store=t,this._projectSourceFilter=fi.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,en(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===fi.Existing?this.projects:this.templates}async loadProjects(){const t=await jm(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 $A(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){NA(nc.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 gb=()=>bn().templatesStore;class LN{constructor(t){this.toasts=[],this.store=t,en(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,{...rt(n)?{header:n}:n,variant:Qt.Error})}addWarning(t,n){this.add(t,{...rt(n)?{header:n}:n,variant:Qt.Warning})}addSuccess(t,n){this.add(t,{...rt(n)?{header:n}:n,variant:Qt.Success})}addInfo(t,n){this.add(t,{...rt(n)?{header:n}:n,variant:Qt.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class $N{constructor(t){this.isOpen=!1,this.store=t,en(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(yn.toggleBlocksPanel,{isOpen:this.isOpen})}}const kN=()=>bn().blockManagerStore,mb=":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",VN=mb+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",IN="["+mb+"]["+VN+"]*",jN=new RegExp("^"+IN+"$");function bb(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 dc=function(e){const t=jN.exec(e);return!(t===null||typeof t>"u")};function DN(e){return typeof e<"u"}const HN={allowBooleanAttributes:!1,unpairedTags:[]};function FN(e,t){t=Object.assign({},HN,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=yb(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=wb(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]!==`
|
|
102
|
-
`&&e[s]!=="\r";s++)l+=e[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!
|
|
103
|
-
`||e==="\r"}function yb(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 Pt("InvalidXml","XML declaration allowed only at the start of the document.",rn(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function wb(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 BN='"',zN="'";function UN(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===BN||e[t]===zN)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 WN=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Sb(e,t){const n=bb(e,WN),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Pt("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",wi(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Pt("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",wi(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Pt("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",wi(n[o]));const s=n[o][2];if(!KN(s))return Pt("InvalidAttr","Attribute '"+s+"' is an invalid name.",wi(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return Pt("InvalidAttr","Attribute '"+s+"' is repeated.",wi(n[o]))}return!0}function GN(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 qN(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,GN(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 Pt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function KN(e){return dc(e)}function YN(e){return dc(e)}function rn(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function wi(e){return e.startIndex+e[1].length}const ZN={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},XN=function(e){return Object.assign({},ZN,e)};let fc;typeof Symbol!="function"?fc="@@xmlMetadata":fc=Symbol("XML Node Metadata");class _s{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][fc]={startIndex:n})}static getMetaDataSymbol(){return fc}}class JN{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&&Ts(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&&Ts(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Ts(t,"!ATTLIST",n))n+=8;else if(s&&Ts(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Ts(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=pn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Si(r),n=pn(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=pn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Si(r),n=pn(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=pn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=pn(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=pn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!dc(r))throw new Error(`Invalid element name: "${r}"`);n=pn(t,n);let o="";if(t[n]==="E"&&Ts(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ts(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=pn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Si(r),n=pn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Si(o))throw new Error(`Invalid attribute name: "${o}"`);n=pn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=pn(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(),!Si(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=pn(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=pn(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 pn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Ts(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Si(e){if(dc(e))return e;throw new Error(`Invalid entity name ${e}`)}const QN=/^[-+]?0x[a-fA-F0-9]+$/,RN=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,e3={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function t3(e,t={}){if(t=Object.assign({},e3,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&&QN.test(n))return s3(n,16);if(n.search(/.+[eE].+/)!==-1)return r3(e,n,t);{const r=RN.exec(n);if(r){const o=r[1]||"",s=r[2];let a=o3(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 n3=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function r3(e,t,n){if(!n.eNotation)return e;const r=t.match(n3);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 o3(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 s3(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 Cb(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 a3{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=i3,this.parseXml=f3,this.parseTextData=l3,this.resolveNameSpace=c3,this.buildAttributesMap=d3,this.isItStopNode=m3,this.replaceEntitiesValue=h3,this.readStopNodeData=v3,this.saveTextToParentTag=g3,this.addChild=p3,this.ignoreAttributesFn=Cb(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 i3(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 l3(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?$f(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?$f(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function c3(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 u3=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function d3(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=bb(e,u3),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]=$f(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 f3=function(e){e=e.replace(/\r\n?/g,`
|
|
104
|
-
`);const t=new
|
|
105
|
-
`;function
|
|
34
|
+
</style>`:""},A3=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),L3=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),nv=e=>!!e.id,ya=e=>t=>(t.tagName||"").toLowerCase()===e,Hr=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),M3=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},wa=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},jo=(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))},Pi=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},N3=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),If=(e,t,n="html")=>{const{Pages:r}=e,o=ln({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":Sl(o||t.getName())}.${n}`},$3=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},yc="custom-html-body",wc="data-custom-html-body",rv="data-global-custom-html-head",ov="data-global-custom-html-body",sv="global",k3=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Hf(t.appStore);let a=o.querySelector(`[${rv}]`);a||(a=o.createElement("div"),a.setAttribute(rv,"true"),o.head.insertBefore(a,o.head.firstChild));const i=tv(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
|
|
35
|
+
`);a.innerHTML=u,Qh(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Hf(t.appStore);let a=o.querySelector(`[${ov}]`);if(!a){a=o.createElement("div"),a.setAttribute(ov,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",Qh(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(Pn.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(yc,{isComponent:o=>Ti(o,wc),model:{defaults:{attributes:{[wc]:!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(),f=[];d.forEach(m=>{m.has(sv)&&f.push(m)}),f.forEach(m=>{const v=m.toHTML();a.includes(v)||(a+=v),m.remove()});const p=[];u.findType(yc).forEach(m=>{m.has(sv)&&p.push(m)}),p.forEach(m=>{const v=m.getInnerHTML();i.includes(v)||(i+=v),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},Oi="page://",Sc="href-params__",I3=`data-gjs-${Sc}`,Cc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},xc=e=>!!Cc(e),av=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},V3=e=>!!(e!=null&&e.Components.getType("mjml")),iv=e=>xc(e)?q.database:Vf(e)?q.home:"",lv=e=>!!e.getSymbolOverride()?c.jsx(ne,{icon:q.rhombusOutline,size:se.s3x}):c.jsx(y1,{className:N("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),cv=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Vf=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},pt={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"}},uv=e=>{for(const t in pt){const n=t;if(pt[n]({cmp:e}))return n}},dv=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(yc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},H3=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.forEach(u=>{pt.title({cmp:u})?(u.components(t.title),delete n.title):pt.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):pt.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):pt.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):pt.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):pt.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):pt.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):uv(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=dv(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:yc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},j3=(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});pt.title({cmp:i})?n.title=i.getInnerHTML():pt.favicon({cmp:i})?n.favicon=u:pt.description({cmp:i})?n.description=l:pt.keywords({cmp:i})?n.keywords=l:pt.socialTitle({cmp:i})?n.socialTitle=l:pt.socialDescription({cmp:i})?n.socialDescription=l:pt.socialImage({cmp:i})?n.socialImage=l:uv(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
|
|
36
|
+
`))}if(n.customCodeBody=dv(e,n.customCodeBody).html,t.replaceDataSources&&Cc(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]=fv(u,a))})}return n},fv=(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=ln({page:e,key:"slug"})??"",s=n?fv(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=`${Sl(l)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},D3=(e,t)=>e.get(`${Sc}${t}`)||"",F3=(e,t,n)=>{e.set({[`${Sc}${t}`]:n})},B3=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${I3}${n}`]=r})},z3=(e,t)=>{e.getModel().set("customData",{...Sa(e),...t})},Sa=e=>e.getModel().get("customData")??{},Hf=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},ln=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?j3(t,a)[n]??s:Hf(r)[n]??o},Do=(e,t,n)=>{const r=e.em.getEditor(),s=Sa(r).globalPageSettings||{};return ln({page:e,key:t,opts:n})||s[t]},hv=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:ln({...r,key:"slug",defPage:Sl(n)}),title:ln({...r,key:"title",defPage:n}),description:ln({...r,key:"description"}),favicon:ln({...r,key:"favicon"}),keywords:ln({...r,key:"keywords"}),socialTitle:ln({...r,key:"socialTitle",defPage:n}),socialImage:ln({...r,key:"socialImage"}),socialDescription:ln({...r,key:"socialDescription"}),customCodeHead:ln({...r,key:"customCodeHead"}),customCodeBody:ln({...r,key:"customCodeBody"})}},Ec=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${Pn.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(re.layoutRemove,{id:i,force:o})),a.runCommand(re.layoutToggle,{...t})}}),gv={type:"static",layoutId:"leftPanelsContainer"},mv={width:240,overflow:"hidden"};Ec({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:mv,placer:gv}}),Ec({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:mv,placer:gv}}),Ec({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Ec({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 U3={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var W3={NODE_ENV:"production"};class G3{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=W3.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=Tr()?window.location.search:"";this.queryParams=XS(r),sn(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&fT(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return Bu({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)||U3;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)===$f.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===$f.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 f,p;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:o}=t.localSettingsStore,s=(f=n.project)==null?void 0:f.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(p=(yield Gm(o)).find(m=>m.id===r))==null?void 0:p.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}__${JS()}`:r;this._projectId=i,a.key=i,YS(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&&z3(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(q3(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(Jh,{baseApiUrl:r});const s=yield kr.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}=a;l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Fu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Fu,{}))}}*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 q3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||xt.web},we=()=>En().appEditorStore,vv=()=>Dh().appEditorStore,K3=()=>{try{return Dh().appEditorStore}catch{}},jf=()=>{const[e,t]=h.useState(0),n=En().appEditorStore,{transitionTime:r}=n;return h.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},Df=()=>{const{baseApiUrl:e}=vv();return`${e}/assets/sdk`},Z3=e=>`${Df()}/${e}`,Y3=async(e,t,n)=>{const r=await kr.get(Df(),{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}))},X3=async(e,t,n,r)=>{const o=await kr.post(Df(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},J3=async(e,t)=>await kr.put(t,{body:e,rawText:!0}),Q3=async(e,t,n,r)=>Promise.all(e.map(o=>X3({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 J3(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:Ns.image}}))),R3=async(e,t,n,r)=>{const o=await kr.delete(Z3(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},bv=async(e,t,n,r)=>Promise.all(e.map(o=>R3(o.id||o.src,t,n,r)));function Fo(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const f=Date.now()-a;f<l&&f>=0?r=setTimeout(u,l-f):(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 yv{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,sn(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Fo(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(Ns.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 f=a.map(n.toAssetProps);this.setCustomAssetProps(f)}else{const f={...a,items:a.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],f])}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 wv=e=>En().assetsStore.assetPanelStores[e];class e4{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${zm()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new yv(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),sn(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Mf.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Mf.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})=>Q3(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 bv(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:Ns.image,onLoad:()=>Y3(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:f}=u;await bv(d,s,r,o),this.deleteFromProjectAssets(u),await f({clearExisting:!1})}}}onEditor(){const t=Fo(()=>!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:To(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 yv(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)),av(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),av(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()??Ns.image,asset:r}}return{...t,type:t.type||Ns.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 _i=()=>En().assetsStore;class t4{constructor(t){var r;this.store=t,this.fonts={},sn(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=et(n)?n({baseDefault:Jm}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>ct(t)?{id:t,label:t}:nv(t)?t:null).filter(t=>!!t):Jm}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!ct(n)&&!nv(n)).map(n=>Ei(n.family,n)):[]}get sortedFonts(){return A3(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return L3([...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}=Sa(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=Ei(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=$s(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=Ei(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=$s(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...Sa(t).globalPageSettings,fonts:To(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),cv(t),t.trigger(Pn.pageSettingsUpdate,{data:r})}}const Ai=()=>En().fontsStore;class n4{constructor(t){this.store=t,sn(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=()=>En().i18nStore,Xn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),Sv="gs-custom-layout",r4=h.forwardRef(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=we(),d=h.useRef(null),f=n,p=f&&u?c.jsx(f,{...a,editor:u}):null,g=N(Sv,o&&`${Sv}__${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?p:c.jsx("div",{className:g,ref:d,...i,children:p})}),Ff=ce(r4);class o4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,sn(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${Pn.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(`${Pn.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=Xn(t,Ff))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const Cv=()=>En().layoutStore,s4=()=>Dh().layoutStore;class a4{constructor(t){this.isActive=!1,this.content="",this.store=t,sn(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=Ci.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,sn(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===Ci.Existing?this.projects:this.templates}async loadProjects(){const t=await Gm(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 c3(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){a3(mc.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 xv=()=>En().templatesStore;class l4{constructor(t){this.toasts=[],this.store=t,sn(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:on.Error})}addWarning(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Warning})}addSuccess(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Success})}addInfo(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class c4{constructor(t){this.isOpen=!1,this.store=t,sn(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(Pn.toggleBlocksPanel,{isOpen:this.isOpen})}}const u4=()=>En().blockManagerStore,Ev=":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=Ev+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",f4="["+Ev+"]["+d4+"]*",p4=new RegExp("^"+f4+"$");function Tv(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 Tc=function(e){const t=p4.exec(e);return!(t===null||typeof t>"u")};function h4(e){return typeof e<"u"}const g4={allowBooleanAttributes:!1,unpairedTags:[]};function m4(e,t){t=Object.assign({},g4,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=Ov(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=_v(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--),!E4(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Nt("InvalidTag",f,cn(e,s))}const u=y4(e,s);if(u===!1)return Nt("InvalidAttr","Attributes for '"+l+"' have open quote.",cn(e,s));let d=u.value;if(s=u.index,d[d.length-1]==="/"){const f=s-d.length;d=d.substring(0,d.length-1);const p=Av(d,t);if(p===!0)r=!0;else return Nt(p.err.code,p.err.msg,cn(e,f+p.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return Nt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",cn(e,a));if(n.length===0)return Nt("InvalidTag","Closing tag '"+l+"' has not been opened.",cn(e,a));{const f=n.pop();if(l!==f.tagName){let p=cn(e,f.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",cn(e,a))}n.length==0&&(o=!0)}}else return Nt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",cn(e,s));else{const f=Av(d,t);if(f!==!0)return Nt(f.err.code,f.err.msg,cn(e,s-d.length+f.err.line));if(o===!0)return Nt("InvalidXml","Multiple possible root nodes found.",cn(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=_v(e,s);continue}else if(e[s+1]==="?"){if(s=Ov(e,++s),s.err)return s}else break;else if(e[s]==="&"){const f=C4(e,s);if(f==-1)return Nt("InvalidChar","char '&' is not expected.",cn(e,s));s=f}else if(o===!0&&!Pv(e[s]))return Nt("InvalidXml","Extra text at the end",cn(e,s));e[s]==="<"&&s--}}else{if(Pv(e[s]))continue;return Nt("InvalidChar","char '"+e[s]+"' is not expected.",cn(e,s))}if(r){if(n.length==1)return Nt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",cn(e,n[0].tagStartPos));if(n.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0}function Pv(e){return e===" "||e===" "||e===`
|
|
38
|
+
`||e==="\r"}function Ov(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 Nt("InvalidXml","XML declaration allowed only at the start of the document.",cn(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _v(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 v4='"',b4="'";function y4(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===v4||e[t]===b4)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 w4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Av(e,t){const n=Tv(e,w4),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",Li(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",Li(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",Li(n[o]));const s=n[o][2];if(!x4(s))return Nt("InvalidAttr","Attribute '"+s+"' is an invalid name.",Li(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return Nt("InvalidAttr","Attribute '"+s+"' is repeated.",Li(n[o]))}return!0}function S4(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 C4(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,S4(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 Nt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function x4(e){return Tc(e)}function E4(e){return Tc(e)}function cn(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Li(e){return e.startIndex+e[1].length}const T4={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},P4=function(e){return Object.assign({},T4,e)};let Pc;typeof Symbol!="function"?Pc="@@xmlMetadata":Pc=Symbol("XML Node Metadata");class ks{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][Pc]={startIndex:n})}static getMetaDataSymbol(){return Pc}}class O4{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&&Is(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&&Is(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Is(t,"!ATTLIST",n))n+=8;else if(s&&Is(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Is(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=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Mi(r),n=Sn(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=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Mi(r),n=Sn(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=Sn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Sn(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=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Tc(r))throw new Error(`Invalid element name: "${r}"`);n=Sn(t,n);let o="";if(t[n]==="E"&&Is(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Is(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=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Mi(r),n=Sn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Mi(o))throw new Error(`Invalid attribute name: "${o}"`);n=Sn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=Sn(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(),!Mi(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=Sn(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=Sn(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 Sn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Is(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Mi(e){if(Tc(e))return e;throw new Error(`Invalid entity name ${e}`)}const _4=/^[-+]?0x[a-fA-F0-9]+$/,A4=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,L4={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function M4(e,t={}){if(t=Object.assign({},L4,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&&_4.test(n))return I4(n,16);if(n.search(/.+[eE].+/)!==-1)return $4(e,n,t);{const r=A4.exec(n);if(r){const o=r[1]||"",s=r[2];let a=k4(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 N4=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function $4(e,t,n){if(!n.eNotation)return e;const r=t.match(N4);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 k4(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 I4(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 Lv(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 V4{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=H4,this.parseXml=z4,this.parseTextData=j4,this.resolveNameSpace=D4,this.buildAttributesMap=B4,this.isItStopNode=q4,this.replaceEntitiesValue=W4,this.readStopNodeData=Z4,this.saveTextToParentTag=G4,this.addChild=U4,this.ignoreAttributesFn=Lv(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 H4(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 j4(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?zf(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?zf(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function D4(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 F4=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function B4(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Tv(e,F4),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]=zf(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 z4=function(e){e=e.replace(/\r\n?/g,`
|
|
39
|
+
`);const t=new ks("!xml");let n=t,r="",o="";const s=new O4(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=Vs(e,">",a,"Closing Tag is not closed.");let u=e.substring(a+2,l).trim();if(this.options.removeNSPrefix){const p=u.indexOf(":");p!==-1&&(u=u.substr(p+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 f=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(f=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=o.lastIndexOf("."),o=o.substring(0,f),n=this.tagsNodeStack.pop(),r="",a=l}else if(e[a+1]==="?"){let l=Bf(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 ks(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=Vs(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=Vs(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=Bf(e,a,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let f=l.tagExp,p=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(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),f=u):f=f.substr(0,f.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 ks(u);u!==f&&p&&(w[":@"]=this.buildAttributesMap(f,o,u)),b&&(b=this.parseTextData(b,u,o,!0,p,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,b),this.addChild(n,w,o,v)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new ks(u);u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,b,o,v),o=o.substr(0,o.lastIndexOf("."))}else{const b=new ks(u);this.tagsNodeStack.push(n),u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,b,o,v),n=b}r="",a=g}}else r+=e[a];return t.child};function U4(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 W4=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 G4(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 q4(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function K4(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 Vs(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Bf(e,t,n,r=">"){const o=K4(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 f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),u=l!==o.data.substr(f+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function Z4(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=Vs(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=Vs(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Vs(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Vs(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Bf(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function zf(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:M4(e,n)}else return h4(e)?e:""}const Uf=ks.getMetaDataSymbol();function Y4(e,t){return Mv(e,t)}function Mv(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=X4(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=Mv(a[i],t,l);const d=Q4(u,t);a[Uf]!==void 0&&(u[Uf]=a[Uf]),a[":@"]?J4(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 X4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function J4(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 Q4(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 R4{constructor(t){this.externalEntities={},this.options=P4(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=m4(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new V4(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:Y4(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 '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return ks.getMetaDataSymbol()}}const eL=`
|
|
40
|
+
`;function tL(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=eL),Nv(e,t,"",n)}function Nv(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=nL(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];rL(u,t)||(m=t.tagValueProcessor(l,m),m=kv(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=$v(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 f=$v(i[":@"],t),p=r+`<${l}${f}`,g=Nv(i[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?o+=p+">":o+=p+"/>":(!g||g.length===0)&&t.suppressEmptyNode?o+=p+"/>":g&&g.endsWith(">")?o+=p+`>${g}${r}</${l}>`:(o+=p+">",g&&r!==""&&(g.includes("/>")||g.includes("</"))?o+=r+t.indentBy+g+r:o+=g,o+=`</${l}>`),s=!0}return o}function nL(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 $v(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=kv(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function rL(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 kv(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 oL={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Bo(e){this.options=Object.assign({},oL,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Lv(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=iL),this.processTextOrObjNode=sL,this.options.format?(this.indentate=aL,this.tagEndChar=`>
|
|
106
41
|
`,this.newLine=`
|
|
107
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$o.prototype.build=function(e){return this.options.preserveOrder?P3(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},$o.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 f=e[a][d];if(!(typeof f>"u"))if(f===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const p=this.j2x(f,t+1,n.concat(a));l+=p.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else l+=this.processTextOrObjNode(f,a,t,n);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(a,f);p=this.replaceEntitiesValue(p),l+=p}else l+=this.buildTextValNode(f,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}},$o.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 A3(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)}$o.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}},$o.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},$o.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}},$o.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 N3(e){return this.options.indentBy.repeat(e)}function M3(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const pc="mjml-code-to-html";function Tb(e,t){const n=t==null?void 0:t.sanitizer;if(Ze(n))return n(e);if(n==="xml-sanitizer"){const f=e.replace(/(<[a-zA-Z!/])|</g,(E,P)=>P??"<").replace(/&(?!#?\w+;)/g,"&"),p=["br","hr"],g=new Set(p),m=E=>{const P=[];for(const T of E){const O=Object.keys(T).find(_=>_!==":@");if(O&&g.has(O)){const _=T[O];Array.isArray(_)&&_.length>0?(P.push({...T,[O]:[]}),P.push(...m(_))):P.push(T)}else O&&Array.isArray(T[O])?P.push({...T,[O]:m(T[O])}):P.push(T)}return P},b={commentPropName:"#comment",unpairedTags:p,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},v=new x3({...b,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new $o({...b}),S=v.parse(`<root>${f}</root>`)[0].root,C=m(S);return w.build(C)}function r(f){const p=document.createElement("textarea");return p.innerHTML=f,p.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,f=>f.replace(i,(p,g)=>{const m=a[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(f,p,g)=>{const m=g.slice(1,-1).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`${p}"${m}"`}).replace(/&(?!#?\w+;)/g,(f,p,g)=>p>0&&g[p-1]==="&"?f:"&").replace(/(<[a-zA-Z!/])|</g,(f,p)=>p??"<")}var Ci=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Ci||{}),Vf=(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))(Vf||{}),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||{}),As=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(As||{});function L3(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 Ob=e=>(e==null?void 0:e.get("groups"))||[],Ab=(e,t)=>Ob(e).includes(t),$3=(e,t)=>{Ab(e,t)||e.set("groups",[...Ob(e),t])};class k3{constructor(t){this.dataSourceKeyid=As.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,en(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)}),L3(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=>Ab(r,t))}addStyleRule(t,n={}){var f,p;const{editor:r}=this,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&&SS(r)&&s.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=Ci,{attributes:b}=Vf,v=g.findFirstType(Ci.root),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];Nt(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((p=(f=n.selectorToRuleMap)==null?void 0:f.get(s))==null?void 0:p.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r==null?void 0:r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&$3(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:f,property:p,category:g}=i,m=o.getRecord(l);if(m){const b={label:d,field:f,category:g};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[p]||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 V3=()=>bn().globalStylesStore,I3=(e,t)=>{let n;try{const r=vr()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},Nb=(e,t)=>{const r={...I3(e),...t};try{vr()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},Mb="gs-utl-dark",j3=()=>vr()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Lb=e=>e==="dark"||e==="auto"&&j3(),$b=(e,t)=>{if(e&&vr()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Lb(e)?(n.add(Mb),r=!0):n.remove(Mb),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?go.dark:go.light}};class D3{constructor(t){this.key="",this.theme=go.auto,this.resolvedTheme=go.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,en(this,{},{autoBind:!0}),this.init()}init(){$b(this.theme,this)}changeTheme(t){$b(t,this),Nb(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)}),Nb(this.key,t)}get isDarkTheme(){return Lb(this.theme)}}const Lr=()=>bn().localSettingsStore;class H3{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,en(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 ma=()=>bn().modalStore,kb="column1",Vb="column2",Ib="column3",If="column3-7",F3=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,f=1,p=1;n.addType(o,{isComponent:v=>No(v,a),model:{defaults:{emptyState:!0,droppable:Mr(s),highlightable:!1,attributes:{class:a},resizable:{...l,keyHeight:"min-height"},icon:`
|
|
42
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Bo.prototype.build=function(e){return this.options.preserveOrder?tL(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},Bo.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 f=e[a][d];if(!(typeof f>"u"))if(f===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const p=this.j2x(f,t+1,n.concat(a));l+=p.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else l+=this.processTextOrObjNode(f,a,t,n);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(a,f);p=this.replaceEntitiesValue(p),l+=p}else l+=this.buildTextValNode(f,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}},Bo.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 sL(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)}Bo.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}},Bo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},Bo.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}},Bo.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 aL(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 Oc="mjml-code-to-html";function Iv(e,t){const n=t==null?void 0:t.sanitizer;if(et(n))return n(e);if(n==="xml-sanitizer"){const f=e.replace(/(<[a-zA-Z!/])|</g,(E,T)=>T??"<").replace(/&(?!#?\w+;)/g,"&"),p=["br","hr"],g=new Set(p),m=E=>{const T=[];for(const _ of E){const O=Object.keys(_).find(P=>P!==":@");if(O&&g.has(O)){const P=_[O];Array.isArray(P)&&P.length>0?(T.push({..._,[O]:[]}),T.push(...m(P))):T.push(_)}else O&&Array.isArray(_[O])?T.push({..._,[O]:m(_[O])}):T.push(_)}return T},v={commentPropName:"#comment",unpairedTags:p,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new R4({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new Bo({...v}),S=b.parse(`<root>${f}</root>`)[0].root,C=m(S);return w.build(C)}function r(f){const p=document.createElement("textarea");return p.innerHTML=f,p.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,f=>f.replace(i,(p,g)=>{const m=a[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(f,p,g)=>{const m=g.slice(1,-1).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`${p}"${m}"`}).replace(/&(?!#?\w+;)/g,(f,p,g)=>p>0&&g[p-1]==="&"?f:"&").replace(/(<[a-zA-Z!/])|</g,(f,p)=>p??"<")}var Ni=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Ni||{}),Wf=(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))(Wf||{}),zo=(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))(zo||{}),Hs=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Hs||{});function lL(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 Vv=e=>(e==null?void 0:e.get("groups"))||[],Hv=(e,t)=>Vv(e).includes(t),cL=(e,t)=>{Hv(e,t)||e.set("groups",[...Vv(e),t])};class uL{constructor(t){this.dataSourceKeyid=Hs.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,sn(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)}),lL(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=>Hv(r,t))}addStyleRule(t,n={}){var f,p;const{editor:r}=this,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&&QS(r)&&s.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=Ni,{attributes:v}=Wf,b=g.findFirstType(Ni.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=((p=(f=n.selectorToRuleMap)==null?void 0:f.get(s))==null?void 0:p.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r==null?void 0:r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&cL(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:f,property:p,category:g}=i,m=o.getRecord(l);if(m){const v={label:d,field:f,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[p]||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=()=>En().globalStylesStore,fL=(e,t)=>{let n;try{const r=Tr()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},jv=(e,t)=>{const r={...fL(e),...t};try{Tr()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},Dv="gs-utl-dark",pL=()=>Tr()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Fv=e=>e==="dark"||e==="auto"&&pL(),Bv=(e,t)=>{if(e&&Tr()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Fv(e)?(n.add(Dv),r=!0):n.remove(Dv),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?So.dark:So.light}};class hL{constructor(t){this.key="",this.theme=So.auto,this.resolvedTheme=So.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,sn(this,{},{autoBind:!0}),this.init()}init(){Bv(this.theme,this)}changeTheme(t){Bv(t,this),jv(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)}),jv(this.key,t)}get isDarkTheme(){return Fv(this.theme)}}const jr=()=>En().localSettingsStore;class gL{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,sn(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 Ca=()=>En().modalStore,zv="column1",Uv="column2",Wv="column3",Gf="column3-7",mL=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,f=1,p=1;n.addType(o,{isComponent:b=>jo(b,a),model:{defaults:{emptyState:!0,droppable:Hr(s),highlightable:!1,attributes:{class:a},resizable:{...l,keyHeight:"min-height"},icon:`
|
|
108
43
|
<svg viewBox="0 0 24 24">
|
|
109
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>
|
|
110
45
|
</svg>
|
|
111
|
-
`,"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:
|
|
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:`
|
|
112
47
|
.${a} {
|
|
113
48
|
display: flex;
|
|
114
49
|
justify-content: flex-start;
|
|
@@ -122,7 +57,7 @@ ${t}
|
|
|
122
57
|
flex-direction: column;
|
|
123
58
|
}
|
|
124
59
|
}
|
|
125
|
-
`}}}),n.addType(s,{isComponent:
|
|
60
|
+
`}}}),n.addType(s,{isComponent:b=>jo(b,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Hr(o),resizable:{...l,bc:0,keyWidth:u,currentUnit:p,minDim:d,step:f},icon:`
|
|
126
61
|
<svg viewBox="0 0 24 24">
|
|
127
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>
|
|
128
63
|
</svg>
|
|
@@ -131,50 +66,50 @@ ${t}
|
|
|
131
66
|
flex: 1 1 0%;
|
|
132
67
|
padding: 5px 0;
|
|
133
68
|
}
|
|
134
|
-
`},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const
|
|
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(zv,{...g,category:v(zv),content:{type:o,components:[{type:s}]}},m),r.add(Uv,{...g,category:v(Uv),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(Wv,{...g,category:v(Wv),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(Gf,{...g,category:v(Gf),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},$i="section",qf="container",Kf="gjs-section",Zf="gjs-container",vL=function(e,t={}){const{Components:n,Blocks:r}=e;r.add($i,{label:$i,media:`
|
|
135
70
|
<svg viewBox="0 0 24 24">
|
|
136
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" />
|
|
137
72
|
</svg>
|
|
138
|
-
`,content:{type
|
|
139
|
-
.${
|
|
73
|
+
`,content:{type:$i},...t.block},{at:Pi(e,Gf)+1}),n.addType($i,{isComponent:o=>jo(o,Kf),model:{defaults:{tagName:"section",emptyState:!0,draggable:Hr("wrapper"),droppable:Hr(qf),attributes:{class:Kf},components:{type:qf},styles:`
|
|
74
|
+
.${Kf} {
|
|
140
75
|
display: flex;
|
|
141
76
|
padding: 50px 0;
|
|
142
77
|
}
|
|
143
|
-
`}}}),n.addType(
|
|
144
|
-
.${
|
|
78
|
+
`}}}),n.addType(qf,{isComponent:o=>jo(o,Zf),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Zf},styles:`
|
|
79
|
+
.${Zf} {
|
|
145
80
|
width: 90%;
|
|
146
81
|
margin: 0 auto;
|
|
147
82
|
max-width: 1200px;
|
|
148
83
|
}
|
|
149
|
-
`}}})},
|
|
84
|
+
`}}})},bL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
|
|
150
85
|
<svg viewBox="0 0 24 24">
|
|
151
86
|
<path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
|
|
152
87
|
</svg>
|
|
153
|
-
`,content:{type:o},...t.block},{at:
|
|
88
|
+
`,content:{type:o},...t.block},{at:Pi(e,$i)+1}),n.addType(o,{isComponent:a=>jo(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:`
|
|
154
89
|
.${s} {
|
|
155
90
|
height: 3px;
|
|
156
91
|
width: 100%;
|
|
157
92
|
margin: 10px;
|
|
158
93
|
background-color: rgba(0, 0, 0, 0.05);
|
|
159
94
|
}
|
|
160
|
-
`}}})},
|
|
95
|
+
`}}})},yL=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(Oi)){const f=d.replace(Oi,""),p=e.Pages.get(f);if(u.href=p?`./${If(e,p)}`:"##",p&&xc(p)){const g={id:D3(this,"id")},m=pv(p,{currentItem:g});u.href=m.fullPath,B3(u,{...g,page:f})}}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:f})=>{u.components(d.map(p=>({type:"option",content:p.label,attributes:{value:p.id}}))),f()},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)}}})},wL=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,media:`
|
|
161
96
|
<svg viewBox="0 0 24 24">
|
|
162
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>
|
|
163
98
|
</svg>
|
|
164
|
-
`,content:{type:o,components:"Insert your text here"},...t.block},{at:
|
|
99
|
+
`,content:{type:o,components:"Insert your text here"},...t.block},{at:Pi(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>M3(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}]}}})},SL=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:`
|
|
165
100
|
<svg viewBox="0 0 24 24">
|
|
166
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" />
|
|
167
102
|
</svg>
|
|
168
|
-
`,content:{type:s},...t.block},{at:
|
|
103
|
+
`,content:{type:s},...t.block},{at:Pi(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>jo(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:`
|
|
169
104
|
.${a} {
|
|
170
105
|
height: 200px;
|
|
171
106
|
width: 100%;
|
|
172
107
|
}
|
|
173
|
-
`},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(),f=i.getStyle(),p=`url('${u}')`;u&&i.addStyle({"background-image":d&&f["background-image"]||p,"background-size":f["background-size"]||"contain","background-position":f["background-position"]||"center center","background-attachment":f["background-attachment"]||"scroll","background-repeat":f["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},
|
|
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(),f=i.getStyle(),p=`url('${u}')`;u&&i.addStyle({"background-image":d&&f["background-image"]||p,"background-size":f["background-size"]||"contain","background-position":f["background-position"]||"center center","background-attachment":f["background-attachment"]||"scroll","background-repeat":f["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},CL=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,media:`
|
|
174
109
|
<svg viewBox="0 0 24 24">
|
|
175
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" />
|
|
176
111
|
</svg>
|
|
177
|
-
`,content:{type:o},...t.block},{at:
|
|
112
|
+
`,content:{type:o},...t.block},{at:Pi(e,"link")+1}),n.addType(o,{isComponent:a=>jo(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
|
|
178
113
|
.${s} {
|
|
179
114
|
color: inherit;
|
|
180
115
|
display: inline-block;
|
|
@@ -183,9 +118,9 @@ ${t}
|
|
|
183
118
|
max-width: 100%;
|
|
184
119
|
text-decoration: none;
|
|
185
120
|
}
|
|
186
|
-
`}}})};function
|
|
121
|
+
`}}})};function xL(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 EL={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},Gv=`<svg viewBox="0 0 24 24">
|
|
187
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>
|
|
188
|
-
</svg>`,
|
|
123
|
+
</svg>`,TL=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:Gv,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>jo(i,s)||Ti(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:EL,components:Gv,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:Fo(({editor:i,component:l,value:u})=>{const d=i.Parser.parseHtml(u).html,f=Array.isArray(d)?d[0]:d;f&&f.tagName==="svg"&&l.components(f)},500)}],styles:`
|
|
189
124
|
.${s} {
|
|
190
125
|
display: inline-block;
|
|
191
126
|
text-decoration: none;
|
|
@@ -195,9 +130,9 @@ ${t}
|
|
|
195
130
|
width: 50px;
|
|
196
131
|
height: 50px;
|
|
197
132
|
}
|
|
198
|
-
`},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")})}}})},
|
|
199
|
-
`).trim();
|
|
200
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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")})}}})},Yf="__nc",PL=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 OL(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=PL(i);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:i,value:l,options:u,emitUpdate:d})=>{const f=u.removed,p=u.previous,g=u.item;if(f)i.removeAttributes(f.id);else{p&&g&&p.id!==g.id&&i.removeAttributes(p.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});i.addAttributes(m)}d()},addItem:()=>({id:Yf,value:!1}),labelItem:i=>i.id===Yf||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===Yf?"":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 _L="Basic";function Xf(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=xL;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:_L,select:!0,activate:!0};k3(e,t),yL(e),mL(e,{block:a}),wL(e,{block:a}),vL(e,{block:a}),bL(e,{block:a}),SL(e,{block:a}),CL(e,{block:a}),TL(e,{block:a}),OL(e)}function qv(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,f={input:t,output:"",error:""};let p="";try{if(i){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=Iv(u,{sanitizer:m});if(g.htmlType==="text/xml"){const w=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");f.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(Oc,{mjml:v})),p=v}else{const g=d.parseFromString(u,"text/html");Kv(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){f.error=g.message}return f.error?r&&s.addError("error-parser",{header:a.t("actions.importCode.parseError"),content:f.error}):f.output=p||u,f}function Kv(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)Kv(r)}function AL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zv(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 Yv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zv(Object(n),!0).forEach(function(r){AL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function LL(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 ML(e,t){if(e==null)return{};var n=LL(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 NL(e,t){return $L(e)||kL(e,t)||IL(e,t)||VL()}function $L(e){if(Array.isArray(e))return e}function kL(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 IL(e,t){if(e){if(typeof e=="string")return Xv(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 Xv(e,t)}}function Xv(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 VL(){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 HL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jv(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 Qv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jv(Object(n),!0).forEach(function(r){HL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jL(){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 ki(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 DL(e){return!Object.keys(e).length}function Ii(e){return typeof e=="function"}function FL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function BL(e,t){return _c(t)||Uo("changeType"),Object.keys(t).some(function(n){return!FL(e,n)})&&Uo("changeField"),t}function zL(e){Ii(e)||Uo("selectorType")}function UL(e){Ii(e)||_c(e)||Uo("handlerType"),_c(e)&&Object.values(e).some(function(t){return!Ii(t)})&&Uo("handlersType")}function WL(e){e||Uo("initialIsRequired"),_c(e)||Uo("initialType"),DL(e)&&Uo("initialContent")}function GL(e,t){throw new Error(e[t]||e.default)}var qL={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"},Uo=ki(GL)(qL),Ac={changes:BL,selector:zL,handler:UL,initial:WL};function KL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ac.initial(e),Ac.handler(t);var n={current:e},r=ki(XL)(n,t),o=ki(YL)(n),s=ki(Ac.changes)(e),a=ki(ZL)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Ac.selector(u),u(n.current)}function l(u){jL(r,o,s,a)(u)}return[i,l]}function ZL(e,t){return Ii(t)?t(e.current):t}function YL(e,t){return e.current=Qv(Qv({},e.current),t),t}function XL(e,t,n){return Ii(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 JL={create:KL},QL={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function RL(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 eM(e){return{}.toString.call(e).includes("Object")}function tM(e){return e||eb("configIsRequired"),eM(e)||eb("configType"),e.urls?(nM(),{paths:{vs:e.urls.monacoBase}}):e}function nM(){console.warn(Rv.deprecation)}function rM(e,t){throw new Error(e[t]||e.default)}var Rv={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!
|
|
201
136
|
You are using deprecated way of configuration.
|
|
202
137
|
|
|
203
138
|
Instead of using
|
|
@@ -206,7 +141,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
206
141
|
monaco.config({ paths: { vs: '...' } })
|
|
207
142
|
|
|
208
143
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
209
|
-
`},qb=x4(T4)(Gb),O4={config:P4},A4=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 Kb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Kb(e[n],t[n]))}),Bb(Bb({},e),t)}var N4={type:"cancelation",msg:"operation is manually canceled"};function zf(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(N4):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var M4=S4.create({config:C4,isInitialized:!1,resolve:null,reject:null,monaco:null}),Yb=n4(M4,2),_i=Yb[0],mc=Yb[1];function L4(e){var t=O4.config(e),n=t.monaco,r=t4(t,["monaco"]);mc(function(o){return{config:Kb(o.config,r),monaco:n}})}function $4(){var e=_i(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(mc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),zf(Uf);if(window.monaco&&window.monaco.editor)return Zb(window.monaco),e.resolve(window.monaco),zf(Uf);A4(k4,I4)(j4)}return zf(Uf)}function k4(e){return document.body.appendChild(e)}function V4(e){var t=document.createElement("script");return e&&(t.src=e),t}function I4(e){var t=_i(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=V4("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function j4(){var e=_i(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){Zb(n),e.resolve(n)},function(n){e.reject(n)})}function Zb(e){_i().monaco||mc({monaco:e})}function D4(){return _i(function(e){var t=e.monaco;return t})}var Uf=new Promise(function(e,t){return mc({resolve:e,reject:t})}),Xb={config:L4,init:$4,__getMonacoInstance:D4},H4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Wf=H4,F4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},B4=F4;function z4({children:e}){return h.createElement("div",{style:B4.container},e)}var U4=z4,W4=U4;function G4({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return h.createElement("section",{style:{...Wf.wrapper,width:e,height:t},...a},!n&&h.createElement(W4,null,r),h.createElement("div",{ref:o,style:{...Wf.fullWidth,...!n&&Wf.hide},className:s}))}var q4=G4,Jb=h.memo(q4);function K4(e){h.useEffect(e,[])}var Qb=K4;function Y4(e,t,n=!0){let r=h.useRef(!0);h.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var On=Y4;function Ti(){}function ba(e,t,n,r){return Z4(e,r)||X4(e,t,n,r)}function Z4(e,t){return e.editor.getModel(Rb(e,t))}function X4(e,t,n,r){return e.editor.createModel(t,n,r?Rb(e,r):void 0)}function Rb(e,t){return e.Uri.parse(t)}function J4({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:f={},height:p="100%",width:g="100%",className:m,wrapperProps:b={},beforeMount:v=Ti,onMount:w=Ti}){let[y,S]=h.useState(!1),[C,x]=h.useState(!0),E=h.useRef(null),P=h.useRef(null),T=h.useRef(null),O=h.useRef(w),_=h.useRef(v),N=h.useRef(!1);Qb(()=>{let $=Xb.init();return $.then(z=>(P.current=z)&&x(!1)).catch(z=>(z==null?void 0:z.type)!=="cancelation"&&console.error("Monaco initialization: error:",z)),()=>E.current?B():$.cancel()}),On(()=>{if(E.current&&P.current){let $=E.current.getOriginalEditor(),z=ba(P.current,e||"",r||n||"text",s||"");z!==$.getModel()&&$.setModel(z)}},[s],y),On(()=>{if(E.current&&P.current){let $=E.current.getModifiedEditor(),z=ba(P.current,t||"",o||n||"text",a||"");z!==$.getModel()&&$.setModel(z)}},[a],y),On(()=>{let $=E.current.getModifiedEditor();$.getOption(P.current.editor.EditorOption.readOnly)?$.setValue(t||""):t!==$.getValue()&&($.executeEdits("",[{range:$.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),$.pushUndoStop())},[t],y),On(()=>{var $,z;(z=($=E.current)==null?void 0:$.getModel())==null||z.original.setValue(e||"")},[e],y),On(()=>{let{original:$,modified:z}=E.current.getModel();P.current.editor.setModelLanguage($,r||n||"text"),P.current.editor.setModelLanguage(z,o||n||"text")},[n,r,o],y),On(()=>{var $;($=P.current)==null||$.editor.setTheme(u)},[u],y),On(()=>{var $;($=E.current)==null||$.updateOptions(f)},[f],y);let L=h.useCallback(()=>{var K;if(!P.current)return;_.current(P.current);let $=ba(P.current,e||"",r||n||"text",s||""),z=ba(P.current,t||"",o||n||"text",a||"");(K=E.current)==null||K.setModel({original:$,modified:z})},[n,t,o,e,r,s,a]),k=h.useCallback(()=>{var $;!N.current&&T.current&&(E.current=P.current.editor.createDiffEditor(T.current,{automaticLayout:!0,...f}),L(),($=P.current)==null||$.editor.setTheme(u),S(!0),N.current=!0)},[f,u,L]);h.useEffect(()=>{y&&O.current(E.current,P.current)},[y]),h.useEffect(()=>{!C&&!y&&k()},[C,y,k]);function B(){var z,K,F,V;let $=(z=E.current)==null?void 0:z.getModel();i||((K=$==null?void 0:$.original)==null||K.dispose()),l||((F=$==null?void 0:$.modified)==null||F.dispose()),(V=E.current)==null||V.dispose()}return h.createElement(Jb,{width:g,height:p,isEditorReady:y,loading:d,_ref:T,className:m,wrapperProps:b})}var Q4=J4;h.memo(Q4);function R4(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var eM=R4,bc=new Map;function tM({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:f=!0,keepCurrentModel:p=!1,width:g="100%",height:m="100%",className:b,wrapperProps:v={},beforeMount:w=Ti,onMount:y=Ti,onChange:S,onValidate:C=Ti}){let[x,E]=h.useState(!1),[P,T]=h.useState(!0),O=h.useRef(null),_=h.useRef(null),N=h.useRef(null),L=h.useRef(y),k=h.useRef(w),B=h.useRef(),$=h.useRef(r),z=eM(s),K=h.useRef(!1),F=h.useRef(!1);Qb(()=>{let A=Xb.init();return A.then(j=>(O.current=j)&&T(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>_.current?D():A.cancel()}),On(()=>{var j,q,G,Y;let A=ba(O.current,e||r||"",t||o||"",s||n||"");A!==((j=_.current)==null?void 0:j.getModel())&&(f&&bc.set(z,(q=_.current)==null?void 0:q.saveViewState()),(G=_.current)==null||G.setModel(A),f&&((Y=_.current)==null||Y.restoreViewState(bc.get(s))))},[s],x),On(()=>{var A;(A=_.current)==null||A.updateOptions(u)},[u],x),On(()=>{!_.current||r===void 0||(_.current.getOption(O.current.editor.EditorOption.readOnly)?_.current.setValue(r):r!==_.current.getValue()&&(F.current=!0,_.current.executeEdits("",[{range:_.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),_.current.pushUndoStop(),F.current=!1))},[r],x),On(()=>{var j,q;let A=(j=_.current)==null?void 0:j.getModel();A&&o&&((q=O.current)==null||q.editor.setModelLanguage(A,o))},[o],x),On(()=>{var A;i!==void 0&&((A=_.current)==null||A.revealLine(i))},[i],x),On(()=>{var A;(A=O.current)==null||A.editor.setTheme(a)},[a],x);let V=h.useCallback(()=>{var A;if(!(!N.current||!O.current)&&!K.current){k.current(O.current);let j=s||n,q=ba(O.current,r||e||"",t||o||"",j||"");_.current=(A=O.current)==null?void 0:A.editor.create(N.current,{model:q,automaticLayout:!0,...u},d),f&&_.current.restoreViewState(bc.get(j)),O.current.editor.setTheme(a),i!==void 0&&_.current.revealLine(i),E(!0),K.current=!0}},[e,t,n,r,o,s,u,d,f,a,i]);h.useEffect(()=>{x&&L.current(_.current,O.current)},[x]),h.useEffect(()=>{!P&&!x&&V()},[P,x,V]),$.current=r,h.useEffect(()=>{var A,j;x&&S&&((A=B.current)==null||A.dispose(),B.current=(j=_.current)==null?void 0:j.onDidChangeModelContent(q=>{F.current||S(_.current.getValue(),q)}))},[x,S]),h.useEffect(()=>{if(x){let A=O.current.editor.onDidChangeMarkers(j=>{var G;let q=(G=_.current.getModel())==null?void 0:G.uri;if(q&&j.find(Y=>Y.path===q.path)){let Y=O.current.editor.getModelMarkers({resource:q});C==null||C(Y)}});return()=>{A==null||A.dispose()}}return()=>{}},[x,C]);function D(){var A,j;(A=B.current)==null||A.dispose(),p?f&&bc.set(s,_.current.saveViewState()):(j=_.current.getModel())==null||j.dispose(),_.current.dispose()}return h.createElement(Jb,{width:g,height:m,isEditorReady:x,loading:l,_ref:N,className:b,wrapperProps:v})}var nM=tM,rM=h.memo(nM),oM=rM;function Io({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,f=!!l;return c.jsxs(d,{className:M(e,r,f&&U.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||f?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...f&&{htmlFor:""},...u,children:[!!i&&c.jsx(Dt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:c.jsx(se,{icon:X.information,size:le.s2x})}),a,f&&c.jsx(bt,{title:"Clear value",onClick:l,icon:{icon:X.close,size:le.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var ev=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e))(ev||{}),tv=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(tv||{});const sM="gs-cmp-button",vc=h.memo(de(function({classNameBtn:t,className:n,children:r,tooltip:o,variant:s,onClick:a,editorEvents:i,label:l,size:u,icon:d,active:f,buttonType:p,disabled:g,...m}){const{editor:b}=ye(),[v,w]=h.useState(()=>({disabled:g,variant:s,active:f,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":S||C?"out-clear":void 0,E=v.label,P=O=>{b&&(a==null||a({event:O,editor:b,state:v,setState:_=>w(N=>({...N,..._}))}))};h.useEffect(()=>{if(!i||!b)return;const O=Object.keys(i).reduce((N,L)=>(N[L]=(k={})=>{i[L]({fromEvent:k,editor:b,state:v,setState:B=>w($=>({...$,...B}))})},N),{}),_=Object.keys(O);return _.forEach(N=>b.on(N,O[N])),()=>{_.forEach(N=>b.off(N,O[N]))}},[b,v]);const T=v.tooltip;return c.jsx(bt,{className:M(sM,v.classNameBtn),classNameWrp:v.className,variant:x,icon:v.icon,active:v.active,size:v.size,disabled:v.disabled,onClick:P,border:S||C,type:p,withBg:C,block:!0,...rt(T)?{title:T}:{tooltipProps:T},...m,children:E?Ze(E)?E({editor:b}):E:r})}));var Gf=(e=>(e.m="m",e.s="s",e))(Gf||{});const nv="gs-input-field",yc=e=>Nt(e)?e:"",Oi=(e={})=>M("gs-utl-w-full",U.bgTr,Co.inputText,e.disabled&&U.txtLowEmphasis),qf=({size:e="m"}={})=>M("gs-input-container gs-utl-w-full",U.bg,oe.b,oe.rnd,U.br,e==="m"&&Ee.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),jo=({className:e,style:t,row:n})=>({className:M(e,"gs-utl-w-full gs-utl-flex",n?`${nv}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),fr=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,f=!!r,p=!!o,g=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!f&&!(d!=null&&d.length)&&!p)return null;const m=c.jsx(c.Fragment,{children:f&&c.jsx(Io,{as:t,className:"gs-utl-w-full",size:n,tip:p?void 0:i,onClear:g,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(vc,{...v},v.id??w))]}):null;return c.jsxs(I,{className:M("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,p&&c.jsx(Io,{size:n,tip:i,as:"span",className:M(U.txtLowEmphasis),capitalize:!1,children:o})]})},Re=h.forwardRef(function(t,n){const{className:r,value:o,type:s,placeholder:a,required:i,disabled:l,readOnly:u,name:d,autoFocus:f,onInput:p,onChange:g,onBlur:m,onKeyDown:b,labelAs:v}=t,[w,y]=h.useState(yc(o)),S=Oi(t),C=h.useRef(null);h.useImperativeHandle(n,()=>C.current,[]),h.useEffect(()=>{y(yc(o))},[o]),h.useEffect(()=>{const _=C.current;if(_&&f){const N=_.querySelector("input"),L=setTimeout(()=>N==null?void 0:N.focus(),gd);return()=>clearTimeout(L)}},[C.current,f]);const x=(_,N)=>{g==null||g(_,N)},E=_=>{const{key:N}=_;switch(b==null||b(_),N){case"Escape":return y(o);case"Enter":return x(w)}},P=()=>{x(w),m==null||m()},T=_=>{const N=_.target.value;y(N),p==null||p(N)},O=jo({...t,className:M(nv,r)});return c.jsxs("div",{...O,ref:C,children:[c.jsx(fr,{...t,as:v}),c.jsxs(I,{className:qf(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(H,{grow:!0,children:c.jsx("input",{className:S,name:d,value:w,onChange:T,placeholder:a,required:i,onBlur:P,onKeyDown:E,readOnly:u,disabled:l,type:s,maxLength:t.maxLength})}),t.afterInput]})]})}),rv=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},aM="gs-field-code",iM={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 so(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:f,readOnly:p,name:g,required:m,disabled:b,formatOnMount:v=!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=jo({...e,className:M(aM,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),T=M("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...P,children:[c.jsx(fr,{...e,as:y}),c.jsxs("div",{className:T,style:{minHeight:d},children:[g&&c.jsx("input",{className:Pe.hiddenVisually,name:g,value:E,disabled:b,required:m,onChange:()=>{}}),c.jsx("div",{className:M("gs-utl-absolute gs-utl-inset-0",b&&Pe.disabled),children:c.jsx(oM,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:M(oe.b,oe.rnd,U.br,l),options:{...iM,readOnly:p,...s&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Nt(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:o,onMount:(O,_)=>{if(v){let N=!1;const L=()=>rv(O);O.onDidChangeModelLanguageConfiguration(L),O.onDidScrollChange(()=>{N||(N=!0,L())}),setTimeout(L,10)}f==null||f(O,_)}})})]})]})}const ov=de(function({buttonProps:t,content:n,code:r,onAction:o}){const s=ma(),a=$e(),i=ye(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=Lr(),[f,p]=h.useState(),g=()=>{let b=(f||"").trim();const v=Db({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()};h.useEffect(()=>{r?p(r):(async()=>{var C,x;const v=await u.runCommand(ae.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=v.find(E=>E.mimeType==="text/html"))==null?void 0:C.content,y=(x=v.find(E=>E.mimeType==="text/mjml"))==null?void 0:x.content,S=l?y:w;S&&p(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(H,{children:n??a.t("actions.importCode.content")}),c.jsx(H,{className:ee("h-96"),children:f!==void 0&&c.jsx(so,{defaultValue:f,onChange:b=>p(b||""),isDarkTheme:d,language:"html"})}),c.jsx(I,{justify:"end",children:c.jsx(qe,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),Kf="data-type-empty",sv=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${Kf}]`));for(const s of o)s.disabled=!t})},lM=(e,t,n="Empty",r={})=>{const o=`[${Kf}="${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(Kf,t),u.innerHTML=`
|
|
144
|
+
`},eb=RL(rM)(Rv),oM={config:tM},sM=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 tb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],tb(e[n],t[n]))}),Yv(Yv({},e),t)}var aM={type:"cancelation",msg:"operation is manually canceled"};function Jf(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(aM):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var iM=JL.create({config:QL,isInitialized:!1,resolve:null,reject:null,monaco:null}),nb=NL(iM,2),Vi=nb[0],Lc=nb[1];function lM(e){var t=oM.config(e),n=t.monaco,r=ML(t,["monaco"]);Lc(function(o){return{config:tb(o.config,r),monaco:n}})}function cM(){var e=Vi(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Lc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Jf(Qf);if(window.monaco&&window.monaco.editor)return rb(window.monaco),e.resolve(window.monaco),Jf(Qf);sM(uM,fM)(pM)}return Jf(Qf)}function uM(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=Vi(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 pM(){var e=Vi(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){rb(n),e.resolve(n)},function(n){e.reject(n)})}function rb(e){Vi().monaco||Lc({monaco:e})}function hM(){return Vi(function(e){var t=e.monaco;return t})}var Qf=new Promise(function(e,t){return Lc({resolve:e,reject:t})}),ob={config:lM,init:cM,__getMonacoInstance:hM},gM={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Rf=gM,mM={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},vM=mM;function bM({children:e}){return h.createElement("div",{style:vM.container},e)}var yM=bM,wM=yM;function SM({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return h.createElement("section",{style:{...Rf.wrapper,width:e,height:t},...a},!n&&h.createElement(wM,null,r),h.createElement("div",{ref:o,style:{...Rf.fullWidth,...!n&&Rf.hide},className:s}))}var CM=SM,sb=h.memo(CM);function xM(e){h.useEffect(e,[])}var ab=xM;function EM(e,t,n=!0){let r=h.useRef(!0);h.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Nn=EM;function Hi(){}function xa(e,t,n,r){return TM(e,r)||PM(e,t,n,r)}function TM(e,t){return e.editor.getModel(ib(e,t))}function PM(e,t,n,r){return e.editor.createModel(t,n,r?ib(e,r):void 0)}function ib(e,t){return e.Uri.parse(t)}function OM({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:f={},height:p="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=Hi,onMount:w=Hi}){let[y,S]=h.useState(!1),[C,x]=h.useState(!0),E=h.useRef(null),T=h.useRef(null),_=h.useRef(null),O=h.useRef(w),P=h.useRef(b),A=h.useRef(!1);ab(()=>{let L=ob.init();return L.then(D=>(T.current=D)&&x(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>E.current?j():L.cancel()}),Nn(()=>{if(E.current&&T.current){let L=E.current.getOriginalEditor(),D=xa(T.current,e||"",r||n||"text",s||"");D!==L.getModel()&&L.setModel(D)}},[s],y),Nn(()=>{if(E.current&&T.current){let L=E.current.getModifiedEditor(),D=xa(T.current,t||"",o||n||"text",a||"");D!==L.getModel()&&L.setModel(D)}},[a],y),Nn(()=>{let L=E.current.getModifiedEditor();L.getOption(T.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),Nn(()=>{var L,D;(D=(L=E.current)==null?void 0:L.getModel())==null||D.original.setValue(e||"")},[e],y),Nn(()=>{let{original:L,modified:D}=E.current.getModel();T.current.editor.setModelLanguage(L,r||n||"text"),T.current.editor.setModelLanguage(D,o||n||"text")},[n,r,o],y),Nn(()=>{var L;(L=T.current)==null||L.editor.setTheme(u)},[u],y),Nn(()=>{var L;(L=E.current)==null||L.updateOptions(f)},[f],y);let M=h.useCallback(()=>{var W;if(!T.current)return;P.current(T.current);let L=xa(T.current,e||"",r||n||"text",s||""),D=xa(T.current,t||"",o||n||"text",a||"");(W=E.current)==null||W.setModel({original:L,modified:D})},[n,t,o,e,r,s,a]),$=h.useCallback(()=>{var L;!A.current&&_.current&&(E.current=T.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...f}),M(),(L=T.current)==null||L.editor.setTheme(u),S(!0),A.current=!0)},[f,u,M]);h.useEffect(()=>{y&&O.current(E.current,T.current)},[y]),h.useEffect(()=>{!C&&!y&&$()},[C,y,$]);function j(){var D,W,F,k;let L=(D=E.current)==null?void 0:D.getModel();i||((W=L==null?void 0:L.original)==null||W.dispose()),l||((F=L==null?void 0:L.modified)==null||F.dispose()),(k=E.current)==null||k.dispose()}return h.createElement(sb,{width:g,height:p,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:v})}var _M=OM;h.memo(_M);function AM(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var LM=AM,Mc=new Map;function MM({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:f=!0,keepCurrentModel:p=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:w=Hi,onMount:y=Hi,onChange:S,onValidate:C=Hi}){let[x,E]=h.useState(!1),[T,_]=h.useState(!0),O=h.useRef(null),P=h.useRef(null),A=h.useRef(null),M=h.useRef(y),$=h.useRef(w),j=h.useRef(),L=h.useRef(r),D=LM(s),W=h.useRef(!1),F=h.useRef(!1);ab(()=>{let V=ob.init();return V.then(U=>(O.current=U)&&_(!1)).catch(U=>(U==null?void 0:U.type)!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>P.current?H():V.cancel()}),Nn(()=>{var U,J,Y,X;let V=xa(O.current,e||r||"",t||o||"",s||n||"");V!==((U=P.current)==null?void 0:U.getModel())&&(f&&Mc.set(D,(J=P.current)==null?void 0:J.saveViewState()),(Y=P.current)==null||Y.setModel(V),f&&((X=P.current)==null||X.restoreViewState(Mc.get(s))))},[s],x),Nn(()=>{var V;(V=P.current)==null||V.updateOptions(u)},[u],x),Nn(()=>{!P.current||r===void 0||(P.current.getOption(O.current.editor.EditorOption.readOnly)?P.current.setValue(r):r!==P.current.getValue()&&(F.current=!0,P.current.executeEdits("",[{range:P.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),P.current.pushUndoStop(),F.current=!1))},[r],x),Nn(()=>{var U,J;let V=(U=P.current)==null?void 0:U.getModel();V&&o&&((J=O.current)==null||J.editor.setModelLanguage(V,o))},[o],x),Nn(()=>{var V;i!==void 0&&((V=P.current)==null||V.revealLine(i))},[i],x),Nn(()=>{var V;(V=O.current)==null||V.editor.setTheme(a)},[a],x);let k=h.useCallback(()=>{var V;if(!(!A.current||!O.current)&&!W.current){$.current(O.current);let U=s||n,J=xa(O.current,r||e||"",t||o||"",U||"");P.current=(V=O.current)==null?void 0:V.editor.create(A.current,{model:J,automaticLayout:!0,...u},d),f&&P.current.restoreViewState(Mc.get(U)),O.current.editor.setTheme(a),i!==void 0&&P.current.revealLine(i),E(!0),W.current=!0}},[e,t,n,r,o,s,u,d,f,a,i]);h.useEffect(()=>{x&&M.current(P.current,O.current)},[x]),h.useEffect(()=>{!T&&!x&&k()},[T,x,k]),L.current=r,h.useEffect(()=>{var V,U;x&&S&&((V=j.current)==null||V.dispose(),j.current=(U=P.current)==null?void 0:U.onDidChangeModelContent(J=>{F.current||S(P.current.getValue(),J)}))},[x,S]),h.useEffect(()=>{if(x){let V=O.current.editor.onDidChangeMarkers(U=>{var Y;let J=(Y=P.current.getModel())==null?void 0:Y.uri;if(J&&U.find(X=>X.path===J.path)){let X=O.current.editor.getModelMarkers({resource:J});C==null||C(X)}});return()=>{V==null||V.dispose()}}return()=>{}},[x,C]);function H(){var V,U;(V=j.current)==null||V.dispose(),p?f&&Mc.set(s,P.current.saveViewState()):(U=P.current.getModel())==null||U.dispose(),P.current.dispose()}return h.createElement(sb,{width:g,height:m,isEditorReady:x,loading:l,_ref:A,className:v,wrapperProps:b})}var NM=MM,$M=h.memo(NM),kM=$M;function Wo({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,f=!!l;return c.jsxs(d,{className:N(e,r,f&&z.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||f?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...f&&{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(ne,{icon:q.information,size:se.s2x})}),a,f&&c.jsx(Ct,{title:"Clear value",onClick:l,icon:{icon:q.close,size:se.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var lb=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(lb||{}),cb=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(cb||{});const IM="gs-cmp-button",Nc=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:f,buttonType:p,disabled:g,...m}){const{editor:v}=we(),[b,w]=h.useState(()=>({disabled:g,variant:s,active:f,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,T=b.label,_=P=>{v&&(a==null||a({event:P,editor:v,state:b,setState:A=>w(M=>({...M,...A}))}))};h.useEffect(()=>{if(!i||!v)return;const P=Object.keys(i).reduce((M,$)=>(M[$]=(j={})=>{i[$]({fromEvent:j,editor:v,state:b,setState:L=>w(D=>({...D,...L}))})},M),{}),A=Object.keys(P);return A.forEach(M=>v.on(M,P[M])),()=>{A.forEach(M=>v.off(M,P[M]))}},[v,b]);const O=b.tooltip;return c.jsx(Ct,{className:N(IM,b.classNameBtn),classNameWrp:b.className,variant:E,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:_,border:S||C,type:p,withBg:C,block:!0,...ct(O)?{title:O}:{tooltipProps:O},...m,children:T?et(T)?T({editor:v}):T:r})}));var ep=(e=>(e.m="m",e.s="s",e))(ep||{});const ub="gs-input-field",$c=e=>Ht(e)?e:"",ji=(e={})=>N("gs-utl-w-full",z.bgTr,Ao.inputText,e.disabled&&z.txtLowEmphasis),tp=({size:e="m"}={})=>N("gs-input-container gs-utl-w-full",z.bg,te.b,te.rnd,z.br,e==="m"&&Te.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),Go=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${ub}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),br=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,f=!!r,p=!!o,g=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!f&&!(d!=null&&d.length)&&!p)return null;const m=c.jsx(c.Fragment,{children:f&&c.jsx(Wo,{as:t,className:"gs-utl-w-full",size:n,tip:p?void 0:i,onClear:g,m:"",children:r})}),v=u||d!=null&&d.length?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,w)=>c.jsx(Nc,{...b},b.id??w))]}):null;return c.jsxs(I,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,p&&c.jsx(Wo,{size:n,tip:i,as:"span",className:N(z.txtLowEmphasis),capitalize:!1,children:o})]})},rt=h.forwardRef(function(t,n){const{className:r,value:o,type:s,placeholder:a,required:i,disabled:l,readOnly:u,name:d,autoFocus:f,onInput:p,onChange:g,onBlur:m,onKeyDown:v,labelAs:b}=t,[w,y]=h.useState($c(o)),S=ji(t),C=h.useRef(null);h.useImperativeHandle(n,()=>C.current,[]),h.useEffect(()=>{y($c(o))},[o]),h.useEffect(()=>{const P=C.current;if(P&&f){const A=P.querySelector("input"),M=setTimeout(()=>A==null?void 0:A.focus(),Cd);return()=>clearTimeout(M)}},[C.current,f]);const x=(P,A)=>{g==null||g(P,A)},E=P=>{const{key:A}=P;switch(v==null||v(P),A){case"Escape":return y(o);case"Enter":return x(w)}},T=()=>{x(w),m==null||m()},_=P=>{const A=P.target.value;y(A),p==null||p(A)},O=Go({...t,className:N(ub,r)});return c.jsxs("div",{...O,ref:C,children:[c.jsx(br,{...t,as:b}),c.jsxs(I,{className:tp(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(B,{grow:!0,children:c.jsx("input",{className:S,name:d,value:w,onChange:_,placeholder:a,required:i,onBlur:T,onKeyDown:E,readOnly:u,disabled:l,type:s,maxLength:t.maxLength})}),t.afterInput]})]})}),db=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},VM="gs-field-code",HM={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 ho(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:f,readOnly:p,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),T=Go({...e,className:N(VM,"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",{...T,children:[c.jsx(br,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[g&&c.jsx("input",{className:Pe.hiddenVisually,name:g,value:E,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",v&&Pe.disabled),children:c.jsx(kM,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:N(te.b,te.rnd,z.br,l),options:{...HM,readOnly:p,...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:(O,P)=>{if(b){let A=!1;const M=()=>db(O);O.onDidChangeModelLanguageConfiguration(M),O.onDidScrollChange(()=>{A||(A=!0,M())}),setTimeout(M,10)}f==null||f(O,P)}})})]})]})}const fb=ce(function({buttonProps:t,content:n,code:r,onAction:o}){const s=Ca(),a=Ie(),i=we(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=jr(),[f,p]=h.useState(),g=()=>{let v=(f||"").trim();const b=qv({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?p(r):(async()=>{var C,x;const b=await u.runCommand(re.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&&p(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(B,{children:n??a.t("actions.importCode.content")}),c.jsx(B,{className:Z("h-96"),children:f!==void 0&&c.jsx(ho,{defaultValue:f,onChange:v=>p(v||""),isDarkTheme:d,language:"html"})}),c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),np="data-type-empty",pb=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${np}]`));for(const s of o)s.disabled=!t})},jM=(e,t,n="Empty",r={})=>{const o=`[${np}="${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(np,t),u.innerHTML=`
|
|
210
145
|
[data-gjs-type="${t}"]${a}:empty {
|
|
211
146
|
text-decoration: none;
|
|
212
147
|
padding: 5px;
|
|
@@ -234,18 +169,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
234
169
|
${r.limitH?"height: auto;":""}
|
|
235
170
|
${r.smallH?"min-height: 30px;":""}
|
|
236
171
|
${l}
|
|
237
|
-
}`,s.appendChild(u)}},
|
|
172
|
+
}`,s.appendChild(u)}},hb=(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;jM(t,s,n.getName({noCustom:!0}),a)},DM=function(t){const{Components:n}=t,r=o=>{const{id:s}=o;n.addType(s,{extendFnView:["onRender"],view:{onRender(){hb(s,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)};function FM(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=Ni,{attributes:d,class:f,font:p,all:g,preview:m,title:v,style:b,breakpoint:w}=Wf,{wrapper:y,section:S,column:C,text:x,button:E,image:T,divider:_,group:O,social:P,socialElement:A,spacer:M,navbar:$,navbarLink:j,table:L,raw:D}=zo,{model:W}=n.getType("default"),{model:F}=n.getType(i),{model:k}=n.getType(u),{model:H}=n.getType(p),{model:V,view:U}=n.getType(l),{model:J,view:Y}=n.getType($),{model:X,view:Q}=n.getType(j),{model:ee,view:G}=n.getType(y),{model:R,view:le}=n.getType(S),{model:ge,view:Ee}=n.getType(C),{model:Ce,view:tt}=n.getType(x),{model:Qe,view:Ot}=n.getType(E),{model:ut}=n.getType(T),{model:Se,view:ot}=n.getType(_),{model:st,view:wt}=n.getType(M),{view:Ne,model:mt}=n.getType(P),{view:dt,model:Ue}=n.getType(A),{view:en,model:he}=n.getType(O),De=Hs.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:""},wo={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},qs={label:"Content",getValue:({component:K})=>K.getInnerHTML(),setValue:({component:K,value:de})=>K.components(de)},Re=K=>{o.open({title:K.getName({noCustom:!0}),content:()=>c.jsx(fb,{content:"",code:K.getInnerHTML(),onAction:de=>K.components(de),buttonProps:{children:s.t("save")}})})},St=K=>{var ue;const de=K.getChildrenContainer();((ue=de==null?void 0:de.innerHTML)==null?void 0:ue.trim())===""&&(de.innerHTML="")},tn=K=>K.set({void:!1},{silent:!0});function jn(K={}){return W.prototype.toHTML.call(this,K)}function Zt(K){const de=K.closestType(i),ue=de==null?void 0:de.findType(l)[0];return(ue==null?void 0:ue.toHTML())||""}function Ks(K){const de=K.toHTML(),ue=e.runCommand(Oc,{mjml:de}),Vt=new DOMParser().parseFromString(ue.html,"text/html");return{mjml:de,mjmlToHtml:ue,document:Vt}}const Tn=function(K){const de=K.model,ue=Fo(()=>{var Ae;return(Ae=de.closestType(i))==null?void 0:Ae.trigger("rerender")});K.listenTo(de.components(),"add remove reset change",ue)},ls=(K,de)=>K.replace(`<${i}>`,`<${i}>${Zt(de)}`),cs=K=>`cls-${K.tagName}-${K.getId()}`,us=(K,de)=>{const ue={...K.get("attributes")||{}};return delete ue.style,{...ue,[Fe]:`${ue[Fe]||""} ${cs(K)}`.trim()}},ds=(K,de)=>{const ue=K.closestType(i),Ae=(ue==null?void 0:ue.findFirstType(l))||(ue==null?void 0:ue.append({type:l})[0]);Ae==null||Ae.trigger(de?"rerenderHeadImmediate":"rerenderHead")},fs=K=>function(){return us(this)},gn=(K,de)=>function(ue){const Ae=ue.querySelector(`.${cs(this.model)}`);return(de?Ae:Ae==null?void 0:Ae.outerHTML)||K.prototype.getTemplateFromEl.call(this,ue)},Er=K=>function(...de){const ue=K.prototype.toJSON.apply(this,de),Ae=ue.attributes||{};return delete ue.style,delete Ae.style,delete Ae.__p,ue},Du=K=>function(...de){const ue=K.prototype.getAttrToHTML.apply(this,de);delete ue.__p;for(const Ae in ue)ue[Ae]===""&&delete ue[Ae];return ue};function Fa(){return{start:`<mjml>${Zt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function Gh(){var ue;const K=(ue=this.model.parent())==null?void 0:ue.is(d),de=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}}function qH(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const TS=(K,de={})=>{var or;const ue=K.parents().filter(Dn=>Dn.tagName.startsWith("mj-")),Ae=ue.map(Dn=>`<${Dn.tagName}>`).reverse().join(""),Vt=ue.map(Dn=>`</${Dn.tagName}>`).join(""),kt=de.withHead?Zt(K):"",rr=de.withSiblings?(or=K.parent())==null?void 0:or.components().filter(Dn=>Dn!==K).map(({tagName:Dn})=>`<${Dn}></${Dn}>`).join(""):"";return{start:`<${i}>${kt}${Ae}`,end:`${rr||""}${Vt}${de.beforeRootEnd||""}</${i}>`}},nn=({model:K,noVoid:de})=>({init(){const ue={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",ue),this.set("style",ue),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),de&&tn(this)},handleStyleChange(ue,Ae,Vt){if(Vt.fromAttr||Vt.fromSync)return;const kt=this.getStylesToAttributes();this.set("attributes",kt,{...Vt,fromStyle:!0,fromSync:!0})},handleAttributeChange(ue,Ae,Vt){if(Vt.fromStyle||Vt.fromSync)return;const kt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(kt,{...Vt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const ue=this.getStyle({skipResolve:!0})||{};return delete ue.__p,ue},toHTML:jn,getAttrToHTML:Du(K),getMjmlAttributes:fs(),toJSON:Er(K)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:K=>K.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...nn({model:F}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:jn},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:Er(V)},view:{init(){this.renderHeadDebounced=Fo(this.renderHead,30);const{em:K,el:de,model:ue}=this,Ae=ue.components(),Vt="core:preview",kt=K.Commands.events;this.listenTo(K,`${kt.runCommand}${Vt}`,()=>{de.style.display="none"}),this.listenTo(K,`${kt.stopCommand}${Vt}`,()=>{de.style.display=""}),this.listenTo(Ae,"change",this.onComponentsChange),this.listenTo(Ae,"add remove reset",this.renderHead),this.listenTo(ue,"rerenderHead",this.renderHeadDebounced),this.listenTo(ue,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(K){const de=Object.keys(K.changedAttributes());de.length===1&&de[0]==="status"||this.renderHead()},renderHead(){var or;const{model:K,el:de}=this,ue=de.ownerDocument;if(!(ue&&ue!==document))return;const Vt=K.closestType(i),kt=Vt&&Ks(Vt),rr=(or=kt==null?void 0:kt.document)==null?void 0:or.head;if(rr){const Dn="mjml-head-result",qh=ue.querySelector(Dn)||ue.createElement(Dn);qh.innerHTML=rr.innerHTML,!ue.head.contains(qh)&&ue.head.prepend(qh)}},render(...K){const de=U.prototype.render.apply(this,K);return this.renderHeadDebounced(),de}}}),n.addType(d,{isComponent:ya(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Hr(l),traits:[]},toJSON:Er(W)},view:{onRender(){this.el.style.display="none"},init(){Tn(this)}}}),n.addType(f,{isComponent:ya(f),model:{defaults:{tagName:f,name:"Class",stylable:!1,draggable:Hr(d),traits:[]},toJSON:Er(W)}}),n.addType(p,{model:{...nn({model:H}),defaults:{tagName:p,name:"Font",stylable:!1,draggable:Hr(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:ya(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Hr(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:ya(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Hr(d),traits:[]},toHTML(...K){return F.prototype.toHTML.apply(this,K)},toJSON:Er(W)}}),n.addType(m,{isComponent:ya(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Hr(l),traits:[qs],icon:`<svg viewBox="0 0 24 24">
|
|
238
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" />
|
|
239
|
-
</svg>`},toJSON:
|
|
174
|
+
</svg>`},toJSON:Er(W)},view:{tagName:()=>"div",init(){const K=this.model.components();this.onRender=Fo(this.onRender,1),this.listenTo(K,"add remove reset change",this.onRender)},onRender(){const{model:K,el:de}=this,ue=K.getName({noCustom:!0}),Ae=K.getInnerHTML();de.innerHTML=`<b>${ue}</b>: ${Ae}`,de.style.padding="5px 10px",de.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:ya(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:Er(W)},view:{render(){return this}}}),n.addType(u,{model:{...nn({model:k,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:{...nn({model:ee,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"],traits:[Gt]}},view:{attributes:{},getMjmlTemplate:Gh,getTemplateFromEl:gn(G),init:qH}}),n.addType(S,{model:{...nn({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:[wo,Gt],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:gn(le),getMjmlTemplate:Gh,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},attributes:{}}}),n.addType(O,{model:{...nn({model:he,noVoid:!0}),defaults:{tagName:O,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[wo]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:gn(en,!0),getChildrenContainer(){return this.el},getMjmlTemplate:Gh,render(){const K=this.getTemplateFromMjml(),de=$S(K);return this.renderAttributes(),this.$el.attr(de),this.el.innerHTML=K.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const KH=[x,T,E,_,M,P,A,D,L,O,$,j,zo.carousel,zo.carouselImage,zo.accordion,zo.accordionElement,zo.accordionTitle,zo.accordionText];n.addType(C,{model:{...nn({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:K=>KH.includes(K.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var ue;const K=(ue=this.model.parent())==null?void 0:ue.is(d),de=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}},getTemplateFromEl:gn(Ee,!0),getChildrenContainer(){const{el:K}=this;return K.querySelector("td > table tbody")||K.querySelector("table tbody")||K},render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),ds(this.model,!0),this}}}),n.addType(x,{model:{...nn({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:Fa,getTemplateFromEl:gn(tt),attributes:{style:"display: table; width: 100%"}}}),n.addType(E,{model:{...nn({model:Qe,noVoid:!0}),defaults:{tagName:E,traits:[He],stylable:[...Qe.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Ot)}}),n.addType(T,{model:{...nn({model:ut}),defaults:{tagName:T,"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 K=ut.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete K.src,K},getMjmlAttributes(){const K=us(this);return this.isDefaultSrc()&&delete K.src,K}},view:{updateSrc(){const{model:K}=this,de=K.get("src",{skipResolve:!0})||K.getSrcResult();K.addAttributes({src:de}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Zt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(K){var de,ue,Ae;return(Ae=(ue=(de=K.querySelector("img"))==null?void 0:de.closest("table"))==null?void 0:ue.closest("tr"))==null?void 0:Ae.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(_,{model:{...nn({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:q.alignHorizontalLeft,size:se.sx})},{id:"center",title:"Center",labelReact:c.jsx(ne,{icon:q.alignHorizontalCenter,size:se.sx})},{id:"right",title:"Right",labelReact:c.jsx(ne,{icon:q.alignHorizontalRight,size:se.sx})}]}]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(ot)}}),n.addType(P,{model:{...nn({model:mt}),defaults:{tagName:P,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...mt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Ne)}}),n.addType(A,{model:{...nn({model:Ue,noVoid:!0}),defaults:{tagName:A,"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,qs]},getMjmlAttributes(){const K=us(this);return{...this.getDefaultIconProps()[K.name],...K}},getAttrToHTML(){const K=Ue.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[K.name],...K}},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:K,end:de}=dt.prototype.getMjmlTemplate.call(this);return{start:ls(K,this.model),end:de}},getInnerMjmlTemplate(){var Ae;const{start:K,end:de}=dt.prototype.getInnerMjmlTemplate.call(this),ue=((Ae=this.model.getInnerHTML())==null?void 0:Ae.trim())||"";return{start:`${K}${ue}`,end:de}},getChildrenContainer(){var Ae;const{el:K}=this,de=(Ae=K.querySelector("tbody > tr > td"))==null?void 0:Ae.nextElementSibling;return(de==null?void 0:de.firstElementChild)||K.querySelector("img")||K}}}),n.addType(M,{model:{...nn({model:st}),defaults:{tagName:M,traits:[]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(wt)}}),n.addType($,{model:{...nn({model:J}),defaults:{tagName:$,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Y,!0),render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),ds(this.model),this}}}),n.addType(j,{model:{...nn({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:K,end:de}=Q.prototype.getMjmlTemplate.call(this);return{start:ls(K,this.model),end:de}},getTemplateFromEl(K){return K.querySelector(".mj-inline-links").innerHTML}}}),n.addType(D,{extendFn:["initToolbar"],model:{defaults:{tagName:D,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){$3(this,{id:"edit",command:()=>Re(this),label:`<svg viewBox="0 0 24 24">
|
|
240
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>
|
|
241
|
-
</svg>`})},toJSON:
|
|
242
|
-
`))},
|
|
176
|
+
</svg>`})},toJSON:Er(W)},view:{events:{dblclick:"onActive"},onActive(){Re(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:K=>{var de,ue;if(((de=K.tagName)==null?void 0:de.toLowerCase())===b&&((ue=K.getAttribute)==null?void 0:ue.call(K,"css-class"))===De)return{type:"textnode",components:[],content:""}}});const ZH=K=>{const{id:de,view:ue}=K,Ae=ue.prototype;n.addType(de,{view:{render(){return Ae.render.apply(this,arguments),hb(de,this),this}}})};[u,S,C,x,$,P,D].forEach(K=>ZH(n.getType(K))),n.getTypes().forEach(({id:K,view:de})=>{de.prototype.disableEditing&&n.addType(K,{view:{onDisable(ue={}){this.disableEditing({...ue,parserOptions:{htmlType:"text/html"}})}}})});const PS=()=>{const K="projectFonts",ue=e.Components.getWrapper().findFirstType(i);if(!ue)return;const Ae=ue.findFirstType(l)||ue.append({type:l})[0];Ae.findType(b).filter(or=>or.getAttributes()[Fe]===K||or.attributes[Rm]===ev).forEach(or=>or.remove());const kt=Qm(a.fonts);if(!kt)return;const rr=Ae.append({type:b,content:kt})[0];rr==null||rr.addAttributes({[Fe]:K})},OS=()=>{const K=e.Css.rules.filter(kt=>{const rr=kt.attributes.groups;return!!(rr!=null&&rr.some(or=>or.startsWith(`${De}:`)))}).map(kt=>kt.toCSS());if(!K.length)return;const ue=e.Components.getWrapper().findFirstType(Ni.root),Ae=ue.findFirstType(l)||ue.append({type:l})[0];(Ae.findType(b).find(kt=>kt.getAttributes()[Fe]===De)||Ae.append({type:b,attributes:{[Fe]:De}})[0]).set("content",K.join(`
|
|
177
|
+
`))},YH=Fo(OS,100);e.on(Pn.pageSettingsUpdate,K=>{K.page||PS()}),e.on(e.events.projectLoad,({loaded:K})=>{K&&(OS(),PS())}),e.on(e.Parser.events.htmlBefore,K=>{var ue;const de=(ue=e.Parser.config.optionsHtml)==null?void 0:ue.codeSanitizer;K.input=Iv(K.input,{sanitizer:de})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${De}`,YH)})}function BM(e){const{Blocks:t}=e,n="Content",r="Layout",o={className:"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">
|
|
243
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" />
|
|
244
179
|
</svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),i("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
|
|
245
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" />
|
|
246
181
|
</svg>`,content:"<mj-button>Button</mj-button>"}),i("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
|
|
247
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" />
|
|
248
|
-
</svg>`,content:`<mj-image src="${
|
|
183
|
+
</svg>`,content:`<mj-image src="${WS}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
|
|
249
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" />
|
|
250
185
|
</svg>`,content:"<mj-divider/>"}),i("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
|
|
251
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" />
|
|
@@ -266,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
266
201
|
<mj-navbar-link>BLOG</mj-navbar-link>
|
|
267
202
|
</mj-navbar>`}),i("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
|
|
268
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" />
|
|
269
|
-
</svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${
|
|
204
|
+
</svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${eg({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
|
|
270
205
|
<mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
|
|
271
206
|
Heading title
|
|
272
207
|
</mj-text>
|
|
@@ -280,49 +215,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
280
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" />
|
|
281
216
|
</svg>`,content:`<mj-raw>
|
|
282
217
|
<span>Insert here you custom HTML</span>
|
|
283
|
-
</mj-raw>`}),i("mj-1-column",{...s,label:"1 Column",mediaReact:c.jsx(I,{...o,children:c.jsx(
|
|
218
|
+
</mj-raw>`}),i("mj-1-column",{...s,label:"1 Column",mediaReact:c.jsx(I,{...o,children:c.jsx(B,{className:a,grow:!0})}),content:`<mj-section>
|
|
284
219
|
<mj-column></mj-column>
|
|
285
|
-
</mj-section>`}),i("mj-2-columns-50-50",{...s,label:"2 Columns 50/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
220
|
+
</mj-section>`}),i("mj-2-columns-50-50",{...s,label:"2 Columns 50/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
286
221
|
<mj-column></mj-column>
|
|
287
222
|
<mj-column></mj-column>
|
|
288
|
-
</mj-section>`}),i("mj-2-columns-25-75",{...s,label:"2 Columns 25/75",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
223
|
+
</mj-section>`}),i("mj-2-columns-25-75",{...s,label:"2 Columns 25/75",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-3/4")})]}),content:`<mj-section>
|
|
289
224
|
<mj-column width="25%"></mj-column>
|
|
290
225
|
<mj-column width="75%"></mj-column>
|
|
291
|
-
</mj-section>`}),i("mj-2-columns-33-67",{...s,label:"2 Columns 33/67",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
226
|
+
</mj-section>`}),i("mj-2-columns-33-67",{...s,label:"2 Columns 33/67",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/3")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/3")})]}),content:`<mj-section>
|
|
292
227
|
<mj-column width="33%"></mj-column>
|
|
293
228
|
<mj-column width="67%"></mj-column>
|
|
294
|
-
</mj-section>`}),i("mj-2-columns-67-33",{...s,label:"2 Columns 67/33",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
229
|
+
</mj-section>`}),i("mj-2-columns-67-33",{...s,label:"2 Columns 67/33",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-2/3")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/3")})]}),content:`<mj-section>
|
|
295
230
|
<mj-column width="67%"></mj-column>
|
|
296
231
|
<mj-column width="33%"></mj-column>
|
|
297
|
-
</mj-section>`}),i("mj-2-columns-75-25",{...s,label:"2 Columns 75/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
232
|
+
</mj-section>`}),i("mj-2-columns-75-25",{...s,label:"2 Columns 75/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-3/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
298
233
|
<mj-column width="75%"></mj-column>
|
|
299
234
|
<mj-column width="25%"></mj-column>
|
|
300
|
-
</mj-section>`}),i("mj-3-columns",{...s,label:"3 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
235
|
+
</mj-section>`}),i("mj-3-columns",{...s,label:"3 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
301
236
|
<mj-column></mj-column>
|
|
302
237
|
<mj-column></mj-column>
|
|
303
238
|
<mj-column></mj-column>
|
|
304
|
-
</mj-section>`}),i("mj-3-columns-25-25-50",{...s,label:"3 Columns 25/25/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
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(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/4")})]}),content:`<mj-section>
|
|
305
240
|
<mj-column width="25%"></mj-column>
|
|
306
241
|
<mj-column width="25%"></mj-column>
|
|
307
242
|
<mj-column width="50%"></mj-column>
|
|
308
|
-
</mj-section>`}),i("mj-3-columns-25-50-25",{...s,label:"3 Columns 25/50/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
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(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
309
244
|
<mj-column width="25%"></mj-column>
|
|
310
245
|
<mj-column width="50%"></mj-column>
|
|
311
246
|
<mj-column width="25%"></mj-column>
|
|
312
|
-
</mj-section>`}),i("mj-3-columns-50-25-25",{...s,label:"3 Columns 50/25/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
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(B,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
313
248
|
<mj-column width="50%"></mj-column>
|
|
314
249
|
<mj-column width="25%"></mj-column>
|
|
315
250
|
<mj-column width="25%"></mj-column>
|
|
316
|
-
</mj-section>`}),i("mj-4-columns",{...s,label:"4 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(
|
|
251
|
+
</mj-section>`}),i("mj-4-columns",{...s,label:"4 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
317
252
|
<mj-column></mj-column>
|
|
318
253
|
<mj-column></mj-column>
|
|
319
254
|
<mj-column></mj-column>
|
|
320
255
|
<mj-column></mj-column>
|
|
321
|
-
</mj-section>`})}const fM=(e,t)=>({[vt.web]:r=>Bf(r,t),[vt.document]:r=>Bf(r,t),[vt.react]:r=>Bf(r,t),[vt.email]:r=>uM(r,t)})[e],va="https://cdn.jsdelivr.net/npm/",Yf={id:"gjs-blocks-basic",src:`${va}grapesjs-blocks-basic@1.0.1/dist/index.js`},pM={id:"grapesjs-plugin-forms",src:`${va}grapesjs-plugin-forms@2.0.5/dist/index.js`},Zf={id:"grapesjs-parser-postcss",src:`${va}grapesjs-parser-postcss@1.0.1/dist/index.js`},hM={id:"grapesjs-navbar",src:`${va}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},Xf={id:"grapesjs-plugin-export",src:`${va}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)}}},gM={id:"grapesjs-mjml",src:`${va}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},mM={[vt.email]:[dM,gM],[vt.web]:[Yf,pM,Xf,Zf,hM],[vt.document]:[Yf,Xf,Zf],[vt.react]:[Yf,Xf,Zf]};function bM(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 iv({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=h.useState(!1),i=()=>{oS((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(bt,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...o,children:c.jsx(se,{className:ue(s&&U.tA),icon:s?X.check:X.contentCopy,size:le.s})})}const vM=(e,t)=>e.filter(n=>n.id===t)[0]||null,lv=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),yM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,cv=ee("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),Jf={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function uv(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:ee([Ee.xy,n&&md.bgH]),children:[c.jsx(H,{className:ee("truncate"),grow:!0,children:t.label}),c.jsx(H,{className:ee("gjs-pl-2"),children:lv(t,r)&&o&&c.jsx(se,{className:ee(U.tA),icon:X.check,size:le.s})})]})}const wM="gs-select-field";function dv({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(se,{...rt(e.icon)?{icon:e.icon,size:le.s2x}:e.icon}),c.jsx(H,{className:ee("truncate"),grow:!0,children:e.content||e.label})]})}function Te(e){const{value:t,onChange:n,onBlur:r,onFocus:o,handlerSelected:s,label:a,options:i,includeEmpty:l,className:u,search:d,open:f,caret:p=X.chevronDown,size:g="m",border:m,emptyState:b="- Select an option -",name:v,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:x,hideCaret:E}=e,[P,T]=h.useState(null),[O,_]=h.useState(null),[N,L]=h.useState(""),{styles:k,attributes:B}=ui(P,O,Jf),$=typeof d=="object"?d.onChange:void 0,z=[...i].filter(Z=>d?$||yM(Z,N):Z),K=d&&(typeof d=="object"&&d.value||N),F=K&&z.length?z[0]:vM(z,t),V=Z=>n(Z.id,Z),D={id:null,label:b},A=(F==null?void 0:F.content)||(F==null?void 0:F.label),j=F?s?s(F):F.icon?c.jsx(I,{items:"center",gap:"s",children:c.jsx(dv,{option:F})}):A:s?s(D):b;l&&z.unshift(D);const q=Z=>{const{value:W}=Z.target,R=W.trim();switch(Z.key){case"Escape":n(null);break;case"Enter":n((z.length?z[0].id:R)||null,z[0]);break;case" ":ts(Z);break}},G=M("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",oe.rnd,Ya.focus),Y=()=>{r==null||r()},Q=jo({...e,className:M(wM,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(ti,{value:F,onChange:V,disabled:y,children:({open:Z})=>c.jsxs("div",{...Q,children:[a&&c.jsx(ti.Label,{as:x,className:e.classNameLabel,children:c.jsx(fr,{as:"span",...e})}),v&&c.jsx("input",{type:"input",name:v,value:(F==null?void 0:F.id)??"",onChange:()=>{},className:ee("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(ti.Button,{ref:T,className:G,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||N,className:M([u,"gs-utl-w-full",oe.rnd,Ya.focus,Ee.xyS]),onChange:W=>{L(W.target.value),$==null||$(W.target.value)},onKeyDown:q,onClick:ts,onBlur:Y,onFocus:o}):c.jsx(Gn,{border:m,size:g,title:j,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:p,shadow:!1,className:ee(u),titleClass:"",disabled:y})}),c.jsx(ti.Options,{static:f,className:cv,ref:_,style:k.popper,...B.popper,children:c.jsxs(Gn,{padding:!1,className:ee("h-full"),style:{minWidth:`${P==null?void 0:P.offsetWidth}px`,maxHeight:200},children:[!z.length&&d&&d!==!0&&c.jsx("div",{className:ee(Ee.xy),children:d.empty}),z.map((W,R)=>c.jsx(ti.Option,{value:W,children:({active:re})=>c.jsxs(I,{items:"center",gap:"s",className:ee([W.className,Ee.xy,re&&md.bgH]),nowrap:!0,children:[c.jsx(dv,{option:W}),c.jsx(H,{className:ee("gjs-pl-2"),children:lv(W,F)&&!K&&c.jsx(se,{className:ee(U.tA),icon:X.check,size:le.s})})]})},R))]})})]})})}const fv=h.createContext(null),SM=({children:e})=>{const[t,n]=h.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(fv.Provider,{value:t,children:e})},Kn=()=>{const e=h.useContext(fv);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Ai=()=>{const{editor:e}=Kn();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},CM=()=>Kn().editor,pv=h.createContext(null),xM=({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(pv.Provider,{value:t,children:e})},$r=()=>{const e=h.useContext(pv);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function EM(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function Do(e){return typeof e=="function"}function pr(){}const hv=e=>typeof e=="string",PM=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},gv=e=>{const t=hv(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)})},_M=e=>{const t=e.map(n=>gv(n));return Promise.allSettled(t)},mv=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(hv(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},bv=new WeakMap;function ya(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=bv.get(e);if(t)return t;const n=function({children:r}){return $n.createPortal(h.createElement("div",null,r),e)};return bv.set(e,n),n}h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[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:f,select:p,close:g,container:m})=>{u&&a({assets:d,types:f,select:p,close:g,Container:ya(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?Do(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[r,o]=h.useState(()=>({blocks:[],dragStart:pr,dragStop:pr,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 f=i.reduce((p,g)=>{const m=g.getCategoryLabel(),b=p.get(m);return b?b.push(g):p.set(m,[g]),p},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:f,Container:ya(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?Do(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function TM({children:e,...t}){const n=$r(),r=h.useRef(null);return h.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const OM=h.memo(function({children:e}){const{editor:t}=Kn(),[n,r]=h.useState(()=>({devices:[],selected:"",select:pr}));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?Do(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),AM=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function NM(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 _M(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const MM=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{AM(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await NM(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}},LM=h.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=pr,onReady:l,onUpdate:u,waitReady:d,...f}){const{setEditor:p}=Kn(),g=$r(),[m,b]=h.useState(!1),v=h.useRef(null);h.useEffect(()=>{if(!g.ready||!v.current)return;const P=v.current,T=g.refCanvas;let O,_={},N=[];const L=k=>{const B={height:"100%",...r,plugins:[...N,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,..._},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:T||P,customUI:!!T,...T?{panels:{defaults:[]}}:{}};O=k.init(B),p(O),i(O),u&&O.on("update",()=>{u(O.getProjectData(),O)}),O.onReady(()=>{b(!0),l==null||l(O)})};return(async()=>{a&&await PM(a);const k=await MM(o);N=k.plugins,_=k.pluginOptions,typeof s=="string"?(await gv(s),L(window.grapesjs)):L(s)})(),()=>O==null?void 0:O.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=EM("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",{...f,ref:v,className:S,style:E,children:e})]})}),$M=h.memo(function(){const e=$r();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(SM,{children:c.jsx(xM,{children:c.jsxs(LM,{...t,children:[e,c.jsx($M,{})]})})})});const vv=h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[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:ya(l)})};return t.on(a,i),s.__trgCustom({}),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?Do(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[r,o]=h.useState(!1),[s,a]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:pr});return h.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:f,close:p,attributes:g})=>{u&&a({title:h.createElement(mv(d)),content:h.createElement(mv(f)),attributes:g,close:p}),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 yv=h.memo(function({children:e}){const{editor:t}=Kn(),[n,r]=h.useState(()=>({pages:[],selected:void 0,select:pr,add:pr,remove:pr}));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?Do(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),wv=h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[r,o]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:pr,removeSelector:pr,setState:pr,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:ya(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?Do(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Sv=h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[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:ya(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?Do(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Qf=h.memo(function({children:e}){const{editor:t}=Kn(),n=$r(),[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:ya(l)})};return t.on(a,i),s.__trgCustom(),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?Do(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ni=({children:e})=>CM()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function Rf(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 zM=(e,t)=>({[xt.web]:r=>Xf(r,t),[xt.document]:r=>Xf(r,t),[xt.react]:r=>Xf(r,t),[xt.email]:r=>FM(r,t)})[e],Ea="https://cdn.jsdelivr.net/npm/",rp={id:"gjs-blocks-basic",src:`${Ea}grapesjs-blocks-basic@1.0.1/dist/index.js`},UM={id:"grapesjs-plugin-forms",src:`${Ea}grapesjs-plugin-forms@2.0.5/dist/index.js`},op={id:"grapesjs-parser-postcss",src:`${Ea}grapesjs-parser-postcss@1.0.1/dist/index.js`},WM={id:"grapesjs-navbar",src:`${Ea}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},sp={id:"grapesjs-plugin-export",src:`${Ea}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)}}},GM={id:"grapesjs-mjml",src:`${Ea}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},qM={[xt.email]:[BM,GM],[xt.web]:[rp,UM,sp,op,WM],[xt.document]:[rp,sp,op],[xt.react]:[rp,sp,op]};function KM(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 gb({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=h.useState(!1),i=()=>{IS((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(ne,{className:ae(s&&z.tA),icon:s?q.check:q.contentCopy,size:se.s})})}const ZM=(e,t)=>e.filter(n=>n.id===t)[0]||null,mb=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),YM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,vb=Z("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),ap={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function bb(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:Z([Te.xy,n&&xd.bgH]),children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:t.label}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(t,r)&&o&&c.jsx(ne,{className:Z(z.tA),icon:q.check,size:se.s})})]})}const XM="gs-select-field";function yb({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(ne,{...ct(e.icon)?{icon:e.icon,size:se.s2x}:e.icon}),c.jsx(B,{className:Z("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:f,caret:p=q.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,[T,_]=h.useState(null),[O,P]=h.useState(null),[A,M]=h.useState(""),{styles:$,attributes:j}=wi(T,O,ap),L=typeof d=="object"?d.onChange:void 0,D=[...i].filter(ee=>d?L||YM(ee,A):ee),W=d&&(typeof d=="object"&&d.value||A),F=W&&D.length?D[0]:ZM(D,t),k=ee=>n(ee.id,ee),H={id:null,label:v},V=(F==null?void 0:F.content)||(F==null?void 0:F.label),U=F?s?s(F):F.icon?c.jsx(I,{items:"center",gap:"s",children:c.jsx(yb,{option:F})}):V:s?s(H):v;l&&D.unshift(H);const J=ee=>{const{value:G}=ee.target,R=G.trim();switch(ee.key){case"Escape":n(null);break;case"Enter":n((D.length?D[0].id:R)||null,D[0]);break;case" ":ps(ee);break}},Y=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,ni.focus),X=()=>{r==null||r()},Q=Go({...e,className:N(XM,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(di,{value:F,onChange:k,disabled:y,children:({open:ee})=>c.jsxs("div",{...Q,children:[a&&c.jsx(di.Label,{as:x,className:e.classNameLabel,children:c.jsx(br,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(F==null?void 0:F.id)??"",onChange:()=>{},className:Z("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(di.Button,{ref:_,className:Y,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||A,className:N([u,"gs-utl-w-full",te.rnd,ni.focus,Te.xyS]),onChange:G=>{M(G.target.value),L==null||L(G.target.value)},onKeyDown:J,onClick:ps,onBlur:X,onFocus:o}):c.jsx(Yn,{border:m,size:g,title:U,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:p,shadow:!1,className:Z(u),titleClass:"",disabled:y})}),c.jsx(di.Options,{static:f,className:vb,ref:P,style:$.popper,...j.popper,children:c.jsxs(Yn,{padding:!1,className:Z("h-full"),style:{minWidth:`${T==null?void 0:T.offsetWidth}px`,maxHeight:200},children:[!D.length&&d&&d!==!0&&c.jsx("div",{className:Z(Te.xy),children:d.empty}),D.map((G,R)=>c.jsx(di.Option,{value:G,children:({active:le})=>c.jsxs(I,{items:"center",gap:"s",className:Z([G.className,Te.xy,le&&xd.bgH]),nowrap:!0,children:[c.jsx(yb,{option:G}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(G,F)&&!W&&c.jsx(ne,{className:Z(z.tA),icon:q.check,size:se.s})})]})},R))]})})]})})}const wb=h.createContext(null),JM=({children:e})=>{const[t,n]=h.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(wb.Provider,{value:t,children:e})},Jn=()=>{const e=h.useContext(wb);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Di=()=>{const{editor:e}=Jn();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},QM=()=>Jn().editor,Sb=h.createContext(null),RM=({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(Sb.Provider,{value:t,children:e})},Dr=()=>{const e=h.useContext(Sb);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function eN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function qo(e){return typeof e=="function"}function yr(){}const Cb=e=>typeof e=="string",tN=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},xb=e=>{const t=Cb(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)})},nN=e=>{const t=e.map(n=>xb(n));return Promise.allSettled(t)},Eb=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(Cb(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Tb=new WeakMap;function Ta(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Tb.get(e);if(t)return t;const n=function({children:r}){return Fn.createPortal(h.createElement("div",null,r),e)};return Tb.set(e,n),n}h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[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:f,select:p,close:g,container:m})=>{u&&a({assets:d,types:f,select:p,close:g,Container:Ta(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?qo(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({blocks:[],dragStart:yr,dragStop:yr,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 f=i.reduce((p,g)=>{const m=g.getCategoryLabel(),v=p.get(m);return v?v.push(g):p.set(m,[g]),p},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:f,Container:Ta(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function rN({children:e,...t}){const n=Dr(),r=h.useRef(null);return h.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const oN=h.memo(function({children:e}){const{editor:t}=Jn(),[n,r]=h.useState(()=>({devices:[],selected:"",select:yr}));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?qo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),sN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function aN(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 nN(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const iN=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{sN(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await aN(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}},lN=h.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=yr,onReady:l,onUpdate:u,waitReady:d,...f}){const{setEditor:p}=Jn(),g=Dr(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const T=b.current,_=g.refCanvas;let O,P={},A=[];const M=$=>{const j={height:"100%",...r,plugins:[...A,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...P},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:_||T,customUI:!!_,..._?{panels:{defaults:[]}}:{}};O=$.init(j),p(O),i(O),u&&O.on("update",()=>{u(O.getProjectData(),O)}),O.onReady(()=>{v(!0),l==null||l(O)})};return(async()=>{a&&await tN(a);const $=await iN(o);A=$.plugins,P=$.pluginOptions,typeof s=="string"?(await xb(s),M(window.grapesjs)):M(s)})(),()=>O==null?void 0:O.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=eN("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",{...f,ref:b,className:S,style:E,children:e})]})}),cN=h.memo(function(){const e=Dr();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(JM,{children:c.jsx(RM,{children:c.jsxs(lN,{...t,children:[e,c.jsx(cN,{})]})})})});const Pb=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[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?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(!1),[s,a]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:yr});return h.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:f,close:p,attributes:g})=>{u&&a({title:h.createElement(Eb(d)),content:h.createElement(Eb(f)),attributes:g,close:p}),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 Ob=h.memo(function({children:e}){const{editor:t}=Jn(),[n,r]=h.useState(()=>({pages:[],selected:void 0,select:yr,add:yr,remove:yr}));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?qo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),_b=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:yr,removeSelector:yr,setState:yr,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?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ab=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[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?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),ip=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[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?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Fi=({children:e})=>QM()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function lp(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 {
|
|
322
257
|
$2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
|
|
323
258
|
}
|
|
324
259
|
$2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
325
|
-
$2`),e}const Cv=de(function(){const t=Ai(),n=$e(),{Styles:r}=t,{isDarkTheme:o}=Lr(),s=r.getSelected(),[a,i]=h.useState(0),l=s?Rf(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const p=()=>i(m=>++m),g=r.events.custom;return t.on(g,p),()=>{t.off(g,p)}},[r,t]);const f=()=>{if(u){const p=t.Parser.parseCss(u)[0];p&&(s==null||s.setStyle(p.style))}};return c.jsxs(I,{className:ee("relative"),col:!0,full:!0,children:[c.jsx(H,{grow:!0,children:s?c.jsx(so,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(qe,{className:ee("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:f,children:n.t("update")})]})}),xv=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],kM=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(ae.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}})},VM=de(function(t){const n=$e(),r=ye(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=h.useState(xv[0].id),[l,u]=h.useState(),{isDarkTheme:d}=Lr(),[f]=h.useState(()=>Rf(s.getCss())),[p,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),b={...t.options,...o?{export:!1}:{}},v=()=>kM(s);h.useEffect(()=>{(async()=>{var P,T;const S=await s.runCommand(ae.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((P=S.find(O=>O.mimeType==="text/html"))==null?void 0:P.content)??"",x=((T=S.find(O=>O.mimeType==="text/mjml"))==null?void 0:T.content)??"";u(a==="mjml"?x:C)})()},[a]),h.useEffect(()=>{var y;p&&((y=p.getModel())==null||y.setValue(l),rv(p))},[p,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{className:ee("h-96"),space:"m",children:[c.jsxs(H,{className:ee("relative"),grow:!0,children:[o&&c.jsxs(I,{className:ee("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Te,{value:a,onChange:i,options:xv,className:ee("min-w-24")}),c.jsx(iv,{getValue:()=>p.getModel().getValue()})]}),l!==void 0&&c.jsx(so,{defaultValue:l,language:"html",onMount:g,...w})]}),!o&&c.jsx(H,{grow:!0,children:c.jsx(so,{defaultValue:f,language:"css",...w})})]}),b.export!==!1&&c.jsx(I,{justify:"end",children:c.jsx(qe,{size:"m2",variant:"pr",onClick:v,children:m("exportButton")})})]})});function IM(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 Ev=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 f=l.attachShadow({mode:"closed"});l.__sh=Jw.createRoot(f)}l.__sh.render(r),Object.keys(i).forEach(f=>{l.style.setProperty(hS(f),i[f],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(f=>{Array.from(f[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},jM="gs-cmp-popover";function hr({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:f,onClose:p,buttonAs:g,className:m,classNameBody:b,buttonProps:v={},disabled:w,hideCloseButton:y}){const[S,C]=h.useState(!!f),[x,E]=h.useState(S),[P,T]=h.useState(null),[O,_]=h.useState(null),N=ui(P,O,{...wh({offset:d}),placement:u}),L=()=>{E(!1),p==null||p()};IM({current:O},{onTrigger:L,enabled:i&&S}),h.useEffect(()=>{E(!!f)},[f]),h.useEffect(()=>{var $;S&&(($=N.update)==null||$.call(N))},[S,N.update]),h.useEffect(()=>{const $=setTimeout(()=>C(x),10);return()=>clearTimeout($)},[x]);const k=ee("w-full transition-colors",w&&"pointer-events-none",...O1({border:!1,size:"",...v})),B=ee(["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(Kd,{className:ee(jM,"relative flex",m),children:[c.jsx(Kd.Button,{ref:T,as:g,className:k,children:c.jsx("div",{onClick:$=>{ts($),!(Nt(f)||w)&&E(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:L,className:ee("z-10 fixed inset-0")}),x&&c.jsx(Kd.Panel,{static:!0,className:B,ref:_,style:N.styles.popper,...N.attributes.popper,children:c.jsx(sf,{as:h.Fragment,show:S,unmount:!1,...C1,children:c.jsx(Gn,{classNameBody:b,title:n,onClose:y?void 0:L,padding:o,border:s,children:typeof e=="function"?e({close:L,open:S}):e})})})]})}function wa(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=h.useRef(null),[d,f]=h.useState(),p=u.current,g=M([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",U.br,Ee.xy,oe.bb,l.disabled&&Pe.disabled,...t?[U.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=v=>{Ze(t)&&(t({event:v}),a==null||a({event:v,item:e}))};h.useEffect(()=>{if(!p)return;const v=setTimeout(()=>f(p.getBoundingClientRect()),l.active?0:gd);return()=>clearTimeout(v)},[p,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:g,onClick:m,onPointerEnter:b,children:[n&&c.jsx(H,{children:c.jsx(se,{icon:n,size:le.sx})}),!!r&&c.jsx(H,{className:M(l.classNameLabel,Pe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(H,{children:c.jsx(se,{className:U.tA,icon:X.check,size:le.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(H,{children:c.jsx(se,{icon:X.chevronRight,size:le.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(lI,{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})=>M(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"),Sc=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),hn=h.memo(de(function({id:t,children:n,className:r,style:o,width:s,gap:a,height:i,grow:l,alignItems:u,justifyContent:d,htmlAttrs:f,...p}){const{layoutsById:g}=hb(),[m,b]=h.useState({}),{className:v,style:w,...y}=f||{},S=r??v,C=o??w,x=h.useMemo(()=>Sc({height:i,gap:a,width:s,style:C}),[C,s,i,a]),E=wc({className:S,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:b}),()=>{g.delete(t)}},[g,m]);const P=p.as??"div";return c.jsx(P,{style:x,className:E,...p,...y,children:m.children??n})})),Cc="gs-cmp-button-menu",DM=h.memo(de(function({className:t,style:n,icon:r,label:o,size:s,tooltip:a,value:i,disabled:l,options:u,children:d,editorEvents:f,classNameBtn:p,iconMenu:g="chevronDown",onClick:m,onClickMenu:b,onOptionSelect:v}){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:F=>x(V=>({...V,...F}))};Xo({editor:w,editorEvents:f,localState:C,setLocalState:x});const T=F=>{m==null||m({...P,event:F})},O=F=>{v==null||v({...P,option:F}),S(!1)},_=C.tooltip,N=rt(_)?{title:_}:{tooltipProps:_},k=(()=>{var j,q;if(C.label)return Ze(C.label)?C.label(P):C.label;const F=(j=C.options)==null?void 0:j.find(G=>G.id===C.value),V=(q=C.options)==null?void 0:q[0],D=F||V,A=M((F==null?void 0:F.id)===C.value&&U.tA);if(D!=null&&D.icon)return{type:"icon",className:A,icon:D.icon,size:18};if(D!=null&&D.label)return{type:"text",className:A,content:D.label}})(),B=At(k),$=()=>{if(d){const F=Ze(d)?d(P):d;return At(F)}return C.options&&C.options.length>0?c.jsx("div",{className:`${Cc}-options`,children:C.options.map(F=>c.jsx(wa,{label:F.label,icon:F.icon,selected:F.id===C.value,action:()=>O(F)},F.id))}):null},z=F=>{F.stopPropagation(),b?b({...P,event:F}):S(!y)},K=c.jsx(I,{items:"center",onClick:z,className:M(`${Cc}__icon-menu`,U.hBgH2,U.txtHighEmphasisH),children:c.jsx(se,{icon:C.iconMenu,size:"14px"})});return c.jsx(hn,{className:M(Cc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(hr,{handler:c.jsx(bt,{className:M(`${Cc}__btn`,p),icon:C.icon,size:C.size,disabled:C.disabled,onClick:T,block:!0,...N,children:k?c.jsxs(I,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(I,{items:"center",children:B}),K]}):K}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:$()})})}));function qt(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(b=>b.id===g)[0];return n.indexOf(m)===n.length-1},f=(g,m)=>M("gs-utl-cursor-pointer",s==="m"&&Ee.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)&&oe.br),p=jo({...e,className:"gs-field-buttons"});return c.jsxs(im,{value:o,onChange:l,disabled:i,...p,children:[c.jsx(fr,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(I,{className:M(t,oe.b,oe.rnd,U.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:b,icon:v})=>c.jsx(Dt,{title:b,className:M("gs-utl-w-full"),classNameWrp:M("gs-utl-flex-1"),children:c.jsx(im.Option,{value:g,className:({checked:w})=>f(w,g),children:c.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!v&&c.jsx(se,{...rt(v)?{icon:v,size:le.s}:v}),m&&c.jsx(H,{children:m})]})})},g))})]})}const HM="gs-cmp-button-group-field",FM=h.memo(de(function({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l,onChange:u,editorEvents:d}){const{editor:f}=ye(),[p,g]=h.useState(()=>({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l})),m=b=>{u({value:b,editor:f,state:p,setState:v=>g(w=>({...w,...v}))})};return Xo({editor:f,editorEvents:d,localState:p,setLocalState:g}),c.jsx(qt,{className:M(HM,p.className),label:p.label,name:p.name,value:p.value,options:p.options??[],size:p.size,required:p.required,disabled:p.disabled,onChange:m})}));function xc({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 BM=h.memo(de(function(){const{isStage:e,updateStudio:t}=ye(),{isDarkTheme:n}=Lr(),r=h.useRef(null),{bg:o,text:s}=_1(n);return Ev({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 Lb=ce(function(){const t=Di(),n=Ie(),{Styles:r}=t,{isDarkTheme:o}=jr(),s=r.getSelected(),[a,i]=h.useState(0),l=s?lp(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const p=()=>i(m=>++m),g=r.events.custom;return t.on(g,p),()=>{t.off(g,p)}},[r,t]);const f=()=>{if(u){const p=t.Parser.parseCss(u)[0];p&&(s==null||s.setStyle(p.style))}};return c.jsxs(I,{className:Z("relative"),col:!0,full:!0,children:[c.jsx(B,{grow:!0,children:s?c.jsx(ho,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(Ke,{className:Z("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:f,children:n.t("update")})]})}),Mb=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],uN=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(re.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}})},dN=ce(function(t){const n=Ie(),r=we(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=h.useState(Mb[0].id),[l,u]=h.useState(),{isDarkTheme:d}=jr(),[f]=h.useState(()=>lp(s.getCss())),[p,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...o?{export:!1}:{}},b=()=>uN(s);h.useEffect(()=>{(async()=>{var T,_;const S=await s.runCommand(re.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((T=S.find(O=>O.mimeType==="text/html"))==null?void 0:T.content)??"",x=((_=S.find(O=>O.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(a==="mjml"?x:C)})()},[a]),h.useEffect(()=>{var y;p&&((y=p.getModel())==null||y.setValue(l),db(p))},[p,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{className:Z("h-96"),space:"m",children:[c.jsxs(B,{className:Z("relative"),grow:!0,children:[o&&c.jsxs(I,{className:Z("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Le,{value:a,onChange:i,options:Mb,className:Z("min-w-24")}),c.jsx(gb,{getValue:()=>p.getModel().getValue()})]}),l!==void 0&&c.jsx(ho,{defaultValue:l,language:"html",onMount:g,...w})]}),!o&&c.jsx(B,{grow:!0,children:c.jsx(ho,{defaultValue:f,language:"css",...w})})]}),v.export!==!1&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function fN(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 Nb=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 f=l.attachShadow({mode:"closed"});l.__sh=_S.createRoot(f)}l.__sh.render(r),Object.keys(i).forEach(f=>{l.style.setProperty(GS(f),i[f],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(f=>{Array.from(f[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},pN="gs-cmp-popover";function wr({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:f,onClose:p,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:w,hideCloseButton:y}){const[S,C]=h.useState(!!f),[x,E]=h.useState(S),[T,_]=h.useState(null),[O,P]=h.useState(null),A=wi(T,O,{...Fh({offset:d}),placement:u}),M=()=>{E(!1),p==null||p()};fN({current:O},{onTrigger:M,enabled:i&&S}),h.useEffect(()=>{E(!!f)},[f]),h.useEffect(()=>{var L;S&&((L=A.update)==null||L.call(A))},[S,A.update]),h.useEffect(()=>{const L=setTimeout(()=>C(x),10);return()=>clearTimeout(L)},[x]);const $=Z("w-full transition-colors",w&&"pointer-events-none",...O1({border:!1,size:"",...b})),j=Z(["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(nf,{className:Z(pN,"relative flex",m),children:[c.jsx(nf.Button,{ref:_,as:g,className:$,children:c.jsx("div",{onClick:L=>{ps(L),!(Ht(f)||w)&&E(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:M,className:Z("z-10 fixed inset-0")}),x&&c.jsx(nf.Panel,{static:!0,className:j,ref:P,style:A.styles.popper,...A.attributes.popper,children:c.jsx(gf,{as:h.Fragment,show:S,unmount:!1,...S1,children:c.jsx(Yn,{classNameBody:v,title:n,onClose:y?void 0:M,padding:o,border:s,children:typeof e=="function"?e({close:M,open:S}):e})})})]})}function Pa(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=h.useRef(null),[d,f]=h.useState(),p=u.current,g=N([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Te.xy,te.bb,l.disabled&&Pe.disabled,...t?[z.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(!p)return;const b=setTimeout(()=>f(p.getBoundingClientRect()),l.active?0:Cd);return()=>clearTimeout(b)},[p,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs(I,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(B,{children:c.jsx(ne,{icon:n,size:se.sx})}),!!r&&c.jsx(B,{className:N(l.classNameLabel,Pe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(B,{children:c.jsx(ne,{className:z.tA,icon:q.check,size:se.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(B,{children:c.jsx(ne,{icon:q.chevronRight,size:se.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(vH,{items:s,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const kc=({className:e,grow:t,alignItems:n,justifyContent:r})=>N(e,z.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"),Ic=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),Cn=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:f,...p}){const{layoutsById:g}=Cv(),[m,v]=h.useState({}),{className:b,style:w,...y}=f||{},S=r??b,C=o??w,x=h.useMemo(()=>Ic({height:i,gap:a,width:s,style:C}),[C,s,i,a]),E=kc({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 T=p.as??"div";return c.jsx(T,{style:x,className:E,...p,...y,children:m.children??n})})),Vc="gs-cmp-button-menu",hN=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:f,classNameBtn:p,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:w}=we(),[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})),T={editor:w,state:C,setState:F=>x(k=>({...k,...F}))};is({editor:w,editorEvents:f,localState:C,setLocalState:x});const _=F=>{m==null||m({...T,event:F})},O=F=>{b==null||b({...T,option:F}),S(!1)},P=C.tooltip,A=ct(P)?{title:P}:{tooltipProps:P},$=(()=>{var U,J;if(C.label)return et(C.label)?C.label(T):C.label;const F=(U=C.options)==null?void 0:U.find(Y=>Y.id===C.value),k=(J=C.options)==null?void 0:J[0],H=F||k,V=N((F==null?void 0:F.id)===C.value&&z.tA);if(H!=null&&H.icon)return{type:"icon",className:V,icon:H.icon,size:18};if(H!=null&&H.label)return{type:"text",className:V,content:H.label}})(),j=$t($),L=()=>{if(d){const F=et(d)?d(T):d;return $t(F)}return C.options&&C.options.length>0?c.jsx("div",{className:`${Vc}-options`,children:C.options.map(F=>c.jsx(Pa,{label:F.label,icon:F.icon,selected:F.id===C.value,action:()=>O(F)},F.id))}):null},D=F=>{F.stopPropagation(),v?v({...T,event:F}):S(!y)},W=c.jsx(I,{items:"center",onClick:D,className:N(`${Vc}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(ne,{icon:C.iconMenu,size:"14px"})});return c.jsx(Cn,{className:N(Vc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(wr,{handler:c.jsx(Ct,{className:N(`${Vc}__btn`,p),icon:C.icon,size:C.size,disabled:C.disabled,onClick:_,block:!0,...A,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 Qt(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},f=(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",z.br,g&&z.bgO,!d(m)&&te.br),p=Go({...e,className:"gs-field-buttons"});return c.jsxs(gm,{value:o,onChange:l,disabled:i,...p,children:[c.jsx(br,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(I,{className:N(t,te.b,te.rnd,z.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(gm.Option,{value:g,className:({checked:w})=>f(w,g),children:c.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(ne,{...ct(b)?{icon:b,size:se.s}:b}),m&&c.jsx(B,{children:m})]})})},g))})]})}const gN="gs-cmp-button-group-field",mN=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:f}=we(),[p,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:f,state:p,setState:b=>g(w=>({...w,...b}))})};return is({editor:f,editorEvents:d,localState:p,setLocalState:g}),c.jsx(Qt,{className:N(gN,p.className),label:p.label,name:p.name,value:p.value,options:p.options??[],size:p.size,required:p.required,disabled:p.disabled,onChange:m})}));function Hc({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 vN=h.memo(ce(function(){const{isStage:e,updateStudio:t}=we(),{isDarkTheme:n}=jr(),r=h.useRef(null),{bg:o,text:s}=T1(n);return Nb({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:`
|
|
326
261
|
.gs-banner {
|
|
327
262
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
328
263
|
padding: 30px 10px;
|
|
@@ -342,7 +277,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
342
277
|
.gs-gs-logo {
|
|
343
278
|
width: 35px;
|
|
344
279
|
}
|
|
345
|
-
`}),c.jsx(
|
|
280
|
+
`}),c.jsx(Yn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx(Hc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),bN=()=>`https://grapesjs.com?ref=${window.location.host}`,yN=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=we(),{isDarkTheme:n}=jr(),r=h.useRef(null),{bg:o,text:s,link:a}=T1(n);return Nb({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:`
|
|
346
281
|
.gs-banner {
|
|
347
282
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
348
283
|
padding: 5px 10px;
|
|
@@ -365,7 +300,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
365
300
|
.gs-logo {
|
|
366
301
|
width: 20px;
|
|
367
302
|
}
|
|
368
|
-
`}),c.jsx(Gn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:zM(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(xc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),Pv="gs-canvas-content",WM=h.memo(de(function({children:t}){const{isReady:n}=ye(),r=M(`${Pv}__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:Pv,children:[c.jsx("div",{className:r}),!n&&c.jsx(hs,{className:M("gs-utl-z-10"),abs:!0,full:!0}),n&&At(t)]}),c.jsx(BM,{}),c.jsx(UM,{})]})})),GM="gs-canvas",_v=h.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(TM,{style:n,className:M(GM,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Ni,{children:c.jsx(WM,{children:o})})})}),ep=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),qM=ep?Promise.resolve().then(function(){return QM}):Promise.resolve().then(function(){return oL});async function KM(...e){return(await qM).default(...e)}ep?Promise.resolve().then(function(){return eL}):Promise.resolve().then(function(){return aL});const YM=ep?Promise.resolve().then(function(){return nL}):Promise.resolve().then(function(){return lL});async function ZM(...e){return(await YM).default(...e)}const XM=async e=>{const t=await e.getFile();return t.handle=e,t};var JM=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(XM));return e[0].multiple?r:r[0]},QM={__proto__:null,default:JM};function Ec(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 Ec=function(n){this.s=n,this.n=n.next},Ec.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 Ec(e)}const Tv=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!1,l=!1;try{for(var u,d=function(f){var p,g,m,b=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);b--;){if(g&&(p=f[g])!=null)return p.call(f);if(m&&(p=f[m])!=null)return new Ec(p.call(f));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const f=u.value,p=`${n}/${f.name}`;f.kind==="file"?s.push(f.getFile().then(g=>(g.directoryHandle=e,g.handle=f,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>p})))):f.kind!=="directory"||!t||r&&r(f)||o.push(Tv(f,t,p,r))}}catch(f){l=!0,a=f}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 RM=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]:Tv(t,e.recursive,void 0,e.skipDirectory)},eL={__proto__:null,default:RM},tL=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(f=>{s[d].accept[f]=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)},nL={__proto__:null,default:tL},rL=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()})),oL={__proto__:null,default:rL},sL=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()})),aL={__proto__:null,default:sL},iL=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:p=>async function g(){return l.read().then(({done:m,value:b})=>{if(!m)return p.enqueue(b),g();p.close()})}()}),d=new Response(u),f=await d.blob();return l.releaseLock(),new Blob([f],{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},lL={__proto__:null,default:iL};function Ho({children:e,label:t,s:n="m",pill:r,border:o,nopad:s,className:a,block:i,...l}){return c.jsx("div",{className:M(!i&&"gs-utl-inline-block",a,!s&&Ee.xyS2,r?oe.pill:oe.rnd,o&&`${oe.b} ${U.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Ov={};const cL=Ov.REACT_APP_VERSION??Ov.NPM_PACKAGE_VERSION,uL=de(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(H,{className:ue("relative"),children:[c.jsx(xc,{className:ue("w-24 opacity-50")}),t&&c.jsx(Ho,{className:ue(U.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(H,{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:ue(Co.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:ue(Co.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(H,{className:ue(U.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",cL]})]})}),dL=de(function(){return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsx(H,{className:ee("relative"),children:c.jsx(xc,{className:ee("w-24 opacity-50")})})}),c.jsx(H,{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:ee(Co.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:ee(Co.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),fL=()=>[{id:vt.web,label:yr(vt.web),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:X.web,size:le.s}),c.jsx("span",{children:yr(vt.web)})]})},{id:vt.email,label:yr(vt.email),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:X.emailOutline,size:le.s}),c.jsx("span",{children:yr(vt.email)})]})}],Pc="gs-cmp-tabs";function Fo({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=gS,value:i}){const l=o==="pills",u=l?M("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",U.bgH):"",d=b=>l?M("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",b?U.bg:""):M("gs-utl-border-b-2",Ee.xy),f=b=>{b&&(b.tabIndex=-1)},p=b=>{const v=b.currentTarget;setTimeout(()=>v.blur(),10)},g=Nt(i)?e.findIndex(b=>b.id===i):void 0,m=!e.some(b=>!!b.content);return c.jsxs(ni.Group,{onChange:b=>a(e[b].id),defaultIndex:e.findIndex(b=>b.id===i),selectedIndex:g,children:[c.jsx(ni.List,{as:I,className:M(Pc,t,u),style:s,full:!0,nowrap:!0,children:e.map(b=>c.jsx(ni,{disabled:b.disabled,className:({selected:v})=>M(`${Pc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",b.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",Ya.focus,d(v),v?`${U.tAo} ${U.bA}`:U.br,r),children:b.label},b.id))}),c.jsx(ni.Panels,{className:M(`${Pc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(b=>c.jsx(ni.Panel,{tabIndex:-1,className:M(`${Pc}__panel`,"gs-utl-h-full"),ref:f,onFocus:p,children:b.content},b.id))})]})}const _c=0,Bo=1,Sa=2,Av=4;function pL(e,t){return n=>e(t(n))}function hL(e,t){return t(e)}function Nv(e,t){return n=>e(t,n)}function Mv(e,t){return()=>e(t)}function tp(e,t){return t(e),e}function Ns(...e){return e}function gL(e){e()}function Lv(e){return()=>e}function mL(...e){return()=>{e.map(gL)}}function Tc(){}function Kt(e,t){return e(Bo,t)}function It(e,t){e(_c,t)}function np(e){e(Sa)}function Ca(e){return e(Av)}function lt(e,t){return Kt(e,Nv(t,_c))}function $v(e,t){const n=e(Bo,r=>{n(),t(r)});return n}function _t(){const e=[];return(t,n)=>{switch(t){case Sa:e.splice(0,e.length);return;case Bo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case _c:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Se(e){let t=e;const n=_t();return(r,o)=>{switch(r){case Bo:o(t);break;case _c:t=o;break;case Av:return t}return n(r,o)}}function bL(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Bo:return s?n===s?void 0:(r(),n=s,t=Kt(e,s),t):(r(),Tc);case Sa:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Mi(e){return tp(_t(),t=>lt(e,t))}function xa(e,t){return tp(Se(t),n=>lt(e,n))}function vL(...e){return t=>e.reduceRight(hL,t)}function _e(e,...t){const n=vL(...t);return(r,o)=>{switch(r){case Bo:return Kt(e,n(o));case Sa:np(e);return}}}function kv(e,t){return e===t}function gn(e=kv){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ut(e){return t=>n=>{e(n)&&t(n)}}function wt(e){return t=>pL(t,e)}function zo(e){return t=>()=>t(e)}function Oc(e,t){return n=>r=>n(t=e(t,r))}function rp(e){return t=>n=>{e>0?e--:t(n)}}function Li(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Vv(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function kr(...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);Kt(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 Iv(...e){return function(t,n){switch(t){case Bo:return mL(...e.map(r=>Kt(r,n)));case Sa:return;default:throw new Error(`unrecognized action ${t}`)}}}function Be(e,t=kv){return _e(e,gn(t))}function ao(...e){const t=_t(),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);Kt(s,l=>{n[a]=l,r=r|i,r===o&&It(t,n)})}),function(s,a){switch(s){case Bo:return r===o&&a(n),Kt(t,a);case Sa:return np(t);default:throw new Error(`unrecognized action ${s}`)}}}function Vr(e,t=[],{singleton:n}={singleton:!0}){return{id:yL(),constructor:e,dependencies:t,singleton:n}}const yL=()=>Symbol();function wL(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 SL(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 Ac=typeof document<"u"?h.useLayoutEffect:h.useEffect;function CL(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&&It(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];It(C,y[S])}for(const S of o)if(S in y){const C=w[t.optional[S]];It(C,y[S])}w.propsReady&&It(w.propsReady,!0)}function u(w){return s.reduce((y,S)=>(y[S]=C=>{const x=w[t.methods[S]];It(x,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=bL(w[t.events[S]]),y),{})}const f=h.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=h.useState(()=>tp(wL(e),T=>l(T,C))),[E]=h.useState(Mv(d,x));Ac(()=>{for(const T of a)T in C&&Kt(E[T],C[T]);return()=>{Object.values(E).map(np)}},[C,E,x]),Ac(()=>{l(x,C)}),h.useImperativeHandle(y,Lv(u(x)));const P=n;return c.jsx(i.Provider,{value:x,children:n?c.jsx(P,{...SL([...r,...o,...a],C),children:S}):S})}),p=w=>h.useCallback(Nv(It,h.useContext(i)[w]),[w]),g=w=>{const S=h.useContext(i)[w],C=h.useCallback(x=>Kt(S,x),[S]);return h.useSyncExternalStore(C,()=>Ca(S),()=>Ca(S))},m=w=>{const S=h.useContext(i)[w],[C,x]=h.useState(Mv(Ca,S));return Ac(()=>Kt(S,E=>{E!==C&&x(Lv(E))}),[S,C]),C},b=h.version.startsWith("18")?g:m;return{Component:f,usePublisher:p,useEmitterValue:b,useEmitter:(w,y)=>{const C=h.useContext(i)[w];Ac(()=>Kt(C,y),[y,C])}}}const jv=typeof document<"u"?h.useLayoutEffect:h.useEffect;var op=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(op||{});const xL={0:"debug",1:"log",2:"warn",3:"error"},EL=()=>typeof globalThis>"u"?window:globalThis,Dv=Vr(()=>{const e=Se(3);return{log:Se((n,r,o=1)=>{var s;const a=(s=EL().VIRTUOSO_LOG_LEVEL)!=null?s:Ca(e);o>=a&&console[xL[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Hv(e,t,n){const r=h.useRef(null);let o=s=>{};if(typeof ResizeObserver<"u"){const s=h.useMemo(()=>new ResizeObserver(a=>{requestAnimationFrame(()=>{const l=a[0].target;l.offsetParent!==null&&e(l)})}),[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 Nc(e,t,n){return Hv(e,t).callbackRef}function Mc(e,t){return Math.round(e.getBoundingClientRect()[t])}function Fv(e,t){return Math.abs(e-t)<1.01}function Bv(e,t,n,r=Tc,o,s){const a=h.useRef(null),i=h.useRef(null),l=h.useRef(null),u=h.useCallback(p=>{const g=p.target,m=g===window||g===document,b=s?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,v=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(b,0),scrollHeight:v,viewportHeight:w})};p.suppressFlushSync?y():$n.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]);h.useEffect(()=>{const p=o||a.current;return r(o||a.current),u({target:p,suppressFlushSync:!0}),p.addEventListener("scroll",u,{passive:!0}),()=>{r(null),p.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(p){const g=a.current;if(!g||(s?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=p.behavior==="smooth";let b,v,w;g===window?(v=Math.max(Mc(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=g[s?"scrollWidth":"scrollHeight"],b=Mc(g,s?"width":"height"),w=g[s?"scrollLeft":"scrollTop"]);const y=v-b;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),Fv(b,v)||p.top===w){e({scrollTop:w,scrollHeight:v,viewportHeight:b}),m&&t(!0);return}m?(i.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(p={left:p.top,behavior:p.behavior}),g.scrollTo(p)}function f(p){s&&(p={left:p.top,behavior:p.behavior}),a.current.scrollBy(p)}return{scrollerRef:a,scrollByCallback:f,scrollToCallback:d}}const Lc=Vr(()=>{const e=_t(),t=_t(),n=Se(0),r=_t(),o=Se(0),s=_t(),a=_t(),i=Se(0),l=Se(0),u=Se(0),d=Se(0),f=_t(),p=_t(),g=Se(!1),m=Se(!1),b=Se(!1);return lt(_e(e,wt(({scrollTop:v})=>v)),t),lt(_e(e,wt(({scrollHeight:v})=>v)),a),lt(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:f,scrollBy:p,statefulScrollTop:o,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),PL=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function _L(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!PL)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const $c="up",$i="down",TL="none",OL={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},AL=0,zv=Vr(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=Se(!1),i=Se(!0),l=_t(),u=_t(),d=Se(4),f=Se(AL),p=xa(_e(Iv(_e(Be(t),rp(1),zo(!0)),_e(Be(t),rp(1),zo(!1),Vv(100))),gn()),!1),g=xa(_e(Iv(_e(s,zo(!0)),_e(s,zo(!1),Vv(200))),gn()),!1);lt(_e(ao(Be(t),Be(f)),wt(([y,S])=>y<=S),gn()),i),lt(_e(i,Li(50)),u);const m=Mi(_e(ao(e,Be(n),Be(r),Be(o),Be(d)),Oc((y,[{scrollTop:S,scrollHeight:C},x,E,P,T])=>{const O=S+x-C>-T,_={viewportHeight:x,scrollTop:S,scrollHeight:C};if(O){let L,k;return S>y.state.scrollTop?(L="SCROLLED_DOWN",k=y.state.scrollTop-S):(L="SIZE_DECREASED",k=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:_,atBottomBecause:L,scrollTopDelta:k}}let N;return _.scrollHeight>y.state.scrollHeight?N="SIZE_INCREASED":x<y.state.viewportHeight?N="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?N="SCROLLING_UPWARDS":N="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:N,state:_}},OL),gn((y,S)=>y&&y.atBottom===S.atBottom))),b=xa(_e(e,Oc((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(Fv(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}),Ut(y=>y.changed),wt(y=>y.jump)),0);lt(_e(m,wt(y=>y.atBottom)),a),lt(_e(a,Li(50)),l);const v=Se($i);lt(_e(e,wt(({scrollTop:y})=>y),gn(),Oc((y,S)=>Ca(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?$c:$i,prevScrollTop:S},{direction:$i,prevScrollTop:0}),wt(y=>y.direction)),v),lt(_e(e,Li(50),zo(TL)),v);const w=Se(0);return lt(_e(p,Ut(y=>!y),zo(0)),w),lt(_e(t,Li(100),kr(p),Ut(([y,S])=>!!S),Oc(([y,S],[C])=>[S,C],[0,0]),wt(([y,S])=>S-y)),w),{isScrolling:p,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:v,atBottomThreshold:d,atTopThreshold:f,scrollVelocity:w,lastJumpDueToItemResize:b}},Ns(Lc)),NL=Vr(([{log:e}])=>{const t=Se(!1),n=Mi(_e(t,Ut(r=>r),gn()));return Kt(t,r=>{r&&Ca(e)("props updated",{},op.DEBUG)}),{propsReady:t,didMount:n}},Ns(Dv),{singleton:!0});function Uv(e,t){e==0?t():requestAnimationFrame(()=>Uv(e-1,t))}function ML(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}function sp(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function LL(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const kc="top",Vc="bottom",Wv="none";function Gv(e,t,n){return typeof e=="number"?n===$c&&t===kc||n===$i&&t===Vc?e:0:n===$c?t===kc?e.main:e.reverse:t===Vc?e.main:e.reverse}function qv(e,t){return typeof e=="number"?e:e[t]||0}const $L=Vr(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=_t(),a=Se(0),i=Se(0),l=Se(0),u=xa(_e(ao(Be(e),Be(t),Be(r),Be(s,sp),Be(l),Be(a),Be(o),Be(n),Be(i)),wt(([d,f,p,[g,m],b,v,w,y,S])=>{const C=d-y,x=v+w,E=Math.max(p-C,0);let P=Wv;const T=qv(S,kc),O=qv(S,Vc);return g-=y,g+=p+w,m+=p+w,m-=y,g>d+x-T&&(P=$c),m<d-E+f+O&&(P=$i),P!==Wv?[Math.max(C-p-Gv(b,kc,P)-T,0),C-E-w+f+Gv(b,Vc,P)+O]:null}),Ut(d=>d!=null),gn(sp)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Ns(Lc),{singleton:!0}),kL=Vr(([{scrollVelocity:e}])=>{const t=Se(!1),n=_t(),r=Se(!1);return lt(_e(e,kr(r,t,n),Ut(([o,s])=>!!s),wt(([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}),gn()),t),Kt(_e(ao(t,e,n),kr(r)),([[o,s,a],i])=>o&&i&&i.change&&i.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Ns(zv),{singleton:!0});function VL(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const IL=Vr(([{scrollTo:e,scrollContainerState:t}])=>{const n=_t(),r=_t(),o=_t(),s=Se(!1),a=Se(void 0);return lt(_e(ao(n,r),wt(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),lt(_e(e,kr(r),wt(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Ns(Lc)),ap="-webkit-sticky",Kv="sticky",Yv=VL(()=>{if(typeof document>"u")return Kv;const e=document.createElement("div");return e.style.position=ap,e.style.position===ap?ap:Kv});function jL(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 f,p;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;f=g.height-Math.max(0,m),p=m+t.scrollTop}else f=window.innerHeight-Math.max(0,u.top),p=u.top+window.pageYOffset;r.current={offsetTop:p,visibleHeight:f,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=Hv(o,!0),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}h.createContext(void 0);const Zv=h.createContext(void 0);function DL(e){return e}Yv();const HL={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},FL={outline:"none",overflowX:"auto",position:"relative"},Xv=e=>({width:"100%",height:"100%",position:"absolute",top:0});Yv();function Ms(e,t){if(typeof e!="string")return{context:t}}function BL({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"),f=n("scrollerRef"),p=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:b,scrollToCallback:v}=Bv(l,d,u,f,void 0,g);t("scrollTo",v),t("scrollBy",b);const w=g?FL:HL;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...Ms(u,p),children:a})})}function zL({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"),f=n("totalListHeight"),p=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:b,scrollByCallback:v,scrollToCallback:w}=Bv(l,d,u,Tc,g);return jv(()=>(b.current=g||window,()=>{b.current=null}),[b,g]),t("windowScrollTo",w),t("scrollBy",v),c.jsx(u,{style:{position:"relative",...s,...f!==0?{height:f+p}:{}},"data-virtuoso-scroller":!0,...i,...Ms(u,m),children:a})})}const Jv={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},UL={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Qv,ceil:Rv,floor:Ic,min:ip,max:ki}=Math;function WL(e){return{...UL,items:e}}function e0(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 GL(e,t){return e&&e.column===t.column&&e.row===t.row}function jc(e,t){return e&&e.width===t.width&&e.height===t.height}const qL=Vr(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:f},p,g,{propsReady:m,didMount:b},{windowViewportRect:v,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=Se(0),P=Se(0),T=Se(Jv),O=Se({height:0,width:0}),_=Se({height:0,width:0}),N=_t(),L=_t(),k=Se(0),B=Se(null),$=Se({row:0,column:0}),z=_t(),K=_t(),F=Se(!1),V=Se(0),D=Se(!0),A=Se(!1),j=Se(!1);Kt(_e(b,kr(V),Ut(([W,R])=>!!R)),()=>{It(D,!1)}),Kt(_e(ao(b,D,_,O,V,A),Ut(([W,R,re,fe,,xe])=>W&&!R&&re.height!==0&&fe.height!==0&&!xe)),([,,,,W])=>{It(A,!0),Uv(1,()=>{It(N,W)}),$v(_e(o),()=>{It(n,[0,0]),It(D,!0)})}),lt(_e(K,Ut(W=>W!=null&&W.scrollTop>0),zo(0)),P),Kt(_e(b,kr(K),Ut(([,W])=>W!=null)),([,W])=>{W&&(It(O,W.viewport),It(_,W==null?void 0:W.item),It($,W.gap),W.scrollTop>0&&(It(F,!0),$v(_e(o,rp(1)),R=>{It(F,!1)}),It(i,{top:W.scrollTop})))}),lt(_e(O,wt(({height:W})=>W)),s),lt(_e(ao(Be(O,jc),Be(_,jc),Be($,(W,R)=>W&&W.column===R.column&&W.row===R.row),Be(o)),wt(([W,R,re,fe])=>({viewport:W,item:R,gap:re,scrollTop:fe}))),z),lt(_e(ao(Be(E),t,Be($,GL),Be(_,jc),Be(O,jc),Be(B),Be(P),Be(F),Be(D),Be(V)),Ut(([,,,,,,,W])=>!W),wt(([W,[R,re],fe,xe,ne,Oe,Ie,,ut,ot])=>{const{row:we,column:et}=fe,{height:tt,width:gt}=xe,{width:Ne}=ne;if(Ie===0&&(W===0||Ne===0))return Jv;if(gt===0){const Ht=ML(ot,W),po=Math.max(Ht+Ie-1,0);return WL(e0(Ht,po,Oe))}const dt=n0(Ne,gt,et);let st,Fe;ut?R===0&&re===0&&Ie>0?(st=0,Fe=Ie-1):(st=dt*Ic((R+we)/(tt+we)),Fe=dt*Rv((re+we)/(tt+we))-1,Fe=ip(W-1,ki(Fe,dt-1)),st=ip(Fe,ki(0,st))):(st=0,Fe=-1);const Yt=e0(st,Fe,Oe),{top:ge,bottom:Ve}=t0(ne,fe,xe,Yt),je=Rv(W/dt),Et=je*tt+(je-1)*we-Ve;return{items:Yt,offsetTop:ge,offsetBottom:Et,top:ge,bottom:Ve,itemHeight:tt,itemWidth:gt}})),T),lt(_e(B,Ut(W=>W!==null),wt(W=>W.length)),E),lt(_e(ao(O,_,T,$),Ut(([W,R,{items:re}])=>re.length>0&&R.height!==0&&W.height!==0),wt(([W,R,{items:re},fe])=>{const{top:xe,bottom:ne}=t0(W,fe,R,re);return[xe,ne]}),gn(sp)),n);const q=Se(!1);lt(_e(o,kr(q),wt(([W,R])=>R||W!==0)),q);const G=Mi(_e(Be(T),Ut(({items:W})=>W.length>0),kr(E,q),Ut(([{items:W},R,re])=>re&&W[W.length-1].index===R-1),wt(([,W])=>W-1),gn())),Y=Mi(_e(Be(T),Ut(({items:W})=>W.length>0&&W[0].index===0),zo(0),gn())),Q=Mi(_e(Be(T),kr(F),Ut(([{items:W},R])=>W.length>0&&!R),wt(([{items:W}])=>({startIndex:W[0].index,endIndex:W[W.length-1].index})),gn(LL),Li(0)));lt(Q,g.scrollSeekRangeChanged),lt(_e(N,kr(O,_,E,$),wt(([W,R,re,fe,xe])=>{const ne=_L(W),{align:Oe,behavior:Ie,offset:ut}=ne;let ot=ne.index;ot==="LAST"&&(ot=fe-1),ot=ki(0,ot,ip(fe-1,ot));let we=lp(R,xe,re,ot);return Oe==="end"?we=Qv(we-R.height+re.height):Oe==="center"&&(we=Qv(we-R.height/2+re.height/2)),ut&&(we+=ut),{top:we,behavior:Ie}})),i);const Z=xa(_e(T,wt(W=>W.offsetBottom+W.bottom)),0);return lt(_e(v,wt(W=>({width:W.visibleWidth,height:W.visibleHeight}))),O),{data:B,totalCount:E,viewportDimensions:O,itemDimensions:_,scrollTop:o,scrollHeight:L,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:N,smoothScrollTargetReached:l,windowViewportRect:v,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:k,scrollContainerState:u,footerHeight:d,headerHeight:f,initialItemCount:P,gap:$,restoreStateFrom:K,...g,initialTopMostItemIndex:V,horizontalDirection:j,gridState:T,totalListHeight:Z,...p,startReached:Y,endReached:G,rangeChanged:Q,stateChanged:z,propsReady:m,stateRestoreInProgress:F,...x}},Ns($L,Lc,zv,kL,NL,IL,Dv));function t0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=lp(e,t,n,r[0].index),a=lp(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function lp(e,t,n,r){const o=n0(e.width,n.width,t.column),s=Ic(r/o),a=s*n.height+ki(0,s-1)*t.row;return a>0?a+t.row:a}function n0(e,t,n){return ki(1,Ic((e+n)/(Ic(t)+n)))}const KL=Vr(([e,t])=>({...e,...t}),Ns(qL,Vr(()=>{const e=Se(f=>`Item ${f}`),t=Se({}),n=Se(null),r=Se("virtuoso-grid-item"),o=Se("virtuoso-grid-list"),s=Se(DL),a=Se("div"),i=Se(Tc),l=(f,p=null)=>xa(_e(t,wt(g=>g[f]),gn()),p),u=Se(!1),d=Se(!1);return lt(Be(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")}}))),YL=h.memo(function(){const t=Ct("gridState"),n=Ct("listClassName"),r=Ct("itemClassName"),o=Ct("itemContent"),s=Ct("computeItemKey"),a=Ct("isSeeking"),i=Yn("scrollHeight"),l=Ct("ItemComponent"),u=Ct("ListComponent"),d=Ct("ScrollSeekPlaceholder"),f=Ct("context"),p=Yn("itemDimensions"),g=Yn("gap"),m=Ct("log"),b=Ct("stateRestoreInProgress"),v=Yn("reportReadyState"),w=Nc(h.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();p({width:x,height:E})}g({row:o0("row-gap",getComputedStyle(y).rowGap,m),column:o0("column-gap",getComputedStyle(y).columnGap,m)})},[i,p,g,m]),!0);return jv(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),b?null:c.jsx(u,{ref:w,className:n,...Ms(u,f),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,f);return a?c.jsx(d,{...Ms(d,f),index:y.index,height:t.itemHeight,width:t.itemWidth},S):h.createElement(l,{...Ms(l,f),className:r,"data-index":y.index,key:S},o(y.index,y.data,f))})})}),ZL=h.memo(function(){const t=Ct("HeaderComponent"),n=Yn("headerHeight"),r=Ct("headerFooterTag"),o=Nc(h.useMemo(()=>a=>n(Mc(a,"height")),[n]),!0),s=Ct("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...Ms(t,s)})}):null}),XL=h.memo(function(){const t=Ct("FooterComponent"),n=Yn("footerHeight"),r=Ct("headerFooterTag"),o=Nc(h.useMemo(()=>a=>n(Mc(a,"height")),[n]),!0),s=Ct("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...Ms(t,s)})}):null}),JL=({children:e})=>{const t=h.useContext(Zv),n=Yn("itemDimensions"),r=Yn("viewportDimensions"),o=Nc(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0);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:Xv(),ref:o,children:e})},QL=({children:e})=>{const t=h.useContext(Zv),n=Yn("windowViewportRect"),r=Yn("itemDimensions"),o=Ct("customScrollParent"),s=jL(n,o);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:Xv(),children:e})},RL=h.memo(function({...t}){const n=Ct("useWindowScroll"),r=Ct("customScrollParent"),o=r||n?n$:t$,s=r||n?QL:JL;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(ZL,{}),c.jsx(YL,{}),c.jsx(XL,{})]})})}),{Component:e$,usePublisher:Yn,useEmitterValue:Ct,useEmitter:r0}=CL(KL,{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"}},RL),t$=BL({usePublisher:Yn,useEmitterValue:Ct,useEmitter:r0}),n$=zL({usePublisher:Yn,useEmitterValue:Ct,useEmitter:r0});function o0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,op.WARN),t==="normal"?0:parseInt(t??"0",10)}const Dc=e$,cp=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},r$=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function o$(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 iS(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const s$=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{r$(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await o$(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}},a$=(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===vt.email)try{i=e.runCommand(pc).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>")},i$=async(e,t,n)=>{const r=jw(t,{appStore:n}),o=await s$(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(Yn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:bN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(Hc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),$b="gs-canvas-content",wN=h.memo(ce(function({children:t}){const{isReady:n}=we(),r=N(`${$b}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,z.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:$b,children:[c.jsx("div",{className:r}),!n&&c.jsx(Lo,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&$t(t)]}),c.jsx(vN,{}),c.jsx(yN,{})]})})),SN="gs-canvas",kb=h.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(rN,{style:n,className:N(SN,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Fi,{children:c.jsx(wN,{children:o})})})}),cp=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),CN=cp?Promise.resolve().then(function(){return _N}):Promise.resolve().then(function(){return kN});async function xN(...e){return(await CN).default(...e)}cp?Promise.resolve().then(function(){return LN}):Promise.resolve().then(function(){return VN});const EN=cp?Promise.resolve().then(function(){return NN}):Promise.resolve().then(function(){return jN});async function TN(...e){return(await EN).default(...e)}const PN=async e=>{const t=await e.getFile();return t.handle=e,t};var ON=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(PN));return e[0].multiple?r:r[0]},_N={__proto__:null,default:ON};function jc(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 jc=function(n){this.s=n,this.n=n.next},jc.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 jc(e)}const Ib=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!1,l=!1;try{for(var u,d=function(f){var p,g,m,v=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);v--;){if(g&&(p=f[g])!=null)return p.call(f);if(m&&(p=f[m])!=null)return new jc(p.call(f));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const f=u.value,p=`${n}/${f.name}`;f.kind==="file"?s.push(f.getFile().then(g=>(g.directoryHandle=e,g.handle=f,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>p})))):f.kind!=="directory"||!t||r&&r(f)||o.push(Ib(f,t,p,r))}}catch(f){l=!0,a=f}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 AN=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]:Ib(t,e.recursive,void 0,e.skipDirectory)},LN={__proto__:null,default:AN},MN=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(f=>{s[d].accept[f]=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)},NN={__proto__:null,default:MN},$N=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()})),kN={__proto__:null,default:$N},IN=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()})),VN={__proto__:null,default:IN},HN=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:p=>async function g(){return l.read().then(({done:m,value:v})=>{if(!m)return p.enqueue(v),g();p.close()})}()}),d=new Response(u),f=await d.blob();return l.releaseLock(),new Blob([f],{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},jN={__proto__:null,default:HN};function Ko({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} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Vb={NODE_ENV:"production"};const DN=Vb.REACT_APP_VERSION??Vb.NPM_PACKAGE_VERSION,FN=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(B,{className:ae("relative"),children:[c.jsx(Hc,{className:ae("w-24 opacity-50")}),t&&c.jsx(Ko,{className:ae(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(B,{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(Ao.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(Ao.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(B,{className:ae(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",DN]})]})}),BN=ce(function(){return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsx(B,{className:Z("relative"),children:c.jsx(Hc,{className:Z("w-24 opacity-50")})})}),c.jsx(B,{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:Z(Ao.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:Z(Ao.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),zN=()=>[{id:xt.web,label:Pr(xt.web),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.web,size:se.s}),c.jsx("span",{children:Pr(xt.web)})]})},{id:xt.email,label:Pr(xt.email),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.emailOutline,size:se.s}),c.jsx("span",{children:Pr(xt.email)})]})}],Dc="gs-cmp-tabs";function Zo({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=qS,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]",z.bgH):"",d=v=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?z.bg:""):N("gs-utl-border-b-2",Te.xy),f=v=>{v&&(v.tabIndex=-1)},p=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:I,className:N(Dc,t,u),style:s,full:!0,nowrap:!0,children:e.map(v=>c.jsx(fi,{disabled:v.disabled,className:({selected:b})=>N(`${Dc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",ni.focus,d(b),b?`${z.tAo} ${z.bA}`:z.br,r),children:v.label},v.id))}),c.jsx(fi.Panels,{className:N(`${Dc}__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(`${Dc}__panel`,"gs-utl-h-full"),ref:f,onFocus:p,children:v.content},v.id))})]})}const Fc=0,Yo=1,Oa=2,Hb=4;function jb(e,t){return n=>e(t(n))}function UN(e,t){return t(e)}function Db(e,t){return n=>e(t,n)}function Fb(e,t){return()=>e(t)}function Bc(e,t){return t(e),e}function Tt(...e){return e}function WN(e){e()}function Bb(e){return()=>e}function GN(...e){return()=>{e.map(WN)}}function up(e){return e!==void 0}function _a(){}function at(e,t){return e(Yo,t)}function Ve(e,t){e(Fc,t)}function dp(e){e(Oa)}function Rt(e){return e(Hb)}function ye(e,t){return at(e,Db(t,Fc))}function Fr(e,t){const n=e(Yo,r=>{n(),t(r)});return n}function Ge(){const e=[];return(t,n)=>{switch(t){case Oa:e.splice(0,e.length);return;case Yo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Fc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function pe(e){let t=e;const n=Ge();return(r,o)=>{switch(r){case Yo:o(t);break;case Fc:t=o;break;case Hb:return t}return n(r,o)}}function qN(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Yo:return s?n===s?void 0:(r(),n=s,t=at(e,s),t):(r(),_a);case Oa:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function $n(e){return Bc(Ge(),t=>ye(e,t))}function un(e,t){return Bc(pe(t),n=>ye(e,n))}function KN(...e){return t=>e.reduceRight(UN,t)}function ie(e,...t){const n=KN(...t);return(r,o)=>{switch(r){case Yo:return at(e,n(o));case Oa:dp(e);return}}}function zb(e,t){return e===t}function Pt(e=zb){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Oe(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>jb(t,e)}function Br(e){return t=>()=>t(e)}function zr(e,t){return n=>r=>n(t=e(t,r))}function Aa(e){return t=>n=>{e>0?e--:t(n)}}function Xo(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ub(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 Wb(...e){return function(t,n){switch(t){case Yo:return GN(...e.map(r=>at(r,n)));case Oa:return;default:throw new Error(`unrecognized action ${t}`)}}}function _e(e,t=zb){return ie(e,Pt(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 Yo:return r===o&&a(n),at(t,a);case Oa:return dp(t);default:throw new Error(`unrecognized action ${s}`)}}}function it(e,t=[],{singleton:n}={singleton:!0}){return{id:ZN(),constructor:e,dependencies:t,singleton:n}}const ZN=()=>Symbol();function YN(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 XN(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 zc=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Gb(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]=qN(w[t.events[S]]),y),{})}const f=h.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=h.useState(()=>Bc(YN(e),_=>l(_,C))),[E]=h.useState(Fb(d,x));zc(()=>{for(const _ of a)_ in C&&at(E[_],C[_]);return()=>{Object.values(E).map(dp)}},[C,E,x]),zc(()=>{l(x,C)}),h.useImperativeHandle(y,Bb(u(x)));const T=n;return c.jsx(i.Provider,{value:x,children:n?c.jsx(T,{...XN([...r,...o,...a],C),children:S}):S})}),p=w=>h.useCallback(Db(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,()=>Rt(S),()=>Rt(S))},m=w=>{const S=h.useContext(i)[w],[C,x]=h.useState(Fb(Rt,S));return zc(()=>at(S,E=>{E!==C&&x(Bb(E))}),[S,C]),C},v=h.version.startsWith("18")?g:m;return{Component:f,usePublisher:p,useEmitterValue:v,useEmitter:(w,y)=>{const C=h.useContext(i)[w];zc(()=>at(C,y),[y,C])}}}const qb=typeof document<"u"?h.useLayoutEffect:h.useEffect;var kn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(kn||{});const JN={0:"debug",1:"log",2:"warn",3:"error"},QN=()=>typeof globalThis>"u"?window:globalThis,Jo=it(()=>{const e=pe(3);return{log:pe((n,r,o=1)=>{var s;const a=(s=QN().VIRTUOSO_LOG_LEVEL)!=null?s:Rt(e);o>=a&&console[JN[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function fp(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 js(e,t,n){return fp(e,t,n).callbackRef}function RN(e,t,n,r,o,s,a,i,l){const u=h.useCallback(d=>{const f=e$(d.children,t,i?"offsetWidth":"offsetHeight",o);let p=d.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const g=p.lastElementChild.dataset.viewportType==="window",m=a?i?a.scrollLeft:a.scrollTop:g?i?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:i?p.scrollLeft:p.scrollTop,v=a?i?a.scrollWidth:a.scrollHeight:g?i?document.documentElement.scrollWidth:document.documentElement.scrollHeight:i?p.scrollWidth:p.scrollHeight,b=a?i?a.offsetWidth:a.offsetHeight:g?i?window.innerWidth:window.innerHeight:i?p.offsetWidth:p.offsetHeight;r({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),s==null||s(i?Kb("column-gap",getComputedStyle(d).columnGap,o):Kb("row-gap",getComputedStyle(d).rowGap,o)),f!==null&&e(f)},[e,t,o,s,a,r]);return fp(u,n,l)}function e$(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},kn.ERROR),d===u)continue;const f=s[s.length-1];s.length===0||f.size!==d||f.endIndex!==l-1?s.push({startIndex:l,endIndex:l,size:d}):s[s.length-1].endIndex++}return s}function Kb(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,kn.WARN),t==="normal"?0:parseInt(t??"0",10)}function Qo(e,t){return Math.round(e.getBoundingClientRect()[t])}function Zb(e,t){return Math.abs(e-t)<1.01}function Yb(e,t,n,r=_a,o,s){const a=h.useRef(null),i=h.useRef(null),l=h.useRef(null),u=h.useCallback(p=>{const g=p.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})};p.suppressFlushSync?y():Fn.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 p=o||a.current;return r(o||a.current),u({target:p,suppressFlushSync:!0}),p.addEventListener("scroll",u,{passive:!0}),()=>{r(null),p.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(p){const g=a.current;if(!g||(s?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=p.behavior==="smooth";let v,b,w;g===window?(b=Math.max(Qo(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=Qo(g,s?"width":"height"),w=g[s?"scrollLeft":"scrollTop"]);const y=b-v;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),Zb(v,b)||p.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(i.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(p={left:p.top,behavior:p.behavior}),g.scrollTo(p)}function f(p){s&&(p={left:p.top,behavior:p.behavior}),a.current.scrollBy(p)}return{scrollerRef:a,scrollByCallback:f,scrollToCallback:d}}const dn=it(()=>{const e=Ge(),t=Ge(),n=pe(0),r=Ge(),o=pe(0),s=Ge(),a=Ge(),i=pe(0),l=pe(0),u=pe(0),d=pe(0),f=Ge(),p=Ge(),g=pe(!1),m=pe(!1),v=pe(!1);return ye(ie(e,me(({scrollTop:b})=>b)),t),ye(ie(e,me(({scrollHeight:b})=>b)),a),ye(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:f,scrollBy:p,statefulScrollTop:o,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),Bi={lvl:0};function Xb(e,t,n,r=Bi,o=Bi){return{k:e,v:t,lvl:n,l:r,r:o}}function ht(e){return e===Bi}function La(){return Bi}function pp(e,t){if(ht(e))return Bi;const{k:n,l:r,r:o}=e;if(t===n){if(ht(r))return o;if(ht(o))return r;{const[s,a]=Jb(r);return Uc(Ft(e,{k:s,v:a,l:Qb(r)}))}}else return t<n?Uc(Ft(e,{l:pp(r,t)})):Uc(Ft(e,{r:pp(o,t)}))}function zi(e,t){if(!ht(e))return t===e.k?e.v:t<e.k?zi(e.l,t):zi(e.r,t)}function Sr(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=Sr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Sr(e.l,t,n)}function In(e,t,n){return ht(e)?Xb(t,n,1):t===e.k?Ft(e,{k:t,v:n}):t<e.k?Rb(Ft(e,{l:In(e.l,t,n)})):Rb(Ft(e,{r:In(e.r,t,n)}))}function hp(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(hp(s,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(hp(a,t,n))),i}function Ds(e){return ht(e)?[]:[...Ds(e.l),{k:e.k,v:e.v},...Ds(e.r)]}function Jb(e){return ht(e.r)?[e.k,e.v]:Jb(e.r)}function Qb(e){return ht(e.r)?e.l:Uc(Ft(e,{r:Qb(e.r)}))}function Ft(e,t){return Xb(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 gp(e){return ht(e)||e.lvl>e.r.lvl}function Rb(e){return mp(t0(e))}function Uc(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(gp(t))return t0(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(gp(e))return mp(Ft(e,{lvl:r-1}));if(!ht(n)&&!ht(n.l)){const o=n.l,s=gp(o)?n.lvl-1:n.lvl;return Ft(o,{l:Ft(e,{r:o.l,lvl:r-1}),r:mp(Ft(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Wc(e,t,n){if(ht(e))return[];const r=Sr(e,t)[0];return t$(hp(e,r,n))}function e0(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 t$(e){return e0(e,({k:t,v:n})=>({index:t,value:n}))}function mp(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 t0(e){const{l:t}=e;return!ht(t)&&t.lvl===e.lvl?Ft(t,{r:Ft(e,{l:t.r})}):e}function Gc(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 n0(e,t,n){return e[Gc(e,t,n)]}function n$(e,t,n,r){const o=Gc(e,t,r),s=Gc(e,n,r,o);return e.slice(o,s+1)}const vp=it(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function r$(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 r0(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 o$(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=In(e,0,o);continue}const i=Wc(e,s-1,a+1);if(i.some(r$(r)))continue;let l=!1,u=!1;for(const{start:d,end:f,value:p}of i)l?(a>=d||o===p)&&(e=pp(e,d)):(u=p!==o,l=!0),f>a&&a>=d&&p!==o&&(e=In(e,a+1,p));u&&(e=In(e,s,o))}return[e,n]}function s$(){return{offsetTree:[],sizeTree:La(),groupOffsetTree:La(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function bp({index:e},t){return t===e?0:t<e?-1:1}function a$({offset:e},t){return t===e?0:t<e?-1:1}function i$(e){return{index:e.index,value:e}}function l$(e,t,n,r=0){return r>0&&(t=Math.max(t,n0(e,r,bp).offset)),e0(n$(e,t,n,a$),i$)}function yp(e,t,n,r){let o=e,s=0,a=0,i=0,l=0;if(t!==0){l=Gc(o,t-1,bp),i=o[l].offset;const d=Sr(n,t-1);s=d[0],a=d[1],o.length&&o[l].size===Sr(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of Wc(n,t,1/0)){const f=u-s,p=f*a+i+f*r;o.push({offset:p,size:d,index:u}),s=u,i=p,a=d}return{offsetTree:o,lastIndex:s,lastOffset:i,lastSize:a}}function c$(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,kn.DEBUG);const s=e.sizeTree;let a=s,i=0;if(n.length>0&&ht(s)&&t.length===2){const p=t[0].size,g=t[1].size;a=n.reduce((m,v)=>In(In(m,v,p),v+1,g),a)}else[a,i]=o$(a,t);if(a===s)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:f}=yp(e.offsetTree,i,a,o);return{sizeTree:a,offsetTree:l,lastIndex:u,lastOffset:f,lastSize:d,groupOffsetTree:n.reduce((p,g)=>In(p,g,Ui(g,l,o)),La()),groupIndices:n}}function Ui(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=n0(t,e,bp),a=e-o,i=s*a+(a-1)*n+r;return i>0?i+n:i}function u$(e){return typeof e.groupIndex<"u"}function o0(e,t,n){if(u$(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=s0(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function s0(e,t){if(!qc(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function qc(e){return!ht(e.groupOffsetTree)}function d$(e){return Ds(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 f$={offsetHeight:"height",offsetWidth:"width"},Ur=it(([{log:e},{recalcInProgress:t}])=>{const n=Ge(),r=Ge(),o=un(r,0),s=Ge(),a=Ge(),i=pe(0),l=pe([]),u=pe(void 0),d=pe(void 0),f=pe((x,E)=>Qo(x,f$[E])),p=pe(void 0),g=pe(0),m=s$(),v=un(ie(n,je(l,e,g),zr(c$,m),Pt()),m),b=un(ie(l,Pt(),zr((x,E)=>({prev:x.current,current:E}),{prev:[],current:[]}),me(({prev:x})=>x)),[]);ye(ie(l,Oe(x=>x.length>0),je(v,g),me(([x,E,T])=>{const _=x.reduce((O,P,A)=>In(O,P,Ui(P,E.offsetTree,T)||A),La());return{...E,groupIndices:x,groupOffsetTree:_}})),v),ye(ie(r,je(v),Oe(([x,{lastIndex:E}])=>x<E),me(([x,{lastIndex:E,lastSize:T}])=>[{startIndex:x,endIndex:E,size:T}])),n),ye(u,d);const w=un(ie(u,me(x=>x===void 0)),!0);ye(ie(d,Oe(x=>x!==void 0&&ht(Rt(v).sizeTree)),me(x=>[{startIndex:0,endIndex:0,size:x}])),n);const y=$n(ie(n,je(v),zr(({sizes:x},[E,T])=>({changed:T!==x,sizes:T}),{changed:!1,sizes:m}),me(x=>x.changed)));at(ie(i,zr((x,E)=>({diff:x.prev-E,prev:E}),{diff:0,prev:0}),me(x=>x.diff)),x=>{const{groupIndices:E}=Rt(v);if(x>0)Ve(t,!0),Ve(s,x+r0(x,E));else if(x<0){const T=Rt(b);T.length>0&&(x-=r0(-x,T)),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},kn.ERROR)});const S=$n(s);ye(ie(s,je(v),me(([x,E])=>{const T=E.groupIndices.length>0,_=[],O=E.lastSize;if(T){const P=zi(E.sizeTree,0);let A=0,M=0;for(;A<x;){const L=E.groupIndices[M],D=E.groupIndices.length===M+1?1/0:E.groupIndices[M+1]-L-1;_.push({startIndex:L,endIndex:L,size:P}),_.push({startIndex:L+1,endIndex:L+1+D-1,size:O}),M++,A+=D+1}const $=Ds(E.sizeTree);return A!==x&&$.shift(),$.reduce((L,{k:D,v:W})=>{let F=L.ranges;return L.prevSize!==0&&(F=[...L.ranges,{startIndex:L.prevIndex,endIndex:D+x-1,size:L.prevSize}]),{ranges:F,prevIndex:D+x,prevSize:W}},{ranges:_,prevIndex:x,prevSize:0}).ranges}return Ds(E.sizeTree).reduce((P,{k:A,v:M})=>({ranges:[...P.ranges,{startIndex:P.prevIndex,endIndex:A+x-1,size:P.prevSize}],prevIndex:A+x,prevSize:M}),{ranges:[],prevIndex:0,prevSize:O}).ranges})),n);const C=$n(ie(a,je(v,g),me(([x,{offsetTree:E},T])=>{const _=-x;return Ui(_,E,T)})));return ye(ie(a,je(v,g),me(([x,E,T])=>{if(E.groupIndices.length>0){if(ht(E.sizeTree))return E;let O=La();const P=Rt(b);let A=0,M=0,$=0;for(;A<-x;){$=P[M];const L=P[M+1]-$-1;M++,A+=L+1}if(O=Ds(E.sizeTree).reduce((L,{k:D,v:W})=>In(L,Math.max(0,D+x),W),O),A!==-x){const L=zi(E.sizeTree,$);O=In(O,0,L);const D=Sr(E.sizeTree,-x+1)[1];O=In(O,1,D)}return{...E,sizeTree:O,...yp(E.offsetTree,0,O,T)}}else{const O=Ds(E.sizeTree).reduce((P,{k:A,v:M})=>In(P,Math.max(0,A+x),M),La());return{...E,sizeTree:O,...yp(E.offsetTree,0,O,T)}}})),v),{data:p,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:f}},Tt(Jo,vp),{singleton:!0}),p$=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function a0(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!p$)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Wi=it(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:a,smoothScrollTargetReached:i,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:f},{log:p}])=>{const g=Ge(),m=Ge(),v=pe(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 ye(ie(g,je(e,s,t,v,l,u,p),je(r,d,f),me(([[C,x,E,T,_,O,P,A],M,$,j])=>{const L=a0(C),{align:D,behavior:W,offset:F}=L,k=T-1,H=o0(L,x,k);let V=Ui(H,x.offsetTree,M)+O;D==="end"?(V+=$+Sr(x.sizeTree,H)[1]-E+j,H===k&&(V+=P)):D==="center"?V+=($+Sr(x.sizeTree,H)[1]-E+j)/2:V-=_,F&&(V+=F);const U=J=>{S(),J?(A("retrying to scroll to",{location:C},kn.DEBUG),Ve(g,C)):(Ve(m,!0),A("list did not change, scroll successful",{},kn.DEBUG))};if(S(),W==="smooth"){let J=!1;y=at(n,Y=>{J=J||Y}),b=Fr(i,()=>{U(J)})}else b=Fr(ie(n,h$(150)),U);return w=setTimeout(()=>{S()},1200),Ve(o,!0),A("scrolling from index to",{index:H,top:V,behavior:W},kn.DEBUG),{top:V,behavior:W}})),a),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Tt(Ur,dn,Jo),{singleton:!0});function h$(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const Gi="up",qi="down",g$="none",m$={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},v$=0,Ki=it(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=pe(!1),i=pe(!0),l=Ge(),u=Ge(),d=pe(4),f=pe(v$),p=un(ie(Wb(ie(_e(t),Aa(1),Br(!0)),ie(_e(t),Aa(1),Br(!1),Ub(100))),Pt()),!1),g=un(ie(Wb(ie(s,Br(!0)),ie(s,Br(!1),Ub(200))),Pt()),!1);ye(ie(zt(_e(t),_e(f)),me(([y,S])=>y<=S),Pt()),i),ye(ie(i,Xo(50)),u);const m=$n(ie(zt(e,_e(n),_e(r),_e(o),_e(d)),zr((y,[{scrollTop:S,scrollHeight:C},x,E,T,_])=>{const O=S+x-C>-_,P={viewportHeight:x,scrollTop:S,scrollHeight:C};if(O){let M,$;return S>y.state.scrollTop?(M="SCROLLED_DOWN",$=y.state.scrollTop-S):(M="SIZE_DECREASED",$=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:P,atBottomBecause:M,scrollTopDelta:$}}let A;return P.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":x<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:P}},m$),Pt((y,S)=>y&&y.atBottom===S.atBottom))),v=un(ie(e,zr((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(Zb(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}),Oe(y=>y.changed),me(y=>y.jump)),0);ye(ie(m,me(y=>y.atBottom)),a),ye(ie(a,Xo(50)),l);const b=pe(qi);ye(ie(e,me(({scrollTop:y})=>y),Pt(),zr((y,S)=>Rt(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?Gi:qi,prevScrollTop:S},{direction:qi,prevScrollTop:0}),me(y=>y.direction)),b),ye(ie(e,Xo(50),Br(g$)),b);const w=pe(0);return ye(ie(p,Oe(y=>!y),Br(0)),w),ye(ie(t,Xo(100),je(p),Oe(([y,S])=>!!S),zr(([y,S],[C])=>[S,C],[0,0]),me(([y,S])=>S-y)),w),{isScrolling:p,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:f,scrollVelocity:w,lastJumpDueToItemResize:v}},Tt(dn)),Ro=it(([{log:e}])=>{const t=pe(!1),n=$n(ie(t,Oe(r=>r),Pt()));return at(t,r=>{r&&Rt(e)("props updated",{},kn.DEBUG)}),{propsReady:t,didMount:n}},Tt(Jo),{singleton:!0});function wp(e,t){e==0?t():requestAnimationFrame(()=>wp(e-1,t))}function Sp(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Zi=it(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:s},{didMount:a}])=>{const i=pe(!0),l=pe(0),u=pe(!0);return ye(ie(a,je(l),Oe(([d,f])=>!!f),Br(!1)),i),ye(ie(a,je(l),Oe(([d,f])=>!!f),Br(!1)),u),at(ie(zt(t,a),je(i,e,n,u),Oe(([[,d],f,{sizeTree:p},g,m])=>d&&(!ht(p)||up(g))&&!f&&!m),je(l)),([,d])=>{Fr(s,()=>{Ve(u,!0)}),wp(4,()=>{Fr(r,()=>{Ve(i,!0)}),Ve(o,d)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Tt(Ur,dn,Wi,Ro),{singleton:!0});function i0(e){return e?e==="smooth"?"smooth":"auto":!1}const b$=(e,t)=>typeof e=="function"?i0(e(t)):t&&i0(e),y$=it(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:a,didMount:i},{log:l},{scrollingInProgress:u}])=>{const d=pe(!1),f=Ge();let p=null;function g(v){Ve(o,{index:"LAST",align:"end",behavior:v})}at(ie(zt(ie(_e(e),Aa(1)),i),je(_e(d),n,s,u),me(([[v,b],w,y,S,C])=>{let x=b&&S,E="auto";return x&&(E=b$(w,y||C),x=x&&!!E),{totalCount:v,shouldFollow:x,followOutputBehavior:E}}),Oe(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{p&&(p(),p=null),p=Fr(t,()=>{Rt(l)("following output to ",{totalCount:v},kn.DEBUG),g(b),p=null})});function m(v){const b=Fr(r,w=>{v&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Rt(l)("scrolling to bottom due to increased size",{},kn.DEBUG),g("auto"))});setTimeout(b,100)}return at(ie(zt(_e(d),e,a),Oe(([v,,b])=>v&&b),zr(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),Oe(({refreshed:v})=>v),je(d,e)),([,v])=>{Rt(s)&&m(v!==!1)}),at(f,()=>{m(Rt(d)!==!1)}),at(zt(_e(d),r),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:f}},Tt(Ur,Ki,Wi,Zi,Ro,Jo,dn));function w$(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const l0=it(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Ge(),a=Ge(),i=$n(ie(s,me(w$)));return ye(ie(i,me(l=>l.totalCount)),e),ye(ie(i,me(l=>l.groupIndices)),t),ye(ie(zt(r,n,o),Oe(([l,u])=>qc(u)),me(([l,u,d])=>Sr(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Pt(),me(l=>[l])),a),{groupCounts:s,topItemsIndexes:a}},Tt(Ur,dn));function Yi(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function c0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Kc="top",Zc="bottom",u0="none";function d0(e,t,n){return typeof e=="number"?n===Gi&&t===Kc||n===qi&&t===Zc?e:0:n===Gi?t===Kc?e.main:e.reverse:t===Zc?e.main:e.reverse}function f0(e,t){return typeof e=="number"?e:e[t]||0}const Cp=it(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Ge(),a=pe(0),i=pe(0),l=pe(0),u=un(ie(zt(_e(e),_e(t),_e(r),_e(s,Yi),_e(l),_e(a),_e(o),_e(n),_e(i)),me(([d,f,p,[g,m],v,b,w,y,S])=>{const C=d-y,x=b+w,E=Math.max(p-C,0);let T=u0;const _=f0(S,Kc),O=f0(S,Zc);return g-=y,g+=p+w,m+=p+w,m-=y,g>d+x-_&&(T=Gi),m<d-E+f+O&&(T=qi),T!==u0?[Math.max(C-p-d0(v,Kc,T)-_,0),C-E-w+f+d0(v,Zc,T)+O]:null}),Oe(d=>d!=null),Pt(Yi)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Tt(dn),{singleton:!0});function S$(e,t,n){if(qc(t)){const r=s0(e,t);return[{index:Sr(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 xp={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(!qc(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=Wc(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 Yc(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 f=n-l,p=i+f*a+(f-1)*r,g=u,m=p-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 h0(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=Sp(t,i),u=Array.from({length:i}).map((d,f)=>({index:f+l,size:0,offset:0,data:s[f+l]}));return Yc(u,[],i,o,n,r)}const Fs=it(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:a,listBoundary:i,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},p,{didMount:g},{recalcInProgress:m}])=>{const v=pe([]),b=pe(0),w=Ge();ye(s.topItemsIndexes,v);const y=un(ie(zt(g,m,_e(a,Yi),_e(t),_e(e),_e(d),u,_e(v),_e(r),_e(o),n),Oe(([E,T,,_,,,,,,,O])=>{const P=O&&O.length!==_;return E&&!T&&!P}),me(([,,[E,T],_,O,P,A,M,$,j,L])=>{const D=O,{sizeTree:W,offsetTree:F}=D,k=Rt(b);if(_===0)return{...xp,totalCount:_};if(E===0&&T===0)return k===0?{...xp,totalCount:_}:h0(k,P,O,$,j,L||[]);if(ht(W))return k>0?null:Yc(S$(Sp(P,_),D,L),[],_,j,D,$);const H=[];if(M.length>0){const X=M[0],Q=M[M.length-1];let ee=0;for(const G of Wc(W,X,Q)){const R=G.value,le=Math.max(G.start,X),ge=Math.min(G.end,Q);for(let Ee=le;Ee<=ge;Ee++)H.push({index:Ee,size:R,offset:ee,data:L&&L[Ee]}),ee+=R}}if(!A)return Yc([],H,_,j,D,$);const V=M.length>0?M[M.length-1]+1:0,U=l$(F,E,T,V);if(U.length===0)return null;const J=_-1,Y=Bc([],X=>{for(const Q of U){const ee=Q.value;let G=ee.offset,R=Q.start;const le=ee.size;if(ee.offset<E){R+=Math.floor((E-ee.offset+j)/(le+j));const Ee=R-Q.start;G+=Ee*le+Ee*j}R<V&&(G+=(V-R)*le,R=V);const ge=Math.min(Q.end,J);for(let Ee=R;Ee<=ge&&!(G>=T);Ee++)X.push({index:Ee,size:le,offset:G,data:L&&L[Ee]}),G+=le+j}});return Yc(Y,H,_,j,D,$)}),Oe(E=>E!==null),Pt()),xp);ye(ie(n,Oe(up),me(E=>E==null?void 0:E.length)),t),ye(ie(y,me(E=>E.topListHeight)),f),ye(f,l),ye(ie(y,me(E=>[E.top,E.bottom])),i),ye(ie(y,me(E=>E.items)),w);const S=$n(ie(y,Oe(({items:E})=>E.length>0),je(t,n),Oe(([{items:E},T])=>E[E.length-1].originalIndex===T-1),me(([,E,T])=>[E-1,T]),Pt(Yi),me(([E])=>E))),C=$n(ie(y,Xo(200),Oe(({items:E,topItems:T})=>E.length>0&&E[0].originalIndex===T.length),me(({items:E})=>E[0].index),Pt())),x=$n(ie(y,Oe(({items:E})=>E.length>0),me(({items:E})=>{let T=0,_=E.length-1;for(;E[T].type==="group"&&T<_;)T++;for(;E[_].type==="group"&&_>T;)_--;return{startIndex:E[T].index,endIndex:E[_].index}}),Pt(c0)));return{listState:y,topItemsIndexes:v,endReached:S,startReached:C,rangeChanged:x,itemsRendered:w,initialItemCount:b,...p}},Tt(Ur,l0,Cp,Zi,Wi,Ki,Ro,vp),{singleton:!0}),C$=it(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:a},{didMount:i}])=>(ye(ie(i,je(s),Oe(([,l])=>l!==0),je(o,e,t,r,n),me(([[,l],u,d,f,p,g=[]])=>h0(l,u,d,f,p,g))),a),{}),Tt(Ur,Zi,Fs,Ro),{singleton:!0}),g0=it(([{scrollVelocity:e}])=>{const t=pe(!1),n=Ge(),r=pe(!1);return ye(ie(e,je(r,t,n),Oe(([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}),Pt()),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}},Tt(Ki),{singleton:!0}),x$=it(([{topItemsIndexes:e}])=>{const t=pe(0);return ye(ie(t,Oe(n=>n>0),me(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Tt(Fs)),m0=it(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Ge(),a=un(ie(zt(e,r,t,n,o),me(([i,l,u,d,f])=>i+l+u+d+f.offsetBottom+f.bottom)),0);return ye(_e(a),s),{totalListHeight:a,totalListHeightChanged:s}},Tt(dn,Fs),{singleton:!0});function v0(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const E$=v0(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),T$=it(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:a,lastJumpDueToItemResize:i},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:f,gap:p},{log:g},{recalcInProgress:m}])=>{const v=$n(ie(l,je(i),zr(([,w,y,S],[{items:C,totalCount:x,bottom:E,offsetBottom:T},_])=>{const O=E+T;let P=0;return y===x&&w.length>0&&C.length>0&&(C[0].originalIndex===0&&w[0].originalIndex===0||(P=O-S,P!==0&&(P+=_))),[P,C,x,O]},[0,[],0,0]),Oe(([w])=>w!==0),je(t,a,r,s,g,m),Oe(([,w,y,S,,,C])=>!C&&!S&&w!==0&&y===Gi),me(([[w],,,,,y])=>(y("Upward scrolling compensation",{amount:w},kn.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&&E$()?Ve(n,y-w):b(-w)}),at(ie(zt(un(o,!1),n,m),Oe(([w,y,S])=>!w&&!S&&y!==0),me(([w,y])=>y),Xo(1)),b),ye(ie(d,me(w=>({top:-w}))),e),at(ie(u,je(f,p),me(([w,{lastSize:y,groupIndices:S,sizeTree:C},x])=>{function E(T){return T*(y+x)}if(S.length===0)return E(w);{let T=0;const _=zi(C,0);let O=0,P=0;for(;O<w;){O++,T+=_;let A=S.length===P+1?1/0:S[P+1]-S[P]-1;O+A>w&&(T-=_,A=w-O+1),O+=A,T+=E(A),P++}return T}})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(e,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Tt(dn,Ki,Fs,Ur,Jo,vp)),P$=it(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=pe(0);return at(ie(e,je(r),Oe(([,o])=>o!==0),me(([,o])=>({top:o}))),o=>{Fr(ie(n,Aa(1),Oe(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,o)})})}),{initialScrollTop:r}},Tt(Ro,dn,Fs),{singleton:!0}),O$=it(([{viewportHeight:e},{totalListHeight:t}])=>{const n=pe(!1),r=un(ie(zt(n,e,t),Oe(([o])=>o),me(([,o,s])=>Math.max(0,o-s)),Xo(0),Pt()),0);return{alignToBottom:n,paddingTopAddition:r}},Tt(dn,m0),{singleton:!0}),Ep=it(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ge(),r=Ge(),o=Ge(),s=pe(!1),a=pe(void 0);return ye(ie(zt(n,r),me(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),ye(ie(e,je(r),me(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Tt(dn)),_$=({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,A$=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 ye(ie(d,je(e,o,t,s,a,i,r),je(n),me(([[f,p,g,m,v,b,w,y],S])=>{const{done:C,behavior:x,align:E,calculateViewLocation:T=_$,..._}=f,O=o0(f,p,m-1),P=Ui(O,p.offsetTree,S)+v+b,A=P+Sr(p.sizeTree,O)[1],M=y+b,$=y+g-w,j=T({itemTop:P,itemBottom:A,viewportTop:M,viewportBottom:$,locationParams:{behavior:x,align:E,..._}});return j?C&&Fr(ie(l,Oe(L=>L===!1),Aa(Rt(l)?1:2)),C):C&&C(),j}),Oe(f=>f!==null)),u),{scrollIntoView:d}},Tt(Ur,dn,Wi,Fs,Jo),{singleton:!0}),L$=it(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Ge(),d=pe(void 0),f=pe(null),p=pe(null);return ye(i,f),ye(l,p),at(ie(u,je(e,n,a,f,p,r)),([g,m,v,b,w,y,S])=>{const C=d$(m.sizeTree);b&&w!==null&&y!==null&&(v=w.scrollTop-y.offsetTop),v-=S,g({ranges:C,scrollTop:v})}),ye(ie(d,Oe(up),me(M$)),o),ye(ie(s,je(d),Oe(([,g])=>g!==void 0),Pt(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Tt(Ur,dn,Zi,Ro,Ep));function M$(e){return{offset:e.scrollTop,index:0,align:"start"}}const N$=it(([e,t,n,r,o,s,a,i,l,u])=>({...e,...t,...n,...r,...o,...s,...a,...i,...l,...u}),Tt(Cp,C$,Ro,g0,m0,P$,O$,Ep,A$,Jo)),$$=it(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:a,firstItemIndex:i,groupIndices:l,statefulTotalCount:u,gap:d,sizes:f},{initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,w,{listState:y,topItemsIndexes:S,...C},{scrollToIndex:x},E,{topItemCount:T},{groupCounts:_},O])=>(ye(C.rangeChanged,O.scrollSeekRangeChanged),ye(ie(O.windowViewportRect,me(P=>P.visibleHeight)),v.viewportHeight),{totalCount:e,data:a,firstItemIndex:i,sizeRanges:t,initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:S,topItemCount:T,groupCounts:_,fixedItemHeight:n,defaultItemHeight:r,gap:d,...w,statefulTotalCount:u,listState:y,scrollToIndex:x,trackItemSizes:o,itemSize:s,groupIndices:l,...C,...O,...v,sizes:f,...b}),Tt(Ur,Zi,dn,L$,y$,Fs,Wi,T$,x$,l0,N$)),Tp="-webkit-sticky",b0="sticky",y0=v0(()=>{if(typeof document>"u")return b0;const e=document.createElement("div");return e.style.position=Tp,e.style.position===Tp?Tp:b0});function w0(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 f,p;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;f=g.height-Math.max(0,m),p=m+t.scrollTop}else f=window.innerHeight-Math.max(0,u.top),p=u.top+window.pageYOffset;r.current={offsetTop:p,visibleHeight:f,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=fp(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 S0=h.createContext(void 0),C0=h.createContext(void 0);function x0(e){return e}const k$=it(([e,t])=>({...e,...t}),Tt($$,it(()=>{const e=pe(l=>`Item ${l}`),t=pe(null),n=pe(l=>`Group ${l}`),r=pe({}),o=pe(x0),s=pe("div"),a=pe(_a),i=(l,u=null)=>un(ie(r,me(d=>d[l]),Pt()),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")}}))),I$=({height:e})=>c.jsx("div",{style:{height:e}}),V$={position:y0(),zIndex:1,overflowAnchor:"none"},E0={overflowAnchor:"none"},H$={...E0,display:"inline-block",height:"100%"},T0=h.memo(function({showTopList:t=!1}){const n=Me("listState"),r=Qn("sizeRanges"),o=Me("useWindowScroll"),s=Me("customScrollParent"),a=Qn("windowScrollContainerState"),i=Qn("scrollContainerState"),l=s||o?a:i,u=Me("itemContent"),d=Me("context"),f=Me("groupContent"),p=Me("trackItemSizes"),g=Me("itemSize"),m=Me("log"),v=Qn("gap"),b=Me("horizontalDirection"),{callbackRef:w}=RN(r,g,p,t?_a:l,m,v,s,b,Me("skipAnimationFrameInResizeObserver")),[y,S]=h.useState(0);Pp("deviation",L=>{y!==L&&S(L)});const C=Me("EmptyPlaceholder"),x=Me("ScrollSeekPlaceholder")||I$,E=Me("ListComponent"),T=Me("ItemComponent"),_=Me("GroupComponent"),O=Me("computeItemKey"),P=Me("isSeeking"),A=Me("groupIndices").length>0,M=Me("alignToBottom"),$=Me("initialItemFinalLocationReached"),j=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:M?"auto":0}:{marginTop:y!==0?y:M?"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:j,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(L=>{const D=L.originalIndex,W=O(D+n.firstItemIndex,L.data,d);return P?h.createElement(x,{...fn(x,d),key:W,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?h.createElement(_,{...fn(_,d),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,style:V$},f(L.index,d)):h.createElement(T,{...fn(T,d),...B$(T,L.data),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,style:b?H$:E0},A?u(L.index,L.groupIndex,L.data,d):u(L.index,L.data,d))})})}),j$={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},D$={outline:"none",overflowX:"auto",position:"relative"},Xc=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),F$={width:"100%",position:y0(),top:0,zIndex:1};function fn(e,t){if(typeof e!="string")return{context:t}}function B$(e,t){return{item:typeof e=="string"?void 0:t}}const z$=h.memo(function(){const t=Me("HeaderComponent"),n=Qn("headerHeight"),r=Me("HeaderFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),U$=h.memo(function(){const t=Me("FooterComponent"),n=Qn("footerHeight"),r=Me("HeaderFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(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 P0({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"),f=n("scrollerRef"),p=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:v,scrollToCallback:b}=Yb(l,d,u,f,void 0,g);t("scrollTo",b),t("scrollBy",v);const w=g?D$:j$;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...fn(u,p),children:a})})}function O0({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"),f=n("totalListHeight"),p=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:v,scrollByCallback:b,scrollToCallback:w}=Yb(l,d,u,_a,g);return qb(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",w),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...s,...f!==0?{height:f+p}:{}},"data-virtuoso-scroller":!0,...i,...fn(u,m),children:a})})}const W$=({children:e})=>{const t=h.useContext(S0),n=Qn("viewportHeight"),r=Qn("fixedItemHeight"),o=Me("alignToBottom"),s=Me("horizontalDirection"),a=h.useMemo(()=>jb(n,l=>Qo(l,s?"width":"height")),[n,s]),i=js(a,!0,Me("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{style:Xc(o),ref:i,"data-viewport-type":"element",children:e})},G$=({children:e})=>{const t=h.useContext(S0),n=Qn("windowViewportRect"),r=Qn("fixedItemHeight"),o=Me("customScrollParent"),s=w0(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:Xc(a),"data-viewport-type":"window",children:e})},q$=({children:e})=>{const t=Me("TopItemListComponent")||"div",n=Me("headerHeight"),r={...F$,marginTop:`${n}px`},o=Me("context");return c.jsx(t,{style:r,...fn(t,o),children:e})},K$=h.memo(function(t){const n=Me("useWindowScroll"),r=Me("topItemsIndexes").length>0,o=Me("customScrollParent"),s=o||n?X$:Y$,a=o||n?G$:W$;return c.jsxs(s,{...t,children:[r&&c.jsx(q$,{children:c.jsx(T0,{showTopList:!0})}),c.jsxs(a,{children:[c.jsx(z$,{}),c.jsx(T0,{}),c.jsx(U$,{})]})]})}),{Component:Z$,usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}=Gb(k$,{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"}},K$),Y$=P0({usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}),X$=O0({usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}),J$=Z$,_0={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Q$={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:A0,ceil:L0,floor:Jc,min:Op,max:Xi}=Math;function R$(e){return{...Q$,items:e}}function M0(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 ek(e,t){return e&&e.column===t.column&&e.row===t.row}function Qc(e,t){return e&&e.width===t.width&&e.height===t.height}const tk=it(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:f},p,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=pe(0),T=pe(0),_=pe(_0),O=pe({height:0,width:0}),P=pe({height:0,width:0}),A=Ge(),M=Ge(),$=pe(0),j=pe(null),L=pe({row:0,column:0}),D=Ge(),W=Ge(),F=pe(!1),k=pe(0),H=pe(!0),V=pe(!1),U=pe(!1);at(ie(v,je(k),Oe(([G,R])=>!!R)),()=>{Ve(H,!1)}),at(ie(zt(v,H,P,O,k,V),Oe(([G,R,le,ge,,Ee])=>G&&!R&&le.height!==0&&ge.height!==0&&!Ee)),([,,,,G])=>{Ve(V,!0),wp(1,()=>{Ve(A,G)}),Fr(ie(o),()=>{Ve(n,[0,0]),Ve(H,!0)})}),ye(ie(W,Oe(G=>G!=null&&G.scrollTop>0),Br(0)),T),at(ie(v,je(W),Oe(([,G])=>G!=null)),([,G])=>{G&&(Ve(O,G.viewport),Ve(P,G==null?void 0:G.item),Ve(L,G.gap),G.scrollTop>0&&(Ve(F,!0),Fr(ie(o,Aa(1)),R=>{Ve(F,!1)}),Ve(i,{top:G.scrollTop})))}),ye(ie(O,me(({height:G})=>G)),s),ye(ie(zt(_e(O,Qc),_e(P,Qc),_e(L,(G,R)=>G&&G.column===R.column&&G.row===R.row),_e(o)),me(([G,R,le,ge])=>({viewport:G,item:R,gap:le,scrollTop:ge}))),D),ye(ie(zt(_e(E),t,_e(L,ek),_e(P,Qc),_e(O,Qc),_e(j),_e(T),_e(F),_e(H),_e(k)),Oe(([,,,,,,,G])=>!G),me(([G,[R,le],ge,Ee,Ce,tt,Qe,,Ot,ut])=>{const{row:Se,column:ot}=ge,{height:st,width:wt}=Ee,{width:Ne}=Ce;if(Qe===0&&(G===0||Ne===0))return _0;if(wt===0){const Gt=Sp(ut,G),wo=Math.max(Gt+Qe-1,0);return R$(M0(Gt,wo,tt))}const mt=$0(Ne,wt,ot);let dt,Ue;Ot?R===0&&le===0&&Qe>0?(dt=0,Ue=Qe-1):(dt=mt*Jc((R+Se)/(st+Se)),Ue=mt*L0((le+Se)/(st+Se))-1,Ue=Op(G-1,Xi(Ue,mt-1)),dt=Op(Ue,Xi(0,dt))):(dt=0,Ue=-1);const en=M0(dt,Ue,tt),{top:he,bottom:De}=N0(Ce,ge,Ee,en),Fe=L0(G/mt),Mt=Fe*st+(Fe-1)*Se-De;return{items:en,offsetTop:he,offsetBottom:Mt,top:he,bottom:De,itemHeight:st,itemWidth:wt}})),_),ye(ie(j,Oe(G=>G!==null),me(G=>G.length)),E),ye(ie(zt(O,P,_,L),Oe(([G,R,{items:le}])=>le.length>0&&R.height!==0&&G.height!==0),me(([G,R,{items:le},ge])=>{const{top:Ee,bottom:Ce}=N0(G,ge,R,le);return[Ee,Ce]}),Pt(Yi)),n);const J=pe(!1);ye(ie(o,je(J),me(([G,R])=>R||G!==0)),J);const Y=$n(ie(_e(_),Oe(({items:G})=>G.length>0),je(E,J),Oe(([{items:G},R,le])=>le&&G[G.length-1].index===R-1),me(([,G])=>G-1),Pt())),X=$n(ie(_e(_),Oe(({items:G})=>G.length>0&&G[0].index===0),Br(0),Pt())),Q=$n(ie(_e(_),je(F),Oe(([{items:G},R])=>G.length>0&&!R),me(([{items:G}])=>({startIndex:G[0].index,endIndex:G[G.length-1].index})),Pt(c0),Xo(0)));ye(Q,g.scrollSeekRangeChanged),ye(ie(A,je(O,P,E,L),me(([G,R,le,ge,Ee])=>{const Ce=a0(G),{align:tt,behavior:Qe,offset:Ot}=Ce;let ut=Ce.index;ut==="LAST"&&(ut=ge-1),ut=Xi(0,ut,Op(ge-1,ut));let Se=_p(R,Ee,le,ut);return tt==="end"?Se=A0(Se-R.height+le.height):tt==="center"&&(Se=A0(Se-R.height/2+le.height/2)),Ot&&(Se+=Ot),{top:Se,behavior:Qe}})),i);const ee=un(ie(_,me(G=>G.offsetBottom+G.bottom)),0);return ye(ie(b,me(G=>({width:G.visibleWidth,height:G.visibleHeight}))),O),{data:j,totalCount:E,viewportDimensions:O,itemDimensions:P,scrollTop:o,scrollHeight:M,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:$,scrollContainerState:u,footerHeight:d,headerHeight:f,initialItemCount:T,gap:L,restoreStateFrom:W,...g,initialTopMostItemIndex:k,horizontalDirection:U,gridState:_,totalListHeight:ee,...p,startReached:X,endReached:Y,rangeChanged:Q,stateChanged:D,propsReady:m,stateRestoreInProgress:F,...x}},Tt(Cp,dn,Ki,g0,Ro,Ep,Jo));function N0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=_p(e,t,n,r[0].index),a=_p(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function _p(e,t,n,r){const o=$0(e.width,n.width,t.column),s=Jc(r/o),a=s*n.height+Xi(0,s-1)*t.row;return a>0?a+t.row:a}function $0(e,t,n){return Xi(1,Jc((e+n)/(Jc(t)+n)))}const nk=it(([e,t])=>({...e,...t}),Tt(tk,it(()=>{const e=pe(f=>`Item ${f}`),t=pe({}),n=pe(null),r=pe("virtuoso-grid-item"),o=pe("virtuoso-grid-list"),s=pe(x0),a=pe("div"),i=pe(_a),l=(f,p=null)=>un(ie(t,me(g=>g[f]),Pt()),p),u=pe(!1),d=pe(!1);return ye(_e(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")}}))),rk=h.memo(function(){const t=At("gridState"),n=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),s=At("computeItemKey"),a=At("isSeeking"),i=Rn("scrollHeight"),l=At("ItemComponent"),u=At("ListComponent"),d=At("ScrollSeekPlaceholder"),f=At("context"),p=Rn("itemDimensions"),g=Rn("gap"),m=At("log"),v=At("stateRestoreInProgress"),b=Rn("reportReadyState"),w=js(h.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();p({width:x,height:E})}g({row:I0("row-gap",getComputedStyle(y).rowGap,m),column:I0("column-gap",getComputedStyle(y).columnGap,m)})},[i,p,g,m]),!0,!1);return qb(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:w,className:n,...fn(u,f),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,f);return a?c.jsx(d,{...fn(d,f),index:y.index,height:t.itemHeight,width:t.itemWidth},S):h.createElement(l,{...fn(l,f),className:r,"data-index":y.index,key:S},o(y.index,y.data,f))})})}),ok=h.memo(function(){const t=At("HeaderComponent"),n=Rn("headerHeight"),r=At("headerFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),sk=h.memo(function(){const t=At("FooterComponent"),n=Rn("footerHeight"),r=At("headerFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),ak=({children:e})=>{const t=h.useContext(C0),n=Rn("itemDimensions"),r=Rn("viewportDimensions"),o=js(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:Xc(!1),ref:o,children:e})},ik=({children:e})=>{const t=h.useContext(C0),n=Rn("windowViewportRect"),r=Rn("itemDimensions"),o=At("customScrollParent"),s=w0(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:Xc(!1),children:e})},lk=h.memo(function({...t}){const n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?dk:uk,s=r||n?ik:ak;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(ok,{}),c.jsx(rk,{}),c.jsx(sk,{})]})})}),{Component:ck,usePublisher:Rn,useEmitterValue:At,useEmitter:k0}=Gb(nk,{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"}},lk),uk=P0({usePublisher:Rn,useEmitterValue:At,useEmitter:k0}),dk=O0({usePublisher:Rn,useEmitterValue:At,useEmitter:k0});function I0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,kn.WARN),t==="normal"?0:parseInt(t??"0",10)}const Rc=ck,Ap=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},fk=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function pk(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 jS(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const hk=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{fk(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await pk(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}},gk=(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(Oc).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>")},mk=async(e,t,n)=>{const r=hS(t,{appStore:n}),o=await hk(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:`
|
|
369
304
|
* { box-sizing: border-box; }
|
|
370
305
|
[data-body] {
|
|
371
306
|
margin: 0;
|
|
@@ -383,42 +318,42 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
383
318
|
height: 0px;
|
|
384
319
|
overflow: hidden;
|
|
385
320
|
}
|
|
386
|
-
`})};function Hc({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=$e();return c.jsx(hr,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(I,{className:ee(o),space:"m",col:!0,children:[c.jsx(H,{grow:!0,className:ee("text-center"),children:t||i.t("confirmAction")}),c.jsxs(I,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(qe,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...s,children:s.children||i.t("confirm")}),c.jsx(qe,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),r==null||r()},children:i.t("cancel")})]})]})})}const s0=new Map,a0=new Map,l$=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},c$=de(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var P;const i=$e(),l=ye(),u=l.editor,[d,f]=h.useState(""),p=h.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((P=t.data.custom)==null?void 0:P.id),b=n===vt.web,v=!t.isTemplate||r,w=()=>{v&&(s==null||s({editor:u,template:t,loadTemplate:y}))},y=l.setProject,S=T=>{T.preventDefault(),s({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const O=setTimeout(async()=>{if(!p.current||!u)return;const _=`${t.isTemplate?"t-":""}${t.id}`;let N=s0.get(_);if(!N){let k=a0.get(n);if(!k){const B=new oI({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});k=await i$(u.config.grapesjs,n,B.appEditorStore),a0.set(n,k)}N=k?a$(k,t.data,n):"",s0.set(_,N)}const L=p.current;l$({el:L,html:N})});return()=>clearTimeout(O)},[p,u,n,t.data]);const{media:C,author:x}=t,E=c.jsx(qe,{className:ue("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return c.jsx(Gn,{padding:!1,className:ue("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,children:[c.jsxs(H,{className:ue("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ue("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:ue("max-w-full")}):c.jsx("div",{className:ue("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:p})}),m&&c.jsx(Ho,{className:ue("absolute top-2 right-2",U.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(I,{justify:"center",items:"center",className:ue(Pe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:v?E:c.jsx(hr,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(I,{space:"m",col:!0,children:[c.jsx(H,{children:c.jsx(Re,{size:"s",value:d,onChange:f,placeholder:g,required:!0})}),c.jsx(H,{children:c.jsx(qe,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(I,{className:ue("gjs-p-2 max-w-full",oe.bt,U.br),col:!0,space:"s",children:[c.jsxs(I,{className:ue("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(H,{className:ue(Pe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&c.jsxs(H,{children:["by"," ",c.jsx("a",{className:ue(Co.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),c.jsxs(I,{items:"center",children:[b&&c.jsxs(H,{className:ue("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(H,{className:ue("gjs-ml-auto"),children:c.jsx(Hc,{onConfirm:()=>a(t),className:"",children:c.jsx(bt,{title:i.t("delete"),children:c.jsx(se,{icon:X.delete,size:le.sx})})})})]})]})]})})}),i0=de(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=Af(),l=$e().tScoped("templates"),d=ye().editor,f=cp(n==null?void 0:n.itemsPerRow),p=o??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(I,{justify:"center",children:l("notFound")}):c.jsx(Dc,{data:e,listClassName:ue("grid gap-2 gjs-pr-2",f),itemContent:(g,m)=>c.jsx(c$,{template:m,projectType:t,onSelect:p,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(hs,{})})}),u$=de(function(){var b;const t=ye(),n=gb(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=$e(),i=ma(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:v,template:w})=>{v(w),i.close()},f=async v=>{n.setProjectTypeFilter(v),await n.loadAllTemplates()},p=v=>{n.removeProject(v.id),n.loadProjects()},g=h.useMemo(()=>[{id:fi.Existing,label:u("existentProjects")},{id:fi.Templates,label:u("templates")}],[a]),m=((b=l.project)==null?void 0:b.types)&&Tu();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&c.jsx(I,{items:"center",space:"m",children:c.jsx(H,{className:ue("gjs-ml-auto"),children:c.jsx(Te,{value:s,onChange:f,options:fL(),handlerSelected:v=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",v.label]})})})}),c.jsx(H,{children:c.jsx(Fo,{tabs:g,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(H,{grow:!0,children:c.jsx(i0,{templates:r,projectType:vt[s],onSelect:d,onRemove:p,content:{itemsPerRow:3}})})]})}),d$=({items:e,editor:t,customItems:n})=>n===!1?[]:Ze(n)?n({items:e,editor:t}):n||e,l0=e=>({icon:X.plus,size:le.s,className:ee("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),c0=e=>!e.type||e.type==="button",f$="gs-cmp-topbar-left",p$=de(function({buttons:t,className:n,style:r}){const o=ye(),s=$e(),{isOpen:a,toggleOpen:i}=kN(),l=o.editor,d=s.tScoped("blockManager")("blocks"),f=d$({items:[{id:`blocks-${d}`,tooltip:d,size:tv.s,icon:l0(a),variant:ev.primary,editorEvents:{[yn.toggleBlocksPanel]:({fromEvent:p,setState:g})=>{g({icon:l0(p.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(I,{gap:"s",items:"center",justify:"start",className:ee(f$,Ee.xS,n),style:r,nowrap:!0,children:f.map(({id:p,...g})=>c0(g)?c.jsx(vc,{...g},p):At({id:p,...g}))})}),h$=[{id:go.auto,label:"Auto"},{id:go.dark,label:"Dark"},{id:go.light,label:"Light"}],g$={size:"s"},up=".grapesjs",m$=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},b$=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const o=r.actions;return o===!1?[]:Ze(o)?o({actions:e,editor:t}):o||(n?Ze(n)?n({items:e,editor:t}):n:e)},v$="gs-cmp-topbar-right",y$=de(function({editor:t,className:n,buttons:r,...o}){const s=ye(),{theme:a,setTheme:i}=Lr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:f,isBrowserMode:p,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:b}=s,v=ma(),w=$e(),y=L=>w.t(`actions.${L}`),S=t.Storage.events,C=l.events,x="change:changesCount",E=(L,k)=>()=>{Ze(L)?L({editor:t}):l.isActive(L)?l.stop(L):l.run(L,k)},P=L=>({[`${C.runCommand}${L}`]:({setState:k})=>k({active:!0}),[`${C.stopCommand}${L}`]:({setState:k})=>k({active:!1})}),T=[{id:dr.componentOutline,icon:X.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:P("core:component-outline")},{id:dr.preview,icon:X.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:P("core:preview")},{id:dr.fullscreen,icon:X.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:P("core:fullscreen")},{id:dr.showCode,icon:X.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(ae.dialogExportCode)},{id:dr.showImportCode,icon:X.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>v.open({title:y("importCode.title"),content:()=>c.jsx(ov,{})})},{id:dr.clearCanvas,icon:X.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:dr.store,tooltip:y("store.title"),onClick:async()=>!s.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:L})=>L({}),[S.startStore]:({setState:L})=>L({disabled:!0}),[S.endStore]:({setState:L})=>L({disabled:!1})},label:()=>c.jsxs("div",{className:ee("relative"),children:[c.jsx(se,{icon:X.floppy,size:le.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:ee("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",U.bg),children:c.jsx("div",{className:ee(Pe.dot,U.bgW)})}),s.isSaving&&c.jsx("div",{className:ee("absolute right-0 bottom-0 gjs-rounded-full",U.bg),children:c.jsx(se,{icon:X.refresh,size:"11px",className:ee(Pe.spin)})})]})},{id:dr.undo,icon:X.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:L})=>L({disabled:!u.hasUndo()})}},{id:dr.redo,icon:X.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:L})=>L({disabled:!u.hasRedo()})}}],O=b$({actions:T,sdkOptions:m,editor:t,buttons:r}),_=[{id:"about",label:y("about.title"),icon:X.helpCircle,action:()=>v.open({size:"m",title:y("about.title"),content:()=>c.jsx(uL,{})})},{id:"embed",label:y("embed.title"),icon:X.powerPlug,action:()=>v.open({size:"m",title:y("embed.title"),content:()=>c.jsx(dL,{})})},{id:"openProject",label:y("open.title"),icon:X.folder,action:async()=>{let L="";try{L=await(await KM({extensions:[up]})).text()}catch(k){return console.error(k)}s.loadProjectData(JSON.parse(L))}},{id:"saveProject",label:y("save.title"),icon:X.contentSave,action:async()=>{const L=t.getProjectData(),k=new Blob([JSON.stringify(L)]),B=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await ZM(k,{fileName:`${B}${up}`,extensions:[up]})}catch($){return console.error($)}}},{id:"loadProject",label:y("newProject.title"),icon:X.newspaperVariantOutline,action:()=>v.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(u$,{})})},{id:"installApp",label:y(f?"installApp.installed":"installApp.title"),icon:X.applicationBracketsOutline,action:async()=>{if(f)return;d==null||d.prompt();const L=await(d==null?void 0:d.userChoice);(L==null?void 0:L.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(I,{items:"center",space:"m",children:[c.jsx(H,{children:"Theme"}),c.jsx(H,{children:c.jsx(Fo,{tabs:h$,onChange:L=>i(L),value:a,variant:"pills"})})]})}]].filter(({id:L})=>!((!p||!d)&&L==="installApp"||!m$(m,L))),N=(L,k)=>B=>{Ze(L)&&(L(B),k())};return c.jsxs(I,{space:"s",items:"center",justify:"end",className:ee(v$,Ee.xS,n),nowrap:!0,...o,children:[O.map(({id:L,...k})=>c0(k)?c.jsx(vc,{size:"s",...k},L):At({id:L,...k})),c.jsx(H,{children:m.settingsMenu!==!1&&_.length>0&&c.jsx(hr,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(se,{icon:X.cog,size:le.s}),buttonProps:g$,overlay:!0,children:({close:L})=>c.jsx(c.Fragment,{children:_.map(k=>c.jsx(wa,{action:N(k.action,L),icon:k.icon,label:k.label},k.id))})})})]})});function w$({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(Te,{size:"xs",className:n,style:r,value:t,options:s,onChange:o}):null}const S$="gs-devices",u0=h.memo(function({className:t,style:n}){return c.jsx(OM,{children:r=>c.jsx(w$,{className:M(S$,t),style:n,...r})})}),Vi="gs-cmp-editor-topbar",C$=de(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:f}=ye(),p=n??l,g=h.useMemo(()=>({...r,minHeight:p,marginTop:u||!f?`-${p}px`:0}),[u,f,r]);return c.jsxs(c.Fragment,{children:[c.jsx(H,{className:M(Vi,"gs-utl-transition-spacing gs-utl-w-full",oe.bb,U.br,t),style:g,children:o??c.jsxs(I,{className:M(`${Vi}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(H,{className:M(`${Vi}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(p$,{...s})}),c.jsx(H,{className:M(`${Vi}__wrp-center`),children:i!==!1&&c.jsx(u0,{...i})}),c.jsx(H,{className:M(`${Vi}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(y$,{editor:d,...a})})]})}),c.jsx(H,{className:M("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(qe,{className:M("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(se,{icon:X.eyeOff,size:le.s})})})]})}),x$="gs-sidebar-top",d0=h.memo(de(function({height:t,children:n,...r}){return c.jsx(C$,{height:t,...r,style:Sc(r),className:M(x$,"gs-utl-flex",wc(r)),children:n?At(n):void 0})})),E$="gs-canvas-sidebar-top",P$=h.memo(de(function({className:t,sidebarTop:n,...r}){return c.jsxs(hn,{className:M(E$,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(d0,{...n}),c.jsx(_v,{grow:!0})]})})),_$="gs-code-field",T$=de(function(e){const{editor:t}=ye(),{isDarkTheme:n}=Lr(),{editorEvents:r,onChange:o}=e,[s,a]=h.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(f=>({...f,...d}))}),l=u=>o==null?void 0:o(i(u||""));return Xo({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(so,{className:M(_$,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})});var O$={grad:.9,turn:360,rad:360/(2*Math.PI)},io=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},jt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Zn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},f0=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},p0=function(e){return{r:Zn(e.r,0,255),g:Zn(e.g,0,255),b:Zn(e.b,0,255),a:Zn(e.a)}},dp=function(e){return{r:jt(e.r),g:jt(e.g),b:jt(e.b),a:jt(e.a,3)}},A$=/^#([0-9a-f]{3,8})$/i,Fc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},h0=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}},g0=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}},m0=function(e){return{h:f0(e.h),s:Zn(e.s,0,100),l:Zn(e.l,0,100),a:Zn(e.a)}},b0=function(e){return{h:jt(e.h),s:jt(e.s),l:jt(e.l),a:jt(e.a,3)}},v0=function(e){return g0((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},Ii=function(e){return{h:(t=h0(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},N$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,M$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,fp={string:[[function(e){var t=A$.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?jt(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?jt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L$.exec(e)||$$.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:p0({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=N$.exec(e)||M$.exec(e);if(!t)return null;var n,r,o=m0({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(O$[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return v0(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 io(t)&&io(n)&&io(r)?p0({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(!io(t)||!io(n)||!io(r))return null;var a=m0({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return v0(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!io(t)||!io(n)||!io(r))return null;var a=function(i){return{h:f0(i.h),s:Zn(i.s,0,100),v:Zn(i.v,0,100),a:Zn(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return g0(a)},"hsv"]]},y0=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]},k$=function(e){return typeof e=="string"?y0(e.trim(),fp.string):typeof e=="object"&&e!==null?y0(e,fp.object):[null,void 0]},pp=function(e,t){var n=Ii(e);return{h:n.h,s:Zn(n.s+100*t,0,100),l:n.l,a:n.a}},hp=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},w0=function(e,t){var n=Ii(e);return{h:n.h,s:n.s,l:Zn(n.l+100*t,0,100),a:n.a}},gp=function(){function e(t){this.parsed=k$(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 jt(hp(this.rgba),2)},e.prototype.isDark=function(){return hp(this.rgba)<.5},e.prototype.isLight=function(){return hp(this.rgba)>=.5},e.prototype.toHex=function(){return t=dp(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?Fc(jt(255*s)):"","#"+Fc(n)+Fc(r)+Fc(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return dp(this.rgba)},e.prototype.toRgbString=function(){return t=dp(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 b0(Ii(this.rgba))},e.prototype.toHslString=function(){return t=b0(Ii(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=h0(this.rgba),{h:jt(t.h),s:jt(t.s),v:jt(t.v),a:jt(t.a,3)};var t},e.prototype.invert=function(){return Ir({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),Ir(pp(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ir(pp(this.rgba,-t))},e.prototype.grayscale=function(){return Ir(pp(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Ir(w0(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Ir(w0(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"?Ir({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):jt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=Ii(this.rgba);return typeof t=="number"?Ir({h:t,s:n.s,l:n.l,a:n.a}):jt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===Ir(t).toHex()},e}(),Ir=function(e){return e instanceof gp?e:new gp(e)},S0=[],V$=function(e){e.forEach(function(t){S0.indexOf(t)<0&&(t(gp,fp),S0.push(t))})};function I$(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(),f=1/0,p="black";if(!s.length)for(var g in n)s[g]=new e(n[g]).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<f&&(f=b,p=m)}return p}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}function Bc(){return(Bc=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 C0(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 mp(e){var t=h.useRef(e),n=h.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Ea=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},ji=function(e){return"touches"in e},bp=function(e){return e&&e.ownerDocument.defaultView||self},x0=function(e,t,n){var r=e.getBoundingClientRect(),o=ji(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:Ea((o.pageX-(r.left+bp(e).pageXOffset))/r.width),top:Ea((o.pageY-(r.top+bp(e).pageYOffset))/r.height)}},E0=function(e){!ji(e)&&e.preventDefault()},vp=h.memo(function(e){var t=e.onMove,n=e.onKey,r=C0(e,["onMove","onKey"]),o=h.useRef(null),s=mp(t),a=mp(n),i=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(v){E0(v),(ji(v)?v.touches.length>0:v.buttons>0)&&o.current?s(x0(o.current,v,i.current)):b(!1)},m=function(){return b(!1)};function b(v){var w=l.current,y=bp(o.current),S=v?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",g),S(w?"touchend":"mouseup",m)}return[function(v){var w=v.nativeEvent,y=o.current;if(y&&(E0(w),!function(C,x){return x&&!ji(C)}(w,l.current)&&y)){if(ji(w)){l.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),s(x0(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],f=u[1],p=u[2];return h.useEffect(function(){return p},[p]),h.createElement("div",Bc({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:f,tabIndex:0,role:"slider"}))}),zc=function(e){return e.filter(Boolean).join(" ")},yp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=zc(["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}}))},on=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},P0=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:on(e.h),s:on(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:on(o/2),a:on(r,2)}},wp=function(e){var t=P0(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Sp=function(e){var t=P0(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},j$=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:on(255*[r,i,a,a,l,r][u]),g:on(255*[l,r,r,i,a,a][u]),b:on(255*[a,a,l,r,r,i][u]),a:on(o,2)}},D$=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?H$({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}},H$=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:on(60*(i<0?i+6:i)),s:on(s?a/s*100:0),v:on(s/255*100),a:o}},F$=h.memo(function(e){var t=e.hue,n=e.onChange,r=zc(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(vp,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ea(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":on(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(yp,{className:"react-colorful__hue-pointer",left:t/360,color:wp({h:t,s:100,v:100,a:1})})))}),B$=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:wp({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(vp,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ea(t.s+100*o.left,0,100),v:Ea(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+on(t.s)+"%, Brightness "+on(t.v)+"%"},h.createElement(yp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:wp(t)})))}),z$=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},U$=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function W$(e,t,n){var r=mp(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;z$(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 G$=typeof window<"u"?h.useLayoutEffect:h.useEffect,q$=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},_0=new Map,K$=function(e){G$(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!_0.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}`,_0.set(t,n);var r=q$();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},Y$=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Sp(Object.assign({},n,{a:0}))+", "+Sp(Object.assign({},n,{a:1}))+")"},s=zc(["react-colorful__alpha",t]),a=on(100*n.a);return h.createElement("div",{className:s},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(vp,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:Ea(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(yp,{className:"react-colorful__alpha-pointer",left:n.a,color:Sp(n)})))},Z$=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=C0(e,["className","colorModel","color","onChange"]),i=h.useRef(null);K$(i);var l=W$(n,o,s),u=l[0],d=l[1],f=zc(["react-colorful",t]);return h.createElement("div",Bc({},a,{ref:i,className:f}),h.createElement(B$,{hsva:u,onChange:d}),h.createElement(F$,{hue:u.h,onChange:d}),h.createElement(Y$,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},X$={defaultColor:"rgba(0, 0, 0, 1)",toHsva:D$,fromHsva:function(e){var t=j$(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:U$},J$=function(e){return h.createElement(Z$,Bc({},e,{colorModel:X$}))};V$([I$]);const Q$=e=>e.startsWith("rgba")?e:Ir(e).toRgbString();function T0({value:e,onChange:t,disabled:n}){const r=Q$(e||""),o=h.useRef(r),[s,a]=h.useState(!1),i=vr()&&!!window.EyeDropper,l=g=>{o.current=g,t==null||t(g)},u=g=>{o.current=g,t==null||t(g,!0)},d=()=>{i&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},f=()=>{a(!0)},p=()=>{t==null||t(o.current,!1),a(!1)};return c.jsxs(c.Fragment,{children:[s&&c.jsx("div",{onPointerUp:p,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(J$,{className:"color-picker",color:r,onChange:u,onPointerDown:f,onPointerUp:p}),c.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(H,{grow:!0,children:c.jsx(Re,{size:"s",value:r,onChange:l,disabled:n})}),i&&c.jsx(qe,{type:"button",onClick:d,children:c.jsx(se,{icon:X.eyedropperVariant,size:le.s})})]})]})}const R$="gs-cmp-studio-color-picker",e6=h.memo(de(function({className:t,style:n,value:r="",disabled:o,onChange:s,editorEvents:a}){const{editor:i}=ye(),[l,u]=h.useState(()=>({className:t,style:n,value:r,disabled:o})),d=(f,p)=>{const g=f||"";s==null||s({value:g,partial:p,editor:i,state:l,setState:m=>u(b=>({...b,...m}))})};return Xo({editor:i,editorEvents:a,localState:l,setLocalState:u}),c.jsx("div",{className:M(R$,l.className,Ee.m),style:l.style,children:c.jsx(T0,{value:l.value||"",onChange:d,disabled:l.disabled})})})),t6="gs-cmp-column",n6=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(hn,{className:M(t6,U.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:At(n)})}),Cp=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
387
|
-
<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>`,Ls="--before-content",xp={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},O0={stylable:!1,traits:[]};function r6(e){return typeof e=="object"&&e.type===Vt.variable}function A0(e){if(r6(e)){const{path:t}=e;return N0(t||"")}return e}function N0(e){return`{{ ${e} }}`}function o6(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===As.globalStyles&&(i={value:i.value}),{...s,[a.id]:i}},{})}),t}function M0(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Ep=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?{...O0}:{}},Pp=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?{...O0}:{}},s6=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,a6=e=>Array.isArray(e)?"array":e===null?"default":typeof e,i6=de(({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:X.codeBrackets,object:X.codeBraces,string:X.codeString,number:X.number,boolean:X.toggleSwitchOffOutline,default:X.null},u=a6(t),d=M(s,"gs-utl-text-left",U.hBgH,oe.b,oe.rnd,Ee.xy,n?[oe.bA,U.tA]:[U.br,U.txtHighEmphasisH]),f=p=>typeof p=="object"?Array.isArray(p)?a("items",{params:{length:p.length}}):p?a("properties",{params:{length:Object.keys(p).length}}):"null":String(p);return c.jsx(qe,{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(se,{icon:l[u],size:le.s}),c.jsx(H,{className:M(Pe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(H,{className:M("gs-utl-w-full",Pe.txtEllips,Pe.disabled),children:f(t)})]}),i&&c.jsx(H,{children:c.jsx(se,{size:le.sx,icon:X.arrowRight,className:M(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),l6="gs-cmp-data-path-explorer",L0=de(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?o6(o):{},...t}),[o,t]),f=(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),x=a[v]===y,E=v===0&&Gr(S)&&S.collectionId===y,P=()=>{const T=x?C.slice(0,-1):C;n==null||n(T.join("."),{paths:T}),i(T)};return c.jsx(i6,{className:M(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:P},y)})};h.useEffect(()=>{s.current=d;const b=[];for(let v=0;v<=a.length;v++){const w=f(a,v);w.length>0&&b.push(w)}u(b)},[d,a]);const p=M(l6,U.bg,U.br,oe.b,oe.rnd,Pe.scrollX,"gs-utl-h-full"),g=M("gs-utl-min-w-[220px]",U.br),m=M("gs-utl-h-full gs-utl-max-h-[60vh]",Pe.scrollY,Ee.xyS);return c.jsx(I,{className:p,full:!0,nowrap:!0,children:l.map((b,v)=>c.jsx(H,{className:M(g,v!==l.length-1&&oe.br),children:c.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:b})},v))})});function $0(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function _p(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 c6=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},u6=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],f=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:f}))||""}else return(u==null?void 0:u.getValue(r,o))||""},d6="gs-cmp-data-path-field",Di=de(e=>{const{size:t="m",value:n="",label:r,open:o,defaultValue:s,additionalSources:a,dataResolver:i,readOnly:l,disabled:u,pickerInPopover:d,onChange:f,onPickerToggle:p}=e,{editor:g}=ye(),m=$e().tScoped("dataSources"),[b,v]=h.useState(!!o),[w,y]=h.useState(!1),S=!!l||b||w,C=()=>y(!w),x=F=>{const V=F??!b;v(V),p==null||p(V)},E=()=>x(!1),P=(...F)=>{f==null||f(...F)},T=F=>{S||f==null||f(F,{paths:F.split(".")})},O=c6({dataResolver:i,value:n}),_=w&&g?`"${u6({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:O,N=t==="m",L=N?"lg":t,k=N?le.l:le.s,B=m(b?"closePathExplorer":"openPathExplorer"),$={icon:b?X.close:X.databaseOutline,size:le.l},z={icon:w?X.eyeOff:X.eye,size:N?le.m:k},K=c.jsx(bt,{block:!0,variant:"pr",size:L,title:B,onClick:()=>x(),icon:$});return c.jsxs(I,{className:d6,gap:t,col:!0,children:[c.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[c.jsx(Re,{readOnly:S,label:r,value:w?_:O,size:t,disabled:u,onChange:T,placeholder:m("selectVariablePath"),className:M("gs-utl-flex-grow",U.txt,Pe.txtEllips),afterInput:!!n&&c.jsx(bt,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Pe.hover,icon:z})}),d?c.jsx(hr,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:K,onClose:E,overlay:!0,children:c.jsx(L0,{path:O,onChange:P,additionalSources:a})}):K]}),!!b&&!d&&c.jsx(L0,{path:O,onChange:P,additionalSources:a})]})}),f6=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},k0=({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},p6=({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=`${Uc({min:r,max:o,value:l})}`,l=k0({value:l,step:s})}return l},Uc=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Nt(e)&&(o=Math.max(o,parseFloat(`${e}`)||0)),Nt(t)&&(o=Math.min(o,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:o}`},h6=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=f=>{const p=f.clientY-t,g=o-p*parseFloat(`${i}`);l=k0({value:Uc({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)},g6=(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))},V0=e=>Nt(e)?e:"",m6="gs-cmp-number-field";function Me(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:f,onChange:p,onChangeUnit:g}=e,[m,b]=h.useState(V0(n)),[v,w]=h.useState(!1),y=(r==null?void 0:r.map(O=>({id:O,label:O})))||[],S={min:i,max:l,step:u};h.useEffect(()=>{b(V0(n))},[n,o]);const C=(O,_)=>{p==null||p(Uc({min:i,max:l,value:O}),_)},x=O=>{if(f)return;w(!0);const _=(N,L)=>{C(N,!!L),!L&&w(!1)};h6(m,O.clientY,_,S)},E=O=>{const{key:_,shiftKey:N}=O;switch(_){case"Escape":return b(n);case"Enter":return C(m)}const L=p6({step:u,value:n,key:_,shiftKey:N});L!==null&&(O.preventDefault(),C(L))},P=()=>{C(m)},T=jo({...e,className:M(m6,t)});return c.jsxs("div",{...T,children:[v&&c.jsx("div",{className:M("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(fr,{as:e.labelAs,...e}),c.jsxs(I,{className:qf(e),items:"center",space:"x2s",children:[!!a&&c.jsx(H,{onMouseDown:x,className:M("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(se,{icon:X.panVertical,size:le.s2x}):a}),c.jsx(H,{grow:!0,children:c.jsx("input",{className:Oi(e),value:m,disabled:f,onChange:O=>b(O.target.value),placeholder:d,onBlur:P,onKeyDown:E})}),!!y.length&&c.jsx(H,{className:M(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Te,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:o,disabled:f,onChange:O=>g==null?void 0:g(O),options:y})})]})]})}const b6="gs-cmp-switch-field";function Hi(e){const{className:t,value:n,label:r,labelAs:o,border:s,disabled:a,onChange:i}=e,l=!!n,u=M("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,Ya.focus,s&&`${U.br} ${oe.b}`);return c.jsx(Qd.Group,{children:c.jsxs(I,{items:"center",className:M(b6,t),full:!0,children:[!!r&&c.jsx(Qd.Label,{as:o,className:M("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(fr,{...e,as:"span"})}),c.jsx(Qd,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:M(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 Tp(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 v6="gs-cmp-data-collection-picker",y6=de(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Tp(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=$0(a),d=l===Number.MAX_VALUE,f=$e().tScoped("dataSources"),p=d?"":l,g=()=>{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:v6,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Re,{className:"gs-utl-flex-grow",size:"s",label:f("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(iv,{size:"s",value:s,block:!0})]}),c.jsx(Di,{label:f("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Me,{size:"s",className:"gs-utl-flex-grow",label:f("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:b}),c.jsx(Me,{size:"s",label:f("collectionEndIndex"),placeholder:d?"-":"",value:p==null?void 0:p.toString(),onChange:v,className:M("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(H,{children:c.jsx(Hi,{label:f("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(I,{full:!0,justify:"end",children:c.jsx(qe,{onClick:g,variant:"pr",size:"m",children:f("confirm")})})]})}),w6="gs-data-collection-picker",S6=de(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(hn,{className:M(w6,t),...o,children:c.jsx(y6,{component:n,onConfirm:r})})});var An=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(An||{}),Nn=(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))(Nn||{}),Op=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Op||{}),Ap=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Ap||{});const C6=[...Object.values(Ap),...Object.values(Op),...Object.values(Nn)],Np={string:Object.values(Ap),number:Object.values(Op),dataSource:C6},x6=h.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case An.DATA_SOURCE:return c.jsx(Di,{size:"s",pickerInPopover:!0,value:$0(s),onChange:i=>a(r,i,o),additionalSources:n});case An.NUMBER:return c.jsx(Me,{size:"s",value:s,onChange:i=>a(r,i,o)});default:return c.jsx(Re,{size:"s",value:s,onChange:i=>a(r,i,o)})}}),E6="gs-cmp-statement-side",I0=h.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(I,{className:M(E6,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Io,{size:"s",children:o}),c.jsxs(I,{items:"center",gap:"xs",children:[c.jsx(H,{children:c.jsx(Te,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(H,{grow:!0,children:c.jsx(x6,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),Wc=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?An.DATA_SOURCE:typeof e=="string"?An.STRING:typeof e=="number"?An.NUMBER:An.STRING,P6=(e,t,n)=>{switch(t){case An.STRING:return e||"";case An.NUMBER:return e?Number(e):0;case An.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(rt(e)?_p(e,r):e)??{path:"",defaultValue:""}}}default:return e}},_6=e=>Np[e][0],T6=e=>![Nn.isTruthy,Nn.isFalsy,Nn.isDefined,Nn.isNull,Nn.isUndefined,Nn.isArray,Nn.isObject,Nn.isString,Nn.isNumber,Nn.isBoolean,Nn.isDefaultValue].includes(e),O6="gs-cmp-statement",A6=de(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=$e().tScoped("dataSources"),[a,i]=h.useState(()=>Wc(t.left)),[l,u]=h.useState(()=>Wc(t.right)),d=Np[a]||Np[An.STRING],f=h.useMemo(()=>Object.values(An).map(C=>({id:C,label:yr(C)})),[]),p=h.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);h.useEffect(()=>{i(Wc(t.left)),u(Wc(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const P=P6(x,E,o),T=C==="left",O=T&&E!==An.DATA_SOURCE;T?i(E):u(E),g({[C]:P,...O&&{operator:_6(E)}})},b=(C,x)=>m(C,null,x),v=C=>g({operator:C}),w=M(O6,r,U.br,oe.b,oe.rnd,Ee.xy),y=T6(t.operator),S={additionalSources:o,onChange:m,onTypeChange:b,typeOptions:f};return c.jsx(I,{className:M(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(I0,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(H,{children:c.jsx(Te,{size:"s",label:s("operator"),value:t.operator,options:p,onChange:v})}),y&&c.jsx(I0,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),Mp="gs-cmp-statements-group",N6=e=>e==="and"||e==="or",Gc=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),j0=de(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=>{N6(m)&&r({...n,logicalOperator:m})},d=()=>{Gc(n),r(Gc(n))},f=m=>{const b=i.filter((v,w)=>w!==m);r({...n,statements:b})},p=(m,b)=>{if(m>=0&&m<i.length){const v=[...i];v[m]=b,r({...n,statements:v})}},g=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return c.jsxs(I,{className:M(Mp,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Fo,{value:l,onChange:u,tabs:g}),c.jsx(I,{className:`${Mp}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,b)=>c.jsxs(I,{className:M(`${Mp}__item`),gap:"s",col:!0,children:[c.jsx(A6,{additionalSources:o,statement:m,onChange:v=>p(b,v)}),b<i.length-1&&c.jsxs(I,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:M(U.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(bt,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>f(b+1),icon:{icon:X.delete,size:le.s}})]})]},`stmt-${b}`))}),!s&&c.jsx(I,{justify:"end",children:c.jsx(qe,{variant:"pr",onClick:d,icon:{icon:X.plus,size:le.s},children:a("addCondition")})})]})}),M6="gs-cmp-data-condition-picker",L6=de(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Tp(e),s=$e().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:Gc(a)})};return c.jsxs(I,{className:M6,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(j0,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(I,{gap:"m",justify:"end",full:!0,children:[c.jsx(qe,{variant:"out",onClick:u,icon:{icon:X.plus,size:le.s},children:s("addCondition")}),c.jsx(qe,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),$6="gs-data-condition-picker",k6=de(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(hn,{className:M($6,t),...o,children:c.jsx(L6,{component:n,onConfirm:r})})}),V6="gs-data-path-field",I6=de(({className:e,value:t="",onChange:n,...r})=>c.jsx(hn,{className:M(V6,e),...r,children:c.jsx(Di,{onChange:o=>n({value:o}),value:t})})),qc={type:"data-variable",path:"",defaultValue:""},D0={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function Uo(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const H0="gs-cmp-dynamic-value-picker",j6=de(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=h.useState(()=>Uo(e)?e:qc),[a,i]=h.useState(o.type),l=$e().tScoped("dataSources");h.useEffect(()=>{const S=Uo(e)?e:qc;(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"?qc:D0;u(x)},f=S=>{u({type:"data-variable",defaultValue:o.defaultValue,..._p(S,r)})},p=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})},b=()=>{const S=o.condition;g(Gc(S))},v=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:qc,y=(o==null?void 0:o.type)==="data-condition"?o:D0;return c.jsxs(I,{className:H0,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{className:H0,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Fo,{value:a,onChange:d,tabs:v}),c.jsx(H,{grow:!0,className:Ee.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(Di,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:f}),c.jsx(Re,{label:l("defaultValue"),value:w.defaultValue||"",onChange:p})]}):c.jsxs(I,{gap:"m",col:!0,children:[c.jsx(j0,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(Re,{label:l("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),c.jsx(Re,{label:l("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&c.jsx(I,{full:!0,justify:"end",className:Ee.x,children:c.jsx(qe,{variant:"out",onClick:b,icon:{icon:X.plus,size:le.s},children:l("addCondition")})})]}),c.jsx(I,{full:!0,justify:"end",className:Ee.y,children:c.jsx(qe,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),D6="gs-data-value-picker",H6=de(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(hn,{className:M(D6,e),...s,children:c.jsx(j6,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),F6="gs-cmp-data-variable-picker",B6=de(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Tp(e),s=$e().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=p=>{r(_p(p,l))},d=()=>{o(),t==null||t({value:n})},f=p=>r({defaultValue:p});return c.jsxs(I,{className:F6,gap:"s",col:!0,nowrap:!0,children:[c.jsx(Di,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(Re,{label:s("defaultValue"),value:i,onChange:f}),c.jsx(I,{full:!0,justify:"end",className:Ee.y,children:c.jsx(qe,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),z6="gs-data-variable-picker",U6=de(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(hn,{className:M(z6,t),...o,children:c.jsx(B6,{component:n,onConfirm:r})})}),W6="gs-cmp-input-field",G6=h.memo(de(function({className:t,style:n,label:r,name:o,value:s,size:a,disabled:i,inputType:l,readOnly:u,required:d,placeholder:f,onChange:p,onInput:g,editorEvents:m}){const{editor:b}=ye(),[v,w]=h.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:f})),y=x=>({value:x,editor:b,state:v,setState:E=>w(P=>({...P,...E}))}),S=x=>p==null?void 0:p(y(x)),C=x=>g==null?void 0:g(y(x));return Xo({editor:b,editorEvents:m,localState:v,setLocalState:w}),c.jsx(Re,{type:l,className:M(W6,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})})),q6="gs-menu-list",K6=de(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 f=>d({item:u,editor:o,...f})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(hn,{className:M(q6,U.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>h.createElement(wa,{...u,label:u.layout?At(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 Y6({children:e,accept:t,onChange:n,multiple:r=!0,...o}){const s=$e(),a=h.useRef(null),i=()=>{const{current:l}=a;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:ee("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),c.jsx(qe,{variant:"pr",size:"m2",...o,onClick:i,children:e||s.t("upload")})]})}const Z6=de(Y6),X6=de(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=vi();return At(r({asset:yo(a.toAsset(n)),assetProps:yo(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),J6="gs-cmp-asset-card",Q6=de(function(t){var f;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=$e(),{editor:l}=ye();if(a)return l?c.jsx(X6,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((f=u.split("/").pop())==null?void 0:f.split("?").shift());return c.jsx(Gn,{padding:!1,className:ue(J6,"overflow-hidden max-w-full group",s),children:c.jsxs(I,{col:!0,children:[c.jsxs(H,{className:ue("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[c.jsx("div",{className:ue("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(I,{justify:"center",items:"center",className:ue(Pe.coverAbs,U.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(qe,{className:ue("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),c.jsxs(I,{className:ue("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(H,{className:ue(Pe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(Hc,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(I,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ue("text-center",U.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ue("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(bt,{title:i.t("delete"),children:c.jsx(se,{icon:X.delete,size:le.sx})})})]})]})})}),jr="gs-asset-manager",R6={search:!0,addUrl:!0,upload:!0},ek=de(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:f,content:p,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:b,onChangeSearchValue:v,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=ye(),{editor:P}=E,T=$e(),[O]=Af(),_=cp(p==null?void 0:p.itemsPerRow),[N,L]=h.useState(""),k=(p==null?void 0:p.header)===!1?!1:{...R6,...Gr(p==null?void 0:p.header)?p.header:{}};if(!P)return;const B=d?t.filter($=>!(a&&!Hs($.src,a)&&!Hs($.name??"",a))):t;return c.jsxs(I,{className:ee(jr,"relative gs-utl-h-full",i&&Pe.disabled),nowrap:!0,col:!0,space:"m",children:[k!==!1&&c.jsxs(I,{className:`${jr}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(I,{className:`${jr}__header-filters`,items:"center",gap:"m",children:[k.search&&c.jsx(H,{children:c.jsx(Re,{className:`${jr}__search-filter`,size:"m",type:"search",value:a,onInput:v,placeholder:`${T.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(H,{children:c.jsx(Te,{className:ee(`${jr}__type-filter`,"items-center"),size:"m",options:n,value:o,onChange:m,emptyState:T.t("assetManager.assetTypes.all"),includeEmpty:l})}),r.length>(u?0:1)&&c.jsx(H,{children:c.jsx(Te,{classNameContainer:ee(`${jr}__provider-filter`,"items-center"),size:"m",options:r.map($=>({...$,label:Ze($.label)?$.label({editor:P}):$.label,icon:$.icon})),value:s,onChange:b,emptyState:T.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(I,{className:`${jr}__header-buttons`,items:"center",gap:"m",children:[k.upload&&c.jsx(H,{children:c.jsx(Z6,{className:`${jr}__upload-field`,onChange:w})}),k.addUrl&&!!y&&c.jsx(H,{children:c.jsx(hr,{className:`${jr}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(qe,{variant:"pr",size:"m2",children:T.t("assetManager.addUrl")}),children:({close:$})=>c.jsxs(I,{gap:"m",children:[c.jsx(H,{children:c.jsx(Re,{type:"url",size:"s",value:N,onChange:L,placeholder:T.t("assetManager.inputPlh")})}),c.jsx(H,{children:c.jsx(qe,{variant:"pr",size:"m2",onClick:()=>{y(N),$()},children:T.t("add")})})]})})})]}),x&&c.jsx(c.Fragment,{children:At(x({editor:P}))})]}),c.jsx(I,{className:ee(`${jr}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!B.length?c.jsx(I,{justify:"center",children:T.t("noItems")}):!!O&&c.jsx(Dc,{data:B,listClassName:ee("gs-utl-grid gs-utl-gap-2",_),endReached:C,itemContent:($,z)=>c.jsx(Q6,{assetProps:z,onSelect:g,onRemove:S,itemLayout:f},z.id),components:{Footer:C?tk:void 0}})}),i&&c.jsx(hs,{abs:!0})]})}),tk=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),nk=de(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:f,layoutAfterHeader:p}){const{appEditorStore:g,i18nStore:m}=bn(),{editor:b}=g,v=vi(),{customOnLoad:w}=v,y=fb(t);h.useEffect(()=>{const P=O=>rt(O)?{id:O,label:m.t(`assetManager.assetTypes.${O}`)||O}:O;y.setCustomTypes(o==null?void 0:o.map(P)),y.setCustomProviders(rt(s)?[s]:s),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Nt(l)?y.setOptionalType(l):y.initOptionalType(),Nt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const T=setTimeout(()=>y.loadAssets());return()=>clearTimeout(T)},[o,s,a,i,l,u]);const S=P=>{v.addToProjectAssets([{id:P,src:P,type:y.typeFilter??Es.image}])},C=P=>{b&&(d==null||d({asset:v.toAsset(P),assetProps:P,editor:b}),f==null||f())},x=r==null?void 0:r.map(v.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(ek,{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=>v.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:p})});var rk=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)}}(),Ot=function(){return Ot=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},Ot.apply(this,arguments)},F0={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},B0={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Kc={width:"20px",height:"20px",position:"absolute"},ok={top:Ot(Ot({},F0),{top:"-5px"}),right:Ot(Ot({},B0),{left:void 0,right:"-5px"}),bottom:Ot(Ot({},F0),{top:void 0,bottom:"-5px"}),left:Ot(Ot({},B0),{left:"-5px"}),topRight:Ot(Ot({},Kc),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Ot(Ot({},Kc),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Ot(Ot({},Kc),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Ot(Ot({},Kc),{left:"-10px",top:"-10px",cursor:"nw-resize"})},sk=function(e){rk(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 Xe.createElement("div",{className:this.props.className||"",style:Ot(Ot({position:"absolute",userSelect:"none"},ok[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(Xe.PureComponent),ak=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)}}(),Dr=function(){return Dr=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},Dr.apply(this,arguments)},ik={width:"auto",height:"auto"},Yc=function(e,t,n){return Math.max(Math.min(e,n),t)},z0=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},Pa=function(e,t){return new RegExp(e,"i").test(t)},Zc=function(e){return!!(e.touches&&e.touches.length)},lk=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},U0=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},Lp=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"},Xc=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},ck=function(e,t,n,r,o,s,a){return r=Xc(r,e.width,t,n),o=Xc(o,e.height,t,n),s=Xc(s,e.width,t,n),a=Xc(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)}},uk=function(e){return Array.isArray(e)?e:[e,e]},dk=["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"],W0="__resizable_base__",fk=function(e){ak(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(W0):u.className+=W0,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||ik},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","")),f=d/u[i]*100;return f+"%"}return Lp(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?Lp(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?Lp(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&&Pa("left",s),i=o&&Pa("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=uk(this.props.resizeRatio||1),a=s[0],i=s[1],l=this.state,u=l.direction,d=l.original,f=this.props,p=f.lockAspectRatio,g=f.lockAspectRatioExtraHeight,m=f.lockAspectRatioExtraWidth,b=d.width,v=d.height,w=g||0,y=m||0;return Pa("right",u)&&(b=d.width+(n-d.x)*a/o,p&&(v=(b-y)/this.ratio+w)),Pa("left",u)&&(b=d.width-(n-d.x)*a/o,p&&(v=(b-y)/this.ratio+w)),Pa("bottom",u)&&(v=d.height+(r-d.y)*i/o,p&&(b=(v-w)*this.ratio+y)),Pa("top",u)&&(v=d.height-(r-d.y)*i/o,p&&(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,f=typeof o.width>"u"||o.width<0?n:o.width,p=typeof s.height>"u"?10:s.height,g=typeof o.height>"u"||o.height<0?r:o.height,m=l||0,b=u||0;if(i){var v=(p-m)*this.ratio+b,w=(g-m)*this.ratio+b,y=(d-b)/this.ratio+m,S=(f-b)/this.ratio+m,C=Math.max(d,v),x=Math.min(f,w),E=Math.max(p,y),P=Math.min(g,S);n=Yc(n,C,x),r=Yc(r,E,P)}else n=Yc(n,d,f),r=Yc(r,p,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&&lk(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Zc(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 f={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Dr(Dr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(f)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Zc(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=Zc(n)?n.touches[0].clientX:n.clientX,d=Zc(n)?n.touches[0].clientY:n.clientY,f=this.state,p=f.direction,g=f.original,m=f.width,b=f.height,v=this.getParentSize(),w=ck(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,x=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(C=U0(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=U0(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=z0(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),T=z0(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),O=this.props.snapGap||0,_=O===0||Math.abs(P-C)<=O?P:C,N=O===0||Math.abs(T-S)<=O?T:S;C=_,S=N}var L={width:C-g.width,height:S-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var k=C/v.width*100;C=k+"%"}else if(m.endsWith("vw")){var B=C/this.window.innerWidth*100;C=B+"vw"}else if(m.endsWith("vh")){var $=C/this.window.innerHeight*100;C=$+"vh"}}if(b&&typeof b=="string"){if(b.endsWith("%")){var k=S/v.height*100;S=k+"%"}else if(b.endsWith("vw")){var B=S/this.window.innerWidth*100;S=B+"vw"}else if(b.endsWith("vh")){var $=S/this.window.innerHeight*100;S=$+"vh"}}var z={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?z.flexBasis=z.width:this.flexDir==="column"&&(z.flexBasis=z.height);var K=this.state.width!==z.width,F=this.state.height!==z.height,V=this.state.flexBasis!==z.flexBasis,D=K||F||V;D&&$n.flushSync(function(){r.setState(z)}),this.props.onResize&&D&&this.props.onResize(n,p,this.resizable,L)}},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:Dr(Dr({},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 f=n.filter(function(p){return s[p]!==!1}).map(function(p){return s[p]!==!1?Xe.createElement(sk,{key:p,direction:p,onResizeStart:r.onResizeStart,replaceStyles:a&&a[p],className:i&&i[p]},d&&d[p]?d[p]:null):null});return Xe.createElement("div",{className:u,style:l},f)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return dk.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=Dr(Dr(Dr({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 Xe.createElement(s,Dr({style:o,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&Xe.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}(Xe.PureComponent);function Jc({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,onResize:g,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=M("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(fk,{className:e,enable:b.enable??v,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,children:t})}const $p="gs-cmp-accordion",kp=`${$p}-handler`,Qc=`${kp}__content`,pk=`${$p}-content`;function lo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:f,open:p}){return c.jsx(Hd,{as:"div",defaultOpen:p,className:ee($p,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(Hd.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>f==null?void 0:f({event:m,open:!g}),className:({open:m})=>M(kp,Ze(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:ee("gap-2"),full:!0,children:[c.jsx(H,{className:ee(Qc,r,"text-left"),grow:!0,children:Ze(s)?s(m):c.jsxs(I,{items:"center",className:ee(`${Qc}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(se,{className:ee(`${Qc}-icon`),icon:a,size:le.s2x}),c.jsx(H,{className:ee(`${Qc}-label gs-utl-w-full`),children:s})]})}),c.jsx(H,{className:ee(`${kp}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(se,{icon:X.chevronDown,className:ee("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(Hd.Panel,{className:ee(pk,n),children:i})]})})}const Fi="gs-studio-panel",G0=(e,t={})=>({...t,...e===!0?{}:e||void 0}),gr=h.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(hn,{className:M(Fi,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(Jc,{className:M([`${Fi}__resizer`]),...u,children:l}):l,f=n===!0?{collapsible:!0}:n||void 0;return f?c.jsx(lo,{classNameWrap:M(`${Fi}__accordion`,s),className:M(`${Fi}__accordion-header`,Ee.xy,f.className),classNameContent:M(`${Fi}__accordion-content`,a),disabled:f.collapsible===!1,style:f.style,handler:c.jsxs(I,{space:"s",items:"center",children:[!!f.icon&&c.jsx(se,{icon:f.icon,size:le.s}),c.jsx(H,{grow:!0,children:f.label})]}),open:n?f.collapsed!==!0:!0,children:d}):d}),hk="gs-panel-assets",gk=h.memo(de(function({className:t,onSelect:n,content:r,assets:o,types:s,providers:a,typeId:i,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:f,layoutAfterHeader:p,...g}){var x;const m=ye(),b=vi(),v=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=p||w,[S]=h.useState(()=>g.id||km());return h.useEffect(()=>(b.createAssetManager(S),()=>{b.removeAssetManager(S)}),[S]),fb(S)?c.jsx(gr,{className:M(hk,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:v&&c.jsx(nk,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:f??d,layoutAfterHeader:y})}):null}));var Bi=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(Bi||{}),Hr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Hr||{});const q0="gs-block-item",K0=de(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=ye(),i=$e(),[,l]=h.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),f=!!t.get("full"),p=o||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),b=t.getMedia(),v=t.get("attributes")||{},w=u(d)||t.getLabel(),y=s==="compact",S=M(q0,`${q0}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",oe.b,oe.rnd,U.br,f&&"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?Pe.disabledM:M("gs-utl-cursor-pointer",U.hTAo,U.hBgH)),C=Nt(v.class)&&!y?v.class:M("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=M("gs-utl-text-center",Pe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!a)return;const{Blocks:N}=a,L=N.events.update,k=B=>B===t&&l($=>++$);return a.on(L,k),()=>{a.off(L,k)}},[t,a]),!a)return null;const{Blocks:E}=a,O={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!o},...!!p&&{onClick:()=>p(t,a)}},_=r==null?void 0:r({editor:a,block:t,attributes:O});return _&&At(_)||c.jsxs(I,{items:"center",...O,children:[m||c.jsx("div",{className:C,dangerouslySetInnerHTML:{__html:b}}),c.jsx("div",{className:x,title:w,children:w})]})});function Vp({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:ee([e,"w-full",U.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:ts,ref:s})}function Y0({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=p=>{a==null||a(p),u(p)},f=p=>{s(p),d(!1)};return c.jsx("div",{className:ee("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(Vp,{className:ee(r&&Pe.noFocusOut),value:t,onChange:f}):c.jsx(c.Fragment,{children:t})})}const Z0=ue("text-sm w-full",Pe.txtEllips),mk=de(({symbol:e,className:t})=>{const n=Ai(),{Components:r}=n,o=$e(),s=ma(),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(),f=r.getSymbolInfo(e).instances.length,p=ue("h-10 w-10 block-media",U.grouphTAo),g=ue("gjs-pt-1 gjs-mt-2",oe.bt,U.br),m=ue("cursor-pointer gjs-p-2 transition-colors group",oe.b,oe.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:p,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(I,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(H,{children:c.jsx(I,{className:ue(Z0,"gjs-mr-auto"),children:c.jsx(Dt,{title:`${f} ${a("instancesProject")}`,children:c.jsx(Ho,{label:`${f}`,className:ue(U.bgH75)})})})}),c.jsx(H,{className:ue("truncate"),grow:!0,title:d,children:c.jsx(Y0,{activable:!0,value:d,className:Z0,onChange:v})}),c.jsx(H,{className:ue(Pe.hoverGroup),children:c.jsx(I,{justify:"end",full:!0,children:c.jsx(bt,{onClick:b,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(se,{icon:X.delete,size:le.s})})})})]})]})}),Wo="gs-block-manager",X0={id:Hr.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>'},bk={id:Hr.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>'},vk={id:Hr.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>'},J0={id:Hr.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>'},Q0=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},R0=e=>{const t=e.getContent();return Ze(t)?e.getDragDef():t},yk=e=>{const t=R0(e);return Array.isArray(t)?t[0]:t},wk=de(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Fe,Yt;const{editor:l}=ye(),u=$e(),[d,f]=h.useState(0),[p,g]=h.useState(Bi.REGULAR),[m,b]=h.useState(""),[v,w]=h.useState(""),y=h.useRef(new Set),[S,C]=h.useState((o==null?void 0:o.position)||Hr.after),[x,E]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),P=p===Bi.SYMBOLS,T=h.useRef(null),O=u.tScoped("blockManager"),_=o==null?void 0:o.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:ge,Components:Ve}=l,je=ge.events.custom,ke=Ve.events.symbol,Et=()=>{E(Ve.getSymbols()),f(Ht=>++Ht)};return l.on(ke,Et),l.on(je,Et),()=>{l.off(ke,Et),l.off(je,Et)}},[l]),h.useEffect(()=>{if(T.current&&t){const ge=T.current.querySelector("input");setTimeout(()=>ge==null?void 0:ge.focus(),gd)}},[T.current,t]),!l)return null;const{Blocks:N,Components:L}=l,k=ge=>O(`labels.${ge.getId()}`)||ge.getLabel(),B=x.filter(ge=>Hs(ge.getName(),m)),$=N.getAll().map(ge=>ge),z=((Fe=i.blocks)==null?void 0:Fe.call(i,{blocks:$}))||$,K=S===Hr.before,F=S===Hr.beforeInside,V=S===Hr.afterInside,D=S===Hr.after,A=!!(_!=null&&_.attributes.droppable),j=z.filter(ge=>{const Ve=Q0(l,ge.category);if(m&&!Hs(Ve,m)&&!Hs(k(ge),m))return!1;if(_){const je=yk(ge);if(A&&(F||V)){const ke=F?0:void 0;return L.canMove(_,je,ke).result}else if(K||D){const ke=_.index(),Et=_.parent(),Ht=K?ke:ke+1;return Et&&L.canMove(Et,je,Ht).result}}return!0}),q=N.getBlocksByCategory(j),G=r?j:(Yt=q.find(ge=>!ge.category))==null?void 0:Yt.items,Y=r?[]:q.filter(ge=>ge.category),Q=i.symbols!==!1,Z=i.search!==!1,W=!Q&&!Z,R=s==="compact",re=O("search")||u.t("search"),fe=M(Wo,n,"gap-2"),xe=M(`${Wo}__header`,"gs-utl-pt-2",Ee.xS,W&&"gs-utl-hidden"),ne=M(`${Wo}__content`,Pe.scrollY,U.br,oe.bt),Oe=M(`${Wo}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Ie=M(`${Wo}__not-found`,"gs-utl-text-center gs-utl-p-4"),ut=M(`${Wo}__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"),ot=M(`${Wo}__no-category`,ut,U.br,Y.length&&oe.bb),we=M(U.tAo,U.bgH75,oe.bA),et=`${Wo}__category`,tt=[{id:Bi.REGULAR,label:O("types.regular")},{id:Bi.SYMBOLS,label:O("types.symbols")}],gt=A?[X0,bk,vk,J0]:[X0,J0],Ne=_?ge=>{const Ve=R0(ge);if(!Ve)return;let je;if(F||V){const ke=F?0:void 0;je=_.append(Ve,{at:ke})[0]}else if(K||D){const ke=_.index(),Et=_.parent(),Ht=K?ke:ke+1;je=Et==null?void 0:Et.append(Ve,{at:Ht})[0]}if(je){const{activate:ke,select:Et}=ge.attributes;Et||ke&&Et!==!1?l.em.setSelected(je,{activate:ke}):ke&&je.trigger("active")}}:void 0,dt=ge=>{if(!_)return;const Ve=Array.from(y.current);if(ge.key==="ArrowDown")ge.preventDefault(),w(je=>{const ke=Ve.indexOf(je);return Ve.at(Math.min(ke+1,Ve.length-1))||""});else if(ge.key==="ArrowUp")ge.preventDefault(),w(je=>{const ke=Ve.indexOf(je);return Ve.at(Math.max(ke-1,0))||""});else if(ge.key==="Enter"&&v){const je=N.get(v);je&&(Ne==null||Ne(je))}},st=ge=>{y.current.clear(),b(ge)};return c.jsxs(I,{className:fe,col:!0,full:!0,children:[c.jsxs(I,{className:xe,gap:"s",col:!0,children:[Q&&c.jsx(Fo,{tabs:tt,onChange:g,value:p,variant:"pills"}),_&&c.jsx(qt,{size:"s",options:gt,value:S,onChange:ge=>C(ge)}),Z&&c.jsx(Re,{ref:T,size:"s",value:m,onInput:st,onKeyDown:dt,placeholder:re,type:"search"})]}),c.jsxs(H,{className:ne,grow:!0,children:[P&&(B.length?c.jsx(I,{className:Oe,children:B.map(ge=>c.jsx(mk,{symbol:ge},`${d}_${ge.getId()}`))}):c.jsx(I,{className:Ie,justify:"center",children:O("symbols.notFound")})),!P&&(j.length?c.jsxs(c.Fragment,{children:[!!(G!=null&&G.length)&&c.jsx(I,{className:ot,children:G==null?void 0:G.map(ge=>(y.current.add(`${ge.id}`),c.jsx(K0,{block:ge,itemLayout:a,onClick:Ne,variant:s,className:M(v===ge.id&&we)},ge.id)))}),Y.map(({category:ge,items:Ve},je)=>c.jsx(lo,{sticky:!0,className:ke=>bd.itemList({index:je,open:ke,length:Y.length}),open:!!(ge!=null&&ge.get("open")),onChange:({open:ke})=>ge==null?void 0:ge.set({open:ke}),handler:Q0(l,ge),handlerIcon:ge==null?void 0:ge.get("icon"),classNameWrap:M(et,`${et}--${ge==null?void 0:ge.id}`),children:c.jsx(I,{className:ut,children:Ve.map(ke=>(y.current.add(`${ke.id}`),c.jsx(K0,{block:ke,itemLayout:a,onClick:Ne,variant:s,className:M(v===ke.id&&we)},ke.id)))})},ge==null?void 0:ge.id))]}):c.jsx(I,{className:Ie,justify:"center",children:O("notFound")}))]})]})}),Sk=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-block-manager-after"),n),ref:o,...r,children:t})}),Ck=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-block-manager-before"),n),ref:o,...r,children:t})}),xk="gs-panel-blocks",Ek=h.memo(de(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=ye().sdkProps.children,f={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(gr,{className:M(xk,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(Ni,{children:[qn(d,Ck),c.jsx(wk,{className:M("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...f}),qn(d,Sk)]})})})),Pk="gs-cmp-color-picker",_k={backgroundSize:"10px"},Tk=[0,15];function ey({className:e,value:t,onChange:n,disabled:r}){const[o,s]=h.useState(!1),a=M(`${Pk}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,oe.b,oe.rnd,U.br),i=()=>{s(!1)},l=c.jsxs("div",{style:_k,className:a,children:[o&&c.jsx("div",{onPointerUp:i,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(hr,{handler:l,title:"Color",size:"s",placement:"left-end",offset:Tk,clickAway:!0,disabled:r,children:c.jsx(T0,{value:t,onChange:n,disabled:r})})}const Ok="gs-cmp-color-field";function co(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i}=e,[l,u]=h.useState(yc(n)),d=Oi(e);h.useEffect(()=>{u(yc(n))},[n]);const f=(b,v)=>{s==null||s(b,v)},p=b=>{switch(b.key){case"Escape":return u(n);case"Enter":f(l),o&&(b.preventDefault(),b.stopPropagation())}},g=()=>{f(l)},m=jo({...e,className:M(Ok,t)});return c.jsxs("div",{...m,children:[c.jsx(fr,{...e,as:a}),c.jsxs(I,{className:qf(e),items:"center",space:"s",children:[c.jsx(H,{children:c.jsx(ey,{value:n,onChange:s,disabled:i})}),c.jsx(H,{grow:!0,children:c.jsx("input",{className:M(d,i&&"gs-utl-pointer-events-none"),value:l,onChange:b=>u(b.target.value),placeholder:r,onBlur:g,onKeyDown:p,disabled:i})})]})]})}const Ak=(e,t)=>{t.runCommand(ae.fontAdd,{font:e})},Ip=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(ae.assetProviderGet).filter(i=>rt(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;Ak(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Rc=de(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=ye(),s=$e(),a=vi(),i=yi(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),f=d?Pf(d):u.id;return{...u,content:c.jsx(I,{col:!0,children:c.jsx(H,{style:{fontFamily:f},children:u.label})})}});return c.jsx(Te,{...r,value:Ps(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(bt,{className:t,title:s.t("fontManager.addFontToProject"),icon:X.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&Ip(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange(Ps(d.family))}})})})}),Nk=(e,{t,id:n})=>t(`fields.${n}.label`)||yr(`${e}`.replace(/-/g," ")),ty=(e,{t,id:n})=>{const r=rt(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},ny=e=>e.get("defaultValue")||"",zi=e=>e.get("field"),ry=e=>{const t=zi(e);return rt(t)?{type:t}:t},oy=e=>`${e.get("value")||ny(e)||ry(e).defaultValue||""}`,Mk=(e,t)=>e||ny(t)||"",Ui=({record:e,value:t,partial:n})=>{e.set({value:Mk(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},Wi=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=ry(e),a=r??e.get("defaultValue");return{...s,hasClear:()=>{const i=e.get("value");return!!i&&Nt(a)&&i!==a},className:M(n,"gs-utl-w-full"),size:o||"s",value:oy(e),label:Nk(e.get("label")||e.id||"",t),onChange:(i,l)=>Ui({record:e,value:i,partial:l})}},Lk=(e,t)=>{const n=zi(e),r=Gr(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=f6(oy(e)),a=s.number,i=s.unit||o[0]||"";return{...Wi(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)=>{Ui({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{Ui({value:a?`${a}${l}`:"",record:e})}}},sy=(e,t)=>{var s;const n=zi(e),r=Gr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>ty(a,t)))||[];return{...Wi(e,t),options:o,onChange:a=>Ui({value:a,record:e})}},$k=(e,t)=>({...Wi(e,t),onChange:n=>Ui({value:n,record:e})}),kk=(e,t)=>{var s;const n=zi(e),r=Gr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>ty(a,t)))||[];return{...sy(e,t),size:"s",options:o}};function Vk(e,t){const n=zi(e);switch(rt(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(qt,{...kk(e,t)});case"select":return c.jsx(Te,{...sy(e,t)});case"selectFont":{const o=$k(e,t);return c.jsx(Rc,{...o,labelAs:"div"})}case"number":return c.jsx(Me,{...Lk(e,t)});case"color":return c.jsx(co,{...Wi(e,t)});default:return c.jsx(Re,{...Wi(e,t)})}}const ay="gs-cmp-global-style-field",Ik=de(function({record:t}){const n=ye(),o=$e().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(f=>++f);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(I,{className:M(ay,`${ay}__${i}`),children:Vk(t,l)})}),Gi="gs-cmp-global-style-manager",iy=({items:e,category:t,className:n})=>{const r=M(t?`${Gi}__cat-fields--${t.id}`:`${Gi}__uncat-fields`,"gs-utl-gap-2",Ee.xy,n);return c.jsx(I,{className:r,nowrap:!0,col:!0,children:e.map(o=>c.jsx(Ik,{record:o},o.id))})},jk=de(function(){const t=V3(),{recordsByCategory:n,openCategories:r}=t,s=$e().tScoped("globalStyleManager");return c.jsx(I,{col:!0,full:!0,nowrap:!0,className:M(Gi,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(I,{col:!0,nowrap:!0,className:M(`${Gi}__fields`,Pe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(lo,{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=>M(`${Gi}__cat-fields`,bd.itemList({index:l,open:u,length:n.length}),l===0&&oe.bt),children:c.jsx(iy,{category:a,items:i})},a.id):c.jsx(iy,{items:i,className:M(n.length!==1&&[oe.bt,U.br])},l)):c.jsx(I,{className:M("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),Dk="gs-panel-global-styles",Hk=h.memo(de(function({className:t,...n}){return c.jsx(gr,{className:M(Dk,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(Ni,{children:c.jsx(jk,{})})})})),Fk={maxWidth:`${mS}px`},Bk="gs-cmp-layer-item";function ly({component:e,draggingCmp:t,dragParent:n,...r}){const o=Ai(),{Layers:s}=o,a=h.useRef(null),[i,l]=h.useState(!1),[u,d]=h.useState(s.getLayerData(e)),{open:f,selected:p,hovered:g,components:m,visible:b,locked:v,name:w}=u,y=m.map(F=>F.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 F=a.current;if(!F)return;const{select:V}=o.Components.events,D=A=>A===e&&F.scrollIntoView({block:"nearest"});return o.on(V,D),()=>{o.off(V,D)}},[e,a.current]),h.useEffect(()=>{const F=D=>{D===e&&d(s.getLayerData(D))},V=s.events.component;return o.on(V,F),()=>{o.off(V,F)}},[o,s,e]);const P=h.useMemo(()=>m.map(F=>c.jsx(ly,{component:F,level:x,draggingCmp:t,dragParent:n},F.cid)),[C,t,n]),T=F=>{s.setLayerData(e,{name:F}),l(!1)},O=F=>{F.stopPropagation(),s.setLayerData(e,{open:!f})},_=F=>{F.stopPropagation(),s.setLayerData(e,{visible:!b})},N=F=>{F.stopPropagation(),s.setLayerData(e,{locked:!v})},L=F=>{F.stopPropagation(),s.setLayerData(e,{selected:!0},{event:F})},k=F=>{F.preventDefault(),o.runCommand(ae.contextMenuComponent,{source:xf.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},B=F=>{(!F||!t)&&s.setLayerData(e,{hovered:F})},$=T1(e),z=ee("layer-item",(p||$.isSymbol)&&$.bgSoftX,(!b||S)&&"opacity-50"),K=ee(Ee.xyS,oe.b,E?$.border:oe.bT,p&&$.bgSoft);return c.jsx("div",{className:Bk,children:c.jsxs(I,{col:!0,className:z,children:[c.jsx(H,{onClick:L,onContextMenu:k,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),className:ee("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(I,{items:"center",space:"xs",className:K,children:[c.jsx(H,{style:{marginLeft:`${x*10}px`},className:ee("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:O,children:c.jsx(se,{icon:X.menuDown,size:le.sx,rotate:f?0:-90})}),c.jsx(H,{children:eb(e)}),c.jsx(H,{className:ee("truncate"),onDoubleClick:()=>l(!0),style:Fk,grow:!0,children:i?c.jsx(Vp,{value:w,onChange:T}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(H,{className:ee("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-100":"opacity-0"),onClick:N,children:c.jsx(se,{icon:v?X.lock:X.lockOpenVariant,size:le.s3x})}),c.jsx(H,{className:ee("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-0":"opacity-100"),onClick:_,children:c.jsx(se,{icon:b?X.eyeOutline:X.eyeOffOutline,size:le.sx})})]})]})}),!!(f&&m.length)&&c.jsx(H,{className:ee("max-w-full",!f&&"hidden"),children:P})]})})}const zk={touchAction:"none"},cy=5,Uk=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}},uy=de(function({root:t,header:n}){const{editor:r}=ye(),[o,s]=h.useState(!1),[a,i]=h.useState({}),[l,u]=h.useState(),[d,f]=h.useState(),[p,g]=h.useState(),[m,b]=h.useState(),v=h.useRef(null);if(h.useEffect(()=>{const O=window.document,_=N=>{N.key==="Escape"&&(i({...a,result:!1}),C())};return O.addEventListener("keydown",_),()=>{O.removeEventListener("keydown",_)}},[]),!r)return null;const{Components:w}=r,y=O=>{O.button===0&&s(!0)},S=O=>{if(!o)return;const{cmp:_,el:N}=Uk(O);if(!N||!_)return;const L=N.getBoundingClientRect(),k=N.offsetHeight,B=N.offsetTop,$=O.clientY,z=$<L.y+k/2,K=d||_,F=_.parent(),V=_.index()+(z?0:1);!d&&f(_),u(_);const D=w.canMove(F,K,V),A=w.canMove(_,K),j={...D,canMoveInside:A,index:V};let q=!1;A.result&&$>L.y+cy&&$<L.y+k-cy&&(q=!0,j.target=_,delete j.index),g(q?_:void 0),i(j),b({pointerInside:q,y:B+(z?0:k),h:k})},C=()=>{var O;a!=null&&a.result&&((O=a.source)==null||O.move(a.target,{at:a.index})),i({}),s(!1),f(void 0),u(void 0),g(void 0),b(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}:{},T=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(I,{col:!0,full:!0,nowrap:!0,className:ee("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(H,{children:c.jsxs(I,{space:"s",items:"center",className:ee([Ee.xy,oe.bb,U.br]),children:[c.jsx(H,{children:c.jsx(se,{icon:X.layers,size:le.s})}),c.jsx(H,{grow:!0,children:T})]})}),c.jsxs(H,{className:ee("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:zk,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(ly,{component:t,level:-1,draggingCmp:d,dragParent:p}),E&&c.jsx("div",{ref:v,className:ee("absolute w-full gs-utl-h-0.5",U.cmp),style:P})]})]})}),dy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-layer-manager-after"),n),ref:o,...r,children:t})}),fy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-layer-manager-before"),n),ref:o,...r,children:t})}),Wk="gs-panel-layers",py=h.memo(de(function({className:t,...n}){const r=ye().sdkProps.children;return c.jsx(gr,{className:M(Wk,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(vv,{children:o=>c.jsxs(c.Fragment,{children:[qn(r,fy),c.jsx(uy,{...o,header:!1}),qn(r,dy)]})})})})),$s="gs-cmp-file-field";function qi(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:f,hideButton:p,labelAs:g,onChange:m,onOpen:b}=e,v=(n||"").replace(/^"|"$/gi,""),w=((x=v.split("/").pop())==null?void 0:x.split("?")[0])||"",y={minWidth:d,minHeight:d},S=v?{...y,backgroundImage:`url("${v}")`}:y,C=M(" 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",oe.b,oe.rnd,U.br);return c.jsxs(I,{className:M($s,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(fr,{...e,as:g}),c.jsxs(I,{className:M(`${$s}-content gs-utl-gap-1`,U.bg),items:"center",nowrap:!0,children:[c.jsx(H,{className:M(`${$s}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(H,{className:M(`${$s}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(Io,{className:M(`${$s}-name`,"gs-utl-mb-2",Pe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(I,{className:M(`${$s}-buttons`),space:"s",nowrap:!0,children:[!p&&c.jsx(qe,{onClick:()=>b==null?void 0:b(n),size:s,type:"button",block:!0,full:!0,disabled:f,children:r||"Select image"}),!!n&&i&&c.jsx(bt,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:X.close,size:le.s},type:"button",block:!0})]})]})]}),l&&c.jsx(Re,{className:M(`${$s}-input`),value:v,onChange:m,size:s,placeholder:u})]})}function Gk(){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 eu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _a(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function jp(e){return"nodeType"in e}function Go(e){var t,n;return e?_a(e)?e:jp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Dp(e){const{Document:t}=Go(e);return e instanceof t}function Ta(e){return _a(e)?!1:e instanceof Go(e).HTMLElement}function hy(e){return e instanceof Go(e).SVGElement}function Oa(e){return e?_a(e)?e.document:jp(e)?Dp(e)?e:Ta(e)||hy(e)?e.ownerDocument:document:document:document}const ks=eu?h.useLayoutEffect:h.useEffect;function qk(e){const t=h.useRef(e);return ks(()=>{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 Kk(){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 Ki(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Hp(e){const t=qk(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 Fp={};function Yi(e,t){return h.useMemo(()=>{if(t)return t;const n=Fp[e]==null?0:Fp[e]+1;return Fp[e]=n,e+"-"+n},[e,t])}function gy(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 Zi=gy(1),my=gy(-1);function Yk(e){return"clientX"in e&&"clientY"in e}function Zk(e){if(!e)return!1;const{KeyboardEvent:t}=Go(e.target);return t&&e instanceof t}function Xk(e){if(!e)return!1;const{TouchEvent:t}=Go(e.target);return t&&e instanceof t}function Bp(e){if(Xk(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 Yk(e)?{x:e.clientX,y:e.clientY}:null}const Xi=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[Xi.Translate.toString(e),Xi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Jk={display:"none"};function Qk(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:Jk},n)}function Rk(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 e8(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const t8={draggable:`
|
|
321
|
+
`})};function eu({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=Ie();return c.jsx(wr,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(I,{className:Z(o),space:"m",col:!0,children:[c.jsx(B,{grow:!0,className:Z("text-center"),children:t||i.t("confirmAction")}),c.jsxs(I,{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 V0=new Map,H0=new Map,vk=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},bk=ce(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var T;const i=Ie(),l=we(),u=l.editor,[d,f]=h.useState(""),p=h.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((T=t.data.custom)==null?void 0:T.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 O=setTimeout(async()=>{if(!p.current||!u)return;const P=`${t.isTemplate?"t-":""}${t.id}`;let A=V0.get(P);if(!A){let $=H0.get(n);if(!$){const j=new pH({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});$=await mk(u.config.grapesjs,n,j.appEditorStore),H0.set(n,$)}A=$?gk($,t.data,n):"",V0.set(P,A)}const M=p.current;vk({el:M,html:A})});return()=>clearTimeout(O)},[p,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(Yn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{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:p})}),m&&c.jsx(Ko,{className:ae("absolute top-2 right-2",z.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(I,{justify:"center",items:"center",className:ae(Pe.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?E:c.jsx(wr,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(I,{space:"m",col:!0,children:[c.jsx(B,{children:c.jsx(rt,{size:"s",value:d,onChange:f,placeholder:g,required:!0})}),c.jsx(B,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(I,{className:ae("gjs-p-2 max-w-full",te.bt,z.br),col:!0,space:"s",children:[c.jsxs(I,{className:ae("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(B,{className:ae(Pe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&c.jsxs(B,{children:["by"," ",c.jsx("a",{className:ae(Ao.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),c.jsxs(I,{items:"center",children:[v&&c.jsxs(B,{className:ae("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(eu,{onConfirm:()=>a(t),className:"",children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(ne,{icon:q.delete,size:se.sx})})})})]})]})]})})}),j0=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=jf(),l=Ie().tScoped("templates"),d=we().editor,f=Ap(n==null?void 0:n.itemsPerRow),p=o??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(I,{justify:"center",children:l("notFound")}):c.jsx(Rc,{data:e,listClassName:ae("grid gap-2 gjs-pr-2",f),itemContent:(g,m)=>c.jsx(bk,{template:m,projectType:t,onSelect:p,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(Lo,{})})}),yk=ce(function(){var v;const t=we(),n=xv(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=Ie(),i=Ca(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:b,template:w})=>{b(w),i.close()},f=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},p=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:Ci.Existing,label:u("existentProjects")},{id:Ci.Templates,label:u("templates")}],[a]),m=((v=l.project)==null?void 0:v.types)&&zu();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&c.jsx(I,{items:"center",space:"m",children:c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(Le,{value:s,onChange:f,options:zN(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(B,{children:c.jsx(Zo,{tabs:g,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(B,{grow:!0,children:c.jsx(j0,{templates:r,projectType:xt[s],onSelect:d,onRemove:p,content:{itemsPerRow:3}})})]})}),wk=({items:e,editor:t,customItems:n})=>n===!1?[]:et(n)?n({items:e,editor:t}):n||e,D0=e=>({icon:q.plus,size:se.s,className:Z("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),F0=e=>!e.type||e.type==="button",Sk="gs-cmp-topbar-left",Ck=ce(function({buttons:t,className:n,style:r}){const o=we(),s=Ie(),{isOpen:a,toggleOpen:i}=u4(),l=o.editor,d=s.tScoped("blockManager")("blocks"),f=wk({items:[{id:`blocks-${d}`,tooltip:d,size:cb.s,icon:D0(a),variant:lb.primary,editorEvents:{[Pn.toggleBlocksPanel]:({fromEvent:p,setState:g})=>{g({icon:D0(p.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(I,{gap:"s",items:"center",justify:"start",className:Z(Sk,Te.xS,n),style:r,nowrap:!0,children:f.map(({id:p,...g})=>F0(g)?c.jsx(Nc,{...g},p):$t({id:p,...g}))})}),xk=[{id:So.auto,label:"Auto"},{id:So.dark,label:"Dark"},{id:So.light,label:"Light"}],Ek={size:"s"},Lp=".grapesjs",Tk=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},Pk=({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)},Ok="gs-cmp-topbar-right",_k=ce(function({editor:t,className:n,buttons:r,...o}){const s=we(),{theme:a,setTheme:i}=jr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:f,isBrowserMode:p,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=s,b=Ca(),w=Ie(),y=M=>w.t(`actions.${M}`),S=t.Storage.events,C=l.events,x="change:changesCount",E=(M,$)=>()=>{et(M)?M({editor:t}):l.isActive(M)?l.stop(M):l.run(M,$)},T=M=>({[`${C.runCommand}${M}`]:({setState:$})=>$({active:!0}),[`${C.stopCommand}${M}`]:({setState:$})=>$({active:!1})}),_=[{id:vr.componentOutline,icon:q.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:T("core:component-outline")},{id:vr.preview,icon:q.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:T("core:preview")},{id:vr.fullscreen,icon:q.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:T("core:fullscreen")},{id:vr.showCode,icon:q.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(re.dialogExportCode)},{id:vr.showImportCode,icon:q.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(re.dialogImportCode)},{id:vr.clearCanvas,icon:q.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:vr.store,tooltip:y("store.title"),onClick:async()=>!s.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:M})=>M({}),[S.startStore]:({setState:M})=>M({disabled:!0}),[S.endStore]:({setState:M})=>M({disabled:!1})},label:()=>c.jsxs("div",{className:Z("relative"),children:[c.jsx(ne,{icon:q.floppy,size:se.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:Z("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:Z(Pe.dot,z.bgW)})}),s.isSaving&&c.jsx("div",{className:Z("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(ne,{icon:q.refresh,size:"11px",className:Z(Pe.spin)})})]})},{id:vr.undo,icon:q.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasUndo()})}},{id:vr.redo,icon:q.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasRedo()})}}],O=Pk({actions:_,sdkOptions:m,editor:t,buttons:r}),P=[{id:"about",label:y("about.title"),icon:q.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(FN,{})})},{id:"embed",label:y("embed.title"),icon:q.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(BN,{})})},{id:"openProject",label:y("open.title"),icon:q.folder,action:async()=>{let M="";try{M=await(await xN({extensions:[Lp]})).text()}catch($){return console.error($)}s.loadProjectData(JSON.parse(M))}},{id:"saveProject",label:y("save.title"),icon:q.contentSave,action:async()=>{const M=t.getProjectData(),$=new Blob([JSON.stringify(M)]),j=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await TN($,{fileName:`${j}${Lp}`,extensions:[Lp]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:q.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(yk,{})})},{id:"installApp",label:y(f?"installApp.installed":"installApp.title"),icon:q.applicationBracketsOutline,action:async()=>{if(f)return;d==null||d.prompt();const M=await(d==null?void 0:d.userChoice);(M==null?void 0:M.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:"Theme"}),c.jsx(B,{children:c.jsx(Zo,{tabs:xk,onChange:M=>i(M),value:a,variant:"pills"})})]})}]].filter(({id:M})=>!((!p||!d)&&M==="installApp"||!Tk(m,M))),A=(M,$)=>j=>{et(M)&&(M(j),$())};return c.jsxs(I,{space:"s",items:"center",justify:"end",className:Z(Ok,Te.xS,n),nowrap:!0,...o,children:[O.map(({id:M,...$})=>F0($)?c.jsx(Nc,{size:"s",...$},M):$t({id:M,...$})),c.jsx(B,{children:m.settingsMenu!==!1&&P.length>0&&c.jsx(wr,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(ne,{icon:q.cog,size:se.s}),buttonProps:Ek,overlay:!0,children:({close:M})=>c.jsx(c.Fragment,{children:P.map($=>c.jsx(Pa,{action:A($.action,M),icon:$.icon,label:$.label},$.id))})})})]})});function Ak({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 Lk="gs-devices",B0=h.memo(function({className:t,style:n}){return c.jsx(oN,{children:r=>c.jsx(Ak,{className:N(Lk,t),style:n,...r})})}),Ji="gs-cmp-editor-topbar",Mk=ce(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:f}=we(),p=n??l,g=h.useMemo(()=>({...r,minHeight:p,marginTop:u||!f?`-${p}px`:0}),[u,f,r]);return c.jsxs(c.Fragment,{children:[c.jsx(B,{className:N(Ji,"gs-utl-transition-spacing gs-utl-w-full",te.bb,z.br,t),style:g,children:o??c.jsxs(I,{className:N(`${Ji}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(B,{className:N(`${Ji}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(Ck,{...s})}),c.jsx(B,{className:N(`${Ji}__wrp-center`),children:i!==!1&&c.jsx(B0,{...i})}),c.jsx(B,{className:N(`${Ji}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(_k,{editor:d,...a})})]})}),c.jsx(B,{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",z.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(ne,{icon:q.eyeOff,size:se.s})})})]})}),Nk="gs-sidebar-top",z0=h.memo(ce(function({height:t,children:n,...r}){return c.jsx(Mk,{height:t,...r,style:Ic(r),className:N(Nk,"gs-utl-flex",kc(r)),children:n?$t(n):void 0})})),$k="gs-canvas-sidebar-top",kk=h.memo(ce(function({className:t,sidebarTop:n,...r}){return c.jsxs(Cn,{className:N($k,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(z0,{...n}),c.jsx(kb,{grow:!0})]})})),Ik="gs-code-field",Vk=ce(function(e){const{editor:t}=we(),{isDarkTheme:n}=jr(),{editorEvents:r,onChange:o}=e,[s,a]=h.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(f=>({...f,...d}))}),l=u=>o==null?void 0:o(i(u||""));return is({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(ho,{className:N(Ik,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})});var Hk={grad:.9,turn:360,rad:360/(2*Math.PI)},go=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},er=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},U0=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},W0=function(e){return{r:er(e.r,0,255),g:er(e.g,0,255),b:er(e.b,0,255),a:er(e.a)}},Mp=function(e){return{r:Ut(e.r),g:Ut(e.g),b:Ut(e.b),a:Ut(e.a,3)}},jk=/^#([0-9a-f]{3,8})$/i,tu=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},G0=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}},q0=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}},K0=function(e){return{h:U0(e.h),s:er(e.s,0,100),l:er(e.l,0,100),a:er(e.a)}},Z0=function(e){return{h:Ut(e.h),s:Ut(e.s),l:Ut(e.l),a:Ut(e.a,3)}},Y0=function(e){return q0((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},Qi=function(e){return{h:(t=G0(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},Dk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Np={string:[[function(e){var t=jk.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=Bk.exec(e)||zk.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:W0({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=Dk.exec(e)||Fk.exec(e);if(!t)return null;var n,r,o=K0({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(Hk[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Y0(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 go(t)&&go(n)&&go(r)?W0({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(!go(t)||!go(n)||!go(r))return null;var a=K0({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return Y0(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!go(t)||!go(n)||!go(r))return null;var a=function(i){return{h:U0(i.h),s:er(i.s,0,100),v:er(i.v,0,100),a:er(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return q0(a)},"hsv"]]},X0=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]},Uk=function(e){return typeof e=="string"?X0(e.trim(),Np.string):typeof e=="object"&&e!==null?X0(e,Np.object):[null,void 0]},$p=function(e,t){var n=Qi(e);return{h:n.h,s:er(n.s+100*t,0,100),l:n.l,a:n.a}},kp=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},J0=function(e,t){var n=Qi(e);return{h:n.h,s:n.s,l:er(n.l+100*t,0,100),a:n.a}},Ip=function(){function e(t){this.parsed=Uk(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(kp(this.rgba),2)},e.prototype.isDark=function(){return kp(this.rgba)<.5},e.prototype.isLight=function(){return kp(this.rgba)>=.5},e.prototype.toHex=function(){return t=Mp(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?tu(Ut(255*s)):"","#"+tu(n)+tu(r)+tu(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return Mp(this.rgba)},e.prototype.toRgbString=function(){return t=Mp(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 Z0(Qi(this.rgba))},e.prototype.toHslString=function(){return t=Z0(Qi(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=G0(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 Wr({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),Wr($p(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Wr($p(this.rgba,-t))},e.prototype.grayscale=function(){return Wr($p(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Wr(J0(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Wr(J0(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"?Wr({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=Qi(this.rgba);return typeof t=="number"?Wr({h:t,s:n.s,l:n.l,a:n.a}):Ut(n.h)},e.prototype.isEqual=function(t){return this.toHex()===Wr(t).toHex()},e}(),Wr=function(e){return e instanceof Ip?e:new Ip(e)},Q0=[],Wk=function(e){e.forEach(function(t){Q0.indexOf(t)<0&&(t(Ip,Np),Q0.push(t))})};function Gk(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(),f=1/0,p="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<f&&(f=v,p=m)}return p}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}function nu(){return(nu=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 R0(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 Vp(e){var t=h.useRef(e),n=h.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Ma=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},Hp=function(e){return e&&e.ownerDocument.defaultView||self},ey=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:Ma((o.pageX-(r.left+Hp(e).pageXOffset))/r.width),top:Ma((o.pageY-(r.top+Hp(e).pageYOffset))/r.height)}},ty=function(e){!Ri(e)&&e.preventDefault()},jp=h.memo(function(e){var t=e.onMove,n=e.onKey,r=R0(e,["onMove","onKey"]),o=h.useRef(null),s=Vp(t),a=Vp(n),i=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){ty(b),(Ri(b)?b.touches.length>0:b.buttons>0)&&o.current?s(ey(o.current,b,i.current)):v(!1)},m=function(){return v(!1)};function v(b){var w=l.current,y=Hp(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&&(ty(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(ey(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],f=u[1],p=u[2];return h.useEffect(function(){return p},[p]),h.createElement("div",nu({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:f,tabIndex:0,role:"slider"}))}),ru=function(e){return e.filter(Boolean).join(" ")},Dp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=ru(["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}}))},pn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},ny=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:pn(e.h),s:pn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:pn(o/2),a:pn(r,2)}},Fp=function(e){var t=ny(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bp=function(e){var t=ny(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},qk=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:pn(255*[r,i,a,a,l,r][u]),g:pn(255*[l,r,r,i,a,a][u]),b:pn(255*[a,a,l,r,r,i][u]),a:pn(o,2)}},Kk=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?Zk({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}},Zk=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:pn(60*(i<0?i+6:i)),s:pn(s?a/s*100:0),v:pn(s/255*100),a:o}},Yk=h.memo(function(e){var t=e.hue,n=e.onChange,r=ru(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(jp,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ma(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":pn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Dp,{className:"react-colorful__hue-pointer",left:t/360,color:Fp({h:t,s:100,v:100,a:1})})))}),Xk=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Fp({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(jp,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ma(t.s+100*o.left,0,100),v:Ma(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+pn(t.s)+"%, Brightness "+pn(t.v)+"%"},h.createElement(Dp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Fp(t)})))}),Jk=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},Qk=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function Rk(e,t,n){var r=Vp(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;Jk(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 e6=typeof window<"u"?h.useLayoutEffect:h.useEffect,t6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},ry=new Map,n6=function(e){e6(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!ry.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}`,ry.set(t,n);var r=t6();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},r6=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Bp(Object.assign({},n,{a:0}))+", "+Bp(Object.assign({},n,{a:1}))+")"},s=ru(["react-colorful__alpha",t]),a=pn(100*n.a);return h.createElement("div",{className:s},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(jp,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:Ma(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Dp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bp(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=R0(e,["className","colorModel","color","onChange"]),i=h.useRef(null);n6(i);var l=Rk(n,o,s),u=l[0],d=l[1],f=ru(["react-colorful",t]);return h.createElement("div",nu({},a,{ref:i,className:f}),h.createElement(Xk,{hsva:u,onChange:d}),h.createElement(Yk,{hue:u.h,onChange:d}),h.createElement(r6,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},s6={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Kk,fromHsva:function(e){var t=qk(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Qk},a6=function(e){return h.createElement(o6,nu({},e,{colorModel:s6}))};Wk([Gk]);const i6=e=>e.startsWith("rgba")?e:Wr(e).toRgbString();function oy({value:e,onChange:t,disabled:n}){const r=i6(e||""),o=h.useRef(r),[s,a]=h.useState(!1),i=Tr()&&!!window.EyeDropper,l=g=>{o.current=g,t==null||t(g)},u=g=>{o.current=g,t==null||t(g,!0)},d=()=>{i&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},f=()=>{a(!0)},p=()=>{t==null||t(o.current,!1),a(!1)};return c.jsxs(c.Fragment,{children:[s&&c.jsx("div",{onPointerUp:p,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(a6,{className:"color-picker",color:r,onChange:u,onPointerDown:f,onPointerUp:p}),c.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx(rt,{size:"s",value:r,onChange:l,disabled:n})}),i&&c.jsx(Ke,{type:"button",onClick:d,children:c.jsx(ne,{icon:q.eyedropperVariant,size:se.s})})]})]})}const l6="gs-cmp-studio-color-picker",c6=h.memo(ce(function({className:t,style:n,value:r="",disabled:o,onChange:s,editorEvents:a}){const{editor:i}=we(),[l,u]=h.useState(()=>({className:t,style:n,value:r,disabled:o})),d=(f,p)=>{const g=f||"";s==null||s({value:g,partial:p,editor:i,state:l,setState:m=>u(v=>({...v,...m}))})};return is({editor:i,editorEvents:a,localState:l,setLocalState:u}),c.jsx("div",{className:N(l6,l.className,Te.m),style:l.style,children:c.jsx(oy,{value:l.value||"",onChange:d,disabled:l.disabled})})})),u6="gs-cmp-column",d6=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(Cn,{className:N(u6,z.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:$t(n)})}),zp=`<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>`,Bs="--before-content",Up={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},sy={stylable:!1,traits:[]};function f6(e){return typeof e=="object"&&e.type===Bt.variable}function ay(e){if(f6(e)){const{path:t}=e;return iy(t||"")}return e}function iy(e){return`{{ ${e} }}`}function p6(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===Hs.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 Wp=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?{...sy}:{}},Gp=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?{...sy}:{}},h6=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,g6=e=>Array.isArray(e)?"array":e===null?"default":typeof e,m6=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:q.codeBrackets,object:q.codeBraces,string:q.codeString,number:q.number,boolean:q.toggleSwitchOffOutline,default:q.null},u=g6(t),d=N(s,"gs-utl-text-left",z.hBgH,te.b,te.rnd,Te.xy,n?[te.bA,z.tA]:[z.br,z.txtHighEmphasisH]),f=p=>typeof p=="object"?Array.isArray(p)?a("items",{params:{length:p.length}}):p?a("properties",{params:{length:Object.keys(p).length}}):"null":String(p);return c.jsx(Ke,{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(B,{className:N(Pe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(B,{className:N("gs-utl-w-full",Pe.txtEllips,Pe.disabled),children:f(t)})]}),i&&c.jsx(B,{children:c.jsx(ne,{size:se.sx,icon:q.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),v6="gs-cmp-data-path-explorer",cy=ce(function({additionalSources:t,onChange:n,path:r=""}){const{editor:o}=we(),s=h.useRef({}),[a,i]=h.useState(()=>r.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...o?p6(o):{},...t}),[o,t]),f=(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&&Rr(S)&&S.collectionId===y,T=()=>{const _=x?C.slice(0,-1):C;n==null||n(_.join("."),{paths:_}),i(_)};return c.jsx(m6,{className:N(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:T},y)})};h.useEffect(()=>{s.current=d;const v=[];for(let b=0;b<=a.length;b++){const w=f(a,b);w.length>0&&v.push(w)}u(v)},[d,a]);const p=N(v6,z.bg,z.br,te.b,te.rnd,Pe.scrollX,"gs-utl-h-full"),g=N("gs-utl-min-w-[220px]",z.br),m=N("gs-utl-h-full gs-utl-max-h-[60vh]",Pe.scrollY,Te.xyS);return c.jsx(I,{className:p,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(B,{className:N(g,b!==l.length-1&&te.br),children:c.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function uy(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function qp(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 b6=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},y6=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],f=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:f}))||""}else return(u==null?void 0:u.getValue(r,o))||""},w6="gs-cmp-data-path-field",el=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:f,onPickerToggle:p}=e,{editor:g}=we(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!o),[w,y]=h.useState(!1),S=!!l||v||w,C=()=>y(!w),x=F=>{const k=F??!v;b(k),p==null||p(k)},E=()=>x(!1),T=(...F)=>{f==null||f(...F)},_=F=>{S||f==null||f(F,{paths:F.split(".")})},O=b6({dataResolver:i,value:n}),P=w&&g?`"${y6({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:O,A=t==="m",M=A?"lg":t,$=A?se.l:se.s,j=m(v?"closePathExplorer":"openPathExplorer"),L={icon:v?q.close:q.databaseOutline,size:se.l},D={icon:w?q.eyeOff:q.eye,size:A?se.m:$},W=c.jsx(Ct,{block:!0,variant:"pr",size:M,title:j,onClick:()=>x(),icon:L});return c.jsxs(I,{className:w6,gap:t,col:!0,children:[c.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[c.jsx(rt,{readOnly:S,label:r,value:w?P:O,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",z.txt,Pe.txtEllips),afterInput:!!n&&c.jsx(Ct,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Pe.hover,icon:D})}),d?c.jsx(wr,{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(cy,{path:O,onChange:T,additionalSources:a})}):W]}),!!v&&!d&&c.jsx(cy,{path:O,onChange:T,additionalSources:a})]})}),S6=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},dy=({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},C6=({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=`${ou({min:r,max:o,value:l})}`,l=dy({value:l,step:s})}return l},ou=({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}`},x6=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=f=>{const p=f.clientY-t,g=o-p*parseFloat(`${i}`);l=dy({value:ou({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)},E6=(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))},fy=e=>Ht(e)?e:"",T6="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:f,onChange:p,onChangeUnit:g}=e,[m,v]=h.useState(fy(n)),[b,w]=h.useState(!1),y=(r==null?void 0:r.map(O=>({id:O,label:O})))||[],S={min:i,max:l,step:u};h.useEffect(()=>{v(fy(n))},[n,o]);const C=(O,P)=>{p==null||p(ou({min:i,max:l,value:O}),P)},x=O=>{if(f)return;w(!0);const P=(A,M)=>{C(A,!!M),!M&&w(!1)};x6(m,O.clientY,P,S)},E=O=>{const{key:P,shiftKey:A}=O;switch(P){case"Escape":return v(n);case"Enter":return C(m)}const M=C6({step:u,value:n,key:P,shiftKey:A});M!==null&&(O.preventDefault(),C(M))},T=()=>{C(m)},_=Go({...e,className:N(T6,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(br,{as:e.labelAs,...e}),c.jsxs(I,{className:tp(e),items:"center",space:"x2s",children:[!!a&&c.jsx(B,{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(ne,{icon:q.panVertical,size:se.s2x}):a}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:ji(e),value:m,disabled:f,onChange:O=>v(O.target.value),placeholder:d,onBlur:T,onKeyDown:E})}),!!y.length&&c.jsx(B,{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:f,onChange:O=>g==null?void 0:g(O),options:y})})]})]})}const P6="gs-cmp-switch-field";function tl(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?z.bgA:z.bgH,ni.focus,s&&`${z.br} ${te.b}`);return c.jsx(lf.Group,{children:c.jsxs(I,{items:"center",className:N(P6,t),full:!0,children:[!!r&&c.jsx(lf.Label,{as:o,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(br,{...e,as:"span"})}),c.jsx(lf,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:N(z.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 Kp(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 O6="gs-cmp-data-collection-picker",_6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=uy(a),d=l===Number.MAX_VALUE,f=Ie().tScoped("dataSources"),p=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(I,{className:O6,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(rt,{className:"gs-utl-flex-grow",size:"s",label:f("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(gb,{size:"s",value:s,block:!0})]}),c.jsx(el,{label:f("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx($e,{size:"s",className:"gs-utl-flex-grow",label:f("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:v}),c.jsx($e,{size:"s",label:f("collectionEndIndex"),placeholder:d?"-":"",value:p==null?void 0:p.toString(),onChange:b,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(B,{children:c.jsx(tl,{label:f("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(I,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:f("confirm")})})]})}),A6="gs-data-collection-picker",L6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(A6,t),...o,children:c.jsx(_6,{component:n,onConfirm:r})})});var Vn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Vn||{}),Hn=(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))(Hn||{}),Zp=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Zp||{}),Yp=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Yp||{});const M6=[...Object.values(Yp),...Object.values(Zp),...Object.values(Hn)],Xp={string:Object.values(Yp),number:Object.values(Zp),dataSource:M6},N6=h.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case Vn.DATA_SOURCE:return c.jsx(el,{size:"s",pickerInPopover:!0,value:uy(s),onChange:i=>a(r,i,o),additionalSources:n});case Vn.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)})}}),$6="gs-cmp-statement-side",py=h.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(I,{className:N($6,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Wo,{size:"s",children:o}),c.jsxs(I,{items:"center",gap:"xs",children:[c.jsx(B,{children:c.jsx(Le,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(B,{grow:!0,children:c.jsx(N6,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),su=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Vn.DATA_SOURCE:typeof e=="string"?Vn.STRING:typeof e=="number"?Vn.NUMBER:Vn.STRING,k6=(e,t,n)=>{switch(t){case Vn.STRING:return e||"";case Vn.NUMBER:return e?Number(e):0;case Vn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(ct(e)?qp(e,r):e)??{path:"",defaultValue:""}}}default:return e}},I6=e=>Xp[e][0],V6=e=>![Hn.isTruthy,Hn.isFalsy,Hn.isDefined,Hn.isNull,Hn.isUndefined,Hn.isArray,Hn.isObject,Hn.isString,Hn.isNumber,Hn.isBoolean,Hn.isDefaultValue].includes(e),H6="gs-cmp-statement",j6=ce(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=Ie().tScoped("dataSources"),[a,i]=h.useState(()=>su(t.left)),[l,u]=h.useState(()=>su(t.right)),d=Xp[a]||Xp[Vn.STRING],f=h.useMemo(()=>Object.values(Vn).map(C=>({id:C,label:Pr(C)})),[]),p=h.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);h.useEffect(()=>{i(su(t.left)),u(su(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const T=k6(x,E,o),_=C==="left",O=_&&E!==Vn.DATA_SOURCE;_?i(E):u(E),g({[C]:T,...O&&{operator:I6(E)}})},v=(C,x)=>m(C,null,x),b=C=>g({operator:C}),w=N(H6,r,z.br,te.b,te.rnd,Te.xy),y=V6(t.operator),S={additionalSources:o,onChange:m,onTypeChange:v,typeOptions:f};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(py,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(B,{children:c.jsx(Le,{size:"s",label:s("operator"),value:t.operator,options:p,onChange:b})}),y&&c.jsx(py,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),Jp="gs-cmp-statements-group",D6=e=>e==="and"||e==="or",au=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),hy=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=>{D6(m)&&r({...n,logicalOperator:m})},d=()=>{au(n),r(au(n))},f=m=>{const v=i.filter((b,w)=>w!==m);r({...n,statements:v})},p=(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(I,{className:N(Jp,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Zo,{value:l,onChange:u,tabs:g}),c.jsx(I,{className:`${Jp}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,v)=>c.jsxs(I,{className:N(`${Jp}__item`),gap:"s",col:!0,children:[c.jsx(j6,{additionalSources:o,statement:m,onChange:b=>p(v,b)}),v<i.length-1&&c.jsxs(I,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:N(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(Ct,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>f(v+1),icon:{icon:q.delete,size:se.s}})]})]},`stmt-${v}`))}),!s&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:q.plus,size:se.s},children:a("addCondition")})})]})}),F6="gs-cmp-data-condition-picker",B6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),s=Ie().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:au(a)})};return c.jsxs(I,{className:F6,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(hy,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(I,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:q.plus,size:se.s},children:s("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),z6="gs-data-condition-picker",U6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(z6,t),...o,children:c.jsx(B6,{component:n,onConfirm:r})})}),W6="gs-data-path-field",G6=ce(({className:e,value:t="",onChange:n,...r})=>c.jsx(Cn,{className:N(W6,e),...r,children:c.jsx(el,{onChange:o=>n({value:o}),value:t})})),iu={type:"data-variable",path:"",defaultValue:""},gy={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function es(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const my="gs-cmp-dynamic-value-picker",q6=ce(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=h.useState(()=>es(e)?e:iu),[a,i]=h.useState(o.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const S=es(e)?e:iu;(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"?iu:gy;u(x)},f=S=>{u({type:"data-variable",defaultValue:o.defaultValue,...qp(S,r)})},p=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(au(S))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:iu,y=(o==null?void 0:o.type)==="data-condition"?o:gy;return c.jsxs(I,{className:my,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{className:my,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Zo,{value:a,onChange:d,tabs:b}),c.jsx(B,{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(el,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:f}),c.jsx(rt,{label:l("defaultValue"),value:w.defaultValue||"",onChange:p})]}):c.jsxs(I,{gap:"m",col:!0,children:[c.jsx(hy,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(I,{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(I,{full:!0,justify:"end",className:Te.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:q.plus,size:se.s},children:l("addCondition")})})]}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),K6="gs-data-value-picker",Z6=ce(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(Cn,{className:N(K6,e),...s,children:c.jsx(q6,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),Y6="gs-cmp-data-variable-picker",X6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),s=Ie().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=p=>{r(qp(p,l))},d=()=>{o(),t==null||t({value:n})},f=p=>r({defaultValue:p});return c.jsxs(I,{className:Y6,gap:"s",col:!0,nowrap:!0,children:[c.jsx(el,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(rt,{label:s("defaultValue"),value:i,onChange:f}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),J6="gs-data-variable-picker",Q6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(J6,t),...o,children:c.jsx(X6,{component:n,onConfirm:r})})}),R6="gs-cmp-input-field",e8=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:f,onChange:p,onInput:g,editorEvents:m}){const{editor:v}=we(),[b,w]=h.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:f})),y=x=>({value:x,editor:v,state:b,setState:E=>w(T=>({...T,...E}))}),S=x=>p==null?void 0:p(y(x)),C=x=>g==null?void 0:g(y(x));return is({editor:v,editorEvents:m,localState:b,setLocalState:w}),c.jsx(rt,{type:l,className:N(R6,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})})),t8="gs-menu-list",n8=ce(function({className:e,items:t,onItemClick:n,...r}){const{editor:o}=we(),[s,a]=h.useState(),i=u=>{const{onClick:d}=u;if(d&&o)return f=>d({item:u,editor:o,...f})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(Cn,{className:N(t8,z.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>h.createElement(Pa,{...u,label:u.layout?$t(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 r8({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:Z("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 o8=ce(r8),s8=ce(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=_i();return $t(r({asset:To(a.toAsset(n)),assetProps:To(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),a8="gs-cmp-asset-card",i8=ce(function(t){var f;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=Ie(),{editor:l}=we();if(a)return l?c.jsx(s8,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((f=u.split("/").pop())==null?void 0:f.split("?").shift());return c.jsx(Yn,{padding:!1,className:ae(a8,"overflow-hidden max-w-full group",s),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{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(I,{justify:"center",items:"center",className:ae(Pe.coverAbs,z.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(I,{className:ae("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(B,{className:ae(Pe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(eu,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(I,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ae("text-center",z.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(ne,{icon:q.delete,size:se.sx})})})]})]})})}),Gr="gs-asset-manager",l8={search:!0,addUrl:!0,upload:!0},c8=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:f,content:p,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=we(),{editor:T}=E,_=Ie(),[O]=jf(),P=Ap(p==null?void 0:p.itemsPerRow),[A,M]=h.useState(""),$=(p==null?void 0:p.header)===!1?!1:{...l8,...Rr(p==null?void 0:p.header)?p.header:{}};if(!T)return;const j=d?t.filter(L=>!(a&&!Zs(L.src,a)&&!Zs(L.name??"",a))):t;return c.jsxs(I,{className:Z(Gr,"relative gs-utl-h-full",i&&Pe.disabled),nowrap:!0,col:!0,space:"m",children:[$!==!1&&c.jsxs(I,{className:`${Gr}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(I,{className:`${Gr}__header-filters`,items:"center",gap:"m",children:[$.search&&c.jsx(B,{children:c.jsx(rt,{className:`${Gr}__search-filter`,size:"m",type:"search",value:a,onInput:b,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(B,{children:c.jsx(Le,{className:Z(`${Gr}__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(B,{children:c.jsx(Le,{classNameContainer:Z(`${Gr}__provider-filter`,"items-center"),size:"m",options:r.map(L=>({...L,label:et(L.label)?L.label({editor:T}):L.label,icon:L.icon})),value:s,onChange:v,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(I,{className:`${Gr}__header-buttons`,items:"center",gap:"m",children:[$.upload&&c.jsx(B,{children:c.jsx(o8,{className:`${Gr}__upload-field`,onChange:w})}),$.addUrl&&!!y&&c.jsx(B,{children:c.jsx(wr,{className:`${Gr}__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:L})=>c.jsxs(I,{gap:"m",children:[c.jsx(B,{children:c.jsx(rt,{type:"url",size:"s",value:A,onChange:M,placeholder:_.t("assetManager.inputPlh")})}),c.jsx(B,{children:c.jsx(Ke,{variant:"pr",size:"m2",onClick:()=>{y(A),L()},children:_.t("add")})})]})})})]}),x&&c.jsx(c.Fragment,{children:$t(x({editor:T}))})]}),c.jsx(I,{className:Z(`${Gr}__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")}):!!O&&c.jsx(Rc,{data:j,listClassName:Z("gs-utl-grid gs-utl-gap-2",P),endReached:C,itemContent:(L,D)=>c.jsx(i8,{assetProps:D,onSelect:g,onRemove:S,itemLayout:f},D.id),components:{Footer:C?u8:void 0}})}),i&&c.jsx(Lo,{abs:!0})]})}),u8=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),d8=ce(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:f,layoutAfterHeader:p}){const{appEditorStore:g,i18nStore:m}=En(),{editor:v}=g,b=_i(),{customOnLoad:w}=b,y=wv(t);h.useEffect(()=>{const T=O=>ct(O)?{id:O,label:m.t(`assetManager.assetTypes.${O}`)||O}:O;y.setCustomTypes(o==null?void 0:o.map(T)),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=T=>{b.addToProjectAssets([{id:T,src:T,type:y.typeFilter??Ns.image}])},C=T=>{v&&(d==null||d({asset:b.toAsset(T),assetProps:T,editor:v}),f==null||f())},x=r==null?void 0:r.map(b.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(c8,{assetProps:x??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:T=>{y.setTypeFilter(T),y.loadAssets()},onChangeProviderFilter:T=>{y.setProviderFilter(T),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:T=>b.uploadFile(T.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:p})});var f8=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)},vy={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},by={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},lu={width:"20px",height:"20px",position:"absolute"},p8={top:It(It({},vy),{top:"-5px"}),right:It(It({},by),{left:void 0,right:"-5px"}),bottom:It(It({},vy),{top:void 0,bottom:"-5px"}),left:It(It({},by),{left:"-5px"}),topRight:It(It({},lu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:It(It({},lu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:It(It({},lu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:It(It({},lu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},h8=function(e){f8(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"},p8[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(nt.PureComponent),g8=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)}}(),qr=function(){return qr=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},qr.apply(this,arguments)},m8={width:"auto",height:"auto"},cu=function(e,t,n){return Math.max(Math.min(e,n),t)},yy=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},Na=function(e,t){return new RegExp(e,"i").test(t)},uu=function(e){return!!(e.touches&&e.touches.length)},v8=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},wy=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},Qp=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"},du=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},b8=function(e,t,n,r,o,s,a){return r=du(r,e.width,t,n),o=du(o,e.height,t,n),s=du(s,e.width,t,n),a=du(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)}},y8=function(e){return Array.isArray(e)?e:[e,e]},w8=["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"],Sy="__resizable_base__",S8=function(e){g8(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(Sy):u.className+=Sy,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||m8},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","")),f=d/u[i]*100;return f+"%"}return Qp(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?Qp(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?Qp(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&&Na("left",s),i=o&&Na("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=y8(this.props.resizeRatio||1),a=s[0],i=s[1],l=this.state,u=l.direction,d=l.original,f=this.props,p=f.lockAspectRatio,g=f.lockAspectRatioExtraHeight,m=f.lockAspectRatioExtraWidth,v=d.width,b=d.height,w=g||0,y=m||0;return Na("right",u)&&(v=d.width+(n-d.x)*a/o,p&&(b=(v-y)/this.ratio+w)),Na("left",u)&&(v=d.width-(n-d.x)*a/o,p&&(b=(v-y)/this.ratio+w)),Na("bottom",u)&&(b=d.height+(r-d.y)*i/o,p&&(v=(b-w)*this.ratio+y)),Na("top",u)&&(b=d.height-(r-d.y)*i/o,p&&(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,f=typeof o.width>"u"||o.width<0?n:o.width,p=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=(p-m)*this.ratio+v,w=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,S=(f-v)/this.ratio+m,C=Math.max(d,b),x=Math.min(f,w),E=Math.max(p,y),T=Math.min(g,S);n=cu(n,C,x),r=cu(r,E,T)}else n=cu(n,d,f),r=cu(r,p,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&&v8(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&uu(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 f={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:qr(qr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(f)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&uu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=uu(n)?n.touches[0].clientX:n.clientX,d=uu(n)?n.touches[0].clientY:n.clientY,f=this.state,p=f.direction,g=f.original,m=f.width,v=f.height,b=this.getParentSize(),w=b8(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=wy(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=wy(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 T=yy(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=yy(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),O=this.props.snapGap||0,P=O===0||Math.abs(T-C)<=O?T:C,A=O===0||Math.abs(_-S)<=O?_:S;C=P,S=A}var M={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 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(v&&typeof v=="string"){if(v.endsWith("%")){var $=S/b.height*100;S=$+"%"}else if(v.endsWith("vw")){var j=S/this.window.innerWidth*100;S=j+"vw"}else if(v.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}var D={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?D.flexBasis=D.width:this.flexDir==="column"&&(D.flexBasis=D.height);var W=this.state.width!==D.width,F=this.state.height!==D.height,k=this.state.flexBasis!==D.flexBasis,H=W||F||k;H&&Fn.flushSync(function(){r.setState(D)}),this.props.onResize&&H&&this.props.onResize(n,p,this.resizable,M)}},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:qr(qr({},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 f=n.filter(function(p){return s[p]!==!1}).map(function(p){return s[p]!==!1?nt.createElement(h8,{key:p,direction:p,onResizeStart:r.onResizeStart,replaceStyles:a&&a[p],className:i&&i[p]},d&&d[p]?d[p]:null):null});return nt.createElement("div",{className:u,style:l},f)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return w8.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=qr(qr(qr({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,qr({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 fu({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,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",z.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(S8,{className:e,enable:v.enable??b,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,children:t})}const Rp="gs-cmp-accordion",eh=`${Rp}-handler`,pu=`${eh}__content`,C8=`${Rp}-content`;function mo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:f,open:p}){return c.jsx(Zd,{as:"div",defaultOpen:p,className:Z(Rp,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(Zd.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>f==null?void 0:f({event:m,open:!g}),className:({open:m})=>N(eh,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(I,{items:"center",className:Z("gap-2"),full:!0,children:[c.jsx(B,{className:Z(pu,r,"text-left"),grow:!0,children:et(s)?s(m):c.jsxs(I,{items:"center",className:Z(`${pu}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(ne,{className:Z(`${pu}-icon`),icon:a,size:se.s2x}),c.jsx(B,{className:Z(`${pu}-label gs-utl-w-full`),children:s})]})}),c.jsx(B,{className:Z(`${eh}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(ne,{icon:q.chevronDown,className:Z("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(Zd.Panel,{className:Z(C8,n),children:i})]})})}const nl="gs-studio-panel",Cy=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Cr=h.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(Cn,{className:N(nl,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(fu,{className:N([`${nl}__resizer`]),...u,children:l}):l,f=n===!0?{collapsible:!0}:n||void 0;return f?c.jsx(mo,{classNameWrap:N(`${nl}__accordion`,s),className:N(`${nl}__accordion-header`,Te.xy,f.className),classNameContent:N(`${nl}__accordion-content`,a),disabled:f.collapsible===!1,style:f.style,handler:c.jsxs(I,{space:"s",items:"center",children:[!!f.icon&&c.jsx(ne,{icon:f.icon,size:se.s}),c.jsx(B,{grow:!0,children:f.label})]}),open:n?f.collapsed!==!0:!0,children:d}):d}),x8="gs-panel-assets",E8=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:f,layoutAfterHeader:p,...g}){var x;const m=we(),v=_i(),b=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=p||w,[S]=h.useState(()=>g.id||zm());return h.useEffect(()=>(v.createAssetManager(S),()=>{v.removeAssetManager(S)}),[S]),wv(S)?c.jsx(Cr,{className:N(x8,"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(d8,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:f??d,layoutAfterHeader:y})}):null}));var rl=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(rl||{}),Kr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Kr||{});const xy="gs-block-item",Ey=ce(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=we(),i=Ie(),[,l]=h.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),f=!!t.get("full"),p=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(xy,`${xy}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",te.b,te.rnd,z.br,f&&"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?Pe.disabledM:N("gs-utl-cursor-pointer",z.hTAo,z.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("gs-utl-text-center",Pe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!a)return;const{Blocks:A}=a,M=A.events.update,$=j=>j===t&&l(L=>++L);return a.on(M,$),()=>{a.off(M,$)}},[t,a]),!a)return null;const{Blocks:E}=a,O={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!o},...!!p&&{onClick:()=>p(t,a)}},P=r==null?void 0:r({editor:a,block:t,attributes:O});return P&&$t(P)||c.jsxs(I,{items:"center",...O,children:[m||c.jsx("div",{className:C,dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:x,title:w,children:w})]})});function th({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:Z([e,"w-full",z.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:ps,ref:s})}function Ty({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=p=>{a==null||a(p),u(p)},f=p=>{s(p),d(!1)};return c.jsx("div",{className:Z("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(th,{className:Z(r&&Pe.noFocusOut),value:t,onChange:f}):c.jsx(c.Fragment,{children:t})})}const Py=ae("text-sm w-full",Pe.txtEllips),T8=ce(({symbol:e,className:t})=>{const n=Di(),{Components:r}=n,o=Ie(),s=Ca(),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(),f=r.getSymbolInfo(e).instances.length,p=ae("h-10 w-10 block-media",z.grouphTAo),g=ae("gjs-pt-1 gjs-mt-2",te.bt,z.br),m=ae("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,z.br,z.hBgH,t),v=()=>{s.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},b=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:p,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(I,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(B,{children:c.jsx(I,{className:ae(Py,"gjs-mr-auto"),children:c.jsx(Wt,{title:`${f} ${a("instancesProject")}`,children:c.jsx(Ko,{label:`${f}`,className:ae(z.bgH75)})})})}),c.jsx(B,{className:ae("truncate"),grow:!0,title:d,children:c.jsx(Ty,{activable:!0,value:d,className:Py,onChange:b})}),c.jsx(B,{className:ae(Pe.hoverGroup),children:c.jsx(I,{justify:"end",full:!0,children:c.jsx(Ct,{onClick:v,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(ne,{icon:q.delete,size:se.s})})})})]})]})}),ts="gs-block-manager",Oy={id:Kr.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>'},P8={id:Kr.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>'},O8={id:Kr.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>'},_y={id:Kr.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>'},Ay=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Ly=e=>{const t=e.getContent();return et(t)?e.getDragDef():t},_8=e=>{const t=Ly(e);return Array.isArray(t)?t[0]:t},A8=ce(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Ue,en;const{editor:l}=we(),u=Ie(),[d,f]=h.useState(0),[p,g]=h.useState(rl.REGULAR),[m,v]=h.useState(""),[b,w]=h.useState(""),y=h.useRef(new Set),[S,C]=h.useState((o==null?void 0:o.position)||Kr.after),[x,E]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),T=p===rl.SYMBOLS,_=h.useRef(null),O=u.tScoped("blockManager"),P=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()),f(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(),Cd)}},[_.current,t]),!l)return null;const{Blocks:A,Components:M}=l,$=he=>O(`labels.${he.getId()}`)||he.getLabel(),j=x.filter(he=>Zs(he.getName(),m)),L=A.getAll().map(he=>he),D=((Ue=i.blocks)==null?void 0:Ue.call(i,{blocks:L}))||L,W=S===Kr.before,F=S===Kr.beforeInside,k=S===Kr.afterInside,H=S===Kr.after,V=!!(P!=null&&P.attributes.droppable),U=D.filter(he=>{const De=Ay(l,he.category);if(m&&!Zs(De,m)&&!Zs($(he),m))return!1;if(P){const Fe=_8(he);if(V&&(F||k)){const He=F?0:void 0;return M.canMove(P,Fe,He).result}else if(W||H){const He=P.index(),Mt=P.parent(),Gt=W?He:He+1;return Mt&&M.canMove(Mt,Fe,Gt).result}}return!0}),J=A.getBlocksByCategory(U),Y=r?U:(en=J.find(he=>!he.category))==null?void 0:en.items,X=r?[]:J.filter(he=>he.category),Q=i.symbols!==!1,ee=i.search!==!1,G=!Q&&!ee,R=s==="compact",le=O("search")||u.t("search"),ge=N(ts,n,"gap-2"),Ee=N(`${ts}__header`,"gs-utl-pt-2",Te.xS,G&&"gs-utl-hidden"),Ce=N(`${ts}__content`,Pe.scrollY,z.br,te.bt),tt=N(`${ts}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Qe=N(`${ts}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ot=N(`${ts}__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"),ut=N(`${ts}__no-category`,Ot,z.br,X.length&&te.bb),Se=N(z.tAo,z.bgH75,te.bA),ot=`${ts}__category`,st=[{id:rl.REGULAR,label:O("types.regular")},{id:rl.SYMBOLS,label:O("types.symbols")}],wt=V?[Oy,P8,O8,_y]:[Oy,_y],Ne=P?he=>{const De=Ly(he);if(!De)return;let Fe;if(F||k){const He=F?0:void 0;Fe=P.append(De,{at:He})[0]}else if(W||H){const He=P.index(),Mt=P.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?l.em.setSelected(Fe,{activate:He}):He&&Fe.trigger("active")}}:void 0,mt=he=>{if(!P)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=A.get(b);Fe&&(Ne==null||Ne(Fe))}},dt=he=>{y.current.clear(),v(he)};return c.jsxs(I,{className:ge,col:!0,full:!0,children:[c.jsxs(I,{className:Ee,gap:"s",col:!0,children:[Q&&c.jsx(Zo,{tabs:st,onChange:g,value:p,variant:"pills"}),P&&c.jsx(Qt,{size:"s",options:wt,value:S,onChange:he=>C(he)}),ee&&c.jsx(rt,{ref:_,size:"s",value:m,onInput:dt,onKeyDown:mt,placeholder:le,type:"search"})]}),c.jsxs(B,{className:Ce,grow:!0,children:[T&&(j.length?c.jsx(I,{className:tt,children:j.map(he=>c.jsx(T8,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(I,{className:Qe,justify:"center",children:O("symbols.notFound")})),!T&&(U.length?c.jsxs(c.Fragment,{children:[!!(Y!=null&&Y.length)&&c.jsx(I,{className:ut,children:Y==null?void 0:Y.map(he=>(y.current.add(`${he.id}`),c.jsx(Ey,{block:he,itemLayout:a,onClick:Ne,variant:s,className:N(b===he.id&&Se)},he.id)))}),X.map(({category:he,items:De},Fe)=>c.jsx(mo,{sticky:!0,className:He=>Ed.itemList({index:Fe,open:He,length:X.length}),open:!!(he!=null&&he.get("open")),onChange:({open:He})=>he==null?void 0:he.set({open:He}),handler:Ay(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:N(ot,`${ot}--${he==null?void 0:he.id}`),children:c.jsx(I,{className:Ot,children:De.map(He=>(y.current.add(`${He.id}`),c.jsx(Ey,{block:He,itemLayout:a,onClick:Ne,variant:s,className:N(b===He.id&&Se)},He.id)))})},he==null?void 0:he.id))]}):c.jsx(I,{className:Qe,justify:"center",children:O("notFound")}))]})]})}),L8=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-after"),n),ref:o,...r,children:t})}),M8=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-before"),n),ref:o,...r,children:t})}),N8="gs-panel-blocks",$8=h.memo(ce(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=we().sdkProps.children,f={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(Cr,{className:N(N8,"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(Fi,{children:[Xn(d,M8),c.jsx(A8,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...f}),Xn(d,L8)]})})})),k8="gs-cmp-color-picker",I8={backgroundSize:"10px"},V8=[0,15];function My({className:e,value:t,onChange:n,disabled:r}){const[o,s]=h.useState(!1),a=N(`${k8}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,z.br),i=()=>{s(!1)},l=c.jsxs("div",{style:I8,className:a,children:[o&&c.jsx("div",{onPointerUp:i,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(wr,{handler:l,title:"Color",size:"s",placement:"left-end",offset:V8,clickAway:!0,disabled:r,children:c.jsx(oy,{value:t,onChange:n,disabled:r})})}const H8="gs-cmp-color-field";function vo(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i}=e,[l,u]=h.useState($c(n)),d=ji(e);h.useEffect(()=>{u($c(n))},[n]);const f=(v,b)=>{s==null||s(v,b)},p=v=>{switch(v.key){case"Escape":return u(n);case"Enter":f(l),o&&(v.preventDefault(),v.stopPropagation())}},g=()=>{f(l)},m=Go({...e,className:N(H8,t)});return c.jsxs("div",{...m,children:[c.jsx(br,{...e,as:a}),c.jsxs(I,{className:tp(e),items:"center",space:"s",children:[c.jsx(B,{children:c.jsx(My,{value:n,onChange:s,disabled:i})}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:N(d,i&&"gs-utl-pointer-events-none"),value:l,onChange:v=>u(v.target.value),placeholder:r,onBlur:g,onKeyDown:p,disabled:i})})]})]})}const j8=(e,t)=>{t.runCommand(re.fontAdd,{font:e})},nh=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(re.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;j8(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},hu=ce(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=we(),s=Ie(),a=_i(),i=Ai(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),f=d?kf(d):u.id;return{...u,content:c.jsx(I,{col:!0,children:c.jsx(B,{style:{fontFamily:f},children:u.label})})}});return c.jsx(Le,{...r,value:$s(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(Ct,{className:t,title:s.t("fontManager.addFontToProject"),icon:q.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&nh(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange($s(d.family))}})})})}),D8=(e,{t,id:n})=>t(`fields.${n}.label`)||Pr(`${e}`.replace(/-/g," ")),Ny=(e,{t,id:n})=>{const r=ct(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},$y=e=>e.get("defaultValue")||"",ol=e=>e.get("field"),ky=e=>{const t=ol(e);return ct(t)?{type:t}:t},Iy=e=>`${e.get("value")||$y(e)||ky(e).defaultValue||""}`,F8=(e,t)=>e||$y(t)||"",sl=({record:e,value:t,partial:n})=>{e.set({value:F8(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},al=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=ky(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:Iy(e),label:D8(e.get("label")||e.id||"",t),onChange:(i,l)=>sl({record:e,value:i,partial:l})}},B8=(e,t)=>{const n=ol(e),r=Rr(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=S6(Iy(e)),a=s.number,i=s.unit||o[0]||"";return{...al(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)=>{sl({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{sl({value:a?`${a}${l}`:"",record:e})}}},Vy=(e,t)=>{var s;const n=ol(e),r=Rr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...al(e,t),options:o,onChange:a=>sl({value:a,record:e})}},z8=(e,t)=>({...al(e,t),onChange:n=>sl({value:n,record:e})}),U8=(e,t)=>{var s;const n=ol(e),r=Rr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...Vy(e,t),size:"s",options:o}};function W8(e,t){const n=ol(e);switch(ct(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Qt,{...U8(e,t)});case"select":return c.jsx(Le,{...Vy(e,t)});case"selectFont":{const o=z8(e,t);return c.jsx(hu,{...o,labelAs:"div"})}case"number":return c.jsx($e,{...B8(e,t)});case"color":return c.jsx(vo,{...al(e,t)});default:return c.jsx(rt,{...al(e,t)})}}const Hy="gs-cmp-global-style-field",G8=ce(function({record:t}){const n=we(),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(f=>++f);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(I,{className:N(Hy,`${Hy}__${i}`),children:W8(t,l)})}),il="gs-cmp-global-style-manager",jy=({items:e,category:t,className:n})=>{const r=N(t?`${il}__cat-fields--${t.id}`:`${il}__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(G8,{record:o},o.id))})},q8=ce(function(){const t=dL(),{recordsByCategory:n,openCategories:r}=t,s=Ie().tScoped("globalStyleManager");return c.jsx(I,{col:!0,full:!0,nowrap:!0,className:N(il,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(I,{col:!0,nowrap:!0,className:N(`${il}__fields`,Pe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(mo,{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(`${il}__cat-fields`,Ed.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(jy,{category:a,items:i})},a.id):c.jsx(jy,{items:i,className:N(n.length!==1&&[te.bt,z.br])},l)):c.jsx(I,{className:N("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),K8="gs-panel-global-styles",Z8=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(K8,"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(Fi,{children:c.jsx(q8,{})})})})),Y8={maxWidth:`${KS}px`},X8="gs-cmp-layer-item";function Dy({component:e,draggingCmp:t,dragParent:n,...r}){const o=Di(),{Layers:s}=o,a=h.useRef(null),[i,l]=h.useState(!1),[u,d]=h.useState(s.getLayerData(e)),{open:f,selected:p,hovered:g,components:m,visible:v,locked:b,name:w}=u,y=m.map(F=>F.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 F=a.current;if(!F)return;const{select:k}=o.Components.events,H=V=>V===e&&F.scrollIntoView({block:"nearest"});return o.on(k,H),()=>{o.off(k,H)}},[e,a.current]),h.useEffect(()=>{const F=H=>{H===e&&d(s.getLayerData(H))},k=s.events.component;return o.on(k,F),()=>{o.off(k,F)}},[o,s,e]);const T=h.useMemo(()=>m.map(F=>c.jsx(Dy,{component:F,level:x,draggingCmp:t,dragParent:n},F.cid)),[C,t,n]),_=F=>{s.setLayerData(e,{name:F}),l(!1)},O=F=>{F.stopPropagation(),s.setLayerData(e,{open:!f})},P=F=>{F.stopPropagation(),s.setLayerData(e,{visible:!v})},A=F=>{F.stopPropagation(),s.setLayerData(e,{locked:!b})},M=F=>{F.stopPropagation(),s.setLayerData(e,{selected:!0},{event:F})},$=F=>{F.preventDefault(),o.runCommand(re.contextMenuComponent,{source:Nf.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},j=F=>{(!F||!t)&&s.setLayerData(e,{hovered:F})},L=P1(e),D=Z("layer-item",(p||L.isSymbol)&&L.bgSoftX,(!v||S)&&"opacity-50"),W=Z(Te.xyS,te.b,E?L.border:te.bT,p&&L.bgSoft);return c.jsx("div",{className:X8,children:c.jsxs(I,{col:!0,className:D,children:[c.jsx(B,{onClick:M,onContextMenu:$,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),className:Z("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(I,{items:"center",space:"xs",className:W,children:[c.jsx(B,{style:{marginLeft:`${x*10}px`},className:Z("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:O,children:c.jsx(ne,{icon:q.menuDown,size:se.sx,rotate:f?0:-90})}),c.jsx(B,{children:lv(e)}),c.jsx(B,{className:Z("truncate"),onDoubleClick:()=>l(!0),style:Y8,grow:!0,children:i?c.jsx(th,{value:w,onChange:_}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(ne,{icon:b?q.lock:q.lockOpenVariant,size:se.s3x})}),c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:P,children:c.jsx(ne,{icon:v?q.eyeOutline:q.eyeOffOutline,size:se.sx})})]})]})}),!!(f&&m.length)&&c.jsx(B,{className:Z("max-w-full",!f&&"hidden"),children:T})]})})}const J8={touchAction:"none"},Fy=5,Q8=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}},By=ce(function({root:t,header:n}){const{editor:r}=we(),[o,s]=h.useState(!1),[a,i]=h.useState({}),[l,u]=h.useState(),[d,f]=h.useState(),[p,g]=h.useState(),[m,v]=h.useState(),b=h.useRef(null);if(h.useEffect(()=>{const O=window.document,P=A=>{A.key==="Escape"&&(i({...a,result:!1}),C())};return O.addEventListener("keydown",P),()=>{O.removeEventListener("keydown",P)}},[]),!r)return null;const{Components:w}=r,y=O=>{O.button===0&&s(!0)},S=O=>{if(!o)return;const{cmp:P,el:A}=Q8(O);if(!A||!P)return;const M=A.getBoundingClientRect(),$=A.offsetHeight,j=A.offsetTop,L=O.clientY,D=L<M.y+$/2,W=d||P,F=P.parent(),k=P.index()+(D?0:1);!d&&f(P),u(P);const H=w.canMove(F,W,k),V=w.canMove(P,W),U={...H,canMoveInside:V,index:k};let J=!1;V.result&&L>M.y+Fy&&L<M.y+$-Fy&&(J=!0,U.target=P,delete U.index),g(J?P:void 0),i(U),v({pointerInside:J,y:j+(D?0:$),h:$})},C=()=>{var O;a!=null&&a.result&&((O=a.source)==null||O.move(a.target,{at:a.index})),i({}),s(!1),f(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),T=E?{top:m.y,left:0,marginLeft:x*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(I,{col:!0,full:!0,nowrap:!0,className:Z("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(B,{children:c.jsxs(I,{space:"s",items:"center",className:Z([Te.xy,te.bb,z.br]),children:[c.jsx(B,{children:c.jsx(ne,{icon:q.layers,size:se.s})}),c.jsx(B,{grow:!0,children:_})]})}),c.jsxs(B,{className:Z("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:J8,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(Dy,{component:t,level:-1,draggingCmp:d,dragParent:p}),E&&c.jsx("div",{ref:b,className:Z("absolute w-full gs-utl-h-0.5",z.cmp),style:T})]})]})}),zy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-after"),n),ref:o,...r,children:t})}),Uy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-before"),n),ref:o,...r,children:t})}),R8="gs-panel-layers",Wy=h.memo(ce(function({className:t,...n}){const r=we().sdkProps.children;return c.jsx(Cr,{className:N(R8,"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(Pb,{children:o=>c.jsxs(c.Fragment,{children:[Xn(r,Uy),c.jsx(By,{...o,header:!1}),Xn(r,zy)]})})})})),zs="gs-cmp-file-field";function ll(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:f,hideButton:p,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,z.br);return c.jsxs(I,{className:N(zs,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(br,{...e,as:g}),c.jsxs(I,{className:N(`${zs}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(B,{className:N(`${zs}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(B,{className:N(`${zs}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(Wo,{className:N(`${zs}-name`,"gs-utl-mb-2",Pe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(I,{className:N(`${zs}-buttons`),space:"s",nowrap:!0,children:[!p&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:s,type:"button",block:!0,full:!0,disabled:f,children:r||"Select image"}),!!n&&i&&c.jsx(Ct,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:q.close,size:se.s},type:"button",block:!0})]})]})]}),l&&c.jsx(rt,{className:N(`${zs}-input`),value:b,onChange:m,size:s,placeholder:u})]})}function eI(){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 gu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $a(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rh(e){return"nodeType"in e}function ns(e){var t,n;return e?$a(e)?e:rh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function oh(e){const{Document:t}=ns(e);return e instanceof t}function ka(e){return $a(e)?!1:e instanceof ns(e).HTMLElement}function Gy(e){return e instanceof ns(e).SVGElement}function Ia(e){return e?$a(e)?e.document:rh(e)?oh(e)?e:ka(e)||Gy(e)?e.ownerDocument:document:document:document}const Us=gu?h.useLayoutEffect:h.useEffect;function tI(e){const t=h.useRef(e);return Us(()=>{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 nI(){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 cl(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function sh(e){const t=tI(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 ah={};function ul(e,t){return h.useMemo(()=>{if(t)return t;const n=ah[e]==null?0:ah[e]+1;return ah[e]=n,e+"-"+n},[e,t])}function qy(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 dl=qy(1),Ky=qy(-1);function rI(e){return"clientX"in e&&"clientY"in e}function oI(e){if(!e)return!1;const{KeyboardEvent:t}=ns(e.target);return t&&e instanceof t}function sI(e){if(!e)return!1;const{TouchEvent:t}=ns(e.target);return t&&e instanceof t}function ih(e){if(sI(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 rI(e)?{x:e.clientX,y:e.clientY}:null}const fl=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[fl.Translate.toString(e),fl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),aI={display:"none"};function iI(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:aI},n)}function lI(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 cI(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const uI={draggable:`
|
|
388
323
|
To pick up a draggable item, press the space bar.
|
|
389
324
|
While dragging, use the arrow keys to move the item.
|
|
390
325
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
391
|
-
`},n8={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 ct;(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"})(ct||(ct={}));function zp(...e){}class Ji 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 tu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:zp,draggableNodes:{},droppableRects:new Map,droppableContainers:new Ji,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zp},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:zp,windowRect:null,willRecomputeLayouts:!1});function r8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new Ji}}}function o8(e,t){switch(t.type){case ct.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ct.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 ct.DragEnd:case ct.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ct.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ji(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case ct.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 Ji(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case ct.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Ji(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const by=h.createContext({type:null,event:null});function s8({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=h.useContext(by),a=h.useRef(s);h.useEffect(()=>{if(s!==a.current){const{type:i,event:l}=s;switch(i){case ct.DragStart:e==null||e(l);break;case ct.DragMove:t==null||t(l);break;case ct.DragOver:n==null||n(l);break;case ct.DragCancel:o==null||o(l);break;case ct.DragEnd:r==null||r(l);break}a.current=s}},[s,e,t,n,r,o])}function a8({announcements:e=n8,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=e8(),s=Yi("DndLiveRegion"),[a,i]=h.useState(!1);return h.useEffect(()=>{i(!0)},[]),s8(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?$n.createPortal(h.createElement(h.Fragment,null,h.createElement(Qk,{id:t,value:n.draggable}),h.createElement(Rk,{id:s,announcement:o})),document.body):null}const uo=Object.freeze({x:0,y:0});function vy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function yy(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const i8=({collisionRect:e,droppableContainers:t})=>{const n=yy(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=vy(yy(a),n);i<r&&(r=i,o=s.id)}}return o};function l8(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function c8(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:uo}function u8(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 wy=u8(1);function d8(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function f8(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 Up(e){const t=[];function n(r){if(!r)return t;if(Dp(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!Ta(r)||hy(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return f8(r,o)&&t.push(r),d8(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function Wp(e){return!eu||!e?null:_a(e)?e:jp(e)?Dp(e)||e===Oa(e).scrollingElement?window:Ta(e)?e:null:null}function Gp(e){return _a(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var Aa;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Aa||(Aa={}));function Sy(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 p8(e){return!eu||!e?!1:e===document.scrollingElement}const h8={x:.2,y:.2};function g8(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=h8){const{clientHeight:l,clientWidth:u}=e,d=p8(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:f,isBottom:p,isLeft:g,isRight:m}=Sy(e),b={x:0,y:0},v={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!f&&n<=d.top+w.height?(b.y=Aa.Backward,v.y=a*Math.abs((d.top+w.height-n)/w.height)):!p&&s>=d.bottom-w.height&&(b.y=Aa.Forward,v.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(b.x=Aa.Forward,v.x=a*Math.abs((d.right-w.width-o)/w.width)):!g&&r<=d.left+w.width&&(b.x=Aa.Backward,v.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:b,speed:v}}function m8(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 Cy(e){return e.reduce((t,n)=>Zi(t,Gp(n)),uo)}function xy(e,t,n=uo){if(!e||!Ta(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:xy(e.offsetParent,t,r)}function nu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=xy(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function ru(e){if(_a(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}=nu(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 qp(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=nu(e),s=Up(e),a=Cy(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 Ey(e){return"top"in e}function Py(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 b8=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=Py(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=Py(a,Ey(a)?a.left:void 0,Ey(a)?a.top:void 0),l=o.reduce((d,f,p)=>d+vy(i[p],f),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function v8(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,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const y8=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=v8(s,e);a>n&&(n=a,r=o.id)}}return r};var Qi;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Qi||(Qi={}));var ou;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ou||(ou={}));function w8({acceleration:e,activator:t=Qi.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=ou.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[f,p]=Kk(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case Qi.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Qi.DraggableRect:return r}return null},[t,r,i]),b=h.useRef(uo),v=h.useRef(null),w=h.useCallback(()=>{const S=v.current;if(!S)return;const C=g.current.x*b.current.x,x=g.current.y*b.current.y;S.scrollBy(C,x)},[]),y=h.useMemo(()=>a===ou.TreeOrder?[...l].reverse():l,[a,l]);h.useEffect(()=>{if(!o||!l.length||!m){p();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}=g8(S,x,m,e,d);if(P.x>0||P.y>0){p(),v.current=S,f(w,s),g.current=P,b.current=E;return}}g.current={x:0,y:0},b.current={x:0,y:0},p()},[e,w,n,p,o,s,JSON.stringify(m),f,l,y,u,JSON.stringify(d)])}function S8(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return Ki(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function C8(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 _y(e){const t=h.useRef(e);return ks(()=>{t.current!==e&&(t.current=e)},[e]),t}var Ri;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ri||(Ri={}));var Kp;(function(e){e.Optimized="optimized"})(Kp||(Kp={}));const Ty=new Map,x8={measure:nu,strategy:Ri.WhileDragging,frequency:Kp.Optimized};function E8(e,{dragging:t,dependencies:n,config:r}){const[o,s]=h.useState(!1),{frequency:a,measure:i,strategy:l}={...x8,...r},u=h.useRef(e),d=h.useCallback(()=>s(!0),[]),f=h.useRef(null),p=m(),g=Ki(b=>{if(p&&!t)return Ty;if(!b||b===Ty||u.current!==e||o){for(let v of e)v&&(v.rect.current=v.node.current?i(v.node.current):null);return P8(e)}return b},[e,t,p,i,o]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{o&&s(!1)},[o]),h.useEffect(function(){p||requestAnimationFrame(d)},[t,p]),h.useEffect(function(){p||typeof a!="number"||f.current!==null||(f.current=setTimeout(()=>{d(),f.current=null},a))},[a,p,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case Ri.Always:return!1;case Ri.BeforeDragging:return t;default:return!t}}}function P8(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 _8(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const a=Wp(s.target);a&&n(i=>i?(i.set(a,Gp(a)),new Map(i)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=Wp(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Gp(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=Wp(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>Zi(s,a),uo):Cy(e):uo,[e,t])}const T8=[];function O8(e){const t=h.useRef(e),n=Ki(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:Up(e):T8,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function A8(e){h.useEffect(()=>{if(!eu)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 N8(e,t){return h.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const Yp=Ay(ru),M8=L8(ru);function Oy(e,t,n){const r=h.useRef(e);return Ki(o=>e?n||!o&&e||e!==r.current?Ta(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function Ay(e){return(t,n)=>Oy(t,e,n)}function L8(e){const t=[];return function(r,o){const s=h.useRef(r);return Ki(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function $8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ta(t)?t:e}function k8(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=nu(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const V8=Ay(k8);function I8({disabled:e,forceRecompute:t}){const[n,r]=Hp(),o=V8(e?null:$8(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function Ny(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function j8(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class el{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 D8(e){const{EventTarget:t}=Go(e);return e instanceof t?e:Oa(e)}function Zp(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 Xn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Xn||(Xn={}));function My(e){e.preventDefault()}function H8(e){e.stopPropagation()}var ze;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(ze||(ze={}));const Ly={start:[ze.Space,ze.Enter],cancel:[ze.Esc],end:[ze.Space,ze.Enter]},F8=(e,{currentCoordinates:t})=>{switch(e.code){case ze.Right:return{...t,x:t.x+25};case ze.Left:return{...t,x:t.x-25};case ze.Down:return{...t,y:t.y+25};case ze.Up:return{...t,y:t.y-25}}};class Xp{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=uo;const{event:{target:n}}=t;this.props=t,this.listeners=new el(Oa(n)),this.windowListeners=new el(Go(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xn.Resize,this.handleCancel),this.windowListeners.add(Xn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Xn.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=ru(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(Zk(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=Ly,coordinateGetter:i=F8,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 f={x:0,y:0},{scrollableAncestors:p}=o.current;for(const g of p){const m=t.code,b=my(d,n),{isTop:v,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=Sy(g),E=m8(g),P={x:Math.min(m===ze.Right?E.right-E.width/2:E.right,Math.max(m===ze.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(m===ze.Down?E.bottom-E.height/2:E.bottom,Math.max(m===ze.Down?E.top:E.top+E.height/2,d.y))},T=m===ze.Right&&!w||m===ze.Left&&!y,O=m===ze.Down&&!S||m===ze.Up&&!v;if(T&&P.x!==d.x){if(m===ze.Right&&g.scrollLeft+b.x<=C.x||m===ze.Left&&g.scrollLeft+b.x>=x.x){g.scrollBy({left:b.x,behavior:l});return}f.x=m===ze.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-f.x,behavior:l});break}else if(O&&P.y!==d.y){if(m===ze.Down&&g.scrollTop+b.y<=C.y||m===ze.Up&&g.scrollTop+b.y>=x.y){g.scrollBy({top:b.y,behavior:l});return}f.y=m===ze.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,Zi(d,f))}}}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()}}Xp.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=Ly,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function $y(e){return!!(e&&"distance"in e)}function ky(e){return!!(e&&"delay"in e)}class Jp{constructor(t,n,r=D8(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=Oa(s),this.documentListeners=new el(this.document),this.listeners=new el(r),this.windowListeners=new el(Go(s)),this.initialCoordinates=Bp(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(Xn.Resize,this.handleCancel),this.windowListeners.add(Xn.DragStart,My),this.windowListeners.add(Xn.VisibilityChange,this.handleCancel),this.windowListeners.add(Xn.ContextMenu,My),this.documentListeners.add(Xn.Keydown,this.handleKeydown),n){if($y(n))return;if(ky(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(Xn.Click,H8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xn.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=Bp(t),l=my(r,i);if(!n&&a){if(ky(a))return Zp(l,a.tolerance)?this.handleCancel():void 0;if($y(a))return a.tolerance!=null&&Zp(l,a.tolerance)?this.handleCancel():Zp(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===ze.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const B8={move:{name:"pointermove"},end:{name:"pointerup"}};class Qp extends Jp{constructor(t){const{event:n}=t,r=Oa(n.target);super(t,B8,r)}}Qp.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const z8={move:{name:"mousemove"},end:{name:"mouseup"}};var Rp;(function(e){e[e.RightClick=2]="RightClick"})(Rp||(Rp={}));class U8 extends Jp{constructor(t){super(t,z8,Oa(t.event.target))}}U8.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Rp.RightClick?!1:(t==null||t({event:e}),!0)}];const eh={move:{name:"touchmove"},end:{name:"touchend"}};class W8 extends Jp{constructor(t){super(t,eh)}static setup(){return window.addEventListener(eh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(eh.move.name,t)};function t(){}}}W8.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function G8(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const q8=[{sensor:Qp,options:{}},{sensor:Xp,options:{}}],K8={current:{}},Vy=h.createContext({...uo,scaleX:1,scaleY:1}),Y8=h.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=q8,collisionDetection:a=y8,measuring:i,modifiers:l,screenReaderInstructions:u=t8,...d}){var f,p,g,m,b;const v=h.useReducer(o8,void 0,r8),[w,y]=v,[S,C]=h.useState(()=>({type:null,event:null})),[x,E]=h.useState(!1),{draggable:{active:P,nodes:T,translate:O},droppable:{containers:_}}=w,N=P?T[P]:null,L=h.useRef({initial:null,translated:null}),k=h.useMemo(()=>{var Ye;return P!=null?{id:P,data:(Ye=N==null?void 0:N.data)!=null?Ye:K8,rect:L}:null},[P,N]),B=h.useRef(null),[$,z]=h.useState(null),[K,F]=h.useState(null),V=h.useRef(d),D=Yi("DndDescribedBy",t),A=h.useMemo(()=>_.getEnabled(),[_]),{layoutRectMap:j,recomputeLayouts:q,willRecomputeLayouts:G}=E8(A,{dragging:x,dependencies:[O.x,O.y],config:i==null?void 0:i.droppable}),Y=S8(T,P),Q=K?Bp(K):null,Z=Oy(Y,(f=i==null||(p=i.draggable)==null?void 0:p.measure)!=null?f:qp),W=Yp(Y),R=h.useRef(null),re=R.current,fe=h.useRef({active:null,activeNode:Y,collisionRect:null,droppableRects:j,draggableNodes:T,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),xe=_.getNodeFor((g=fe.current.over)==null?void 0:g.id),ne=Yp(Y?Y.ownerDocument.defaultView:null),Oe=Yp(Y?Y.parentElement:null),Ie=O8(P?xe??Y:null),ut=M8(Ie),ot=I8({disabled:P==null,forceRecompute:G}),we=(m=ot.rect)!=null?m:Z,et=we===Z?c8(Z,re):uo,tt=G8(l,{transform:{x:O.x-et.x,y:O.y-et.y,scaleX:1,scaleY:1},activatorEvent:K,active:k,activeNodeRect:W,containerNodeRect:Oe,draggingNodeRect:we,over:fe.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Ie,scrollableAncestorRects:ut,windowRect:ne}),gt=Q?Zi(Q,O):null,Ne=_8(Ie),dt=Zi(tt,Ne),st=we?wy(we,tt):null,Fe=st?wy(st,Ne):null,Yt=k&&Fe?a({active:k,collisionRect:Fe,droppableContainers:A}):null,[ge,Ve]=h.useState(null),je=l8(tt,(b=ge==null?void 0:ge.rect)!=null?b:null,Z),ke=h.useCallback((Ye,{sensor:mt,options:Zt})=>{if(!B.current)return;const Qn=T[B.current];if(!Qn)return;const Wt=new mt({active:B.current,activeNode:Qn,event:Ye.nativeEvent,options:Zt,context:fe,onStart(vn){const ho=B.current;if(!ho)return;const Jo=T[ho];if(!Jo)return;const{onDragStart:Qo}=V.current,Ro={active:{id:ho,data:Jo.data,rect:L}};$n.unstable_batchedUpdates(()=>{y({type:ct.DragStart,initialCoordinates:vn,active:ho}),C({type:ct.DragStart,event:Ro})}),Qo==null||Qo(Ro)},onMove(vn){y({type:ct.DragMove,coordinates:vn})},onEnd:Ds(ct.DragEnd),onCancel:Ds(ct.DragCancel)});$n.unstable_batchedUpdates(()=>{z(Wt),F(Ye.nativeEvent)});function Ds(vn){return async function(){const{active:Jo,over:Qo,scrollAdjustedTranslate:Ro}=fe.current;let es=null;if(Jo&&Ro){const{cancelDrop:an}=V.current;es={active:Jo,delta:Ro,over:Qo},vn===ct.DragEnd&&typeof an=="function"&&await Promise.resolve(an(es))&&(vn=ct.DragCancel)}if(B.current=null,$n.unstable_batchedUpdates(()=>{y({type:vn}),Ve(null),E(!1),z(null),F(null),es&&C({type:vn,event:es})}),es){const{onDragCancel:an,onDragEnd:br}=V.current,Eu=vn===ct.DragEnd?br:an;Eu==null||Eu(es)}}}},[y,T]),Et=h.useCallback((Ye,mt)=>(Zt,Qn)=>{const Wt=Zt.nativeEvent;B.current!==null||Wt.dndKit||Wt.defaultPrevented||Ye(Zt,mt.options)===!0&&(Wt.dndKit={capturedBy:mt.sensor},B.current=Qn,ke(Zt,mt))},[ke]),Ht=C8(s,Et);A8(s),ks(()=>{V.current=d},Object.values(d)),h.useEffect(()=>{P!=null&&E(!0)},[P]),h.useEffect(()=>{k||(R.current=null),k&&Z&&!R.current&&(R.current=Z)},[Z,k]),h.useEffect(()=>{const{onDragMove:Ye}=V.current,{active:mt,over:Zt}=fe.current;if(!mt)return;const Qn={active:mt,delta:{x:dt.x,y:dt.y},over:Zt};C({type:ct.DragMove,event:Qn}),Ye==null||Ye(Qn)},[dt.x,dt.y]),h.useEffect(()=>{const{active:Ye,droppableContainers:mt,scrollAdjustedTranslate:Zt}=fe.current;if(!Ye||!B.current||!Zt)return;const{onDragOver:Qn}=V.current,Wt=mt.get(Yt),Ds=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,vn={active:Ye,delta:{x:Zt.x,y:Zt.y},over:Ds};$n.unstable_batchedUpdates(()=>{Ve(Ds),C({type:ct.DragOver,event:vn}),Qn==null||Qn(vn)})},[Yt]),ks(()=>{fe.current={active:k,activeNode:Y,collisionRect:Fe,droppableRects:j,draggableNodes:T,draggingNodeRect:we,droppableContainers:_,over:ge,scrollableAncestors:Ie,scrollAdjustedTranslate:dt,translatedRect:st},L.current={initial:we,translated:st}},[k,Y,Fe,T,we,j,_,ge,Ie,dt,st]),w8({...js(),draggingRect:st,pointerCoordinates:gt,scrollableAncestors:Ie,scrollableAncestorRects:ut});const po=h.useMemo(()=>({active:k,activeNode:Y,activeNodeRect:Z,activeNodeClientRect:W,activatorEvent:K,activators:Ht,ariaDescribedById:{draggable:D},containerNodeRect:Oe,dispatch:y,dragOverlay:ot,draggableNodes:T,droppableContainers:_,droppableRects:j,over:ge,recomputeLayouts:q,scrollableAncestors:Ie,scrollableAncestorRects:ut,willRecomputeLayouts:G,windowRect:ne}),[k,Y,W,Z,K,Ht,Oe,ot,y,T,D,_,j,ge,q,Ie,ut,G,ne]);return h.createElement(by.Provider,{value:S},h.createElement(tu.Provider,{value:po},h.createElement(Vy.Provider,{value:je},o)),h.createElement(a8,{announcements:r,hiddenTextDescribedById:D,screenReaderInstructions:u}));function js(){const Ye=($==null?void 0:$.autoScrollEnabled)===!1,mt=typeof n=="object"?n.enabled===!1:n===!1,Zt=!Ye&&!mt;return typeof n=="object"?{...n,enabled:Zt}:{enabled:Zt}}}),Z8=h.createContext(null),Iy="button",X8="Droppable";function J8({id:e,data:t,disabled:n=!1,attributes:r}){const o=Yi(X8),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:f,over:p}=h.useContext(tu),{role:g=Iy,roleDescription:m="draggable",tabIndex:b=0}=r??{},v=(s==null?void 0:s.id)===e,w=h.useContext(v?Vy:Z8),[y,S]=Hp(),C=N8(f,e),x=_y(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:b,"aria-pressed":v&&g===Iy?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,b,v,m,l.draggable]);return{active:s,activeNodeRect:a,activatorEvent:i,attributes:E,droppableRects:d,isDragging:v,listeners:n?void 0:C,node:y,over:p,setNodeRef:S,transform:w}}function Q8(){return h.useContext(tu)}const R8="Droppable";function e9({data:e,disabled:t=!1,id:n}){const r=Yi(R8),{active:o,dispatch:s,over:a}=h.useContext(tu),i=h.useRef(null),[l,u]=Hp(),d=_y(e);return ks(()=>(s({type:ct.RegisterDroppable,element:{id:n,key:r,disabled:t,node:l,rect:i,data:d}}),()=>s({type:ct.UnregisterDroppable,key:r,id:n})),[n]),h.useEffect(()=>{s({type:ct.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 t9(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 n9=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:t9(t,e,r)},r9=({transform:e})=>({...e,x:0});function jy(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function o9(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function su(e){return e!==null&&e>=0}const Dy=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=jy(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}},au={scaleX:1,scaleY:1},s9=({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,...au}:null}const i=a9(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,...au}:n<e&&n>=o?{x:0,y:a.height+i,...au}:{x:0,y:0,...au}};function a9(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 Hy="Sortable",Fy=h.createContext({activeIndex:-1,containerId:Hy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dy,wasDragging:{current:!1}});function i9({children:e,id:t,items:n,strategy:r=Dy}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=Q8(),d=Yi(Hy,t),f=s.rect!==null,p=h.useMemo(()=>n.map(P=>typeof P=="string"?P:P.id),[n]),g=o!=null,m=h.useRef(!1),b=o?p.indexOf(o.id):-1,v=b!==-1,w=i?p.indexOf(i.id):-1,y=h.useRef(p),S=o9(p,a),C=!l9(p,y.current),x=w!==-1&&b===-1||C;ks(()=>{C&&v&&!u&&l()},[C,v,l,u]),h.useEffect(()=>{y.current=p},[p]),h.useEffect(()=>{const P=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(P)},[g]);const E=h.useMemo(()=>({activeIndex:b,containerId:d,disableTransforms:x,items:p,overIndex:w,useDragOverlay:f,sortedRects:S,strategy:r,wasDragging:m}),[b,d,x,p,w,S,f,r,m]);return h.createElement(Fy.Provider,{value:E},e)}function l9(e,t){return e.join()===t.join()}const c9=({id:e,items:t,activeIndex:n,overIndex:r})=>jy(t,n,r).indexOf(e),u9=({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,d9={duration:200,easing:"ease"},By="transform",f9=Xi.Transition.toString({property:By,duration:0,easing:"linear"}),p9={roleDescription:"sortable"};function h9({disabled:e,index:t,node:n,rect:r}){const[o,s]=h.useState(null),a=h.useRef(t);return ks(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=ru(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 g9({animateLayoutChanges:e=u9,attributes:t,disabled:n,data:r,getNewIndex:o=c9,id:s,strategy:a,transition:i=d9}){const{items:l,containerId:u,activeIndex:d,disableTransforms:f,sortedRects:p,overIndex:g,useDragOverlay:m,strategy:b,wasDragging:v}=h.useContext(Fy),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}=e9({id:s,data:y}),{active:E,activeNodeRect:P,activatorEvent:T,attributes:O,setNodeRef:_,listeners:N,isDragging:L,over:k,transform:B}=J8({id:s,data:y,attributes:{...p9,...t},disabled:n}),$=Gk(x,_),z=!!E,K=z&&v.current&&!f&&su(d)&&su(g),F=!m&&L,V=F&&K?B:null,A=K?V??(a??b)({layoutRects:p,activeNodeRect:P,activeIndex:d,overIndex:g,index:w}):null,j=su(d)&&su(g)?o({id:s,items:l,activeIndex:d,overIndex:g}):w,q=h.useRef(l),G=l!==q.current,Y=h.useRef(j),Q=h.useRef(u),Z=e({active:E,containerId:u,isDragging:L,isSorting:z,id:s,index:w,items:l,newIndex:Y.current,previousItems:q.current,previousContainerId:Q.current,transition:i,wasDragging:v.current}),W=h9({disabled:!Z,index:w,node:C,rect:S});return h.useEffect(()=>{z&&Y.current!==j&&(Y.current=j),u!==Q.current&&(Q.current=u),l!==q.current&&(q.current=l)},[z,j,u,l]),{active:E,attributes:O,activatorEvent:T,rect:S,index:w,isSorting:z,isDragging:L,listeners:N,node:C,overIndex:g,over:k,setNodeRef:$,setDroppableNodeRef:x,setDraggableNodeRef:_,transform:W??A,transition:R()};function R(){if(W||G&&Y.current===w)return f9;if(!(F||!i)&&(z||Z))return Xi.Transition.toString({...i,property:By})}}const m9=[ze.Down,ze.Right,ze.Up,ze.Left],b9=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(m9.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=qp(u),f={...l,rect:{current:d}};switch(e.code){case ze.Down:r.top+r.height<=d.top&&a.push(f);break;case ze.Up:r.top>=d.top+d.height&&a.push(f);break;case ze.Left:r.left>=d.left+d.width&&a.push(f);break;case ze.Right:r.left+r.width<=d.left&&a.push(f);break}});const i=b8({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=Up(l).some((m,b)=>o[b]!==m),f=qp(l),p=d?{x:0,y:0}:{x:r.width-f.width,y:r.height-f.height};return{x:f.left-p.x,y:f.top-p.y}}}}};function v9(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:f,listeners:p,setNodeRef:g,transform:m,transition:b}=g9({id:t,disabled:u}),v={transform:Xi.Transform.toString(m),transition:b},w=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:g,style:v,...f}:{},children:c.jsxs(I,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[l&&c.jsx(H,{className:ee(!u&&Pe.hover,!u&&"cursor-grab"),...p,children:c.jsx(se,{icon:X.dotsVertical,size:le.sx})}),c.jsx(H,{grow:!0,className:ee("overflow-hidden"),children:c.jsxs(I,{children:[c.jsx(H,{grow:!0,className:ee("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(H,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",oe.b,oe.rnd),style:i(n)})})]})}),s&&d?c.jsx(Hc,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(H,{className:ee(!u&&Pe.click),children:c.jsx(se,{icon:X.close,size:le.sx})})}):c.jsx(H,{className:ee(!u&&Pe.click),onClick:y=>{ts(y),!u&&(s==null||s(n))},children:c.jsx(se,{icon:X.close,size:le.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Fr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=_=>_.id||_.name||_.title||_.label||"",label:f,labelAs:p,children:g,title:m="Select",titleAdd:b="Add",emptyState:v,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=j8(Ny(Qp),Ny(Xp,{coordinateGetter:b9}));function E(_){const{active:N,over:L}=_;if(N.id!==(L==null?void 0:L.id)){const k=n.find($=>d($)===N.id),B=n.findIndex($=>d($)===(L==null?void 0:L.id));k&&(l==null||l(k,B))}}const P=ee(oe.rnd,U.br,n.length&&oe.b,n.length&&"gjs-mt-1");let T=c.jsxs("div",{className:P,children:[n.length===0&&v&&c.jsx(I,{className:M("gs-utl-p-2 gs-utl-text-center",U.txtLowEmphasis),items:"center",justify:"center",children:v}),n.map((_,N)=>{const L=d(_),k=_===r,B=ee("gjs-px-2 gjs-py-2 text-xs",U.br,N&&oe.bt,!!s&&!k&&!w&&U.hBgH2,k&&U.bgH,w&&"opacity-75");return c.jsx(v9,{id:L,item:_,className:B,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},L||N)})]});l&&(T=c.jsx(Y8,{sensors:x,collisionDetection:i8,onDragEnd:E,modifiers:[r9,n9],children:c.jsx(i9,{items:n.map(d),strategy:s9,children:T})})),s&&!y&&(T=c.jsx(hr,{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:T,children:g}));const O=a?[{type:"button",icon:X.plus,tooltip:b,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:ee(t,"w-full"),children:[!!(f||a)&&c.jsx(fr,{...e,as:p,afterLabelButtons:O}),T]})}const y9=de(function(){const t=$e(),{editor:n}=ye(),r=vi(),o=yi(),s=o.sortedFonts;return n?c.jsx(Fr,{items:s,selected:null,renderItem:a=>{const i=Pf(a);return c.jsxs(I,{col:!0,children:[c.jsx(H,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(H,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>Ip(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),zy=h.forwardRef(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ue(U.bg,U.br,o&&`${oe.b} ${oe.rnd}`,t==="m"&&Ee.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(H,{grow:!0,className:r,children:s})})}),Uy=h.forwardRef(({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})});Uy.displayName="TextAreaWithAutoResize";const w9="gs-field-textarea";function Wy(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,required:u,onChange:d,onKeyDown:f,afterInput:p,minHeight:g,maxHeight:m,autoResize:b,classNameField:v,classNameFieldContent:w,classNameInput:y}=e,S=Oi(e);return c.jsxs("div",{className:ee(w9,t),children:[!!r&&c.jsx(Io,{size:o,children:r}),!!s&&c.jsx(Io,{size:o,as:"span",className:ee(U.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(zy,{size:o,className:v,classNameContent:w,children:[c.jsx(Uy,{className:ee(S,y),autoResize:b,value:n,placeholder:a,readOnly:i,disabled:l,required:u,onChange:C=>d==null?void 0:d(C.target.value),onKeyDown:f,style:{minHeight:g,maxHeight:m}}),p]})]})}const iu="gs-page-settings",S9=`${iu}-header`,C9=`${iu}-content`,x9=`${iu}-footer`,Gy="",E9=de(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=Gf.m}){const i=ye(),{isDarkTheme:l}=Lr(),u=yi(),d=$e(),[f,p]=h.useState(s),[g,m]=h.useState(()=>ab(f,i)),[b,v]=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=k=>m(B=>({...B,...k})),E=k=>{k.preventDefault();const{name:B,...$}=g;$.customCodeHead=uS($.customCodeHead),$.customCodeBody=cS($.customCodeBody),f?(iN(f,$),f.setName(B)):i.setProjectDataCustom({globalPageSettings:$}),v(d.t("updated")),setTimeout(()=>v(d.t("update")),2e3),tb(S),S.trigger(yn.pageSettingsUpdate,{page:f,data:{name:B,...$}})},P={tooltip:d.t("clear")},T=(f==null?void 0:f.getId())??Gy,O=k=>{const B=S.Pages.get(k);p(B),m(ab(B,i))},_=Tf(f),N=!!f&&cc(f),L=[{id:Gy,label:w("global")},...S.Pages.getAll().map(k=>({icon:Rm(k),id:k.getId(),label:k.getName()}))];return c.jsx("form",{onSubmit:E,className:M(iu,"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(H,{className:M(S9,n,U.br,oe.bb),children:c.jsx(Te,{value:T,onChange:O,options:L,handlerSelected:k=>c.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),k.icon&&rt(k.icon)&&c.jsx(se,{icon:k.icon,size:le.s2x}),c.jsx("span",{children:k.label})]})})}),c.jsxs(I,{col:!0,className:M(C9,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!T&&c.jsxs(c.Fragment,{children:[c.jsx(Re,{size:a,value:g.name,onChange:k=>x({name:k}),label:y("name.label"),description:y("name.description"),required:!0}),!_&&c.jsx(Re,{size:a,value:g.slug,onChange:k=>x({slug:N?CS(k,["id"]):al(k)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(Re,{size:a,value:g.title,onChange:k=>x({title:k}),label:y("title.label"),description:y("title.description")}),c.jsx(Wy,{size:a,value:g.description,onChange:k=>x({description:k}),label:y("description.label"),description:y("description.description")}),c.jsx(qi,{size:a,clear:P,value:g.favicon,onChange:k=>x({favicon:k}),onOpen:()=>{S.Assets.open({select(k){x({favicon:k.getSrc()}),S.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(Re,{size:a,value:g.keywords,onChange:k=>x({keywords:k}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(Re,{size:a,value:g.socialTitle,onChange:k=>x({socialTitle:k}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(qi,{size:a,clear:P,value:g.socialImage,onChange:k=>x({socialImage:k}),onOpen:()=>{S.Assets.open({select(k){x({socialImage:k.getSrc()}),S.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(Wy,{size:a,value:g.socialDescription,onChange:k=>x({socialDescription:k}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(so,{language:"html",defaultValue:g.customCodeHead,onChange:k=>x({customCodeHead:k}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${T}`),c.jsx(so,{language:"html",defaultValue:g.customCodeBody,onChange:k=>x({customCodeBody:k}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${T}`),u.sdkShowProjectFonts&&!T&&c.jsx(y9,{})]}),c.jsx(I,{className:M(x9,"gs-utl-mt-auto",o,U.br,oe.bt),children:c.jsx(qe,{type:"submit",variant:"pr",size:"m2",full:!0,children:b})})]})})}),P9="gs-panel-page-settings",_9=h.memo(de(function({className:t,page:n,...r}){return c.jsx(gr,{className:M(P9,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:c.jsx(Ni,{children:c.jsx(E9,{className:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:Gf.s,classNameHeader:Ee.s,classNameContent:Ee.s,classNameFooter:Ee.s})})})})),lu="gs-page-item",qy=de(function({page:t,rename:n,setRename:r,commandItems:o}){const s=ye(),a=$e(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,f=u==null?void 0:u.showHomeIcon,p=u==null?void 0:u.layoutBefore,g=E=>a.t(`pageManager.${E}`),m=E=>l.select(E),b=E=>l.getSelected()===E,v=E=>E===n,w=b(t),y=E=>E.getName()||E.getId(),S=E=>{n==null||n.set({name:E}),r(void 0)},C=ue("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),x=()=>i.runCommand(ae.setPageSettings,{page:t,isOpen:!0});return c.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ue([lu,"group cursor-default",Ee.xy,w?U.bgH:U.hBgH2]),children:[f&&Tf(t)&&c.jsx(H,{className:`${lu}__icon-home`,title:g("homePage"),children:c.jsx(se,{icon:X.home,size:le.s3x})}),p&&At(p({page:t,editor:i,isSelected:w})),c.jsx(H,{className:ue(`${lu}__name truncate`),grow:!0,children:v(t)?c.jsx(Vp,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(I,{className:`${lu}__actions`,gap:"xs",onClick:ts,items:"center",children:[!n&&d!==!1&&c.jsx(bt,{className:C,size:"xs",border:!1,title:g("settings.label"),onClick:x,block:!0,children:c.jsx(se,{icon:X.cog,size:le.s3x})}),w&&!!o.length&&c.jsx(hr,{placement:"right-start",handler:c.jsx(se,{icon:X.dotsVertical,size:le.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>o.map(P=>c.jsx(wa,{icon:P.icon,label:Ze(P.label)?P.label({editor:i}):P.label,action:()=>{var T;E(),(T=P.cmd)==null||T.call(P,{page:t,editor:i})}},P.id))})]})]},t.getId())});function T9({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var Ky=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Ky||{});const th="gs-cmp-sortable",Yy=3;function O9({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=h.useState(null),[a,i]=h.useState(-1),[l,u]=h.useState(),[d,f]=h.useState(!1),p=h.useRef(null),{showIndicator:g,indicatorStyle:m}=T9({dragging:!!o&&d,dragRect:l}),b=h.useMemo(()=>[],[e]);h.useEffect(()=>{const P=window.document,T=O=>O.key==="Escape"&&y(O);return P.addEventListener("keydown",T),()=>P.removeEventListener("keydown",T)},[]);const v=P=>T=>{T.button===0&&(p.current={x:T.clientX,y:T.clientY},s(P),f(!1),T.target.setPointerCapture(T.pointerId))},w=P=>{const T=p.current;if(!o||!T)return;if(!d){const k=Math.abs(P.clientX-T.x),B=Math.abs(P.clientY-T.y);(t==="vertical"?B>Yy:k>Yy)&&f(!0);return}const O=P.clientY;let _=-1;b.forEach((k,B)=>{const $=k.getBoundingClientRect();O>$.top+$.height/2&&(_=B)});const N=e.findIndex(k=>k.id===o.id);_<N&&(_+=1),_=Math.min(_,e.length-1),i(_);const L=b[_];if(L){const{height:k,top:B}=L.getBoundingClientRect(),$=O<B+k/2;u({y:L.offsetTop+($?0:k),h:k})}},y=P=>{s(null),f(!1),p.current=null,u(void 0);const T=P.target,{pointerId:O}=P;O&&(T==null||T.releasePointerCapture(O))},S=P=>{!o||!p.current||(l&&a!==-1&&(n==null||n(o,a)),y(P))},C=M(th,"gs-utl-relative"),x=M(`${th}__indicator`,U.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=P=>M(`${th}__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(I,{col:t==="vertical",className:C,children:e.map((P,T)=>c.jsx(H,{ref:O=>{O&&(b[T]=O)},className:E(P),onPointerDown:v(P),onPointerMove:w,onPointerUp:S,children:r(P)},P.id))}),g&&c.jsx("div",{className:x,style:m})]})}const A9=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(qy,{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(qy,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(O9,{items:i,direction:Ky.vertical,onDrop:s,renderItem:a})},N9=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:Ze(r)?r({items:e,editor:t}):r||e},nh="gs-panel-page-manager",Zy=de(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=ye(),u=ma(),d=$e(),{sdkPagesConfig:f}=l,p=l.editor,[g,m]=h.useState(),b=L=>d.t(`pageManager.${L}`),v=f==null?void 0:f.add,w=f==null?void 0:f.duplicate,y=f==null?void 0:f.remove,S=L=>{ts(L);const k=$=>{const z=t.length+1;return r({name:`${b("page")} ${z}`,component:`<div>${b("newPage")} ${z}</div>`,...$},{select:!0})};if(v)return v({event:L,editor:p,rename:m,addPage:k});const B=k();B&&m(B)},C=({page:L})=>{if(y)return y({editor:p,page:L});u.confirm({title:b("deletePage"),content:b("confirmDelete"),confirmButton:{variant:"danger",children:b("deletePage")},onConfirm:()=>{const k=t.indexOf(L),B=t[k+1]||t[0];n(B),o(L)}})},x=({page:L})=>{if(w)return w({editor:p,page:L,rename:m});const k=L.getMainComponent(),B=r({name:`${L.getName()} (${b("copy")})`,component:k.clone()},{select:!0});B&&m(B)},E=[{id:"rename",label:b("rename"),icon:X.pencil,cmd:({page:L})=>m(L)},w!==!1&&{id:"duplicate",label:b("duplicate"),icon:X.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:b("delete"),icon:X.delete,cmd:C}].filter(Boolean),P=N9({items:E,editor:p,sdkPageConfig:f}),T=G0(s,{collapsible:!0,label:b("pages"),icon:X.textBoxMultiple}),O=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,_=c.jsx(A9,{pages:t,commandItems:P,rename:g,setRename:m,editor:p}),N=O?c.jsx(Jc,{className:ee([`${nh}__content`,"text-sm overflow-auto",oe.bt,U.br]),height:i,...O,children:_}):_;return c.jsx(lo,{classNameWrap:nh,className:ee(`${nh}__header`,Ee.xy,s===!1&&"gs-utl-hidden"),disabled:T&&T.collapsible===!1,handler:c.jsxs(I,{space:"s",items:"center",children:[!!T.icon&&c.jsx(H,{children:c.jsx(se,{icon:T.icon,size:le.s})}),c.jsx(H,{grow:!0,children:T.label}),v!==!1&&c.jsx(Dt,{title:b("add"),children:c.jsx(I,{onClick:S,className:ee("cursor-pointer"),children:c.jsx(se,{icon:X.plus,size:le.s})})})]}),open:T?T.collapsed!==!0:!0,children:N})}),Xy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-page-manager-after"),n),ref:o,...r,children:t})}),Jy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:M(ue("gs-page-manager-before"),n),ref:o,...r,children:t})}),M9="gs-panel-pages",Qy=h.memo(de(function({className:t,header:n,height:r,resizable:o,...s}){const a=ye().sdkProps.children;return c.jsx(hn,{className:M(M9,t),...s,children:c.jsx(yv,{children:i=>c.jsxs(c.Fragment,{children:[qn(a,Jy),c.jsx(Zy,{header:n,height:r,resizable:o,...i}),qn(a,Xy)]})})})})),L9="gs-panel-pages-layers",$9=h.memo(de(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=ye(),a=$e(),{className:i,...l}=n||{},u=G0(r==null?void 0:r.header,{icon:X.layers,collapsible:!1,label:a.t("layerManager.layers"),className:M(oe.bb,U.br)});return c.jsxs(gr,{className:M(L9,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(Qy,{className:M(i,oe.bb,U.br),...l}),c.jsx(py,{...r,header:u})]})})),k9="gs-trait-custom",V9=de(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"),f=n.get("render"),p=n.target,g=u.current;if(h.useEffect(()=>{if(p){let v=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(p.on("change",y),!d&&f&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=f({editor:r,component:p,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),v=()=>C(x)):Ze(x)&&(v=()=>x())}return()=>{p.off("change",y),v()}}},[p,g,o]),!p)return null;const m=jo({...t,className:M(k9,i)}),b={trait:n,component:p,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(fr,{...t,as:a}),c.jsx("div",{className:M(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...b}):f?c.jsx("div",{ref:u}):null})]})});function Ry({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:f,onBlur:p,placeholder:g}){const[m,b]=h.useState(null),[v,w]=h.useState(null),{styles:y,attributes:S}=ui(m,v,Jf),[C,x]=h.useState(""),E=Oi(),P=C===""?t:t.filter(B=>B.label.toLowerCase().includes(C.toLowerCase())),T=B=>x(B.target.value),O=B=>B==null?void 0:B.label,_=d&&C.length>0&&!P.some(B=>B.label===C),N=Ze(d)?d(C):d,L={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},k=()=>p==null?void 0:p();return c.jsxs("div",{className:ee("w-full",e),children:[!!o&&c.jsx(Io,{size:i,children:o}),c.jsxs(ra,{value:n,onChange:f,name:r,nullable:!0,children:[c.jsx(zy,{size:i,ref:b,border:s,children:c.jsxs(I,{nowrap:!0,children:[c.jsx(ra.Input,{autoFocus:l,className:E,displayValue:O,onChange:T,onBlur:k,placeholder:g}),!a&&c.jsx(ra.Button,{children:c.jsx(se,{icon:X.chevronDown,size:le.sx})})]})}),c.jsx(ra.Options,{static:u,className:cv,ref:w,style:y.popper,...S.popper,children:c.jsxs(Gn,{className:ee("h-full"),padding:!1,style:L,children:[_&&c.jsx(ra.Option,{value:{id:null,label:C},children:({active:B})=>c.jsx(uv,{option:{id:null,label:N},active:B,selected:n})}),!_&&P.length===0&&c.jsx("div",{className:ee(Ee.xy),children:"No items found"}),P.map(B=>c.jsx(ra.Option,{value:B,children:({active:$})=>c.jsx(uv,{option:B,active:$,selected:n})},B.id))]})})]})]})}const I9=(e,t)=>{const n=`${ic}${t}`,r=e.get(n,{skipResolve:!0});return r?ew(r):e.get(n)||""};function ew(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const j9=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=lc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(f=>{if(d!=null&&d[f]){const{collectionId:p}=d,g=r.t(`dataSources.collections.${p}`)||p,m=r.t(`dataSources.variableTypes.${f}`)||f,b={collectionId:p,path:"id",type:n.dataComponentTypes.variable,variableType:f};return{id:ew(b),label:`${g} > ${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]},tw="#",cu="mailto:",rh="subject=",oh="tel:",nw="hrefType",rw="showIdList",ow=(e,t)=>{const n=t==null?void 0:t.get(nw);return n||(e.startsWith(oh)?"phone":e.startsWith(cu)?"email":e.startsWith(bi)?"pages":e.startsWith(tw)?"elements":"url")},sw=e=>`${e.getName()} - #${e.getId()}`,D9="gs-trait-href",H9=de(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=ye(),{isSelectingTarget:u,editor:d}=l,[,f]=h.useState(0),[p,g]=h.useState(""),[m,b]=h.useState(""),[v,w]=h.useState(""),[y,S]=h.useState([]),C=$e(),x=d==null?void 0:d.Pages.getAll(),E=C.tScoped("traitManager.traits.labels"),P=()=>f(Q=>++Q),T=i.get(rw)??!1,O=ow(r,i),_=O==="pages"?r==null?void 0:r.replace(bi,""):"",N=!!_&&(d==null?void 0:d.Pages.get(_)),L=N?cc(N):!1,k=h.useMemo(()=>!L||!N||!d?[]:j9({page:N,component:i}),[d,N,L,i]),B=Q=>{n.setValue(Q)},$=Q=>{i.set({[rw]:Q}),P()},z=Q=>{g(""),b(""),w(""),B(""),i.set({[nw]:Q}),P()},K=Q=>{B(Q),P()},F=(Q,Z)=>{uN(i,"id",(Z==null?void 0:Z.dataVariable)||Q),P()},V=Q=>{Q&&(B(Q.id),P())},D=Q=>{B(`${oh}${Q}`),w(Q)},A=Q=>{B(`${cu}${Q}${m?`?${rh}${m}`:""}`),g(Q)},j=Q=>{B(`${cu}${p}${Q?`?${rh}${Q}`:""}`),b(Q)},q=()=>{l.setSelectingTarget(!u)},G=Q=>{const Z=Q.replace(tw,""),W=d==null?void 0:d.Components.componentsById[Z];return{id:Q,label:W?sw(W):Q}};h.useEffect(()=>{var Z;const Q=[];if(T){const W=["path","br","b","u","i","strike"],R=(Z=d==null?void 0:d.Pages.getSelected())==null?void 0:Z.getMainComponent();R==null||R.forEachChild(re=>{!re.is("comment")&&!re.is("textnode")&&!W.includes(re.get("tagName"))&&Q.push({id:`#${re.getId()}`,label:sw(re)})})}S(Q)},[d,T]),h.useEffect(()=>{let Q=()=>{};const Z=()=>{Q(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(vu))};return u&&(Q=sS(Z),d==null||d.runCommand(vu,{onSelect:W=>B(`#${W.getId()}`)})),Z},[d,u]),h.useEffect(()=>{if(!r)return;switch(ow(r,i)){case"phone":w(r.replace(oh,""));break;case"email":{const[Z,W=""]=r.replace(cu,"").split("?");g(Z),b(W.replace(rh,""));break}}},[r]);const Y=jo({className:M(D9,a)});return c.jsxs("div",{...Y,children:[c.jsx(fr,{...t,as:s}),c.jsx("div",{className:M(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Fo,{onChange:z,classNamePanel:"gs-utl-p-1",value:O,tabs:[{id:"url",label:c.jsx(se,{icon:X.link,size:le.s}),content:c.jsx(Re,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:B,size:"s",type:"url"})},{id:"pages",label:c.jsx(se,{icon:X.textBoxMultiple,size:le.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Te,{size:"s",options:(x||[]).map(Q=>({id:`${bi}${Q.getId()}`,icon:Rm(Q),label:Q.getName()})),value:r,onChange:K,label:"Page"}),L&&c.jsx(Te,{size:"s",options:k,value:I9(i,"id"),onChange:F,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(se,{icon:X.viewDayOutline,size:le.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Io,{size:"s",children:"Element ID"}),c.jsxs(I,{gap:"xs",nowrap:!0,children:[T?c.jsx(Ry,{options:y,onChange:V,value:G(r),placeholder:C.t("selectList")}):c.jsx(Re,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:B,className:"gs-utl-flex-1"}),c.jsx(bt,{title:C.t("selectTarget"),size:"m2",active:u,onClick:q,className:"gs-utl-h-[30px]",children:c.jsx(se,{icon:X.target,size:le.sx})})]}),c.jsx(Hi,{value:T,onChange:$,label:E("showList")})]})},{id:"email",label:c.jsx(se,{icon:X.email,size:le.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Re,{placeholder:"eg. mail@gmail.com",value:p,onChange:A,size:"s",label:"Email",type:"email"}),c.jsx(Re,{placeholder:"eg. My subject",value:m,onChange:j,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(se,{icon:X.phone,size:le.s}),content:c.jsx(Re,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:v,onChange:D})}]})})]})});function F9({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||[],f=d.findIndex(p=>p.id===(s==null?void 0:s.id));return c.jsx(Fr,{items:d,selected:f>-1?s:null,select:a,disabled:n,label:r,labelAs:o,add:()=>{const p=d.length+1,g=l?l(p):{id:`opt${p}`,label:`New option ${p}`};e.setValue([...d,g])},move:(p,g)=>{const m=e.getValue().filter(b=>b.id!==p.id);m.splice(g,0,p),e.setValue(m)},remove:p=>{const g=e.getValue().filter(m=>m.id!==p.id);e.setValue(g,{removed:p})},renderItem:p=>u?u(p):p.label,children:c.jsx(I,{space:"m",col:!0,children:!!s&&i.map(p=>{const{name:g,getValue:m}=p,b=p.setValue,v=p.label||g,w=d[f];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const P={...w};w[g]=b?b(E,S):E,e.setValue([...d],{item:w,previous:P}),g==="id"&&a(w)};let x=c.jsx(Re,{label:v,value:S,onChange:C});switch(p.type){case"select":x=c.jsx(Te,{label:v,options:p.options,value:S,onChange:C})}return c.jsx(h.Fragment,{children:x},g)})})})}const B9="gs-trait-custom-type",z9=de(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")}),f=d.render().el;return u.appendChild(f),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(f),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:B9,ref:r})}),U9=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(ae.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(ae.layoutToggle,{...a})};function aw(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:X.databaseOutline,size:le.s2x},onClick:()=>U9({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:X.close,size:le.s2x},onClick:r}),u}function W9(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:Gr(t)&&Ze(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=Uo(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 G9=({label:e,buttons:t})=>c.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[c.jsx(H,{grow:!0,children:e}),c.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(bt,{...n},r))})]}),iw=e=>yr((e||"").replace(/-/g," ")),q9=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&iw(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=W9(e,n.traitManagerDataConfig),o=aw(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=q9(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(G9,{label:i.label,buttons:o})}},lw=(e,t,n)=>mr(e,t,n),K9=(e,t,n)=>mr(e,t,n),Y9=(e,t,n)=>{const r=Uo(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}},cw=(e,t,n)=>{const r=e.get("labelToTitle"),o=Uo(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 rt(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}},Z9=(e,t,n)=>{const{options:r,onChange:o}=cw(e,t,n),s={options:r,onChange:o};return{...mr(e,t,n),...s}},X9=(e,t,n)=>{const r=e.get("typeProps")||{},o=Uo(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}},J9=e=>({children:iw(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");rt(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),Q9=(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}},R9=(e,t,n)=>{const r=mr(e,t,n),o=e.get("typeProps")||{},s=Uo(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},e7=(e,t,n)=>({...mr(e,t,n),trait:e}),t7=(e,t,n)=>({...mr(e,t,n),trait:e}),n7=(e,t,n)=>({...mr(e,t,n),trait:e,editor:t});function r7(e,t,n={}){var a;const r=e.get("visible"),o=e.getType(),s={traitManagerDataConfig:n.traitManagerDataConfig};if(Ze(r)&&r({component:e.target,trait:e})===!1)return null;switch(o){case"text":return c.jsx(Re,{...lw(e,t,s)});case"select":return c.jsx(Te,{...cw(e,t,s)});case"number":return c.jsx(Me,{...Y9(e,t,s)});case"color":return c.jsx(co,{...K9(e,t,s)});case"checkbox":return c.jsx(Hi,{...Q9(e,t,s)});case"button":return c.jsx(qe,{...J9(e)});case"radio":return c.jsx(qt,{...Z9(e,t,s)});case"code":return c.jsx(so,{...R9(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(qi,{...X9(e,t,s)});case"stack":return c.jsx(F9,{...e7(e,t,s)});case"href":return c.jsx(H9,{...t7(e,t,s)});case"custom":return c.jsx(V9,{...n7(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(z9,{editor:t,trait:e}):c.jsx(Re,{...lw(e,t,s)})}}const sh="gs-trait-manager",uw=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(H,{className:ee(`${sh}-field gs-utl-mb-2 gs-utl-w-full`),children:r7(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function o7({traits:e,className:t}){var d,f;const n=Ai(),{isDarkTheme:r}=Lr(),s=(d=ye().sdkOptions.dataSources)==null?void 0:d.traitManager,a=n.Traits.getTraitsByCategory(e),i=(f=a.find(p=>!p.category))==null?void 0:f.items,l=a.filter(p=>p.category),u=ee("gs-utl-text-center");return c.jsx(I,{className:ee(sh,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(p=>c.jsx(uw,{trait:p,isDarkTheme:r,traitManagerDataConfig:s},p.id)),l.map(({category:p,items:g},m)=>c.jsx(lo,{open:!!(p!=null&&p.get("open")),onChange:({open:b})=>p==null?void 0:p.set({open:b}),handler:p==null?void 0:p.getLabel(),handlerIcon:p==null?void 0:p.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${sh}-category -gs-utl-mx-2`,className:b=>ee(bd.itemList({index:m+(i?1:0),open:b,length:l.length})),children:g.map(b=>c.jsx(uw,{trait:b,isDarkTheme:r,traitManagerDataConfig:s},b.id))},p==null?void 0:p.id))]}):c.jsx(H,{className:u,children:"No properties available"}):c.jsx(H,{className:u,children:n.t("traitManager.empty")})})}const ah=de(o7),s7="gs-panel-properties",a7=h.memo(de(function({className:t,...n}){return c.jsx(gr,{className:M(s7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(Qf,{children:r=>c.jsx(ah,{...r})})})})),i7=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},l7=de(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=h.useRef(null),i=ye().editor,l=$e(),u=t.getDevice(),d=t.getState(),{isDarkTheme:f}=Lr(),[p,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,b]=h.useState(p),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),g(m))}};return h.useEffect(()=>{if(s.current){const C=s.current;i7({el:C,html:'<div class="prv-rule">Preview</div>',css:`
|
|
326
|
+
`},dI={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 lh(...e){}class pl 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 mu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:lh,draggableNodes:{},droppableRects:new Map,droppableContainers:new pl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lh},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:lh,windowRect:null,willRecomputeLayouts:!1});function fI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new pl}}}function pI(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 pl(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 pl(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 pl(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const Zy=h.createContext({type:null,event:null});function hI({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=h.useContext(Zy),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 gI({announcements:e=dI,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=cI(),s=ul("DndLiveRegion"),[a,i]=h.useState(!1);return h.useEffect(()=>{i(!0)},[]),hI(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?Fn.createPortal(h.createElement(h.Fragment,null,h.createElement(iI,{id:t,value:n.draggable}),h.createElement(lI,{id:s,announcement:o})),document.body):null}const bo=Object.freeze({x:0,y:0});function Yy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xy(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const mI=({collisionRect:e,droppableContainers:t})=>{const n=Xy(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=Yy(Xy(a),n);i<r&&(r=i,o=s.id)}}return o};function vI(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:bo}function yI(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 Jy=yI(1);function wI(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function SI(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 ch(e){const t=[];function n(r){if(!r)return t;if(oh(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!ka(r)||Gy(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return SI(r,o)&&t.push(r),wI(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function uh(e){return!gu||!e?null:$a(e)?e:rh(e)?oh(e)||e===Ia(e).scrollingElement?window:ka(e)?e:null:null}function dh(e){return $a(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var Va;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Va||(Va={}));function Qy(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 CI(e){return!gu||!e?!1:e===document.scrollingElement}const xI={x:.2,y:.2};function EI(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=xI){const{clientHeight:l,clientWidth:u}=e,d=CI(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:f,isBottom:p,isLeft:g,isRight:m}=Qy(e),v={x:0,y:0},b={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!f&&n<=d.top+w.height?(v.y=Va.Backward,b.y=a*Math.abs((d.top+w.height-n)/w.height)):!p&&s>=d.bottom-w.height&&(v.y=Va.Forward,b.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(v.x=Va.Forward,b.x=a*Math.abs((d.right-w.width-o)/w.width)):!g&&r<=d.left+w.width&&(v.x=Va.Backward,b.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:v,speed:b}}function TI(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 Ry(e){return e.reduce((t,n)=>dl(t,dh(n)),bo)}function ew(e,t,n=bo){if(!e||!ka(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:ew(e.offsetParent,t,r)}function vu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=ew(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function bu(e){if($a(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}=vu(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 fh(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=vu(e),s=ch(e),a=Ry(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 tw(e){return"top"in e}function nw(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 PI=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=nw(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=nw(a,tw(a)?a.left:void 0,tw(a)?a.top:void 0),l=o.reduce((d,f,p)=>d+Yy(i[p],f),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function OI(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,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const _I=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=OI(s,e);a>n&&(n=a,r=o.id)}}return r};var hl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(hl||(hl={}));var yu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(yu||(yu={}));function AI({acceleration:e,activator:t=hl.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=yu.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[f,p]=nI(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case hl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case hl.DraggableRect:return r}return null},[t,r,i]),v=h.useRef(bo),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===yu.TreeOrder?[...l].reverse():l,[a,l]);h.useEffect(()=>{if(!o||!l.length||!m){p();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:T}=EI(S,x,m,e,d);if(T.x>0||T.y>0){p(),b.current=S,f(w,s),g.current=T,v.current=E;return}}g.current={x:0,y:0},v.current={x:0,y:0},p()},[e,w,n,p,o,s,JSON.stringify(m),f,l,y,u,JSON.stringify(d)])}function LI(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return cl(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function MI(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 rw(e){const t=h.useRef(e);return Us(()=>{t.current!==e&&(t.current=e)},[e]),t}var gl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(gl||(gl={}));var ph;(function(e){e.Optimized="optimized"})(ph||(ph={}));const ow=new Map,NI={measure:vu,strategy:gl.WhileDragging,frequency:ph.Optimized};function $I(e,{dragging:t,dependencies:n,config:r}){const[o,s]=h.useState(!1),{frequency:a,measure:i,strategy:l}={...NI,...r},u=h.useRef(e),d=h.useCallback(()=>s(!0),[]),f=h.useRef(null),p=m(),g=cl(v=>{if(p&&!t)return ow;if(!v||v===ow||u.current!==e||o){for(let b of e)b&&(b.rect.current=b.node.current?i(b.node.current):null);return kI(e)}return v},[e,t,p,i,o]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{o&&s(!1)},[o]),h.useEffect(function(){p||requestAnimationFrame(d)},[t,p]),h.useEffect(function(){p||typeof a!="number"||f.current!==null||(f.current=setTimeout(()=>{d(),f.current=null},a))},[a,p,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case gl.Always:return!1;case gl.BeforeDragging:return t;default:return!t}}}function kI(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 II(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const a=uh(s.target);a&&n(i=>i?(i.set(a,dh(a)),new Map(i)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=uh(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,dh(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=uh(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>dl(s,a),bo):Ry(e):bo,[e,t])}const VI=[];function HI(e){const t=h.useRef(e),n=cl(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:ch(e):VI,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function jI(e){h.useEffect(()=>{if(!gu)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 DI(e,t){return h.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const hh=aw(bu),FI=BI(bu);function sw(e,t,n){const r=h.useRef(e);return cl(o=>e?n||!o&&e||e!==r.current?ka(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function aw(e){return(t,n)=>sw(t,e,n)}function BI(e){const t=[];return function(r,o){const s=h.useRef(r);return cl(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function zI(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ka(t)?t:e}function UI(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=vu(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const WI=aw(UI);function GI({disabled:e,forceRecompute:t}){const[n,r]=sh(),o=WI(e?null:zI(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function iw(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function qI(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class ml{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 KI(e){const{EventTarget:t}=ns(e);return e instanceof t?e:Ia(e)}function gh(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 tr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(tr||(tr={}));function lw(e){e.preventDefault()}function ZI(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 cw={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter]},YI=(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 mh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=bo;const{event:{target:n}}=t;this.props=t,this.listeners=new ml(Ia(n)),this.windowListeners=new ml(ns(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(tr.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=bu(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(oI(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=cw,coordinateGetter:i=YI,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 f={x:0,y:0},{scrollableAncestors:p}=o.current;for(const g of p){const m=t.code,v=Ky(d,n),{isTop:b,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=Qy(g),E=TI(g),T={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,O=m===qe.Down&&!S||m===qe.Up&&!b;if(_&&T.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}f.x=m===qe.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-f.x,behavior:l});break}else if(O&&T.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}f.y=m===qe.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,dl(d,f))}}}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()}}mh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=cw,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function uw(e){return!!(e&&"distance"in e)}function dw(e){return!!(e&&"delay"in e)}class vh{constructor(t,n,r=KI(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=Ia(s),this.documentListeners=new ml(this.document),this.listeners=new ml(r),this.windowListeners=new ml(ns(s)),this.initialCoordinates=ih(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(tr.Resize,this.handleCancel),this.windowListeners.add(tr.DragStart,lw),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),this.windowListeners.add(tr.ContextMenu,lw),this.documentListeners.add(tr.Keydown,this.handleKeydown),n){if(uw(n))return;if(dw(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(tr.Click,ZI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(tr.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=ih(t),l=Ky(r,i);if(!n&&a){if(dw(a))return gh(l,a.tolerance)?this.handleCancel():void 0;if(uw(a))return a.tolerance!=null&&gh(l,a.tolerance)?this.handleCancel():gh(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 XI={move:{name:"pointermove"},end:{name:"pointerup"}};class bh extends vh{constructor(t){const{event:n}=t,r=Ia(n.target);super(t,XI,r)}}bh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const JI={move:{name:"mousemove"},end:{name:"mouseup"}};var yh;(function(e){e[e.RightClick=2]="RightClick"})(yh||(yh={}));class QI extends vh{constructor(t){super(t,JI,Ia(t.event.target))}}QI.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===yh.RightClick?!1:(t==null||t({event:e}),!0)}];const wh={move:{name:"touchmove"},end:{name:"touchend"}};class RI extends vh{constructor(t){super(t,wh)}static setup(){return window.addEventListener(wh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wh.move.name,t)};function t(){}}}RI.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function e9(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const t9=[{sensor:bh,options:{}},{sensor:mh,options:{}}],n9={current:{}},fw=h.createContext({...bo,scaleX:1,scaleY:1}),r9=h.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=t9,collisionDetection:a=_I,measuring:i,modifiers:l,screenReaderInstructions:u=uI,...d}){var f,p,g,m,v;const b=h.useReducer(pI,void 0,fI),[w,y]=b,[S,C]=h.useState(()=>({type:null,event:null})),[x,E]=h.useState(!1),{draggable:{active:T,nodes:_,translate:O},droppable:{containers:P}}=w,A=T?_[T]:null,M=h.useRef({initial:null,translated:null}),$=h.useMemo(()=>{var Re;return T!=null?{id:T,data:(Re=A==null?void 0:A.data)!=null?Re:n9,rect:M}:null},[T,A]),j=h.useRef(null),[L,D]=h.useState(null),[W,F]=h.useState(null),k=h.useRef(d),H=ul("DndDescribedBy",t),V=h.useMemo(()=>P.getEnabled(),[P]),{layoutRectMap:U,recomputeLayouts:J,willRecomputeLayouts:Y}=$I(V,{dragging:x,dependencies:[O.x,O.y],config:i==null?void 0:i.droppable}),X=LI(_,T),Q=W?ih(W):null,ee=sw(X,(f=i==null||(p=i.draggable)==null?void 0:p.measure)!=null?f:fh),G=hh(X),R=h.useRef(null),le=R.current,ge=h.useRef({active:null,activeNode:X,collisionRect:null,droppableRects:U,draggableNodes:_,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Ee=P.getNodeFor((g=ge.current.over)==null?void 0:g.id),Ce=hh(X?X.ownerDocument.defaultView:null),tt=hh(X?X.parentElement:null),Qe=HI(T?Ee??X:null),Ot=FI(Qe),ut=GI({disabled:T==null,forceRecompute:Y}),Se=(m=ut.rect)!=null?m:ee,ot=Se===ee?bI(ee,le):bo,st=e9(l,{transform:{x:O.x-ot.x,y:O.y-ot.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:G,containerNodeRect:tt,draggingNodeRect:Se,over:ge.current.over,overlayNodeRect:ut.rect,scrollableAncestors:Qe,scrollableAncestorRects:Ot,windowRect:Ce}),wt=Q?dl(Q,O):null,Ne=II(Qe),mt=dl(st,Ne),dt=Se?Jy(Se,st):null,Ue=dt?Jy(dt,Ne):null,en=$&&Ue?a({active:$,collisionRect:Ue,droppableContainers:V}):null,[he,De]=h.useState(null),Fe=vI(st,(v=he==null?void 0:he.rect)!=null?v:null,ee),He=h.useCallback((Re,{sensor:St,options:tn})=>{if(!j.current)return;const jn=_[j.current];if(!jn)return;const Zt=new St({active:j.current,activeNode:jn,event:Re.nativeEvent,options:tn,context:ge,onStart(Tn){const ls=j.current;if(!ls)return;const cs=_[ls];if(!cs)return;const{onDragStart:us}=k.current,ds={active:{id:ls,data:cs.data,rect:M}};Fn.unstable_batchedUpdates(()=>{y({type:gt.DragStart,initialCoordinates:Tn,active:ls}),C({type:gt.DragStart,event:ds})}),us==null||us(ds)},onMove(Tn){y({type:gt.DragMove,coordinates:Tn})},onEnd:Ks(gt.DragEnd),onCancel:Ks(gt.DragCancel)});Fn.unstable_batchedUpdates(()=>{D(Zt),F(Re.nativeEvent)});function Ks(Tn){return async function(){const{active:cs,over:us,scrollAdjustedTranslate:ds}=ge.current;let fs=null;if(cs&&ds){const{cancelDrop:gn}=k.current;fs={active:cs,delta:ds,over:us},Tn===gt.DragEnd&&typeof gn=="function"&&await Promise.resolve(gn(fs))&&(Tn=gt.DragCancel)}if(j.current=null,Fn.unstable_batchedUpdates(()=>{y({type:Tn}),De(null),E(!1),D(null),F(null),fs&&C({type:Tn,event:fs})}),fs){const{onDragCancel:gn,onDragEnd:Er}=k.current,Du=Tn===gt.DragEnd?Er:gn;Du==null||Du(fs)}}}},[y,_]),Mt=h.useCallback((Re,St)=>(tn,jn)=>{const Zt=tn.nativeEvent;j.current!==null||Zt.dndKit||Zt.defaultPrevented||Re(tn,St.options)===!0&&(Zt.dndKit={capturedBy:St.sensor},j.current=jn,He(tn,St))},[He]),Gt=MI(s,Mt);jI(s),Us(()=>{k.current=d},Object.values(d)),h.useEffect(()=>{T!=null&&E(!0)},[T]),h.useEffect(()=>{$||(R.current=null),$&&ee&&!R.current&&(R.current=ee)},[ee,$]),h.useEffect(()=>{const{onDragMove:Re}=k.current,{active:St,over:tn}=ge.current;if(!St)return;const jn={active:St,delta:{x:mt.x,y:mt.y},over:tn};C({type:gt.DragMove,event:jn}),Re==null||Re(jn)},[mt.x,mt.y]),h.useEffect(()=>{const{active:Re,droppableContainers:St,scrollAdjustedTranslate:tn}=ge.current;if(!Re||!j.current||!tn)return;const{onDragOver:jn}=k.current,Zt=St.get(en),Ks=Zt&&Zt.rect.current?{id:Zt.id,rect:Zt.rect.current,data:Zt.data,disabled:Zt.disabled}:null,Tn={active:Re,delta:{x:tn.x,y:tn.y},over:Ks};Fn.unstable_batchedUpdates(()=>{De(Ks),C({type:gt.DragOver,event:Tn}),jn==null||jn(Tn)})},[en]),Us(()=>{ge.current={active:$,activeNode:X,collisionRect:Ue,droppableRects:U,draggableNodes:_,draggingNodeRect:Se,droppableContainers:P,over:he,scrollableAncestors:Qe,scrollAdjustedTranslate:mt,translatedRect:dt},M.current={initial:Se,translated:dt}},[$,X,Ue,_,Se,U,P,he,Qe,mt,dt]),AI({...qs(),draggingRect:dt,pointerCoordinates:wt,scrollableAncestors:Qe,scrollableAncestorRects:Ot});const wo=h.useMemo(()=>({active:$,activeNode:X,activeNodeRect:ee,activeNodeClientRect:G,activatorEvent:W,activators:Gt,ariaDescribedById:{draggable:H},containerNodeRect:tt,dispatch:y,dragOverlay:ut,draggableNodes:_,droppableContainers:P,droppableRects:U,over:he,recomputeLayouts:J,scrollableAncestors:Qe,scrollableAncestorRects:Ot,willRecomputeLayouts:Y,windowRect:Ce}),[$,X,G,ee,W,Gt,tt,ut,y,_,H,P,U,he,J,Qe,Ot,Y,Ce]);return h.createElement(Zy.Provider,{value:S},h.createElement(mu.Provider,{value:wo},h.createElement(fw.Provider,{value:Fe},o)),h.createElement(gI,{announcements:r,hiddenTextDescribedById:H,screenReaderInstructions:u}));function qs(){const Re=(L==null?void 0:L.autoScrollEnabled)===!1,St=typeof n=="object"?n.enabled===!1:n===!1,tn=!Re&&!St;return typeof n=="object"?{...n,enabled:tn}:{enabled:tn}}}),o9=h.createContext(null),pw="button",s9="Droppable";function a9({id:e,data:t,disabled:n=!1,attributes:r}){const o=ul(s9),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:f,over:p}=h.useContext(mu),{role:g=pw,roleDescription:m="draggable",tabIndex:v=0}=r??{},b=(s==null?void 0:s.id)===e,w=h.useContext(b?fw:o9),[y,S]=sh(),C=DI(f,e),x=rw(t);h.useEffect(()=>(u[e]={id:e,key:o,node:y,data:x},()=>{const T=u[e];T&&T.key===o&&delete u[e]}),[u,e]);const E=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===pw?!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:p,setNodeRef:S,transform:w}}function i9(){return h.useContext(mu)}const l9="Droppable";function c9({data:e,disabled:t=!1,id:n}){const r=ul(l9),{active:o,dispatch:s,over:a}=h.useContext(mu),i=h.useRef(null),[l,u]=sh(),d=rw(e);return Us(()=>(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 u9(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 d9=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:u9(t,e,r)},f9=({transform:e})=>({...e,x:0});function hw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function p9(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function wu(e){return e!==null&&e>=0}const gw=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=hw(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}},Su={scaleX:1,scaleY:1},h9=({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,...Su}:null}const i=g9(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,...Su}:n<e&&n>=o?{x:0,y:a.height+i,...Su}:{x:0,y:0,...Su}};function g9(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 mw="Sortable",vw=h.createContext({activeIndex:-1,containerId:mw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gw,wasDragging:{current:!1}});function m9({children:e,id:t,items:n,strategy:r=gw}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=i9(),d=ul(mw,t),f=s.rect!==null,p=h.useMemo(()=>n.map(T=>typeof T=="string"?T:T.id),[n]),g=o!=null,m=h.useRef(!1),v=o?p.indexOf(o.id):-1,b=v!==-1,w=i?p.indexOf(i.id):-1,y=h.useRef(p),S=p9(p,a),C=!v9(p,y.current),x=w!==-1&&v===-1||C;Us(()=>{C&&b&&!u&&l()},[C,b,l,u]),h.useEffect(()=>{y.current=p},[p]),h.useEffect(()=>{const T=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(T)},[g]);const E=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:x,items:p,overIndex:w,useDragOverlay:f,sortedRects:S,strategy:r,wasDragging:m}),[v,d,x,p,w,S,f,r,m]);return h.createElement(vw.Provider,{value:E},e)}function v9(e,t){return e.join()===t.join()}const b9=({id:e,items:t,activeIndex:n,overIndex:r})=>hw(t,n,r).indexOf(e),y9=({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,w9={duration:200,easing:"ease"},bw="transform",S9=fl.Transition.toString({property:bw,duration:0,easing:"linear"}),C9={roleDescription:"sortable"};function x9({disabled:e,index:t,node:n,rect:r}){const[o,s]=h.useState(null),a=h.useRef(t);return Us(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=bu(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 E9({animateLayoutChanges:e=y9,attributes:t,disabled:n,data:r,getNewIndex:o=b9,id:s,strategy:a,transition:i=w9}){const{items:l,containerId:u,activeIndex:d,disableTransforms:f,sortedRects:p,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(vw),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}=c9({id:s,data:y}),{active:E,activeNodeRect:T,activatorEvent:_,attributes:O,setNodeRef:P,listeners:A,isDragging:M,over:$,transform:j}=a9({id:s,data:y,attributes:{...C9,...t},disabled:n}),L=eI(x,P),D=!!E,W=D&&b.current&&!f&&wu(d)&&wu(g),F=!m&&M,k=F&&W?j:null,V=W?k??(a??v)({layoutRects:p,activeNodeRect:T,activeIndex:d,overIndex:g,index:w}):null,U=wu(d)&&wu(g)?o({id:s,items:l,activeIndex:d,overIndex:g}):w,J=h.useRef(l),Y=l!==J.current,X=h.useRef(U),Q=h.useRef(u),ee=e({active:E,containerId:u,isDragging:M,isSorting:D,id:s,index:w,items:l,newIndex:X.current,previousItems:J.current,previousContainerId:Q.current,transition:i,wasDragging:b.current}),G=x9({disabled:!ee,index:w,node:C,rect:S});return h.useEffect(()=>{D&&X.current!==U&&(X.current=U),u!==Q.current&&(Q.current=u),l!==J.current&&(J.current=l)},[D,U,u,l]),{active:E,attributes:O,activatorEvent:_,rect:S,index:w,isSorting:D,isDragging:M,listeners:A,node:C,overIndex:g,over:$,setNodeRef:L,setDroppableNodeRef:x,setDraggableNodeRef:P,transform:G??V,transition:R()};function R(){if(G||Y&&X.current===w)return S9;if(!(F||!i)&&(D||ee))return fl.Transition.toString({...i,property:bw})}}const T9=[qe.Down,qe.Right,qe.Up,qe.Left],P9=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(T9.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=fh(u),f={...l,rect:{current:d}};switch(e.code){case qe.Down:r.top+r.height<=d.top&&a.push(f);break;case qe.Up:r.top>=d.top+d.height&&a.push(f);break;case qe.Left:r.left>=d.left+d.width&&a.push(f);break;case qe.Right:r.left+r.width<=d.left&&a.push(f);break}});const i=PI({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=ch(l).some((m,v)=>o[v]!==m),f=fh(l),p=d?{x:0,y:0}:{x:r.width-f.width,y:r.height-f.height};return{x:f.left-p.x,y:f.top-p.y}}}}};function O9(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:f,listeners:p,setNodeRef:g,transform:m,transition:v}=E9({id:t,disabled:u}),b={transform:fl.Transform.toString(m),transition:v},w=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:g,style:b,...f}:{},children:c.jsxs(I,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[l&&c.jsx(B,{className:Z(!u&&Pe.hover,!u&&"cursor-grab"),...p,children:c.jsx(ne,{icon:q.dotsVertical,size:se.sx})}),c.jsx(B,{grow:!0,className:Z("overflow-hidden"),children:c.jsxs(I,{children:[c.jsx(B,{grow:!0,className:Z("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:i(n)})})]})}),s&&d?c.jsx(eu,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(B,{className:Z(!u&&Pe.click),children:c.jsx(ne,{icon:q.close,size:se.sx})})}):c.jsx(B,{className:Z(!u&&Pe.click),onClick:y=>{ps(y),!u&&(s==null||s(n))},children:c.jsx(ne,{icon:q.close,size:se.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Zr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=P=>P.id||P.name||P.title||P.label||"",label:f,labelAs:p,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=qI(iw(bh),iw(mh,{coordinateGetter:P9}));function E(P){const{active:A,over:M}=P;if(A.id!==(M==null?void 0:M.id)){const $=n.find(L=>d(L)===A.id),j=n.findIndex(L=>d(L)===(M==null?void 0:M.id));$&&(l==null||l($,j))}}const T=Z(te.rnd,z.br,n.length&&te.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:T,children:[n.length===0&&b&&c.jsx(I,{className:N("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((P,A)=>{const M=d(P),$=P===r,j=Z("gjs-px-2 gjs-py-2 text-xs",z.br,A&&te.bt,!!s&&!$&&!w&&z.hBgH2,$&&z.bgH,w&&"opacity-75");return c.jsx(O9,{id:M,item:P,className:j,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},M||A)})]});l&&(_=c.jsx(r9,{sensors:x,collisionDetection:mI,onDragEnd:E,modifiers:[f9,d9],children:c.jsx(m9,{items:n.map(d),strategy:h9,children:_})})),s&&!y&&(_=c.jsx(wr,{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 O=a?[{type:"button",icon:q.plus,tooltip:v,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:Z(t,"w-full"),children:[!!(f||a)&&c.jsx(br,{...e,as:p,afterLabelButtons:O}),_]})}const _9=ce(function(){const t=Ie(),{editor:n}=we(),r=_i(),o=Ai(),s=o.sortedFonts;return n?c.jsx(Zr,{items:s,selected:null,renderItem:a=>{const i=kf(a);return c.jsxs(I,{col:!0,children:[c.jsx(B,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(B,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>nh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),yw=h.forwardRef(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ae(z.bg,z.br,o&&`${te.b} ${te.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(B,{grow:!0,className:r,children:s})})}),ww=h.forwardRef(({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})});ww.displayName="TextAreaWithAutoResize";const A9="gs-field-textarea";function Sw(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,required:u,onChange:d,onKeyDown:f,afterInput:p,minHeight:g,maxHeight:m,autoResize:v,classNameField:b,classNameFieldContent:w,classNameInput:y}=e,S=ji(e);return c.jsxs("div",{className:Z(A9,t),children:[!!r&&c.jsx(Wo,{size:o,children:r}),!!s&&c.jsx(Wo,{size:o,as:"span",className:Z(z.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(yw,{size:o,className:b,classNameContent:w,children:[c.jsx(ww,{className:Z(S,y),autoResize:v,value:n,placeholder:a,readOnly:i,disabled:l,required:u,onChange:C=>d==null?void 0:d(C.target.value),onKeyDown:f,style:{minHeight:g,maxHeight:m}}),p]})]})}const Cu="gs-page-settings",L9=`${Cu}-header`,M9=`${Cu}-content`,N9=`${Cu}-footer`,Cw="",$9=ce(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=ep.m}){const i=we(),{isDarkTheme:l}=jr(),u=Ai(),d=Ie(),[f,p]=h.useState(s),[g,m]=h.useState(()=>hv(f,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(j=>({...j,...$})),E=$=>{$.preventDefault();const{name:j,...L}=g;L.customCodeHead=BS(L.customCodeHead),L.customCodeBody=FS(L.customCodeBody),f?(H3(f,L),f.setName(j)):i.setProjectDataCustom({globalPageSettings:L}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),cv(S),S.trigger(Pn.pageSettingsUpdate,{page:f,data:{name:j,...L}})},T={tooltip:d.t("clear")},_=(f==null?void 0:f.getId())??Cw,O=$=>{const j=S.Pages.get($);p(j),m(hv(j,i))},P=Vf(f),A=!!f&&xc(f),M=[{id:Cw,label:w("global")},...S.Pages.getAll().map($=>({icon:iv($),id:$.getId(),label:$.getName()}))];return c.jsx("form",{onSubmit:E,className:N(Cu,"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(B,{className:N(L9,n,z.br,te.bb),children:c.jsx(Le,{value:_,onChange:O,options:M,handlerSelected:$=>c.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),$.icon&&ct($.icon)&&c.jsx(ne,{icon:$.icon,size:se.s2x}),c.jsx("span",{children:$.label})]})})}),c.jsxs(I,{col:!0,className:N(M9,"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}),!P&&c.jsx(rt,{size:a,value:g.slug,onChange:$=>x({slug:A?RS($,["id"]):Sl($)}),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(Sw,{size:a,value:g.description,onChange:$=>x({description:$}),label:y("description.label"),description:y("description.description")}),c.jsx(ll,{size:a,clear:T,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(ll,{size:a,clear:T,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(Sw,{size:a,value:g.socialDescription,onChange:$=>x({socialDescription:$}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(ho,{language:"html",defaultValue:g.customCodeHead,onChange:$=>x({customCodeHead:$}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${_}`),c.jsx(ho,{language:"html",defaultValue:g.customCodeBody,onChange:$=>x({customCodeBody:$}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(_9,{})]}),c.jsx(I,{className:N(N9,"gs-utl-mt-auto",o,z.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),k9="gs-panel-page-settings",I9=h.memo(ce(function({className:t,page:n,...r}){return c.jsx(Cr,{className:N(k9,"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(Fi,{children:c.jsx($9,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:ep.s,classNameHeader:Te.s,classNameContent:Te.s,classNameFooter:Te.s})})})})),xu="gs-page-item",xw=ce(function({page:t,rename:n,setRename:r,commandItems:o}){const s=we(),a=Ie(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,f=u==null?void 0:u.showHomeIcon,p=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(re.setPageSettings,{page:t,isOpen:!0});return c.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ae([xu,"group cursor-default",Te.xy,w?z.bgH:z.hBgH2]),children:[f&&Vf(t)&&c.jsx(B,{className:`${xu}__icon-home`,title:g("homePage"),children:c.jsx(ne,{icon:q.home,size:se.s3x})}),p&&$t(p({page:t,editor:i,isSelected:w})),c.jsx(B,{className:ae(`${xu}__name truncate`),grow:!0,children:b(t)?c.jsx(th,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(I,{className:`${xu}__actions`,gap:"xs",onClick:ps,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(ne,{icon:q.cog,size:se.s3x})}),w&&!!o.length&&c.jsx(wr,{placement:"right-start",handler:c.jsx(ne,{icon:q.dotsVertical,size:se.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>o.map(T=>c.jsx(Pa,{icon:T.icon,label:et(T.label)?T.label({editor:i}):T.label,action:()=>{var _;E(),(_=T.cmd)==null||_.call(T,{page:t,editor:i})}},T.id))})]})]},t.getId())});function V9({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var Ew=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Ew||{});const Sh="gs-cmp-sortable",Tw=3;function H9({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=h.useState(null),[a,i]=h.useState(-1),[l,u]=h.useState(),[d,f]=h.useState(!1),p=h.useRef(null),{showIndicator:g,indicatorStyle:m}=V9({dragging:!!o&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const T=window.document,_=O=>O.key==="Escape"&&y(O);return T.addEventListener("keydown",_),()=>T.removeEventListener("keydown",_)},[]);const b=T=>_=>{_.button===0&&(p.current={x:_.clientX,y:_.clientY},s(T),f(!1),_.target.setPointerCapture(_.pointerId))},w=T=>{const _=p.current;if(!o||!_)return;if(!d){const $=Math.abs(T.clientX-_.x),j=Math.abs(T.clientY-_.y);(t==="vertical"?j>Tw:$>Tw)&&f(!0);return}const O=T.clientY;let P=-1;v.forEach(($,j)=>{const L=$.getBoundingClientRect();O>L.top+L.height/2&&(P=j)});const A=e.findIndex($=>$.id===o.id);P<A&&(P+=1),P=Math.min(P,e.length-1),i(P);const M=v[P];if(M){const{height:$,top:j}=M.getBoundingClientRect(),L=O<j+$/2;u({y:M.offsetTop+(L?0:$),h:$})}},y=T=>{s(null),f(!1),p.current=null,u(void 0);const _=T.target,{pointerId:O}=T;O&&(_==null||_.releasePointerCapture(O))},S=T=>{!o||!p.current||(l&&a!==-1&&(n==null||n(o,a)),y(T))},C=N(Sh,"gs-utl-relative"),x=N(`${Sh}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=T=>N(`${Sh}__item`,g&&(o==null?void 0:o.id)===T.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((T,_)=>c.jsx(B,{ref:O=>{O&&(v[_]=O)},className:E(T),onPointerDown:b(T),onPointerMove:w,onPointerUp:S,children:r(T)},T.id))}),g&&c.jsx("div",{className:x,style:m})]})}const j9=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(xw,{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(xw,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(H9,{items:i,direction:Ew.vertical,onDrop:s,renderItem:a})},D9=({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},Ch="gs-panel-page-manager",Pw=ce(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=we(),u=Ca(),d=Ie(),{sdkPagesConfig:f}=l,p=l.editor,[g,m]=h.useState(),v=M=>d.t(`pageManager.${M}`),b=f==null?void 0:f.add,w=f==null?void 0:f.duplicate,y=f==null?void 0:f.remove,S=M=>{ps(M);const $=L=>{const D=t.length+1;return r({name:`${v("page")} ${D}`,component:`<div>${v("newPage")} ${D}</div>`,...L},{select:!0})};if(b)return b({event:M,editor:p,rename:m,addPage:$});const j=$();j&&m(j)},C=({page:M})=>{if(y)return y({editor:p,page:M});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const $=t.indexOf(M),j=t[$+1]||t[0];n(j),o(M)}})},x=({page:M})=>{if(w)return w({editor:p,page:M,rename:m});const $=M.getMainComponent(),j=r({name:`${M.getName()} (${v("copy")})`,component:$.clone()},{select:!0});j&&m(j)},E=[{id:"rename",label:v("rename"),icon:q.pencil,cmd:({page:M})=>m(M)},w!==!1&&{id:"duplicate",label:v("duplicate"),icon:q.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:q.delete,cmd:C}].filter(Boolean),T=D9({items:E,editor:p,sdkPageConfig:f}),_=Cy(s,{collapsible:!0,label:v("pages"),icon:q.textBoxMultiple}),O=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,P=c.jsx(j9,{pages:t,commandItems:T,rename:g,setRename:m,editor:p}),A=O?c.jsx(fu,{className:Z([`${Ch}__content`,"text-sm overflow-auto",te.bt,z.br]),height:i,...O,children:P}):P;return c.jsx(mo,{classNameWrap:Ch,className:Z(`${Ch}__header`,Te.xy,s===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(I,{space:"s",items:"center",children:[!!_.icon&&c.jsx(B,{children:c.jsx(ne,{icon:_.icon,size:se.s})}),c.jsx(B,{grow:!0,children:_.label}),b!==!1&&c.jsx(Wt,{title:v("add"),children:c.jsx(I,{onClick:S,className:Z("cursor-pointer"),children:c.jsx(ne,{icon:q.plus,size:se.s})})})]}),open:_?_.collapsed!==!0:!0,children:A})}),Ow=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-after"),n),ref:o,...r,children:t})}),_w=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-before"),n),ref:o,...r,children:t})}),F9="gs-panel-pages",Aw=h.memo(ce(function({className:t,header:n,height:r,resizable:o,...s}){const a=we().sdkProps.children;return c.jsx(Cn,{className:N(F9,t),...s,children:c.jsx(Ob,{children:i=>c.jsxs(c.Fragment,{children:[Xn(a,_w),c.jsx(Pw,{header:n,height:r,resizable:o,...i}),Xn(a,Ow)]})})})})),B9="gs-panel-pages-layers",z9=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=we(),a=Ie(),{className:i,...l}=n||{},u=Cy(r==null?void 0:r.header,{icon:q.layers,collapsible:!1,label:a.t("layerManager.layers"),className:N(te.bb,z.br)});return c.jsxs(Cr,{className:N(B9,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(Aw,{className:N(i,te.bb,z.br),...l}),c.jsx(Wy,{...r,header:u})]})})),U9="gs-trait-custom",W9=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"),f=n.get("render"),p=n.target,g=u.current;if(h.useEffect(()=>{if(p){let b=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(p.on("change",y),!d&&f&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=f({editor:r,component:p,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),b=()=>C(x)):et(x)&&(b=()=>x())}return()=>{p.off("change",y),b()}}},[p,g,o]),!p)return null;const m=Go({...t,className:N(U9,i)}),v={trait:n,component:p,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(br,{...t,as:a}),c.jsx("div",{className:N(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):f?c.jsx("div",{ref:u}):null})]})});function Lw({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:f,onBlur:p,placeholder:g}){const[m,v]=h.useState(null),[b,w]=h.useState(null),{styles:y,attributes:S}=wi(m,b,ap),[C,x]=h.useState(""),E=ji(),T=C===""?t:t.filter(j=>j.label.toLowerCase().includes(C.toLowerCase())),_=j=>x(j.target.value),O=j=>j==null?void 0:j.label,P=d&&C.length>0&&!T.some(j=>j.label===C),A=et(d)?d(C):d,M={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},$=()=>p==null?void 0:p();return c.jsxs("div",{className:Z("w-full",e),children:[!!o&&c.jsx(Wo,{size:i,children:o}),c.jsxs(ca,{value:n,onChange:f,name:r,nullable:!0,children:[c.jsx(yw,{size:i,ref:v,border:s,children:c.jsxs(I,{nowrap:!0,children:[c.jsx(ca.Input,{autoFocus:l,className:E,displayValue:O,onChange:_,onBlur:$,placeholder:g}),!a&&c.jsx(ca.Button,{children:c.jsx(ne,{icon:q.chevronDown,size:se.sx})})]})}),c.jsx(ca.Options,{static:u,className:vb,ref:w,style:y.popper,...S.popper,children:c.jsxs(Yn,{className:Z("h-full"),padding:!1,style:M,children:[P&&c.jsx(ca.Option,{value:{id:null,label:C},children:({active:j})=>c.jsx(bb,{option:{id:null,label:A},active:j,selected:n})}),!P&&T.length===0&&c.jsx("div",{className:Z(Te.xy),children:"No items found"}),T.map(j=>c.jsx(ca.Option,{value:j,children:({active:L})=>c.jsx(bb,{option:j,active:L,selected:n})},j.id))]})})]})]})}const G9=(e,t)=>{const n=`${Sc}${t}`,r=e.get(n,{skipResolve:!0});return r?Mw(r):e.get(n)||""};function Mw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const q9=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=Cc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(f=>{if(d!=null&&d[f]){const{collectionId:p}=d,g=r.t(`dataSources.collections.${p}`)||p,m=r.t(`dataSources.variableTypes.${f}`)||f,v={collectionId:p,path:"id",type:n.dataComponentTypes.variable,variableType:f};return{id:Mw(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]},Nw="#",Eu="mailto:",xh="subject=",Eh="tel:",$w="hrefType",kw="showIdList",Iw=(e,t)=>{const n=t==null?void 0:t.get($w);return n||(e.startsWith(Eh)?"phone":e.startsWith(Eu)?"email":e.startsWith(Oi)?"pages":e.startsWith(Nw)?"elements":"url")},Vw=e=>`${e.getName()} - #${e.getId()}`,K9="gs-trait-href",Z9=ce(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=we(),{isSelectingTarget:u,editor:d}=l,[,f]=h.useState(0),[p,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"),T=()=>f(Q=>++Q),_=i.get(kw)??!1,O=Iw(r,i),P=O==="pages"?r==null?void 0:r.replace(Oi,""):"",A=!!P&&(d==null?void 0:d.Pages.get(P)),M=A?xc(A):!1,$=h.useMemo(()=>!M||!A||!d?[]:q9({page:A,component:i}),[d,A,M,i]),j=Q=>{n.setValue(Q)},L=Q=>{i.set({[kw]:Q}),T()},D=Q=>{g(""),v(""),w(""),j(""),i.set({[$w]:Q}),T()},W=Q=>{j(Q),T()},F=(Q,ee)=>{F3(i,"id",(ee==null?void 0:ee.dataVariable)||Q),T()},k=Q=>{Q&&(j(Q.id),T())},H=Q=>{j(`${Eh}${Q}`),w(Q)},V=Q=>{j(`${Eu}${Q}${m?`?${xh}${m}`:""}`),g(Q)},U=Q=>{j(`${Eu}${p}${Q?`?${xh}${Q}`:""}`),v(Q)},J=()=>{l.setSelectingTarget(!u)},Y=Q=>{const ee=Q.replace(Nw,""),G=d==null?void 0:d.Components.componentsById[ee];return{id:Q,label:G?Vw(G):Q}};h.useEffect(()=>{var ee;const Q=[];if(_){const G=["path","br","b","u","i","strike"],R=(ee=d==null?void 0:d.Pages.getSelected())==null?void 0:ee.getMainComponent();R==null||R.forEachChild(le=>{!le.is("comment")&&!le.is("textnode")&&!G.includes(le.get("tagName"))&&Q.push({id:`#${le.getId()}`,label:Vw(le)})})}S(Q)},[d,_]),h.useEffect(()=>{let Q=()=>{};const ee=()=>{Q(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand($u))};return u&&(Q=VS(ee),d==null||d.runCommand($u,{onSelect:G=>j(`#${G.getId()}`)})),ee},[d,u]),h.useEffect(()=>{if(!r)return;switch(Iw(r,i)){case"phone":w(r.replace(Eh,""));break;case"email":{const[ee,G=""]=r.replace(Eu,"").split("?");g(ee),v(G.replace(xh,""));break}}},[r]);const X=Go({className:N(K9,a)});return c.jsxs("div",{...X,children:[c.jsx(br,{...t,as:s}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Zo,{onChange:D,classNamePanel:"gs-utl-p-1",value:O,tabs:[{id:"url",label:c.jsx(ne,{icon:q.link,size:se.s}),content:c.jsx(rt,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:j,size:"s",type:"url"})},{id:"pages",label:c.jsx(ne,{icon:q.textBoxMultiple,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Le,{size:"s",options:(x||[]).map(Q=>({id:`${Oi}${Q.getId()}`,icon:iv(Q),label:Q.getName()})),value:r,onChange:W,label:"Page"}),M&&c.jsx(Le,{size:"s",options:$,value:G9(i,"id"),onChange:F,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(ne,{icon:q.viewDayOutline,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Wo,{size:"s",children:"Element ID"}),c.jsxs(I,{gap:"xs",nowrap:!0,children:[_?c.jsx(Lw,{options:y,onChange:k,value:Y(r),placeholder:C.t("selectList")}):c.jsx(rt,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:j,className:"gs-utl-flex-1"}),c.jsx(Ct,{title:C.t("selectTarget"),size:"m2",active:u,onClick:J,className:"gs-utl-h-[30px]",children:c.jsx(ne,{icon:q.target,size:se.sx})})]}),c.jsx(tl,{value:_,onChange:L,label:E("showList")})]})},{id:"email",label:c.jsx(ne,{icon:q.email,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(rt,{placeholder:"eg. mail@gmail.com",value:p,onChange:V,size:"s",label:"Email",type:"email"}),c.jsx(rt,{placeholder:"eg. My subject",value:m,onChange:U,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(ne,{icon:q.phone,size:se.s}),content:c.jsx(rt,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:H})}]})})]})});function Y9({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||[],f=d.findIndex(p=>p.id===(s==null?void 0:s.id));return c.jsx(Zr,{items:d,selected:f>-1?s:null,select:a,disabled:n,label:r,labelAs:o,add:()=>{const p=d.length+1,g=l?l(p):{id:`opt${p}`,label:`New option ${p}`};e.setValue([...d,g])},move:(p,g)=>{const m=e.getValue().filter(v=>v.id!==p.id);m.splice(g,0,p),e.setValue(m)},remove:p=>{const g=e.getValue().filter(m=>m.id!==p.id);e.setValue(g,{removed:p})},renderItem:p=>u?u(p):p.label,children:c.jsx(I,{space:"m",col:!0,children:!!s&&i.map(p=>{const{name:g,getValue:m}=p,v=p.setValue,b=p.label||g,w=d[f];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const T={...w};w[g]=v?v(E,S):E,e.setValue([...d],{item:w,previous:T}),g==="id"&&a(w)};let x=c.jsx(rt,{label:b,value:S,onChange:C});switch(p.type){case"select":x=c.jsx(Le,{label:b,options:p.options,value:S,onChange:C})}return c.jsx(h.Fragment,{children:x},g)})})})}const X9="gs-trait-custom-type",J9=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")}),f=d.render().el;return u.appendChild(f),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(f),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:X9,ref:r})}),Q9=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(re.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(re.layoutToggle,{...a})};function Hw(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?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:o.I18n.t("dataSources.connectDataValue"),icon:{icon:q.databaseOutline,size:se.s2x},onClick:()=>Q9({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:q.close,size:se.s2x},onClick:r}),u}function R9(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:Rr(t)&&et(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=es(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 e7=({label:e,buttons:t})=>c.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[c.jsx(B,{grow:!0,children:e}),c.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(Ct,{...n},r))})]}),jw=e=>Pr((e||"").replace(/-/g," ")),t7=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&jw(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})}),xr=(e,t,n)=>{const r=R9(e,n.traitManagerDataConfig),o=Hw(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=t7(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(e7,{label:i.label,buttons:o})}},Dw=(e,t,n)=>xr(e,t,n),n7=(e,t,n)=>xr(e,t,n),r7=(e,t,n)=>{const r=es(e.getValue({skipResolve:!0})),o=xr(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}},Fw=(e,t,n)=>{const r=e.get("labelToTitle"),o=es(e.getValue({skipResolve:!0})),s=xr(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}},o7=(e,t,n)=>{const{options:r,onChange:o}=Fw(e,t,n),s={options:r,onChange:o};return{...xr(e,t,n),...s}},s7=(e,t,n)=>{const r=e.get("typeProps")||{},o=es(e.getValue({skipResolve:!0}));return{...xr(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}},a7=e=>({children:jw(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}),i7=(e,t,n)=>{const r=xr(e,t,n),s={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...s}},l7=(e,t,n)=>{const r=xr(e,t,n),o=e.get("typeProps")||{},s=es(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},c7=(e,t,n)=>({...xr(e,t,n),trait:e}),u7=(e,t,n)=>({...xr(e,t,n),trait:e}),d7=(e,t,n)=>({...xr(e,t,n),trait:e,editor:t});function f7(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,{...Dw(e,t,s)});case"select":return c.jsx(Le,{...Fw(e,t,s)});case"number":return c.jsx($e,{...r7(e,t,s)});case"color":return c.jsx(vo,{...n7(e,t,s)});case"checkbox":return c.jsx(tl,{...i7(e,t,s)});case"button":return c.jsx(Ke,{...a7(e)});case"radio":return c.jsx(Qt,{...o7(e,t,s)});case"code":return c.jsx(ho,{...l7(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(ll,{...s7(e,t,s)});case"stack":return c.jsx(Y9,{...c7(e,t,s)});case"href":return c.jsx(Z9,{...u7(e,t,s)});case"custom":return c.jsx(W9,{...d7(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(J9,{editor:t,trait:e}):c.jsx(rt,{...Dw(e,t,s)})}}const Th="gs-trait-manager",Bw=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(B,{className:Z(`${Th}-field gs-utl-mb-2 gs-utl-w-full`),children:f7(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function p7({traits:e,className:t}){var d,f;const n=Di(),{isDarkTheme:r}=jr(),s=(d=we().sdkOptions.dataSources)==null?void 0:d.traitManager,a=n.Traits.getTraitsByCategory(e),i=(f=a.find(p=>!p.category))==null?void 0:f.items,l=a.filter(p=>p.category),u=Z("gs-utl-text-center");return c.jsx(I,{className:Z(Th,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(p=>c.jsx(Bw,{trait:p,isDarkTheme:r,traitManagerDataConfig:s},p.id)),l.map(({category:p,items:g},m)=>c.jsx(mo,{open:!!(p!=null&&p.get("open")),onChange:({open:v})=>p==null?void 0:p.set({open:v}),handler:p==null?void 0:p.getLabel(),handlerIcon:p==null?void 0:p.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Th}-category -gs-utl-mx-2`,className:v=>Z(Ed.itemList({index:m+(i?1:0),open:v,length:l.length})),children:g.map(v=>c.jsx(Bw,{trait:v,isDarkTheme:r,traitManagerDataConfig:s},v.id))},p==null?void 0:p.id))]}):c.jsx(B,{className:u,children:"No properties available"}):c.jsx(B,{className:u,children:n.t("traitManager.empty")})})}const Ph=ce(p7),h7="gs-panel-properties",g7=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(h7,"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(ip,{children:r=>c.jsx(Ph,{...r})})})})),m7=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},v7=ce(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=h.useRef(null),i=we().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:f}=jr(),[p,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(p),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;m7({el:C,html:'<div class="prv-rule">Preview</div>',css:`
|
|
392
327
|
.prv-rule {
|
|
393
328
|
background-color: #fff;
|
|
394
329
|
padding: 5px;
|
|
395
330
|
}
|
|
396
331
|
.prv-rule, ${p}
|
|
397
|
-
`})}},[s,p]),c.jsx(
|
|
332
|
+
`})}},[s,p]),c.jsx(Yn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(I,{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(I,{className:ae("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(I,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(B,{grow:!0,children:c.jsx("pre",{className:ae("text-xs bg-white/10",z.txt,te.rnd,Te.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(B,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})})}),!!d&&c.jsx(B,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(ne,{icon:q.flare,size:se.sx})})})]}),c.jsxs(I,{nowrap:!0,className:ae(Pe.txtEllips),space:"s",children:[c.jsx(B,{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(wr,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(Ct,{title:l.t("selectorManager.showCSS"),children:c.jsx(ne,{icon:q.codeBraces,size:se.sx})}),children:({close:C})=>c.jsxs(I,{className:ae("relative w-80 h-48"),col:!0,children:[c.jsx(B,{grow:!0,children:c.jsx(ho,{defaultValue:lp(p),onChange:v,language:"css",padding:5,isDarkTheme:f,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(eu,{onConfirm:y,className:ae("w-48"),children:c.jsx(Ct,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(ne,{icon:q.delete,size:se.sx})})})]})]})]},t.cid)})}),b7=ce(function(){const[t]=jf(),n=Ca(),r=Ie(),[o,s]=h.useState(""),[a,i]=h.useState(""),u=we().editor,[d,f]=h.useState(u.Css.getRules("")),p=u.Devices.getDevices().map(v=>({id:v.id,label:v.getName()})),g=d.filter(v=>{var b;return!(o&&!Zs(v.selectorsToString(),o)||a&&((b=v.getDevice())==null?void 0:b.id)!==a)}),m=()=>f(u.Css.getRules(""));return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:c.jsx(rt,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(B,{children:c.jsx(Le,{includeEmpty:!0,size:"s",value:a,options:p,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs(I,{space:"s",items:"center",children:[c.jsx(ne,{icon:q.cellphoneLink,size:se.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(B,{className:ae("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(Rc,{data:g,listClassName:ae("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(v7,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx(I,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),y7=ce(function({selector:t,className:n,removable:r,toggleable:o}){const s=Ie(),a=we(),[i,l]=h.useState(),[u,d]=h.useState(t.getActive()),f=a.editor,{Selectors:p}=f,g=t.getLabel(),m=c.jsx(ne,{icon:q.dotsVertical,size:se.sx}),v=()=>{p.removeSelected(t)},b=E=>{i&&p.rename(i,E),l(void 0)},w=()=>{p.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,T)=>_=>{E(),et(T)&&T(_)};return c.jsx(Ko,{className:ae(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",z.sel,n]),s:"s",children:c.jsxs(I,{items:"center",children:[c.jsx(B,{className:ae("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(Ty,{value:g,onChange:b,active:!!i,unstyled:!0})}),c.jsx(I,{className:ae("absolute h-full right-0 transition-opacity",z.sel,z.selBr,te.bl),children:c.jsx(wr,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>C.map(T=>c.jsx(Pa,{className:ae(z.txt),label:T.label,action:x(E,T.action)},T.id))})})]})})}),w7=e=>(e==null?void 0:e.get("groups"))||[],S7=/^\.[a-zA-Z_][\w-]*$/;function C7(e,t={}){const n=e.Css.getAll().filter(r=>w7(r).some(o=>o.startsWith(Hs.globalStyles)));return t.withSingleClass?n.filter(r=>S7.test(r.getSelectorsString())):n}const x7=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())},E7=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?C7(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...x7(e).map(i=>({id:i,label:i.getLabel()})),...s]},T7=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} {
|
|
398
333
|
${t}
|
|
399
|
-
}`),t},Jn="gs-cmp-selector-manager",ih={},dw=de(function(t){var re,fe,xe;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=ye(),[l,u]=h.useState(!1),[d,f]=h.useState([]),[p,g]=h.useState(ih),{toggleCssPanel:m,isCssPanelActive:b,editor:v,store:w}=ye(),{i18nStore:y,modalStore:S}=w,C=v==null?void 0:v.getSelected(),x=v==null?void 0:v.Styles.getSelected();if(h.useEffect(()=>{if(v&&x&&i){const ne=setTimeout(()=>{let Oe=ih;const Ie=C==null?void 0:C.get("selectorManager");C&&Ze(Ie)&&(Oe=Ie({editor:v,component:C})),g(Oe||ih),f(g7(v,i))});return()=>clearTimeout(ne)}},[C,v,x,i]),!v)return null;const{Selectors:E}=v,P=p.disableClasses,T=p.disableComponent,O=P&&T,_=E.getComponentFirst()&&!T,N=E.getSelectedAll(),L=v.getSelectedAll(),k=r.map(ne=>({id:ne.getName(),label:ne.getLabel()})),B=v.getModel(),$=(re=x==null?void 0:x.getDevice)==null?void 0:re.call(x),z=(fe=x==null?void 0:x.getState)==null?void 0:fe.call(x),K=M("gs-utl-overflow-hidden",oe.b,oe.rnd,U.br),F=M(U.bA),V=M("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",oe.br,U.br),D=`${U.bgA}`,A=m7(x),j=N.length>0,q=L.length>0,G=j||q,Y=_&&q||!_&&!j,Q=Y?"Components":"Selectors",Z=ne=>y.t(`selectorManager.${ne}`),W=y.t("modals.styleCatalog.title"),R=()=>S.open({title:W,content:c.jsx(c7,{})});return c.jsxs(I,{className:Jn,gap:"s",col:!0,full:!0,children:[c.jsxs(I,{className:M(`${Jn}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(I,{className:M(`${Jn}__head-start`),items:"center",gap:"s",children:[c.jsx(H,{className:M(`${Jn}__head-title`),children:Z("selection")}),s!==!1&&c.jsx(H,{className:M(`${Jn}__style-catalog`),children:c.jsx(Dt,{className:"gs-utl-cursor-pointer",onClick:R,title:W,children:c.jsx(se,{icon:X.paletteSwatch,size:le.s})})})]}),!!x&&a!==!1&&!O&&c.jsx(H,{className:`${Jn}__head-end`,children:c.jsx(Te,{size:"s",value:n,options:k,includeEmpty:!0,onChange:o,emptyState:`- ${Z("state")} -`,className:M(n&&U.bA)})})]}),G&&!O?c.jsxs(c.Fragment,{children:[!P&&c.jsxs(I,{className:M(`${Jn}__field-selectors`,K,!Y&&F),items:"stretch",gap:"xs",children:[c.jsx(Dt,{title:Z(j?"applyOnSelector":"noSelectors"),className:M(V,!Y&&D),onClick:()=>j&&E.setComponentFirst(!1),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(se,{icon:X.tag,size:le.sx})})}),c.jsx(H,{grow:!0,children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Ry,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:Z("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:ne=>{ne&&(E.addSelected(ne.id||ne.label),u(!1))}}):c.jsxs(c.Fragment,{children:[q&&c.jsx(bt,{title:Z("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(se,{icon:X.plus,size:le.sx})}),N.map(ne=>c.jsx(u7,{selector:ne,removable:q,toggleable:q&&N.filter(Oe=>Oe.getActive()||Oe===ne).length>1},ne.toString()))]})})})]}),!T&&c.jsxs(I,{className:M(`${Jn}__field-components`,K,Y&&F),items:"stretch",gap:"xs",children:[c.jsx(Dt,{title:Z(q?"applyOnComponents":"noComponents"),onClick:()=>q&&E.setComponentFirst(!0),className:M(V,Y&&D),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(se,{icon:X.targetVariant,size:le.sx})})}),c.jsx(H,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:L.map(ne=>c.jsx(Ho,{s:"s",className:M("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",U.cmp),onPointerEnter:()=>B.setHovered(ne),onPointerOut:()=>B.setHovered(),label:ne.getName()},ne.getId()))})})]}),c.jsxs(I,{className:`${Jn}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:Z("selected")}),c.jsx("pre",{className:M("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",oe.rnd,Ee.xyS),children:A}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:Z("currentSelection")})]}),children:c.jsx(Ho,{className:M(oe.b,oe.rnd,U.br),s:"xs",nopad:!0,block:!0,children:c.jsx(se,{icon:X.target,size:le.sx})})}),c.jsx(H,{className:"gs-utl-text-sm",children:c.jsx(Ho,{className:M(oe.b,oe.rnd,U.br),s:"xs",nopad:!0,children:c.jsxs(I,{space:"xs",items:"center",nowrap:!0,children:[!!$&&$.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[Z("device"),": ",c.jsx("b",{children:$.getName()})]}),children:c.jsx(se,{icon:X.cellphoneLink,size:le.sx})}),c.jsx(H,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[Z("target"),": ",c.jsx("b",{children:Q}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(xe=x==null?void 0:x.selectorsToString)==null?void 0:xe.call(x,{skipState:1})]})]}),children:c.jsx(se,{icon:Y?X.targetVariant:X.tag,size:le.sx})}),!!z&&c.jsxs(c.Fragment,{children:[c.jsx(H,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[Z("state"),": ",c.jsx("b",{children:z.getLabel()})]}),children:c.jsx(se,{icon:X.flare,size:le.sx})})]})]})})}),c.jsx(bt,{title:y.t("toggleCss"),onClick:m,active:b,size:"s",children:c.jsx(se,{icon:X.codeBraces,size:le.sx})})]})]}):c.jsxs(I,{className:M(`${Jn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(H,{className:`${Jn}__empty-state-title`,children:Z("noSelecton")}),c.jsxs("ul",{className:M(`${Jn}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:Z("selectFromCanvas")}),c.jsx("li",{children:Z("selectFromList")})]})]})]})}),b7="gs-panel-selectors",v7=h.memo(de(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(gr,{className:M(b7,t),...o,children:c.jsx(wv,{children:s=>c.jsx(dw,{...s,styleCatalog:n,stateSelector:r})})})}));function qo({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,tooltip:l,skipClear:u,className:d,...f}){const p=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})),b=!m&&(t==null?void 0:t.hasValue())&&g,v=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:M(d,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...f},x=M("gs-utl-flex-1",m&&!a&&U.tAo);return t&&!t.isVisible()?null:c.jsxs(I,{gap:"xs",...C,children:[c.jsxs(I,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(H,{children:c.jsx(Dt,{title:l,children:c.jsx(se,{icon:X.information,size:le.sx})})}),c.jsx(H,{children:r?c.jsx("span",{children:" "}):p}),!!b&&!a&&c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M("gs-utl-mb-1"),children:"Value inherited from"}),!!v&&c.jsxs(I,{gap:"s",children:[c.jsx(H,{children:c.jsx(se,{icon:X.cellphoneLink,size:le.sx})}),c.jsx(H,{children:c.jsx("b",{children:v.getName()})})]}),c.jsxs(I,{gap:"s",children:[c.jsx(H,{children:c.jsx(se,{icon:y?X.targetVariant:X.tag,size:le.sx})}),c.jsxs(H,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:M("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!w&&c.jsxs(I,{gap:"s",children:[c.jsx(H,{children:c.jsx(se,{icon:X.flare,size:le.sx})}),c.jsx(H,{children:c.jsx("b",{children:w.getLabel()})})]})]}),children:c.jsx("div",{className:M("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",U.bgW)})}),m&&!a&&!u&&c.jsx(Dt,{title:"Clear value",onClick:S,children:c.jsx(se,{className:Pe.click,icon:X.close,size:le.s2x})})]}),!!s&&c.jsx(H,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function uu(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 y7=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,w7=/,(?![^(]*\))/,lh=/\s(?![^(]*\))/,S7=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,ch=/^circle|ellipse/i,uh=e=>{var d;const t=[],{name:n,value:r}=uu(e),[o,...s]=r.split(w7).map(f=>f.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(y7.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if(S7.test(i))l.type="size",l.value=i;else if(ch.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const f=((d=i.match(ch))==null?void 0:d[0])||"circle";l.shape=f;const p={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,b]=i.replace(ch,"").trim().split("at").map(v=>v.trim());if(m){const[v,w]=m.split(lh);p.x=v,p.y=w||v}if(b){const[v,w]=b.split(lh);g.x=v,g.y=w||v}l.size=p,l.position=g}return u.forEach(f=>{const[p,g]=f.split(lh);t.push({color:p,hint:g?parseFloat(g):null})}),t.forEach((f,p)=>{f.hint===null&&(f.hint=p/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},Ko=({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"},C7=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),x7="gs-cmp-grad-picker";function E7({className:e,value:t,onChange:n}){var z,K,F;const r=uh(t),[o,s]=h.useState(r.colorStops),[a,i]=h.useState(null),l=h.useRef(null),u=ee(x7,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,oe.rnd),d=r.name||"linear-gradient",f=d.indexOf("radial")>=0,p=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,b=`${parseFloat(`${(z=r.orientation.size)==null?void 0:z.x}`)||0}`,v=`${parseFloat(`${(K=r.orientation.position)==null?void 0:K.x}`)||0}`,w=`${parseFloat(`${(F=r.orientation.position)==null?void 0:F.y}`)||0}`,y=0,S=100,C=(V,D=!1)=>{const A=C7(V);s(A),n==null||n(Ko({name:d,orientation:g,stops:A}),D)},x=(V,D=!1)=>{n==null||n(Ko({stops:o,name:d,orientation:`${V}deg`}),D)},E=(V,D=!1)=>{n==null||n(Ko({stops:o,name:d,orientation:`${V}px at ${v}% ${w}%`}),D)},P=(V,D=!1)=>{n==null||n(Ko({stops:o,name:d,orientation:`${b}px at ${V}% ${w}%`}),D)},T=(V,D=!1)=>{n==null||n(Ko({stops:o,name:d,orientation:`${b}px at ${v}% ${V}%`}),D)},O=V=>{const D=`${V?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(Ko({stops:o,orientation:g,name:D}))},_=V=>{const D=`${p?"repeating-":""}${V?"radial":"linear"}-gradient`;n==null||n(Ko({stops:o,orientation:V?"100px at 50% 50%":"90deg",name:D}))};h.useEffect(()=>{if(!a)return;const V=parseFloat(`${a.stop.hint}`),D=j=>{let G=(j.clientX-a.x)*100;G=G/a.w,G=V+G,G=G<y?y:G,G=G>S?S:G,a.stop.hint=parseInt(`${G}`,10),C(o,!0)},A=()=>{i(null),C(o)};return window.addEventListener("pointermove",D),window.addEventListener("pointerup",A),()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",A),A()}},[a]);const N=(V,D)=>{const A=l.current;i({stop:D,w:(A==null?void 0:A.clientWidth)||0,h:(A==null?void 0:A.clientHeight)||0,x:V.clientX,y:V.clientY})},L=V=>{const D=l.current,A=(D==null?void 0:D.clientWidth)||0,j=(D==null?void 0:D.clientHeight)||0,q=V.nativeEvent.offsetX-((D==null?void 0:D.clientLeft)||0),G=V.nativeEvent.offsetY-((D==null?void 0:D.clientTop)||0),Y=q/A*100,Q=document.createElement("canvas"),Z=Q.getContext("2d");if(!Z)return;Q.width=A,Q.height=j;const W=Z.createLinearGradient(0,0,A,j);o.forEach(ne=>W.addColorStop(parseFloat(`${ne.hint}`)/100,ne.color)),Z.fillStyle=W,Z.fillRect(0,0,Q.width,Q.height),Q.style.background="black";const R=Z.getImageData(q,G,1,1).data,re=R[3]?(100/255*R[3]/100).toFixed(2):0,fe=`rgba(${R[0]}, ${R[1]}, ${R[2]}, ${re})`,xe=fe==="rgba(0, 0, 0, 0)"?"#000":fe;C([...o,{color:xe,hint:Y}])},k=V=>{C(o.filter(D=>D!==V))},B=(V,D,A)=>{D&&(V.color=D),C(o,A)},$=V=>(a==null?void 0:a.stop)===V;return c.jsxs(I,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx("div",{className:ee("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:ee("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:ee("bg-checker h-8",oe.rnd),children:c.jsx("div",{ref:l,className:ee("w-full h-full cursor-cross",oe.b,oe.rnd,U.br),style:{backgroundImage:Ko({stops:o})},onClick:L})}),o.map((V,D)=>c.jsxs("div",{className:ee("absolute top-0 h-full"),style:{left:`${V.hint}%`},children:[c.jsx("div",{className:ee("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>k(V),children:c.jsx(se,{icon:X.close,size:le.s3x})}),c.jsx("div",{onPointerDown:A=>N(A,V),className:ee("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",oe.br,oe.bl,$(V)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:ee("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(ey,{value:V.color,onChange:(A,j)=>B(V,A,j),className:ee("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},D))]}),c.jsxs(I,{space:"s",items:"center",children:[c.jsx(H,{grow:!0,children:c.jsx(Hi,{label:"Repeat",value:p,onChange:O})}),c.jsx(H,{grow:!0,children:c.jsx(Hi,{label:"Radial",value:f,onChange:_})})]}),f?c.jsxs(I,{space:"s",col:!0,children:[c.jsx(H,{children:c.jsx(I,{space:"s",items:"center",children:c.jsx(H,{grow:!0,children:c.jsx(Me,{pan:"S",size:"s",value:b,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(H,{children:c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:c.jsx(Me,{pan:"X",size:"s",value:v,onChange:P,valueUnit:"%",units:["%"]})}),c.jsx(H,{grow:!0,children:c.jsx(Me,{pan:"Y",size:"s",value:w,onChange:T,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(I,{space:"s",items:"center",nowrap:!0,children:c.jsx(H,{grow:!0,children:c.jsx(Me,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const P7="gs-sm-custom-type",_7=de(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:P7,ref:r})});function fw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const pw="gs-cmp-style-field";function hw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=M(pw,`${pw}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(Rc,{className:o,...xw(e,s),...r});case"number":case"slider":case"integer":return c.jsx(Me,{className:o,...nt(e,s),...r});case"color":return c.jsx(co,{className:o,...Is(e,s),...r});case"select":return c.jsx(Te,{className:o,...xt(e,s),...r});case"radio":return c.jsx(qt,{className:o,...Ur(e,s),...r});case"file":return c.jsx(qi,{className:o,...Z7(e,s),...r});case"composite":return c.jsx(mn,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Fr,{className:o,...Zo(e,s),children:c.jsx(Br,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(_7,{editor:a,property:e}):c.jsx(Re,{className:o,...gh(e,s)})}}}const gw="gs-cmp-style-prop-row";function Br({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=M(gw,`${gw}__${s}`,fw(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(hw,{property:o,...r})},s):null})})}function T7({sector:e,styleManagerDataConfig:t}){const n=yi(),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:M("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Br,{properties:r,sector:e,styleManagerDataConfig:t})})}const O7="gs-cmp-sector-row";function ve({className:e,children:t,bottom:n,separator:r,separatorTop:o,property:s,...a}){const i=c.jsx("div",{className:ee("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",oe.bb,U.br)}),l=ee(O7,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(f=>f.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(I,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function tl(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 f={property:i.getName()};return c.jsx(Te,{...xt(e,l,f),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,f)||u:"Custom",onChange:p=>t.all.map(g=>g.upValue(p))}:{},label:void 0})}else return r==="color"?c.jsx(co,{...Is(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f}))}:{},label:void 0}):c.jsx(Me,{...nt(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,f)=>t.all.map(p=>p.upValue(d,{partial:f})),onChangeUnit:d=>t.all.map(f=>f.upUnit(d))}:{},label:void 0})}const du="gs-cmp-style-prop-composite";function mn({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 f={id:"custom",label:c.jsx(se,{icon:X.borderStyle,size:le.s}),title:"Custom"},p=[{id:"all",label:c.jsx(se,{icon:X.borderAllVariant,size:le.s}),title:"All"},f],g=t.isDetached(),m=t.getProperties(),b=m.length,[v,w,y,S]=m,C=v.getFullValue(),E=m.map(F=>F.getFullValue()).every(F=>F===C),P=u!==null?u:E||l?"all":f.id,T=l?[...l,f]:[],O=t.getFullValue(),_=T.some(F=>F.id===O),N=P===f.id||(l?!_:!1)||!!a,L={compact:s,sector:n,styleManagerDataConfig:r},k=c.jsx(qo,{property:s?null:v,shallow:!g,children:tl(v,null,L)}),B=c.jsx(qo,{property:s?null:w,shallow:!g,children:tl(w,null,L)}),$=!!y&&c.jsx(qo,{property:s?null:y,shallow:!g,children:tl(y,null,L)}),z=!!S&&c.jsx(qo,{property:s?null:S,shallow:!g,children:tl(S,null,L)}),K=s?{label:t.getLabel()}:{property:t};return c.jsxs(I,{className:ee(du,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(ve,{className:`${du}__main`,children:c.jsx(qo,{...K,children:!a&&c.jsx(ve,{bottom:"0",children:i!==void 0?i:l?c.jsx(c.Fragment,{children:c.jsx(H,{grow:!0,children:c.jsx(qt,{size:"s",options:T,value:N?f.id:O,onChange:F=>{F===f.id?d(F):(t.upValue(F),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(H,{grow:!0,children:tl(v,{same:E,all:m},L)}),c.jsx(H,{grow:!0,children:c.jsx(qt,{size:"s",options:p,value:P,onChange:d})})]})})})}),N&&c.jsx(ve,{col:!0,className:ee(`${du}__details`,"gjs-px-2 gjs-py-1",U.bgH2,oe.rnd,oe.b,U.br),children:a?c.jsx("div",{className:ee(`${du}__props`,"grid grid-cols-2 gap-2"),children:m.map(F=>c.jsx(qo,{property:F,shallow:!g,className:ee(fw(F)&&"col-span-full"),children:c.jsx(hw,{property:F,...L,fieldProps:{label:void 0}})},F.getId()))}):b===2?c.jsx(c.Fragment,{children:c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:k}),c.jsx(H,{grow:!0,children:B})]})}):b===3?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:k}),c.jsx(H,{grow:!0,children:B})]}),c.jsx(I,{space:"s",children:c.jsx(H,{grow:!0,children:$})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:k}),c.jsx(H,{grow:!0,children:B})]}),c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:z}),c.jsx(H,{grow:!0,children:$})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(I,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:k}),c.jsxs(I,{space:"s",children:[c.jsx(H,{grow:!0,children:z}),c.jsx(H,{grow:!0,children:B})]}),c.jsx(I,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:$})]})})]})}var Yo=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(Yo||{});const fu="background-image",zr="__background-type",nl=fu,mw="https://placehold.co/150/777/white.png?text=IMAGE",dh="50px",A7={[zr]:"image","background-image":`url("${mw}")`,"background-size":`${dh} ${dh}`,"background-repeat":"repeat","background-position":"0px 0px"},N7=e=>(e.includes("gradient(")?uh(e).colorStops[0].color:e)||"";function M7({sector:e,styleManagerDataConfig:t}){var C;const n=Ai(),r=e.getProperty("background"),o=r.getProperty(zr),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},f=[r,l,u].map(x=>x==null?void 0:x.id),p=e.getProperties().filter(x=>!f.includes(`${x.id}`)),g=((C=r.getSelectedLayer())==null?void 0:C.getIndex())||-1,m=o==null?void 0:o.getValue(),b=m==="image",v=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("${mw}")`,P=dh):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=K7(o,[{id:"image",label:c.jsx(se,{icon:X.image,size:le.s})},{id:"gradient",label:c.jsx(se,{icon:X.gradientVertical,size:le.s})},{id:"color",label:c.jsx(se,{icon:X.checkboxBlank,size:le.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(ve,{property:r,separator:!0,children:c.jsxs(Fr,{...Zo(r,d,A7),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[c.jsx(ve,{children:c.jsx(qt,{...Ur(o,d),options:S,onChange:y,label:void 0})}),c.jsx(ve,{children:c.jsxs(qo,{children:[b&&c.jsx(qi,{value:uu(v).value,onOpen:w}),m==="color"&&c.jsx(co,{...Is(s,d),value:N7(v),label:void 0}),m==="gradient"&&c.jsx(E7,{value:v,onChange:(x,E)=>s.upValue(x,{partial:E})},g)]})}),b&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{col:!0,children:c.jsx(mn,{property:a,...d})}),c.jsx(ve,{col:!0,children:c.jsx(mn,{property:i,...d})}),c.jsxs(ve,{children:[c.jsx(Te,{...xt(r.getProperty("background-repeat"),{sector:e})}),c.jsx(Te,{...xt(r.getProperty("background-attachment"),{sector:e})})]}),c.jsx(ve,{children:c.jsx(Te,{...xt(r.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(ve,{property:l,children:c.jsx(co,{...Is(l,d)})}),c.jsx(ve,{property:u,children:c.jsx(Te,{...xt(u,d)})}),p.length>0&&c.jsx(Br,{properties:p,...d})]})}function L7({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(mn,{property:n,corners:!0,...a}),c.jsx(mn,{property:r,...a}),c.jsx(mn,{property:o,...a}),c.jsx(mn,{property:s,...a}),l.length>0&&c.jsx(Br,{properties:l,...a})]})}const Vs=e=>Uc({value:parseFloat(e),min:-3,max:3}),fh=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=g6(a,s)?a:s[0];return{...nt(r,n),units:s,valueUnit:i,onChange:(l,u)=>{r.upValue(l,{partial:u,units:s,min:o.min,max:o.max})}}},bw=(e,t,n,r)=>{const o=e.getProperty(`${t}-name`),s=e.getProperty(`${t}-value`);return{...xt(o,n,r),onChange:a=>{o.upValue(a),s.upValue("")}}},$7={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function k7({sector:e,styleManagerDataConfig:t}){const n=$e(),r=T=>n.t(`styleManager.effects.${T}`),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"),f=e.getProperty("backface-visibility"),p=e.getProperty("perspective"),g=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,f,p,g,m,b,v,w,y].map(T=>T==null?void 0:T.id),x=e.getProperties().filter(T=>!C.includes(`${T.id}`)),E=T=>{const{boxShadowH:O,boxShadowV:_,boxShadowBlur:N,boxShadowColor:L,boxShadowSpread:k,boxShadowType:B}=T.getValues({camelCase:!0}),$=Vs(O),z=Vs(_),K=Vs(N),F=Vs(k),V=`${$}px ${z}px ${K}px ${F}px ${L} ${B}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(H,{grow:!0,children:[O," ",_," ",N," ",k]}),c.jsx(H,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",oe.b,oe.rnd),style:{boxShadow:V}})})]})},P=T=>{const{textShadowH:O,textShadowV:_,textShadowBlur:N,textShadowColor:L}=T.getValues({camelCase:!0}),k=Vs(O),B=Vs(_),$=Vs(N),z=`${k}px ${B}px ${$}px ${L}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(H,{grow:!0,children:[O," ",_," ",N]}),c.jsx(H,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",oe.b,oe.rnd),style:{boxShadow:z}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[m,b],children:[c.jsx(Me,{...nt(m,S)}),c.jsx(Te,{...xt(b,S)})]}),c.jsx(ve,{property:v,separator:!0,children:c.jsx(Te,{...xt(v,S)})}),c.jsx(ve,{property:o,separator:!0,children:c.jsxs(Fr,{...Zo(o,S),renderItem:E,children:[c.jsx(ve,{children:c.jsx(qt,{...Ur(o.getProperty("box-shadow-type"),S),label:""})}),c.jsxs(ve,{children:[c.jsx(Me,{...nt(o.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),c.jsx(Me,{...nt(o.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),c.jsxs(ve,{children:[c.jsx(Me,{...nt(o.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),c.jsx(Me,{...nt(o.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),c.jsx(ve,{children:c.jsx(co,{...Is(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(ve,{property:s,separator:!0,children:c.jsxs(Fr,{...Zo(s,S,$7),renderItem:P,children:[c.jsxs(ve,{children:[c.jsx(Me,{...nt(s.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),c.jsx(Me,{...nt(s.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),c.jsx(ve,{children:c.jsx(Me,{...nt(s.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),c.jsx(ve,{children:c.jsx(co,{...Is(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(ve,{property:a,separator:!0,children:c.jsx(Fr,{...Zo(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Te,{...bw(a,"filter",S),label:r("filter.type")}),c.jsx(Me,{...fh(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(ve,{property:i,separator:!0,children:c.jsx(Fr,{...Zo(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Te,{...xt(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),c.jsx(Me,{...fh(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(ve,{property:l,separator:!0,children:c.jsxs(Fr,{...Zo(l,S),children:[c.jsx(ve,{children:c.jsx(Te,{...xt(l.getProperty("transition-property"),S),label:r("transition.type")})}),c.jsx(ve,{children:c.jsx(Te,{...xt(l.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),c.jsxs(ve,{children:[c.jsx(Me,{...nt(l.getProperty("transition-duration"),S),label:r("transition.duration")}),c.jsx(Me,{...nt(l.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),c.jsx(ve,{property:u,separator:!0,children:c.jsx(Fr,{...Zo(u,S),children:c.jsxs(ve,{children:[c.jsx(Te,{...bw(u,"transform",S),label:r("transform.type")}),c.jsx(Me,{...fh(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(mn,{property:w,...S}),c.jsx(mn,{property:y,...S}),c.jsx(ve,{property:f,children:c.jsx(qt,{...Ur(f,S)})}),c.jsx(ve,{property:[p,g,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(ve,{property:[p,g],children:[c.jsx(Me,{...nt(p,S)}),c.jsx(qt,{...Ur(g,S)})]}),c.jsx(mn,{property:d,...S}),x.length>0&&c.jsx(Br,{properties:x,...S})]})}function V7(e,t){return e.indexOf(t)>=0}const pt=le.s,pu="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",gu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",vw="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",yw="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",I7="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",ph="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function j7({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=$e(),[o,s]=h.useState({}),[a,i]=h.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),f=e.getProperty("align-items"),p=e.getProperty("flex-wrap"),g=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,f,p,g,m,b,v,w].map(F=>F.id),C=e.getProperties().filter(F=>!S.includes(`${F.id}`)),x=F=>r.t(`styleManager.layout.${F}`),E=l.getValue(),P=E==="flex",T=(a.display||"").indexOf("flex")>=0,O=u.getValue(),_=O.indexOf("reverse")>=0,N=!V7(["column","column-reverse"],O),L=[{id:"row",label:c.jsx(se,{icon:X.arrowRight,size:le.sx}),title:x("direction.title.row")},{id:"row-reverse",label:c.jsx(se,{icon:X.arrowRight,size:pt,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:c.jsx(se,{icon:X.arrowDown,size:le.sx}),title:x("direction.title.column")},{id:"column-reverse",label:c.jsx(se,{icon:X.arrowDown,size:pt,vertical:!0}),title:x("direction.title.column-reverse")}],k=[{id:"flex-start",title:x("justify.title.start"),label:c.jsx(se,{icon:pu,size:pt,rotate:N?0:90,horizontal:N&&_,vertical:!N&&_})},{id:"center",title:x("justify.title.center"),label:c.jsx(se,{icon:hu,size:pt,rotate:N?0:90})},{id:"flex-end",title:x("justify.title.end"),label:c.jsx(se,{icon:gu,size:pt,rotate:N?0:90,horizontal:N&&_,vertical:!N&&_})},{id:"space-between",title:x("justify.title.spaceBetween"),label:c.jsx(se,{icon:vw,size:pt,rotate:N?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:c.jsx(se,{icon:yw,size:pt,rotate:N?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:c.jsx(se,{icon:I7,size:pt,rotate:N?0:90})}],B=[{id:"stretch",title:x("align.title.stretch"),label:c.jsx(se,{icon:ph,size:pt,rotate:N?0:90})},{id:"flex-start",title:x("align.title.start"),label:c.jsx(se,{icon:pu,size:pt,rotate:N?90:0})},{id:"center",title:x("align.title.center"),label:c.jsx(se,{icon:hu,size:pt,rotate:N?90:0})},{id:"flex-end",title:x("align.title.end"),label:c.jsx(se,{icon:gu,size:pt,rotate:N?90:0})}],$=[{id:"flex-start",title:x("alignContent.title.start"),label:c.jsx(se,{icon:pu,size:pt,rotate:N?90:0,horizontal:N&&_,vertical:!N&&_})},{id:"center",title:x("alignContent.title.center"),label:c.jsx(se,{icon:hu,size:pt,rotate:N?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:c.jsx(se,{icon:gu,size:pt,rotate:N?90:0,horizontal:N&&_,vertical:!N&&_})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:c.jsx(se,{icon:vw,size:pt,rotate:N?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:c.jsx(se,{icon:yw,size:pt,rotate:N?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:c.jsx(se,{icon:ph,size:pt,rotate:N?0:90})}],z=[{id:"auto",title:x("alignSelf.title.auto"),label:c.jsx(se,{icon:X.close,size:pt})},{id:"flex-start",title:x("alignSelf.title.start"),label:c.jsx(se,{icon:pu,size:pt,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:c.jsx(se,{icon:hu,size:pt,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:c.jsx(se,{icon:gu,size:pt,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:c.jsx(se,{icon:ph,size:pt,rotate:0})}],K=[{id:"0 0 auto",label:c.jsx(se,{icon:X.close,size:pt}),title:x("flex.title.auto")},{id:"1 1 0%",label:c.jsx(se,{icon:X.unfoldMoreHorizontal,size:pt,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(se,{icon:X.unfoldLessHorizontal,size:pt,rotate:90}),title:x("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,V=()=>{const A=n.getSelected();let j={},q={};if(A){const G=A.getEl();if(G){j=window.getComputedStyle(G);const Y=G.parentElement;Y&&(q=window.getComputedStyle(Y))}}s(j),i(q)},D=F.events.target;return n.on(D,V),V(),()=>n.off(D,V)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(Te,{...xt(l,y),...hh,tip:x(`display.tips.${E}`)})}),P&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(qt,{...Ur(u,y),options:L})}),c.jsx(ve,{children:c.jsx(qt,{...Ur(d,y),options:k})}),c.jsx(ve,{children:c.jsx(qt,{...Ur(f,y),options:B})}),c.jsx(ve,{children:c.jsx(mn,{property:v,...y})}),c.jsx(ve,{children:c.jsx(Te,{...xt(p,y),...hh})}),p.getValue()!=="nowrap"&&c.jsx(ve,{children:c.jsx(qt,{...Ur(g,y),options:$})})]}),T&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{separatorTop:!0,children:x("flexChild")}),c.jsx(ve,{children:c.jsx(mn,{property:w,options:K,...y})}),c.jsx(ve,{children:c.jsx(qt,{...Ur(m,y),options:z})}),c.jsx(ve,{children:c.jsx(Me,{...nt(b,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(Br,{properties:C,...y})]})}const D7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function H7({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},f=y=>n.t(`styleManager.position.${y}`),p=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!p.includes(`${y.id}`)),m=D7.map(y=>({id:y,label:f(`presets.options.${y}`)})),b=["absolute","fixed"].includes(o),v=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(ve,{property:r,children:[c.jsx(Te,{...xt(r,d),tip:f(`tips.${(w=r.getOption())==null?void 0:w.id}`),...hh}),b&&c.jsx(H,{children:c.jsx(Dt,{title:f("presets.title"),children:c.jsx(Te,{options:m,onChange:v,emptyState:"P",size:"s",caret:"",value:!0})})})]}),o!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(ve,{col:!0,children:[c.jsx(I,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Me,{...nt(s,d)})}),c.jsxs(I,{gap:"s",children:[c.jsx(H,{grow:!0,children:c.jsx(Me,{...nt(l,d)})}),c.jsx(H,{grow:!0,children:c.jsx(Me,{...nt(a,d)})})]}),c.jsx(I,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Me,{...nt(i,d)})})]}),c.jsx(ve,{children:c.jsx(Me,{...nt(u,d)})})]}),g.length>0&&c.jsx(Br,{properties:g,...d})]})}function F7({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(f=>f==null?void 0:f.id),d=e.getProperties().filter(f=>!u.includes(`${f.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[n,s],children:[c.jsx(Me,{...nt(n,l)}),c.jsx(Me,{...nt(s,l)})]}),c.jsxs(ve,{property:[r,a],children:[c.jsx(Me,{...nt(r,l)}),c.jsx(Me,{...nt(a,l)})]}),c.jsxs(ve,{property:[o,i],children:[c.jsx(Me,{...nt(o,l)}),c.jsx(Me,{...nt(i,l)})]}),d.length>0&&c.jsx(Br,{properties:d,...l})]})}function B7({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(mn,{property:n,...o}),c.jsx(mn,{property:r,...o}),a.length>0&&c.jsx(Br,{properties:a,...o})]})}function z7({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"),f=e.getProperty("text-transform"),p=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},b=[n,r,o,s,a,i,l,u,d,f,p,g].map(y=>y==null?void 0:y.id),v=e.getProperties().filter(y=>!b.includes(`${y.id}`)),{sdkAddFonts:w}=yi();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(ve,{property:n,children:w?c.jsx(Rc,{...xw(n,m)}):c.jsx(Te,{...xt(n,m)})}),!!r&&c.jsx(ve,{property:r,children:c.jsx(co,{...Is(r,m)})}),c.jsxs(ve,{property:[o,s],children:[!!o&&c.jsx(Me,{...nt(o,m)}),!!s&&c.jsx(Te,{...xt(s,m)})]}),c.jsxs(ve,{property:[a,i],children:[!!a&&c.jsx(Me,{...nt(a,m)}),!!i&&c.jsx(Me,{...nt(i,m)})]}),c.jsxs(ve,{property:[l,u],children:[!!l&&c.jsx(Te,{...xt(l,m)}),!!u&&c.jsx(Te,{...xt(u,m)})]}),c.jsxs(ve,{property:[f,p],children:[!!f&&c.jsx(Te,{...xt(f,m)}),!!p&&c.jsx(Te,{...xt(p,m)})]}),c.jsxs(ve,{property:[g,d],children:[!!g&&c.jsx(Te,{...xt(g,m)}),!!d&&c.jsx(Te,{...xt(d,m)})]}),v.length>0&&c.jsx(Br,{properties:v,...m})]})}const hh={row:!0,classNameLabel:"gs-utl-w-full"},U7=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(H,{grow:!1,children:c.jsx(qo,{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(bt,{...o},s))})]}),ww="gs-style-manager",mu=`${ww}-sector`,W7=`${mu}-header`,G7=`${mu}-content`,Sw=(e,t=0,n=!0)=>M(W7,U.bgH2,Ee.xyS,U.br,t&&oe.bt,(e||n)&&oe.bb),q7=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),K7=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),rl=(e,t)=>{const n=Y7(e,t),r=aw(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(U7,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},gh=(e,t)=>{const{connectDataSources:n,commonProps:r}=rl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},Cw=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=rl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:q7(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},Ur=(e,t,n)=>Cw(e,t,n).fieldProps,xt=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=Cw(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},xw=(e,t)=>{const{commonProps:n,connectDataSources:r}=rl(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)}},Zo=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=rl(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)}},nt=(e,t)=>{const{connectDataSources:n,commonProps:r}=rl(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 Y7(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&&Gr(n)&&Ze(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),f=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",p=Uo(f),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:p,dataResolverValue:p?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:f,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:g}}const Is=(e,t)=>gh(e,t),Z7=(e,t)=>{const{label:n,...r}=gh(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()}})}}},X7=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=T7;switch(n){case"gs-layout":r=j7;break;case"gs-size":r=F7;break;case"gs-space":r=B7;break;case"gs-position":r=H7;break;case"gs-borders":r=L7;break;case"gs-effects":r=k7;break;case"gs-typography":r=z7;break;case"gs-background":r=M7;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},mh={},Ew=de(function({className:t,sectors:n}){var p;const[r,o]=h.useState(mh),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();if(h.useEffect(()=>{if(u&&a){const g=setTimeout(()=>{let m=mh;const b=u.get("styleManager");Ze(b)&&(m=b({editor:a,component:u})),o(m||mh)});return()=>clearTimeout(g)}},[u,a]),!i||!l)return null;const d=n.length?n:i.getSectors({visible:!0}),f=(p=s.sdkOptions.dataSources)==null?void 0:p.styleManager;return r.disabled?null:c.jsx("div",{className:M(ww,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(lo,{open:g.isOpen(),onChange:({open:b})=>g.setOpen(b),classNameWrap:M(mu,`${mu}__${g.id}`),sticky:!0,handler:()=>{const b=g.getProperties({withValue:!0}).length>0,v=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(I,{gap:"xs",items:"center",children:[c.jsx(H,{className:"gs-utl-mr-2",children:g.getName()}),b&&c.jsx(H,{children:c.jsx("div",{className:M(Pe.dot,U.bgA2)})}),v&&c.jsx(H,{children:c.jsx("div",{className:M(Pe.dot,U.bgW)})})]})},className:b=>Sw(b,m,m===d.length-1),children:c.jsx(I,{className:M(G7,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:X7(g,{styleManagerDataConfig:f})})},g.id))})}),J7=h.forwardRef(function({children:t,className:n,content:r,...o},s){return c.jsx("div",{className:M(ue("gs-design-manager-tab"),n),ref:s,...o,children:t})}),Pw="gs-cmp-sidebar-right",_w="gs-cmp-traits-provider",bh=M("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function Q7(){var y,S,C;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:r,sdkProps:o,sdkOptions:s,isProjectTypeEmail:a}=ye(),i=$e(),l=M(e&&"gs-utl-hidden"),d=(((y=qn(o.children,J7))==null?void 0:y.filter(Boolean))||[]).map(({props:x},E)=>({id:x.id,label:x.label,content:c.jsx(Ni,{children:x.children}),order:x.order??2+E+1})),f=(S=s.designPanel)==null?void 0:S.propsInStyles,p=(C=s.designPanel)==null?void 0:C.hideTabs,g=f===!0||a&&f!==!1,m=p===!0||a&&p!==!1,b=i.t("traitManager.panelLabel"),w=[{id:"style",label:i.t("styleManager.panelLabel"),order:1,content:c.jsxs(I,{col:!0,full:!0,children:[!!n&&c.jsx(H,{className:M("gs-cmp-selectors-provider",Ee.s,oe.bb,U.br),children:c.jsx(wv,{children:x=>c.jsx(dw,{...x})})}),g&&c.jsx(H,{className:M(_w,bh),children:c.jsx(lo,{handler:b,className:Sw(!1),sticky:!0,open:!0,children:c.jsx(Qf,{children:x=>c.jsx(ah,{...x,className:M("gs-utl-p-2",U.br,oe.bb)})})})}),c.jsx(H,{className:M("gs-cmp-styles-provider",bh),grow:!0,children:c.jsx(Sv,{children:x=>c.jsxs(c.Fragment,{children:[e&&c.jsx(Cv,{}),c.jsx(Ew,{className:l,...x})]})})})]})},!g&&{id:"props",label:b,order:2,content:c.jsx(I,{className:_w,col:!0,full:!0,children:c.jsx(H,{className:M(Ee.s,bh),children:c.jsx(Qf,{children:x=>c.jsx(ah,{...x})})})})},...d].filter(Boolean).sort((x,E)=>x.order-E.order);return c.jsx(I,{className:Pw,col:!0,full:!0,nowrap:!0,children:c.jsx(Fo,{value:t,onChange:r,tabs:w,className:M(`${Pw}__tabs`,m&&"gs-utl-hidden")})})}const Tw=de(Q7),R7="gs-panel-sidebar-tabs",eV=h.memo(de(function({className:t,...n}){return c.jsx(gr,{className:M(R7,"gs-utl-h-full",t),...n,children:c.jsx(Tw,{})})})),tV="gs-panel-styles",nV=h.memo(de(function({className:t,...n}){const{isCssPanelActive:r}=ye(),o=M(r&&" gs-utl-hidden");return c.jsx(gr,{className:M(tV,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(Sv,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(Cv,{}),c.jsx(Ew,{className:o,...s})]})})})})),rV="gs-panel-templates",oV=h.memo(de(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=gb(),{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(gr,{className:M(rV,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(I,{className:ue("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(I,{className:ue("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(i0,{templates:l,projectType:vt[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),sV="gs-cmp-row",aV=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(hn,{className:M(sV,U.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:At(n)})}),iV="gs-cmp-select-field",lV=h.memo(de(function({className:t,style:n,label:r,name:o,value:s,options:a,size:i,onChange:l,required:u,disabled:d,emptyState:f,editorEvents:p}){const{editor:g}=ye(),[m,b]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:f})),v=w=>{l({value:w,editor:g,state:m,setState:y=>b(S=>({...S,...y}))})};return Xo({editor:g,editorEvents:p,localState:m,setLocalState:b}),c.jsx(Te,{classNameContainer:M(iV,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})})),cV="gs-cmp-select-field",uV=h.memo(de(function({className:t,style:n,label:r,name:o,value:s,size:a,onChange:i,required:l,disabled:u,emptyState:d,editorEvents:f}){const{editor:p}=ye(),[g,m]=h.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:p,state:g,setState:w=>m(y=>({...y,...w}))})};return Xo({editor:p,editorEvents:f,localState:g,setLocalState:m}),c.jsx(Rc,{classNameContainer:M(cV,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:b})})),dV="gs-sidebar-bottom",fV=h.memo(de(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(hn,{className:M(dV,"gs-utl-flex gs-utl-transition-spacing",oe.bt,U.br,n),style:u,...s,children:t?At(t):void 0})})),pV=de(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,f=d??n,p=t.resizable===!1,g=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",oe.br,U.br),m=M("gs-utl-w-full",oe.bb,U.br),b=M("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),v=h.useMemo(()=>({marginLeft:s||!a?`-${f}px`:0,...t.style}),[f,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return c.jsx(Jc,{className:g,enable:p?!1:void 0,right:!p,style:v,height:"100%",width:f,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(I,{full:!0,col:!0,children:[l&&c.jsx(H,{className:m,children:c.jsx(yv,{children:C=>c.jsxs(c.Fragment,{children:[qn(u,Jy),c.jsx(Zy,{...C}),qn(u,Xy)]})})}),c.jsx(H,{className:b,grow:!0,children:c.jsx(vv,{children:C=>c.jsxs(c.Fragment,{children:[qn(u,fy),c.jsx(uy,{...C}),qn(u,dy)]})})})]})})}),hV="gs-sidebar-left",gV=h.memo(de(function({children:t,width:n,resizable:r,...o}){return c.jsx(pV,{className:M(hV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",wc(o)),width:n,resizable:r,style:Sc(o),children:t?At(t):void 0})})),mV=de(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=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",oe.bl,U.br),f=h.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),p=()=>o==null?void 0:o.refresh(),g=(b,v,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(Jc,{className:d,enable:u?!1:void 0,left:!u,style:f,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:p,onResizeStop:g,children:t.children??c.jsx(Tw,{})})}),bV="gs-sidebar-right",vV=h.memo(de(function({children:t,resizable:n,...r}){return c.jsx(mV,{className:M(bV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",wc(r)),resizable:n,style:Sc(r),children:t?At(t):void 0})})),yV=de(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})),f=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:At(m.children)})))||[]},[u.tabs]),p=g=>{i&&l?i({value:g,editor:l,state:u,setState:m=>d(b=>({...b,...m}))}):d(m=>({...m,value:g}))};return Xo({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Fo,{tabs:f,className:M(u.className),variant:u.variant,value:u.value,style:u.style,onChange:p})}),wV="gs-cmp-text",SV=h.memo(function({className:t,content:n,children:r,...o}){return c.jsx(hn,{className:M(wV,t),...o,children:r||n})}),CV="gs-cmp-virtual-list",xV=de(function({id:t,items:n,itemLayout:r,itemsPerRow:o=12,className:s,style:a,htmlAttrs:i}){const[l,u]=h.useState(0),{editor:d,transitionTime:f}=ye(),p=cp(o);return h.useEffect(()=>{const g=setTimeout(()=>u(m=>++m),f);return()=>clearTimeout(g)},[f]),!!l&&c.jsx(Dc,{...i,data:n,className:M(CV,"gs-utl-h-full",s),listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${p}`,style:a,itemContent:(g,m)=>c.jsx(h.Fragment,{children:r?At(r({item:m,editor:d})):c.jsx("pre",{children:JSON.stringify(m,void 0,2)})},m.id??g)},t)});var vh=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",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))(vh||{});const EV={icon:se,row:aV,column:n6,text:SV,tabs:yV,button:vc,buttonMenu:DM,buttonGroupField:FM,colorPicker:e6,menuList:K6,inputField:G6,codeField:T$,selectField:lV,selectFontField:uV,devices:u0,panelPages:Qy,panelPageSettings:_9,panelLayers:py,panelPagesLayers:$9,panelBlocks:Ek,panelGlobalStyles:Hk,panelSelectors:v7,panelStyles:nV,panelProperties:a7,panelSidebarTabs:eV,panelAssets:gk,panelTemplates:oV,sidebarRight:vV,sidebarLeft:gV,sidebarTop:d0,sidebarBottom:fV,canvas:_v,canvasSidebarTop:P$,virtualList:xV,dataPathField:I6,panelDataVariablePicker:U6,panelDataConditionPicker:k6,panelDataCollectionPicker:S6,panelDataValuePicker:H6},At=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=AN();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=rt(r)?{type:vh.text,content:r}:r||{},i=a.id||"",l=EV[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),f=i||o;if(u)return c.jsx(Mf,{id:i,...u},f);if(d){const p=d({id:i,...a});return At([p])[0]}else{if(s===vh.custom)return c.jsx(Mf,{id:i,...a},f);if(l)return c.jsx(l,{id:i,...a},f)}return null})},PV=de(({components:e})=>(hb().customLayoutComponents,At(e))),Xo=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:f=>o(p=>({...p,...f}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},_V=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=nN(o.get("name"));r[s]={mime:a[1],name:l,base64:i}}return r},{}),TV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ow=(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(TV(s),"g"),`${o}${a.name}`),a.found=!0}return r},OV=(e,t,n)=>`${t||""}${e||""}${n||""}`,AV=(e,t)=>{const n=e?`<div ${ac}>${e}</div>`:"",r=t?`<div ${ac} data-gjs-global>${t}</div>`:"";return`${n}${r}`},NV=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:f}=t,p={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),b=_V(e),v=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=Ow(w,b,{pathPfx:v}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=f==="skip",P=u?{}:ga(e).globalPageSettings||{},T=[],O=(_,N)=>{var Ht,po,js;const{pageSettingOpts:L}=N||{},k=_.getName(),B=S||(L==null?void 0:L.replaceDataSources),$=Mo(_,"title",L)||k,z=Mo(_,"favicon",L),K=Mo(_,"description",L),F=Mo(_,"keywords",L),V=Mo(_,"socialTitle",L),D=Mo(_,"socialDescription",L),A=Mo(_,"socialImage",L),j=u?"":Km(Mo(_,"fonts")),q=nn({page:_,key:"customCodeHead",opts:L})??"",G=OV(q,P.customCodeHead,j),Y=nn({page:_,key:"customCodeBody",opts:L})??"",Q=d?"":AV(Y,P.customCodeBody),Z=_.getMainComponent(),W=E?"":e.getJs({component:Z}),R=W?`<script>${W}<\/script>`:"",re=[],fe=[],xe={asDocument:!1,...p},ne=Z.toHTML(xe).replace("</body>",()=>`${Q}${R}</body>`),Oe=Z.head;let Ie=$&&`<title>${$}</title>`,ut=z&&`<link rel="icon" href="${z}"/>`,ot=K&&`<meta name="description" content="${K}"/>`,we=F&&`<meta name="keywords" content="${F}"/>`,et=V&&`<meta property="og:title" content="${V}"/>`,tt=D&&`<meta property="og:description" content="${D}"/>`,gt=A&&`<meta property="og:image" content="${A}"/>`,Ne='<meta charset="utf-8">',dt='<meta name="viewport" content="width=device-width,initial-scale=1">',st='<meta name="robots" content="index,follow">',Fe='<meta name="generator" content="GrapesJS Studio">';Oe.components().forEach(Ye=>{const mt=Ye.toHTML(p);it.title({cmp:Ye})?Ie=mt:it.favicon({cmp:Ye})?ut=mt:it.description({cmp:Ye})?ot=mt:it.keywords({cmp:Ye})?we=mt:it.socialTitle({cmp:Ye})?et=mt:it.socialDescription({cmp:Ye})?tt=mt:it.socialImage({cmp:Ye})?gt=mt:it.charset({cmp:Ye})?Ne=mt:it.viewport({cmp:Ye})?dt=mt:it.robots({cmp:Ye})?st=mt:it.generator({cmp:Ye})&&(Fe=mt)}),Ie&&re.push(Ie),Ne&&re.push(Ne),dt&&re.push(dt),st&&re.push(st),Fe&&re.push(Fe),ot&&re.push(ot),we&&re.push(we),et&&re.push(et),tt&&re.push(tt),gt&&re.push(gt),ut&&re.push(ut),fe.length&&re.push(...fe),G&&re.push(G),y&&!(C||x)&&re.push(B?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const ge=Z.doctype||"<!DOCTYPE html>",Ve=(po=(Ht=Z.docEl).__attrToString)==null?void 0:po.call(Ht,p),je=(js=Oe.__attrToString)==null?void 0:js.call(Oe,p),ke=e.getHtml(p).trim(),Et=i?e.runCommand(pc,{mjml:ke}).html:`${ge}
|
|
400
|
-
<html${
|
|
401
|
-
<head${
|
|
402
|
-
${
|
|
334
|
+
}`),t},nr="gs-cmp-selector-manager",Oh={},zw=ce(function(t){var le,ge,Ee;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=we(),[l,u]=h.useState(!1),[d,f]=h.useState([]),[p,g]=h.useState(Oh),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:w}=we(),{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=Oh;const Qe=C==null?void 0:C.get("selectorManager");C&&et(Qe)&&(tt=Qe({editor:b,component:C})),g(tt||Oh),f(E7(b,i))});return()=>clearTimeout(Ce)}},[C,b,x,i]),!b)return null;const{Selectors:E}=b,T=p.disableClasses,_=p.disableComponent,O=T&&_,P=E.getComponentFirst()&&!_,A=E.getSelectedAll(),M=b.getSelectedAll(),$=r.map(Ce=>({id:Ce.getName(),label:Ce.getLabel()})),j=b.getModel(),L=(le=x==null?void 0:x.getDevice)==null?void 0:le.call(x),D=(ge=x==null?void 0:x.getState)==null?void 0:ge.call(x),W=N("gs-utl-overflow-hidden",te.b,te.rnd,z.br),F=N(z.bA),k=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,z.br),H=`${z.bgA}`,V=T7(x),U=A.length>0,J=M.length>0,Y=U||J,X=P&&J||!P&&!U,Q=X?"Components":"Selectors",ee=Ce=>y.t(`selectorManager.${Ce}`),G=y.t("modals.styleCatalog.title"),R=()=>S.open({title:G,content:c.jsx(b7,{})});return c.jsxs(I,{className:nr,gap:"s",col:!0,full:!0,children:[c.jsxs(I,{className:N(`${nr}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(I,{className:N(`${nr}__head-start`),items:"center",gap:"s",children:[c.jsx(B,{className:N(`${nr}__head-title`),children:ee("selection")}),s!==!1&&c.jsx(B,{className:N(`${nr}__style-catalog`),children:c.jsx(Wt,{className:"gs-utl-cursor-pointer",onClick:R,title:G,children:c.jsx(ne,{icon:q.paletteSwatch,size:se.s})})})]}),!!x&&a!==!1&&!O&&c.jsx(B,{className:`${nr}__head-end`,children:c.jsx(Le,{size:"s",value:n,options:$,includeEmpty:!0,onChange:o,emptyState:`- ${ee("state")} -`,className:N(n&&z.bA)})})]}),Y&&!O?c.jsxs(c.Fragment,{children:[!T&&c.jsxs(I,{className:N(`${nr}__field-selectors`,W,!X&&F),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:ee(U?"applyOnSelector":"noSelectors"),className:N(k,!X&&H),onClick:()=>U&&E.setComponentFirst(!1),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:q.tag,size:se.sx})})}),c.jsx(B,{grow:!0,children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Lw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:ee("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Ce=>{Ce&&(E.addSelected(Ce.id||Ce.label),u(!1))}}):c.jsxs(c.Fragment,{children:[J&&c.jsx(Ct,{title:ee("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(ne,{icon:q.plus,size:se.sx})}),A.map(Ce=>c.jsx(y7,{selector:Ce,removable:J,toggleable:J&&A.filter(tt=>tt.getActive()||tt===Ce).length>1},Ce.toString()))]})})})]}),!_&&c.jsxs(I,{className:N(`${nr}__field-components`,W,X&&F),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:ee(J?"applyOnComponents":"noComponents"),onClick:()=>J&&E.setComponentFirst(!0),className:N(k,X&&H),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:q.targetVariant,size:se.sx})})}),c.jsx(B,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:M.map(Ce=>c.jsx(Ko,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>j.setHovered(Ce),onPointerOut:()=>j.setHovered(),label:Ce.getName()},Ce.getId()))})})]}),c.jsxs(I,{className:`${nr}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:ee("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:V}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:ee("currentSelection")})]}),children:c.jsx(Ko,{className:N(te.b,te.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(ne,{icon:q.target,size:se.sx})})}),c.jsx(B,{className:"gs-utl-text-sm",children:c.jsx(Ko,{className:N(te.b,te.rnd,z.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(Wt,{title:c.jsxs(c.Fragment,{children:[ee("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[ee("target"),": ",c.jsx("b",{children:Q}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Ee=x==null?void 0:x.selectorsToString)==null?void 0:Ee.call(x,{skipState:1})]})]}),children:c.jsx(ne,{icon:X?q.targetVariant:q.tag,size:se.sx})}),!!D&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[ee("state"),": ",c.jsx("b",{children:D.getLabel()})]}),children:c.jsx(ne,{icon:q.flare,size:se.sx})})]})]})})}),c.jsx(Ct,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(ne,{icon:q.codeBraces,size:se.sx})})]})]}):c.jsxs(I,{className:N(`${nr}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(B,{className:`${nr}__empty-state-title`,children:ee("noSelecton")}),c.jsxs("ul",{className:N(`${nr}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:ee("selectFromCanvas")}),c.jsx("li",{children:ee("selectFromList")})]})]})]})}),P7="gs-panel-selectors",O7=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(Cr,{className:N(P7,t),...o,children:c.jsx(_b,{children:s=>c.jsx(zw,{...s,styleCatalog:n,stateSelector:r})})})}));function rs({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,tooltip:l,skipClear:u,className:d,...f}){const p=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,...f},x=N("gs-utl-flex-1",m&&!a&&z.tAo);return t&&!t.isVisible()?null:c.jsxs(I,{gap:"xs",...C,children:[c.jsxs(I,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(B,{children:c.jsx(Wt,{title:l,children:c.jsx(ne,{icon:q.information,size:se.sx})})}),c.jsx(B,{children:r?c.jsx("span",{children:" "}):p}),!!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(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:y?q.targetVariant:q.tag,size:se.sx})}),c.jsxs(B,{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(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:q.flare,size:se.sx})}),c.jsx(B,{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",z.bgW)})}),m&&!a&&!u&&c.jsx(Wt,{title:"Clear value",onClick:S,children:c.jsx(ne,{className:Pe.click,icon:q.close,size:se.s2x})})]}),!!s&&c.jsx(B,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function Tu(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 _7=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,A7=/,(?![^(]*\))/,_h=/\s(?![^(]*\))/,L7=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Ah=/^circle|ellipse/i,Lh=e=>{var d;const t=[],{name:n,value:r}=Tu(e),[o,...s]=r.split(A7).map(f=>f.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(_7.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if(L7.test(i))l.type="size",l.value=i;else if(Ah.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const f=((d=i.match(Ah))==null?void 0:d[0])||"circle";l.shape=f;const p={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=i.replace(Ah,"").trim().split("at").map(b=>b.trim());if(m){const[b,w]=m.split(_h);p.x=b,p.y=w||b}if(v){const[b,w]=v.split(_h);g.x=b,g.y=w||b}l.size=p,l.position=g}return u.forEach(f=>{const[p,g]=f.split(_h);t.push({color:p,hint:g?parseFloat(g):null})}),t.forEach((f,p)=>{f.hint===null&&(f.hint=p/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},os=({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"},M7=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),N7="gs-cmp-grad-picker";function $7({className:e,value:t,onChange:n}){var D,W,F;const r=Lh(t),[o,s]=h.useState(r.colorStops),[a,i]=h.useState(null),l=h.useRef(null),u=Z(N7,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=r.name||"linear-gradient",f=d.indexOf("radial")>=0,p=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(D=r.orientation.size)==null?void 0:D.x}`)||0}`,b=`${parseFloat(`${(W=r.orientation.position)==null?void 0:W.x}`)||0}`,w=`${parseFloat(`${(F=r.orientation.position)==null?void 0:F.y}`)||0}`,y=0,S=100,C=(k,H=!1)=>{const V=M7(k);s(V),n==null||n(os({name:d,orientation:g,stops:V}),H)},x=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${k}deg`}),H)},E=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${k}px at ${b}% ${w}%`}),H)},T=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${v}px at ${k}% ${w}%`}),H)},_=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${v}px at ${b}% ${k}%`}),H)},O=k=>{const H=`${k?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(os({stops:o,orientation:g,name:H}))},P=k=>{const H=`${p?"repeating-":""}${k?"radial":"linear"}-gradient`;n==null||n(os({stops:o,orientation:k?"100px at 50% 50%":"90deg",name:H}))};h.useEffect(()=>{if(!a)return;const k=parseFloat(`${a.stop.hint}`),H=U=>{let Y=(U.clientX-a.x)*100;Y=Y/a.w,Y=k+Y,Y=Y<y?y:Y,Y=Y>S?S:Y,a.stop.hint=parseInt(`${Y}`,10),C(o,!0)},V=()=>{i(null),C(o)};return window.addEventListener("pointermove",H),window.addEventListener("pointerup",V),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),V()}},[a]);const A=(k,H)=>{const V=l.current;i({stop:H,w:(V==null?void 0:V.clientWidth)||0,h:(V==null?void 0:V.clientHeight)||0,x:k.clientX,y:k.clientY})},M=k=>{const H=l.current,V=(H==null?void 0:H.clientWidth)||0,U=(H==null?void 0:H.clientHeight)||0,J=k.nativeEvent.offsetX-((H==null?void 0:H.clientLeft)||0),Y=k.nativeEvent.offsetY-((H==null?void 0:H.clientTop)||0),X=J/V*100,Q=document.createElement("canvas"),ee=Q.getContext("2d");if(!ee)return;Q.width=V,Q.height=U;const G=ee.createLinearGradient(0,0,V,U);o.forEach(Ce=>G.addColorStop(parseFloat(`${Ce.hint}`)/100,Ce.color)),ee.fillStyle=G,ee.fillRect(0,0,Q.width,Q.height),Q.style.background="black";const R=ee.getImageData(J,Y,1,1).data,le=R[3]?(100/255*R[3]/100).toFixed(2):0,ge=`rgba(${R[0]}, ${R[1]}, ${R[2]}, ${le})`,Ee=ge==="rgba(0, 0, 0, 0)"?"#000":ge;C([...o,{color:Ee,hint:X}])},$=k=>{C(o.filter(H=>H!==k))},j=(k,H,V)=>{H&&(k.color=H),C(o,V)},L=k=>(a==null?void 0:a.stop)===k;return c.jsxs(I,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx("div",{className:Z("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:Z("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:Z("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:Z("w-full h-full cursor-cross",te.b,te.rnd,z.br),style:{backgroundImage:os({stops:o})},onClick:M})}),o.map((k,H)=>c.jsxs("div",{className:Z("absolute top-0 h-full"),style:{left:`${k.hint}%`},children:[c.jsx("div",{className:Z("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>$(k),children:c.jsx(ne,{icon:q.close,size:se.s3x})}),c.jsx("div",{onPointerDown:V=>A(V,k),className:Z("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,L(k)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:Z("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(My,{value:k.color,onChange:(V,U)=>j(k,V,U),className:Z("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},H))]}),c.jsxs(I,{space:"s",items:"center",children:[c.jsx(B,{grow:!0,children:c.jsx(tl,{label:"Repeat",value:p,onChange:O})}),c.jsx(B,{grow:!0,children:c.jsx(tl,{label:"Radial",value:f,onChange:P})})]}),f?c.jsxs(I,{space:"s",col:!0,children:[c.jsx(B,{children:c.jsx(I,{space:"s",items:"center",children:c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"S",size:"s",value:v,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(B,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"X",size:"s",value:b,onChange:T,valueUnit:"%",units:["%"]})}),c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"Y",size:"s",value:w,onChange:_,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(I,{space:"s",items:"center",nowrap:!0,children:c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const k7="gs-sm-custom-type",I7=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:k7,ref:r})});function Uw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const Ww="gs-cmp-style-field";function Gw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=N(Ww,`${Ww}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(hu,{className:o,...eS(e,s),...r});case"number":case"slider":case"integer":return c.jsx($e,{className:o,...lt(e,s),...r});case"color":return c.jsx(vo,{className:o,...Gs(e,s),...r});case"select":return c.jsx(Le,{className:o,...Lt(e,s),...r});case"radio":return c.jsx(Qt,{className:o,...Jr(e,s),...r});case"file":return c.jsx(ll,{className:o,...oV(e,s),...r});case"composite":return c.jsx(xn,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Zr,{className:o,...as(e,s),children:c.jsx(Yr,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(I7,{editor:a,property:e}):c.jsx(rt,{className:o,...Ih(e,s)})}}}const qw="gs-cmp-style-prop-row";function Yr({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(qw,`${qw}__${s}`,Uw(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(Gw,{property:o,...r})},s):null})})}function V7({sector:e,styleManagerDataConfig:t}){const n=Ai(),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(Yr,{properties:r,sector:e,styleManagerDataConfig:t})})}const H7="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:Z("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,z.br)}),l=Z(H7,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(f=>f.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(I,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function vl(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 f={property:i.getName()};return c.jsx(Le,{...Lt(e,l,f),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,f)||u:"Custom",onChange:p=>t.all.map(g=>g.upValue(p))}:{},label:void 0})}else return r==="color"?c.jsx(vo,{...Gs(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f}))}:{},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,f)=>t.all.map(p=>p.upValue(d,{partial:f})),onChangeUnit:d=>t.all.map(f=>f.upUnit(d))}:{},label:void 0})}const Pu="gs-cmp-style-prop-composite";function xn({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 f={id:"custom",label:c.jsx(ne,{icon:q.borderStyle,size:se.s}),title:"Custom"},p=[{id:"all",label:c.jsx(ne,{icon:q.borderAllVariant,size:se.s}),title:"All"},f],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,w,y,S]=m,C=b.getFullValue(),E=m.map(F=>F.getFullValue()).every(F=>F===C),T=u!==null?u:E||l?"all":f.id,_=l?[...l,f]:[],O=t.getFullValue(),P=_.some(F=>F.id===O),A=T===f.id||(l?!P:!1)||!!a,M={compact:s,sector:n,styleManagerDataConfig:r},$=c.jsx(rs,{property:s?null:b,shallow:!g,children:vl(b,null,M)}),j=c.jsx(rs,{property:s?null:w,shallow:!g,children:vl(w,null,M)}),L=!!y&&c.jsx(rs,{property:s?null:y,shallow:!g,children:vl(y,null,M)}),D=!!S&&c.jsx(rs,{property:s?null:S,shallow:!g,children:vl(S,null,M)}),W=s?{label:t.getLabel()}:{property:t};return c.jsxs(I,{className:Z(Pu,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(be,{className:`${Pu}__main`,children:c.jsx(rs,{...W,children:!a&&c.jsx(be,{bottom:"0",children:i!==void 0?i:l?c.jsx(c.Fragment,{children:c.jsx(B,{grow:!0,children:c.jsx(Qt,{size:"s",options:_,value:A?f.id:O,onChange:F=>{F===f.id?d(F):(t.upValue(F),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(B,{grow:!0,children:vl(b,{same:E,all:m},M)}),c.jsx(B,{grow:!0,children:c.jsx(Qt,{size:"s",options:p,value:T,onChange:d})})]})})})}),A&&c.jsx(be,{col:!0,className:Z(`${Pu}__details`,"gjs-px-2 gjs-py-1",z.bgH2,te.rnd,te.b,z.br),children:a?c.jsx("div",{className:Z(`${Pu}__props`,"grid grid-cols-2 gap-2"),children:m.map(F=>c.jsx(rs,{property:F,shallow:!g,className:Z(Uw(F)&&"col-span-full"),children:c.jsx(Gw,{property:F,...M,fieldProps:{label:void 0}})},F.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{space:"s",children:c.jsx(B,{grow:!0,children:L})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:L})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:$}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:L})]})})]})}var ss=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(ss||{});const Ou="background-image",Xr="__background-type",bl=Ou,Kw="https://placehold.co/150/777/white.png?text=IMAGE",Mh="50px",j7={[Xr]:"image","background-image":`url("${Kw}")`,"background-size":`${Mh} ${Mh}`,"background-repeat":"repeat","background-position":"0px 0px"},D7=e=>(e.includes("gradient(")?Lh(e).colorStops[0].color:e)||"";function F7({sector:e,styleManagerDataConfig:t}){var C;const n=Di(),r=e.getProperty("background"),o=r.getProperty(Xr),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},f=[r,l,u].map(x=>x==null?void 0:x.id),p=e.getProperties().filter(x=>!f.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 T=E.getSrc();s.upValue(`url("${T}")`),x.close()}})},y=x=>{let E="none",T="100%";x==="image"?(E=`url("${Kw}")`,T=Mh):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(`${T} ${T}`)},S=nV(o,[{id:"image",label:c.jsx(ne,{icon:q.image,size:se.s})},{id:"gradient",label:c.jsx(ne,{icon:q.gradientVertical,size:se.s})},{id:"color",label:c.jsx(ne,{icon:q.checkboxBlank,size:se.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(be,{property:r,separator:!0,children:c.jsxs(Zr,{...as(r,d,j7),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(o,d),options:S,onChange:y,label:void 0})}),c.jsx(be,{children:c.jsxs(rs,{children:[v&&c.jsx(ll,{value:Tu(b).value,onOpen:w}),m==="color"&&c.jsx(vo,{...Gs(s,d),value:D7(b),label:void 0}),m==="gradient"&&c.jsx($7,{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(xn,{property:a,...d})}),c.jsx(be,{col:!0,children:c.jsx(xn,{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(vo,{...Gs(l,d)})}),c.jsx(be,{property:u,children:c.jsx(Le,{...Lt(u,d)})}),p.length>0&&c.jsx(Yr,{properties:p,...d})]})}function B7({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(xn,{property:n,corners:!0,...a}),c.jsx(xn,{property:r,...a}),c.jsx(xn,{property:o,...a}),c.jsx(xn,{property:s,...a}),l.length>0&&c.jsx(Yr,{properties:l,...a})]})}const Ws=e=>ou({value:parseFloat(e),min:-3,max:3}),Nh=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=E6(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})}}},Zw=(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("")}}},z7={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function U7({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"),f=e.getProperty("backface-visibility"),p=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,f,p,g,m,v,b,w,y].map(_=>_==null?void 0:_.id),x=e.getProperties().filter(_=>!C.includes(`${_.id}`)),E=_=>{const{boxShadowH:O,boxShadowV:P,boxShadowBlur:A,boxShadowColor:M,boxShadowSpread:$,boxShadowType:j}=_.getValues({camelCase:!0}),L=Ws(O),D=Ws(P),W=Ws(A),F=Ws($),k=`${L}px ${D}px ${W}px ${F}px ${M} ${j}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A," ",$]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:k}})})]})},T=_=>{const{textShadowH:O,textShadowV:P,textShadowBlur:A,textShadowColor:M}=_.getValues({camelCase:!0}),$=Ws(O),j=Ws(P),L=Ws(A),D=`${$}px ${j}px ${L}px ${M}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:D}})})]})};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(Zr,{...as(o,S),renderItem:E,children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(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(vo,{...Gs(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(be,{property:s,separator:!0,children:c.jsxs(Zr,{...as(s,S,z7),renderItem:T,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(vo,{...Gs(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(be,{property:a,separator:!0,children:c.jsx(Zr,{...as(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(a,"filter",S),label:r("filter.type")}),c.jsx($e,{...Nh(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(be,{property:i,separator:!0,children:c.jsx(Zr,{...as(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,{...Nh(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(be,{property:l,separator:!0,children:c.jsxs(Zr,{...as(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(Zr,{...as(u,S),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(u,"transform",S),label:r("transform.type")}),c.jsx($e,{...Nh(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(xn,{property:w,...S}),c.jsx(xn,{property:y,...S}),c.jsx(be,{property:f,children:c.jsx(Qt,{...Jr(f,S)})}),c.jsx(be,{property:[p,g,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(be,{property:[p,g],children:[c.jsx($e,{...lt(p,S)}),c.jsx(Qt,{...Jr(g,S)})]}),c.jsx(xn,{property:d,...S}),x.length>0&&c.jsx(Yr,{properties:x,...S})]})}function W7(e,t){return e.indexOf(t)>=0}const bt=se.s,_u="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Au="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",Lu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Yw="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",Xw="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",G7="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",$h="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function q7({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"),f=e.getProperty("align-items"),p=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,f,p,g,m,v,b,w].map(F=>F.id),C=e.getProperties().filter(F=>!S.includes(`${F.id}`)),x=F=>r.t(`styleManager.layout.${F}`),E=l.getValue(),T=E==="flex",_=(a.display||"").indexOf("flex")>=0,O=u.getValue(),P=O.indexOf("reverse")>=0,A=!W7(["column","column-reverse"],O),M=[{id:"row",label:c.jsx(ne,{icon:q.arrowRight,size:se.sx}),title:x("direction.title.row")},{id:"row-reverse",label:c.jsx(ne,{icon:q.arrowRight,size:bt,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:c.jsx(ne,{icon:q.arrowDown,size:se.sx}),title:x("direction.title.column")},{id:"column-reverse",label:c.jsx(ne,{icon:q.arrowDown,size:bt,vertical:!0}),title:x("direction.title.column-reverse")}],$=[{id:"flex-start",title:x("justify.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("justify.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?0:90})},{id:"flex-end",title:x("justify.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("justify.title.spaceBetween"),label:c.jsx(ne,{icon:Yw,size:bt,rotate:A?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:c.jsx(ne,{icon:Xw,size:bt,rotate:A?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:c.jsx(ne,{icon:G7,size:bt,rotate:A?0:90})}],j=[{id:"stretch",title:x("align.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:A?0:90})},{id:"flex-start",title:x("align.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?90:0})},{id:"center",title:x("align.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("align.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?90:0})}],L=[{id:"flex-start",title:x("alignContent.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("alignContent.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:c.jsx(ne,{icon:Yw,size:bt,rotate:A?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:c.jsx(ne,{icon:Xw,size:bt,rotate:A?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:A?0:90})}],D=[{id:"auto",title:x("alignSelf.title.auto"),label:c.jsx(ne,{icon:q.close,size:bt})},{id:"flex-start",title:x("alignSelf.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:0})}],W=[{id:"0 0 auto",label:c.jsx(ne,{icon:q.close,size:bt}),title:x("flex.title.auto")},{id:"1 1 0%",label:c.jsx(ne,{icon:q.unfoldMoreHorizontal,size:bt,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(ne,{icon:q.unfoldLessHorizontal,size:bt,rotate:90}),title:x("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,k=()=>{const V=n.getSelected();let U={},J={};if(V){const Y=V.getEl();if(Y){U=window.getComputedStyle(Y);const X=Y.parentElement;X&&(J=window.getComputedStyle(X))}}s(U),i(J)},H=F.events.target;return n.on(H,k),k(),()=>n.off(H,k)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l,y),...kh,tip:x(`display.tips.${E}`)})}),T&&c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(u,y),options:M})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(d,y),options:$})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(f,y),options:j})}),c.jsx(be,{children:c.jsx(xn,{property:b,...y})}),c.jsx(be,{children:c.jsx(Le,{...Lt(p,y),...kh})}),p.getValue()!=="nowrap"&&c.jsx(be,{children:c.jsx(Qt,{...Jr(g,y),options:L})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(be,{separatorTop:!0,children:x("flexChild")}),c.jsx(be,{children:c.jsx(xn,{property:w,options:W,...y})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(m,y),options:D})}),c.jsx(be,{children:c.jsx($e,{...lt(v,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(Yr,{properties:C,...y})]})}const K7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function Z7({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},f=y=>n.t(`styleManager.position.${y}`),p=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!p.includes(`${y.id}`)),m=K7.map(y=>({id:y,label:f(`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:f(`tips.${(w=r.getOption())==null?void 0:w.id}`),...kh}),v&&c.jsx(B,{children:c.jsx(Wt,{title:f("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(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx($e,{...lt(s,d)})}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx($e,{...lt(l,d)})}),c.jsx(B,{grow:!0,children:c.jsx($e,{...lt(a,d)})})]}),c.jsx(I,{className:Z("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(Yr,{properties:g,...d})]})}function Y7({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(f=>f==null?void 0:f.id),d=e.getProperties().filter(f=>!u.includes(`${f.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(Yr,{properties:d,...l})]})}function X7({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(xn,{property:n,...o}),c.jsx(xn,{property:r,...o}),a.length>0&&c.jsx(Yr,{properties:a,...o})]})}function J7({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"),f=e.getProperty("text-transform"),p=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},v=[n,r,o,s,a,i,l,u,d,f,p,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:w}=Ai();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(be,{property:n,children:w?c.jsx(hu,{...eS(n,m)}):c.jsx(Le,{...Lt(n,m)})}),!!r&&c.jsx(be,{property:r,children:c.jsx(vo,{...Gs(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:[f,p],children:[!!f&&c.jsx(Le,{...Lt(f,m)}),!!p&&c.jsx(Le,{...Lt(p,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(Yr,{properties:b,...m})]})}const kh={row:!0,classNameLabel:"gs-utl-w-full"},Q7=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(B,{grow:!1,children:c.jsx(rs,{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(Ct,{...o},s))})]}),Jw="gs-style-manager",Mu=`${Jw}-sector`,R7=`${Mu}-header`,eV=`${Mu}-content`,Qw=(e,t=0,n=!0)=>N(R7,z.bgH2,Te.xyS,z.br,t&&te.bt,(e||n)&&te.bb),tV=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),nV=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),yl=(e,t)=>{const n=rV(e,t),r=Hw(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(Q7,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},Ih=(e,t)=>{const{connectDataSources:n,commonProps:r}=yl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},Rw=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=yl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:tV(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},Jr=(e,t,n)=>Rw(e,t,n).fieldProps,Lt=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=Rw(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},eS=(e,t)=>{const{commonProps:n,connectDataSources:r}=yl(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)}},as=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=yl(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}=yl(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 rV(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&&Rr(n)&&et(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),f=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",p=es(f),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:p,dataResolverValue:p?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:f,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 Gs=(e,t)=>Ih(e,t),oV=(e,t)=>{const{label:n,...r}=Ih(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()}})}}},sV=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=V7;switch(n){case"gs-layout":r=q7;break;case"gs-size":r=Y7;break;case"gs-space":r=X7;break;case"gs-position":r=Z7;break;case"gs-borders":r=B7;break;case"gs-effects":r=U7;break;case"gs-typography":r=J7;break;case"gs-background":r=F7;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},Vh={},tS=ce(function({className:t,sectors:n}){var p;const[r,o]=h.useState(Vh),s=we(),{editor:a}=s,i=a==null?void 0:a.Styles,l=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected();if(h.useEffect(()=>{if(u&&a){const g=setTimeout(()=>{let m=Vh;const v=u.get("styleManager");et(v)&&(m=v({editor:a,component:u})),o(m||Vh)});return()=>clearTimeout(g)}},[u,a]),!i||!l)return null;const d=n.length?n:i.getSectors({visible:!0}),f=(p=s.sdkOptions.dataSources)==null?void 0:p.styleManager;return r.disabled?null:c.jsx("div",{className:N(Jw,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(mo,{open:g.isOpen(),onChange:({open:v})=>g.setOpen(v),classNameWrap:N(Mu,`${Mu}__${g.id}`),sticky:!0,handler:()=>{const v=g.getProperties({withValue:!0}).length>0,b=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(I,{gap:"xs",items:"center",children:[c.jsx(B,{className:"gs-utl-mr-2",children:g.getName()}),v&&c.jsx(B,{children:c.jsx("div",{className:N(Pe.dot,z.bgA2)})}),b&&c.jsx(B,{children:c.jsx("div",{className:N(Pe.dot,z.bgW)})})]})},className:v=>Qw(v,m,m===d.length-1),children:c.jsx(I,{className:N(eV,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:sV(g,{styleManagerDataConfig:f})})},g.id))})}),aV=h.forwardRef(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})}),nS="gs-cmp-sidebar-right",rS="gs-cmp-traits-provider",Hh=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function iV(){var y,S,C;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:r,sdkProps:o,sdkOptions:s,isProjectTypeEmail:a}=we(),i=Ie(),l=N(e&&"gs-utl-hidden"),d=(((y=Xn(o.children,aV))==null?void 0:y.filter(Boolean))||[]).map(({props:x},E)=>({id:x.id,label:x.label,content:c.jsx(Fi,{children:x.children}),order:x.order??2+E+1})),f=(S=s.designPanel)==null?void 0:S.propsInStyles,p=(C=s.designPanel)==null?void 0:C.hideTabs,g=f===!0||a&&f!==!1,m=p===!0||a&&p!==!1,v=i.t("traitManager.panelLabel"),w=[{id:"style",label:i.t("styleManager.panelLabel"),order:1,content:c.jsxs(I,{col:!0,full:!0,children:[!!n&&c.jsx(B,{className:N("gs-cmp-selectors-provider",Te.s,te.bb,z.br),children:c.jsx(_b,{children:x=>c.jsx(zw,{...x})})}),g&&c.jsx(B,{className:N(rS,Hh),children:c.jsx(mo,{handler:v,className:Qw(!1),sticky:!0,open:!0,children:c.jsx(ip,{children:x=>c.jsx(Ph,{...x,className:N("gs-utl-p-2",z.br,te.bb)})})})}),c.jsx(B,{className:N("gs-cmp-styles-provider",Hh),grow:!0,children:c.jsx(Ab,{children:x=>c.jsxs(c.Fragment,{children:[e&&c.jsx(Lb,{}),c.jsx(tS,{className:l,...x})]})})})]})},!g&&{id:"props",label:v,order:2,content:c.jsx(I,{className:rS,col:!0,full:!0,children:c.jsx(B,{className:N(Te.s,Hh),children:c.jsx(ip,{children:x=>c.jsx(Ph,{...x})})})})},...d].filter(Boolean).sort((x,E)=>x.order-E.order);return c.jsx(I,{className:nS,col:!0,full:!0,nowrap:!0,children:c.jsx(Zo,{value:t,onChange:r,tabs:w,className:N(`${nS}__tabs`,m&&"gs-utl-hidden")})})}const oS=ce(iV),lV="gs-panel-sidebar-tabs",cV=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(lV,"gs-utl-h-full",t),...n,children:c.jsx(oS,{})})})),uV="gs-panel-styles",dV=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:r}=we(),o=N(r&&" gs-utl-hidden");return c.jsx(Cr,{className:N(uV,"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(Ab,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(Lb,{}),c.jsx(tS,{className:o,...s})]})})})})),fV="gs-panel-templates",pV=h.memo(ce(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=xv(),{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(Cr,{className:N(fV,"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:ae("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(I,{className:ae("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(j0,{templates:l,projectType:xt[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),hV="gs-cmp-row",gV=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(Cn,{className:N(hV,z.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:$t(n)})}),mV="gs-cmp-select-field",vV=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:f,editorEvents:p}){const{editor:g}=we(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:f})),b=w=>{l({value:w,editor:g,state:m,setState:y=>v(S=>({...S,...y}))})};return is({editor:g,editorEvents:p,localState:m,setLocalState:v}),c.jsx(Le,{classNameContainer:N(mV,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})})),bV="gs-cmp-select-field",yV=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:f}){const{editor:p}=we(),[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:p,state:g,setState:w=>m(y=>({...y,...w}))})};return is({editor:p,editorEvents:f,localState:g,setLocalState:m}),c.jsx(hu,{classNameContainer:N(bV,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})})),wV="gs-sidebar-bottom",SV=h.memo(ce(function({children:t,className:n,style:r,height:o,...s}){const{isInPreview:a,isBottomSidebarOpen:i}=we(),l=o??35,u=h.useMemo(()=>({height:l,marginBottom:a||!i?`-${l}px`:0,...r}),[a,i,r]);return c.jsx(Cn,{className:N(wV,"gs-utl-flex gs-utl-transition-spacing",te.bt,z.br,n),style:u,...s,children:t?$t(t):void 0})})),CV=ce(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:o,isInPreview:s,isLeftSidebarOpen:a,sdkProps:i,showPages:l}=we(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,f=d??n,p=t.resizable===!1,g=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,z.br),m=N("gs-utl-w-full",te.bb,z.br),v=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:s||!a?`-${f}px`:0,...t.style}),[f,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return c.jsx(fu,{className:g,enable:p?!1:void 0,right:!p,style:b,height:"100%",width:f,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(I,{full:!0,col:!0,children:[l&&c.jsx(B,{className:m,children:c.jsx(Ob,{children:C=>c.jsxs(c.Fragment,{children:[Xn(u,_w),c.jsx(Pw,{...C}),Xn(u,Ow)]})})}),c.jsx(B,{className:v,grow:!0,children:c.jsx(Pb,{children:C=>c.jsxs(c.Fragment,{children:[Xn(u,Uy),c.jsx(By,{...C}),Xn(u,zy)]})})})]})})}),xV="gs-sidebar-left",EV=h.memo(ce(function({children:t,width:n,resizable:r,...o}){return c.jsx(CV,{className:N(xV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",kc(o)),width:n,resizable:r,style:Ic(o),children:t?$t(t):void 0})})),TV=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:o,isInPreview:s,isRightSidebarOpen:a}=we(),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,z.br),f=h.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),p=()=>o==null?void 0:o.refresh(),g=(v,b,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(fu,{className:d,enable:u?!1:void 0,left:!u,style:f,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:p,onResizeStop:g,children:t.children??c.jsx(oS,{})})}),PV="gs-sidebar-right",OV=h.memo(ce(function({children:t,resizable:n,...r}){return c.jsx(TV,{className:N(PV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",kc(r)),resizable:n,style:Ic(r),children:t?$t(t):void 0})})),_V=ce(function({className:t,variant:n,value:r,tabs:o,style:s,editorEvents:a,onChange:i}){const{editor:l}=we(),[u,d]=h.useState(()=>({tabs:o,style:s,value:r,variant:n,className:t})),f=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:$t(m.children)})))||[]},[u.tabs]),p=g=>{i&&l?i({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return is({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Zo,{tabs:f,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:p})}),AV="gs-cmp-text",LV=h.memo(function({className:t,content:n,children:r,...o}){return c.jsx(Cn,{className:N(AV,t),...o,children:r||n})}),MV="gs-cmp-virtual-list",NV=ce(function({id:t,items:n,itemLayout:r,footerLayout:o,onRef:s,itemsPerRow:a=12,className:i,style:l,htmlAttrs:u}){const[d,f]=h.useState(0),{editor:p,transitionTime:g}=we(),m=Ap(a),v=a===1;h.useEffect(()=>{const S=setTimeout(()=>f(C=>++C),g);return()=>clearTimeout(S)},[g]);const b={id:t,...u},w=!!d&&!!p,y={data:n,style:l,className:N(MV,"gs-utl-h-full",i),itemContent:(S,C)=>c.jsx(h.Fragment,{children:r?$t(r({item:C,index:S,editor:p})):c.jsx("pre",{children:JSON.stringify(C,void 0,2)})},C.id??S),components:{Footer:o&&p?()=>$t(o({editor:p})):void 0}};return w&&(v?c.jsx(J$,{...b,...y,ref:s},t):c.jsx(Rc,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:s},t))});var jh=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",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))(jh||{});const $V={icon:ne,row:gV,column:d6,text:LV,tabs:_V,button:Nc,buttonMenu:hN,buttonGroupField:mN,colorPicker:c6,menuList:n8,inputField:e8,codeField:Vk,selectField:vV,selectFontField:yV,devices:B0,panelPages:Aw,panelPageSettings:I9,panelLayers:Wy,panelPagesLayers:z9,panelBlocks:$8,panelGlobalStyles:Z8,panelSelectors:O7,panelStyles:dV,panelProperties:g7,panelSidebarTabs:cV,panelAssets:E8,panelTemplates:pV,sidebarRight:OV,sidebarLeft:EV,sidebarTop:z0,sidebarBottom:SV,canvas:kb,canvasSidebarTop:kk,virtualList:NV,dataPathField:G6,panelDataVariablePicker:Q6,panelDataConditionPicker:U6,panelDataCollectionPicker:L6,panelDataValuePicker:Z6},$t=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=s4();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=ct(r)?{type:jh.text,content:r}:r||{},i=a.id||"",l=$V[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),f=i||o;if(u)return c.jsx(Ff,{id:i,...u},f);if(d){const p=d({id:i,...a});return $t([p])[0]}else{if(s===jh.custom)return c.jsx(Ff,{id:i,...a},f);if(l)return c.jsx(l,{id:i,...a},f)}return null})},kV=ce(({components:e})=>(Cv().customLayoutComponents,$t(e))),is=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:f=>o(p=>({...p,...f}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},IV=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=N3(o.get("name"));r[s]={mime:a[1],name:l,base64:i}}return r},{}),VV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sS=(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(VV(s),"g"),`${o}${a.name}`),a.found=!0}return r},HV=(e,t,n)=>`${t||""}${e||""}${n||""}`,jV=(e,t)=>{const n=e?`<div ${wc}>${e}</div>`:"",r=t?`<div ${wc} data-gjs-global>${t}</div>`:"";return`${n}${r}`},DV=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:f}=t,p={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=IV(e),b=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=sS(w,v,{pathPfx:b}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=f==="skip",T=u?{}:Sa(e).globalPageSettings||{},_=[],O=(P,A)=>{var Gt,wo,qs;const{pageSettingOpts:M}=A||{},$=P.getName(),j=S||(M==null?void 0:M.replaceDataSources),L=Do(P,"title",M)||$,D=Do(P,"favicon",M),W=Do(P,"description",M),F=Do(P,"keywords",M),k=Do(P,"socialTitle",M),H=Do(P,"socialDescription",M),V=Do(P,"socialImage",M),U=u?"":tv(Do(P,"fonts")),J=ln({page:P,key:"customCodeHead",opts:M})??"",Y=HV(J,T.customCodeHead,U),X=ln({page:P,key:"customCodeBody",opts:M})??"",Q=d?"":jV(X,T.customCodeBody),ee=P.getMainComponent(),G=E?"":e.getJs({component:ee}),R=G?`<script>${G}<\/script>`:"",le=[],ge=[],Ee={asDocument:!1,...p},Ce=ee.toHTML(Ee).replace("</body>",()=>`${Q}${R}</body>`),tt=ee.head;let Qe=L&&`<title>${L}</title>`,Ot=D&&`<link rel="icon" href="${D}"/>`,ut=W&&`<meta name="description" content="${W}"/>`,Se=F&&`<meta name="keywords" content="${F}"/>`,ot=k&&`<meta property="og:title" content="${k}"/>`,st=H&&`<meta property="og:description" content="${H}"/>`,wt=V&&`<meta property="og:image" content="${V}"/>`,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(p);pt.title({cmp:Re})?Qe=St:pt.favicon({cmp:Re})?Ot=St:pt.description({cmp:Re})?ut=St:pt.keywords({cmp:Re})?Se=St:pt.socialTitle({cmp:Re})?ot=St:pt.socialDescription({cmp:Re})?st=St:pt.socialImage({cmp:Re})?wt=St:pt.charset({cmp:Re})?Ne=St:pt.viewport({cmp:Re})?mt=St:pt.robots({cmp:Re})?dt=St:pt.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(j?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const he=ee.doctype||"<!DOCTYPE html>",De=(wo=(Gt=ee.docEl).__attrToString)==null?void 0:wo.call(Gt,p),Fe=(qs=tt.__attrToString)==null?void 0:qs.call(tt,p),He=e.getHtml(p).trim(),Mt=i?e.runCommand(Oc,{mjml:He}).html:`${he}
|
|
335
|
+
<html${De?` ${De}`:""}>
|
|
336
|
+
<head${Fe?` ${Fe}`:""}>
|
|
337
|
+
${le.join(`
|
|
403
338
|
`)}
|
|
404
339
|
</head>
|
|
405
|
-
${
|
|
340
|
+
${Ce}
|
|
406
341
|
</html>
|
|
407
|
-
`;return{filename:
|
|
342
|
+
`;return{filename:If(e,P),content:sS(Mt,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(P=>{if(Cc(P)){const M=P.getMainComponent(),{dataSourceItem:$}=t,j=$?[$]:M.getDataSourceItems(),L=M.resolverCurrentItem;Object.entries(j).forEach(([D,W])=>{const F=W;M.setResolverCurrentItem(F.id??D);const k=O(P,{pageSettingOpts:{replaceDataSources:!0}}),{path:H,filename:V}=pv(P,{currentItem:F});k.path=H,k.filename=V,_.push(k)}),M.setResolverCurrentItem(L)}else _.push(O(P))}),g.push(..._),i&&m.forEach(P=>{g.push({filename:If(e,P,"mjml"),content:P.getMainComponent().toHTML(p),mimeType:"text/mjml"})});for(const P in v){const A=v[P];A.found&&g.push({path:o,filename:A.name,content:atob(A.base64),mimeType:A.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 FV(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"),f='<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>',p=u&&u!==f&&!d?u:d||f;t.addType(a,{model:{defaults:{icon:p}}})};t.getTypes().forEach(r),e.on("component:type:add",r)}const BV=(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(),f=r.getZoomDecimal();e.runCommand(re.contextMenuComponent,{component:u,event:i,x:i.clientX*f+d.left,y:i.clientY*f+d.top})}})})};function zV(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,f=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(re.layoutRemove,{id:b})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(re.layoutToggle,{...w})},p=({items:m,component:v})=>[{id:`open-${a}-picker`,label:zp,command:()=>f(v)},...m];n.addType(i,{isComponent:m=>wa(m,i),model:{defaults:{...Gp(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:p}}}),n.addType(a,{isComponent:m=>Ti(m,l)||wa(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...Up},model:{defaults:{...Wp(o),icon:u,name:s,attributes:{[l]:!0},toolbarItems:p},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(),f(this.model)}}})}function UV(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,f=Bt.conditionTrue,p=Bt.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
|
|
408
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" />
|
|
409
|
-
</svg>`,
|
|
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(re.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(re.layoutToggle,{...x})},b=({items:y,component:S})=>[{id:`open-${d}-picker`,label:zp,command:()=>v(S)},...y];n.addType(f,{isComponent:y=>wa(y,f),model:{defaults:{...Gp(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(p,{isComponent:y=>wa(y,p),model:{defaults:{...Gp(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)||wa(y,d),block:u&&{label:o,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:f},{type:p}]},...Up},model:{defaults:{...Wp(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,Pn.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 ",T=C.map(_=>{const{left:O="",operator:P="",right:A=""}=_,M=ay(O),$=ay(A);return`(${M} ${P} ${$})`}).join(x);return`${o}: ${T}`},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(re.getStateDataSource).showPlaceholder){x&&(x.style.display="",x.style.setProperty(Bs,`"${this.getConditionString()} "`)),E&&(E.style.display="",E.style.setProperty(Bs,`" ${i} "`));return}const _=y.isTrue();x&&(x.style.removeProperty(Bs),x.style.display=_?"":"none"),E&&(E.style.removeProperty(Bs),E.style.display=_?"none":"")}}})}function WV(e,t){var f;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="${Ul.codeBraces}"/></svg>`,{appStore:l}=t,u=(f=l.sdkOptions.dataSources)==null?void 0:f.blocks,d=p=>{const g="dataVariablePicker",m={id:g,header:!1,layout:{type:"panelDataVariablePicker",component:p,onConfirm:()=>e.runCommand(re.layoutRemove,{id:g})},placer:{type:"dialog",title:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(re.layoutToggle,{...m})};n.addType(o,{isComponent:p=>Ti(p,s)||wa(p,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...Up},model:{defaults:{...Wp(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:p,component:g})=>[{id:`open-${o}-modal`,label:zp,command:()=>d(g)},...p]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:p}=this;this.listenTo(p,Pn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(p){e.getEditing()||(p==null||p.stopPropagation(),d(this.model))},renderDataResolver(){const{model:p,el:g}=this;if(e.runCommand(re.getStateDataSource).showPlaceholder){const v=p.getPath();g.textContent="",g.style.setProperty(Bs,`"${iy(v)}"`);return}g.style.removeProperty(Bs),g.textContent=p.getDataValue()}}})}const Ha=(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 Nu({component:e,value:t,getCustomPath:n}){if(Rr(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 GV(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}>`,f=`</${i}>`;return`${d}${a}${f}`}Ha(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,f=this.__attrToString(s),p=(b=this.getDataResolver)==null?void 0:b.call(this),g=Nu({component:this,value:p,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return a?v:`<${d}${f?` ${f}`:""}>${v}</${d}>`}}),Ha(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,[f,p]=((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(p){const E=a.getConditionElseSyntax(u);v=`
|
|
410
345
|
${l(E)}
|
|
411
|
-
${p.toHTML(s)??""}`}const
|
|
412
|
-
${`${l(
|
|
413
|
-
${(f==null?void 0:f.toHTML(s))??""}${
|
|
346
|
+
${p.toHTML(s)??""}`}const b=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
|
|
347
|
+
${`${l(b)}
|
|
348
|
+
${(f==null?void 0:f.toHTML(s))??""}${v}
|
|
414
349
|
${l(w)}`}
|
|
415
|
-
`},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(
|
|
416
|
-
${
|
|
417
|
-
${u(
|
|
350
|
+
`},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(h6(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:Nu({...i,value:s.left}),right:Nu({...i,value:s.right})}}}),Ha(e,Bt.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=T=>l({component:this,content:T}),d={component:this},f=this.getDataResolver(),p={...f,dataSource:Nu({component:this,value:f==null?void 0:f.dataSource,getCustomPath:s==null?void 0:s.getCustomPath})},g=this.components().at(0),m=i.getCollectionStartSyntax({...d,dataResolver:p}),v=i.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(s))??"",w=`${u(m)}
|
|
351
|
+
${b}
|
|
352
|
+
${u(v)}`;if(a)return`
|
|
418
353
|
${w}
|
|
419
354
|
`;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",x=`<${y}${C}>`,E=`</${y}>`;return`
|
|
420
355
|
${x}${w}${E}
|
|
421
|
-
`}}),
|
|
356
|
+
`}}),Ha(e,Bt.conditionTrue,{toHTML:o}),Ha(e,Bt.conditionFalse,{toHTML:o}),Ha(e,Bt.collectionItem,{toHTML:o})}const qV=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:Hs.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 p=d.createElement("style"),g=[Bt.variable,Bt.condition,Bt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);p.setAttribute(u,""),p.textContent=`
|
|
422
357
|
${g.join(",")} {
|
|
423
358
|
outline: 2px dotted #8b5cf6;
|
|
424
359
|
}
|
|
@@ -431,7 +366,7 @@ ${x}${w}${E}
|
|
|
431
366
|
[data-gjs-type="data-variable"]::before,
|
|
432
367
|
[data-gjs-type="data-condition-true-content"]::before,
|
|
433
368
|
[data-gjs-type="data-condition-false-content"]::before {
|
|
434
|
-
content: var(${
|
|
369
|
+
content: var(${Bs});
|
|
435
370
|
font-style: italic;
|
|
436
371
|
color: #666;
|
|
437
372
|
white-space: nowrap;
|
|
@@ -442,7 +377,7 @@ ${x}${w}${E}
|
|
|
442
377
|
font-weight: 500;
|
|
443
378
|
font-family: sans-serif;
|
|
444
379
|
}
|
|
445
|
-
`,d.head.appendChild(p)}),
|
|
380
|
+
`,d.head.appendChild(p)}),WV(e,t),UV(e,t),zV(e,t),GV(e,{isProjectTypeEmail:s})};function KV(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(f=>f.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:`
|
|
446
381
|
.gjs-typed {
|
|
447
382
|
padding: 5px;
|
|
448
383
|
}
|
|
@@ -450,4 +385,4 @@ ${x}${w}${E}
|
|
|
450
385
|
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
451
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"/>
|
|
452
387
|
</svg>
|
|
453
|
-
`:void 0};o==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(Nw),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const HV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},FV=(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([]))},BV=()=>{const{baseApiUrl:e}=cb();return`${e}/sdk/projects`},Aw=e=>`${BV()}/${e}`,zV=async({licenseKey:e,projectId:t,...n})=>{const r=await Or.put(Aw(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},UV=async(e,t)=>await Or.put(t,{body:e,headers:{"Content-Type":"application/json"}}),WV=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await zV({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 UV(o,a)},GV=(e,t,n)=>Or.get(Aw(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),qV=async e=>await Or.get(e),KV=async(e,t,n,r)=>{const o=await GV(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 qV(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},YV=(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:f,autosaveChanges:p,autosaveIntervalMs:g}=l;let m,b,v,w;if(s)v=d,w=f,m=p,b=g;else if(a){const E=i.licenseKey,P=n.sdkProjectId,T=n.sdkIdentityId,O=10,_=1e4;w=({project:N})=>WV(N,E,P,T),v=({editor:N})=>KV(N,E,P,T),m=Math.max(O,p??O),g&&(b=Math.max(_,g))}const{Storage:y,events:S}=e,{events:C}=y;let x=!1;if(e.once(S.projectLoad,E=>{x=!!E.loaded}),e.once("change:readyLoad",()=>{var P;const E=(P=i.project)==null?void 0:P.default;!x&&E&&e.loadProjectData(E)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(v||u)&&w){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await v({editor:e})).project},async store(P){await w({project:P,editor:e})}}),e.on(C.errorLoad,P=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:P.message})}),e.on(C.errorStore,P=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:P.message})}),m&&y.setStepsBeforeSave(m),b&&e.onReady(()=>{const P=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},b);e.on("destroy",()=>clearInterval(P))})}},vu="select-target",Nw="enable-sm";function ZV(e,t){var $,z,K,F;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:f,nextProjectData:p,sdkOptions:g}=r,m=()=>o.toggleOpen(),b=()=>r.toggleLeftSidebar(),v=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,x=C.events,E=e.events,P=(z=($=g.gjsOptions)==null?void 0:$.assetManager)==null?void 0:z.custom;let T=!1;if(y.all.model.prototype.idAttribute="src",Nt(P)&&(y.getConfig().custom=P),p&&(w.projectData=p,r.setNextProjectData()),f){const V=S.getConfig().options;V&&(V.local.key=f)}e.on(E.projectLoad,({project:V})=>{var D;n.setProjectDataCustom(V.custom||{projectType:(D=r.sdkOptions.project)==null?void 0:D.type}),d.loadFonts()}),e.on(E.projectGet,({project:V})=>{V.custom=ga(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:O}=e,_=Lo(()=>r.setCanvasPanning(!1),200);e.on(O.events.coords,()=>{r.setCanvasPanning(!0),_()}),e.on(O.events.frameLoad,({el:V})=>{V.tabIndex=-1});const{Parser:N}=e,L=((K=r.sdkOptions.parser)==null?void 0:K.showErrors)!==!1;(F=N.events)!=null&&F.css&&L&&e.on(N.events.css,V=>{const{error:D}=V;if(D){const A=rt(D)?D:D.name&&D.reason?`${D.name}: ${D.reason}`:D.message;s.addError("css-error",{header:"CSS Parser Error",content:A})}}),[{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:ae.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:ae.symbolDetach}].forEach(({id:V,keys:D,cmd:A})=>{e.Keymaps.add(`preset:${V}`,D,A,{prevent:!0})}),e.on(`${x.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),sv(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),sv(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const k="target-selection",{Components:B}=e;C.add(vu,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(V,D){const A={id:k,type:"target",component:D};D?O.addSpot(A):O.removeSpots(A)},beforeSelect(V,D={}){D.abort=!0,D.useValid=!1,this.opts.onSelect(V),e.stopCommand(vu)},run(V,D,A){this.opts=A,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),O.removeSpots({id:k}),r.setSelectingTarget(!1)}}),C.add(Nw,()=>{r.setSelectedDesignerTab("style")}),C.add(ae.toastAdd,(V,D,A)=>{s.add(A.id,A)}),C.add(ae.toastRemove,(V,D,A)=>{s.remove(A.id)}),C.add(ae.dialogOpen,(V,D,A)=>{a.open(A)}),C.add(ae.dialogClose,()=>{a.close()}),C.add(ae.dialogExportCode,()=>{a.open({title:e.t("actions.showCode.title"),content:()=>{var V,D;return h.createElement(VM,{options:(D=(V=g.commands)==null?void 0:V.options)==null?void 0:D[dr.showCode]})}})}),C.add(ae.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(ae.sidebarLeftSet,(V,D,A)=>{r.setLeftSidebarOpen(!!A.visible)}),C.add(ae.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(ae.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(ae.sidebarRightSet,(V,D,A)=>{r.setRightSidebarOpen(!!A.visible)}),C.add(ae.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(ae.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(ae.sidebarTopSet,(V,D,A)=>{r.setTopSidebarOpen(!!A.visible)}),C.add(ae.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(ae.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(ae.sidebarBottomSet,(V,D,A)=>{r.setBottomSidebarOpen(!!A.visible)}),C.add(ae.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(ae.layoutAdd,(V,D,A)=>{A.id&&i.add(A.id,A)}),C.add(ae.layoutRemove,(V,D,A)=>{const{id:j,...q}=A;i.remove(j,q)}),C.add(ae.layoutToggle,(V,D,A)=>{const{id:j,...q}=A;j&&(i.get(j)?i.remove(j,q):i.add(j,q))}),C.add(ae.layoutUpdate,(V,D,A)=>{const j=A;e.runCommand(ae.layoutRemove,{id:j.id,layout:{placer:{...j.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(ae.layoutAdd,{...j}))}),C.add(ae.layoutGet,(V,D,A)=>[yo(i.get(A.id))]),C.add(ae.layoutConfigGet,()=>yo(i.customConfig)),C.add(ae.layoutConfigSet,(V,D,A)=>{const j=A;i.setCustomConfig(j)}),C.add(ae.layoutComponentAdd,(V,D,A)=>{const{type:j,component:q}=A;j&&q&&i.addCustomLayoutComponent(j,q)}),C.add(ae.layoutComponentGet,(V,D,A)=>i.getCustomLayoutComponent(A.type)),C.add(ae.layoutComponentRemove,(V,D,A)=>{i.removeCustomLayoutComponent(A.type)}),C.add(ae.layoutComponentRender,(V,D,A)=>h.createElement(PV,{components:A.components})),C.add(ae.getStateTheme,()=>r.publicStateTheme),C.add(ae.setStateTheme,(V,D,A)=>r.setPublicStateTheme(A)),C.add(ae.getPagesConfig,()=>r.sdkPagesConfig),C.add(ae.setPagesConfig,(V,D,A)=>{const{config:j}=A||{};Nt(j)&&r.setSdkPagesConfig(j)}),C.add(ae.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(ae.setPageSettings,(V,D,A)=>{r.setPanelPageSettings(A)}),C.add(ae.clearPage,()=>{const V=D=>e.t(`actions.${D}`);a.confirm({title:V("clearCanvas.title"),content:V("clearCanvas.content"),confirmButton:{variant:"danger",children:V("clearCanvas.title")},onConfirm:()=>{aN(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(ae.projectFiles,(V,D,A)=>{var Y,Q;const j=(Y=r.sdkOptions.dataSources)==null?void 0:Y.exportConfig,q=((Q=A.exportConfig)==null?void 0:Q.exportPreset)??j,G={isMJML:r.isProjectTypeEmail,exportConfig:q,...A};return NV(V,G)}),C.add(ae.validateCode,(V,D,A)=>Db({...A,appStore:n})),C.add(ae.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(ae.setBlocksPanel,(V,D,A)=>{const j=A||{};Nt(j.isOpen)&&o.setOpen(j.isOpen)}),C.add(ae.canvasReload,()=>{const V=e.getSelected(),D=O.getCanvasView(),{frames:A}=O.canvas;A.once("loaded:all",()=>{const j=V==null?void 0:V.getView();j&&!j.isInViewport()&&j.el.scrollIntoView({block:"center"})}),D.renderFrames()}),C.add(ae.contextMenuComponent,(V,D,A)=>{const{component:j,...q}=A;l.showForComponent(j,q)}),C.add(ae.getStateContextMenu,()=>l.publicState),C.add(ae.setStateContextMenu,(V,D,A)=>{l.setPublicState(A)}),C.add(ae.symbolAdd,(V,D,A)=>{const j=A.component||e.getSelected();if(j)return B.getSymbolInfo(j).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:Qt.Warning}):B.addSymbol(j)}),C.add(ae.symbolDetach,(V,D,A)=>{const j=A.component||e.getSelected();j&&B.getSymbolInfo(j).isRoot&&B.detachSymbol(j)}),C.add(ae.symbolOverride,(V,D,A)=>{const j=A.component||e.getSelected();j&&(j.setSymbolOverride(A.override),e.Layers.updateLayer(j))}),C.add(ae.symbolPropagateStyles,(V,D,A)=>{const j=A.component||e.getSelected();if(!j)return;const{Css:q}=e,G=q.getComponentRules(j,{current:!0})[0];if(G){const{state:Y,mediaText:Q}=G.attributes,Z=G.getStyle();B.getSymbolInfo(j).relatives.forEach(W=>{q.setIdRule(W.getId(),Z,{state:Y,mediaText:Q})})}A.deep&&j.components().forEach(Y=>e.runCommand(ae.symbolPropagateStyles,{...A,component:Y}))}),C.add(ae.assetProviderGet,()=>yo(u.allProviders)),C.add(ae.assetProviderAdd,(V,D,{provider:A,index:j})=>{u.addProvider(A,j)}),C.add(ae.assetProviderRemove,(V,D,{id:A})=>{const j=u.allProviders.filter(q=>q.id!==A);u.setAllProviders(j)}),C.add(ae.fontGet,()=>yo(d.fonts)),C.add(ae.fontAdd,(V,D,{font:A})=>{d.addFont(A)}),C.add(ae.fontRemove,(V,D,{family:A})=>{d.removeFont(A)}),C.add(ae.fontManagerOpen,(V,D,A)=>{Ip(V,A)}),C.add(ae.menuFontLoad,(V,D,{font:A})=>Pf(A,!1)),C.add(ae.toggleStateDataSource,()=>(T=!T,e.trigger(yn.toggleDataSourcesPreview,{showPlaceholder:T}),e.refresh({tools:!0}),{showPlaceholder:T})),C.add(ae.getStateDataSource,()=>({showPlaceholder:T})),C.add(ae.dataSourceSetGlobalData,(V,D,{globalData:A})=>{const j=M0(A);return e.DataSources.get(As.globalData).setRecords(j)}),C.add(ae.setDragAbsolute,(V,D,{enabled:A})=>{r.setIsDraggingAbsolute(!!A)}),C.add(ae.dataSourceSetImporter,(V,D,A)=>{e.on(e.Parser.events.htmlBefore,j=>{j.input=A.import(j.input)})}),C.add(ae.dataSourceSetExporter,(V,D,A)=>{e.config.optsHtml={...e.config.optsHtml,exporter:A}}),FV(e,t),YV(e,t),HV(e,t),DV(e),MV(e),cM(e),LV(e,t),jV(e,t)}const XV=/\s(?![^(]*\))/,Mw=/^-?[0-9]+[a-zA-Z%]{0,}$/;function Lw(e){const t=e.split(XV),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!Mw.test(d))[0]||"currentColor",s=r.filter(d=>Mw.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 yu=["%"],wu=["s","ms"],ol=["deg","rad","grad"],Wr=["px","%","em","rem","vw","vh"],$w={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},JV=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Su=e=>({id:e,label:e.split("-").map(yr).join(" ")}),kw=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)}},QV=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}=uu(a);return{[t]:i,[n]:l}}):[]}},Vw=e=>{const t={[nl]:e};if(e.indexOf("url(")>-1)t[zr]=Yo.Image;else if(e.indexOf("gradient(")>-1){const n=uh(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[zr]=Yo.Color:t[zr]=Yo.Gradient}else t[zr]=Yo.Color,t[nl]=JV(e);return t},Iw=(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}=uu(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:kw(n)},{property:n,type:"integer"}]}},Cu=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:Wr,...t},s={property:`${e}-y`,type:"integer",units:Wr,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,f]=u.getProperties(),[p,g]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||p||"",[f.getId()]:a[f.getName()]||g||p||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),f=a[u.getId()],p=a[d.getId()];return{[i]:f===p?f:`${f} ${p}`}}}}},RV=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Su),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Su),["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"})),Cu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Su),fS("(?<!\\(.*[^)]),(?![^()]*\\))"),Yo.Image,Yo.Gradient,Yo.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:Wr,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:Wr,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:Wr})),["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"})),Cu("overflow",{x:$w,y:$w,mergable:!0}),Iw(),Iw("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(Su),wu[0],wu[0],QV("transform"),RV("transform","0"),kw("transform-value"),Cu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Cu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function jw(e,t){return[n=>bM(n,t),...mM[e],n=>ZV(n,t),fM(e,t)]}class eI{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,en(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield nI()).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=[...jw(t,{appStore:n}),...this.projectPlugins||[]],o=n.sdkOptions.plugins||[];return Ze(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 tI={db:Vm.gjsStudio},nI=()=>new Promise(async e=>{let t=[];try{t=await AA(nc.Settings,"plugins",tI)||[]}catch(n){vr()&&console.error(n)}e(t)}),rI=h.createContext(void 0);class oI{constructor(t){this.blockManagerStore=new $N(this),this.appEditorStore=new gN(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new D3(t==null?void 0:t.localSettingsStore),this.toastStore=new LN(this),this.modalStore=new H3(this),this.i18nStore=new _N(this),this.pluginStore=new eI(this),this.pointerBadgeStore=new NN(this),this.contextMenu=new sI(this),this.layoutStore=new ON(this),this.templatesStore=new MN(this),this.assetsStore=new EN(this),this.globalStylesStore=new k3(this),this.fontsStore=new PN(this),this.appEditorStore.init(),Tu()&&(window.__gjss=this)}}const bn=()=>{const e=h.useContext(rI);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},yh=()=>{throw new Error("Store has not been initialized")};class sI{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=us(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"),f=[u&&{id:Ao.selectParent,icon:X.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:Ao.duplicate,icon:X.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:Ao.symbolCreate,icon:X.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(ae.symbolAdd)}},s&&a&&{id:Ao.symbolDetach,icon:X.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(ae.symbolDetach)}},s&&!i&&{id:Ao.symbolOverride,icon:X.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(ae.symbolOverride,{override:!0})}},s&&i&&{id:Ao.symbolOverrideClear,icon:X.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(ae.symbolOverride)}},l&&{id:Ao.delete,icon:X.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),p=n.get("contextMenu"),g={...r,items:f,component:n,editor:o,type:n.get("type")||"default",source:r.source||xf.canvas},m=yield Dw(p,g),b=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield Dw(b,{...g,items:m})}),this.store=t,en(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 Dw=async(e,t)=>Ze(e)?(await e(t)).filter(Boolean):t.items,aI=()=>bn().contextMenu,Hw=vr()&&document.body,wh=(e={})=>({...Jf,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Hw}},{name:"preventOverflow",options:{boundary:e.boundary??Hw}}]}),iI=wh(),xu="gs-ctx-menu-list",lI=de(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=aI(),[d,f]=h.useState(),[p,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:b,attributes:v}=ui(m,p,iI),w=M(`${xu}-wrp gs-utl-z-20`,l),y=M(`${xu} gs-utl-z-20`),S=M(`${xu}-body gs-utl-max-w-56`),C=M(`${xu}-item`),x="gs-utl-max-w-40",E=P=>{const{action:T,onClick:O}=P;if(T||O)return _=>{const N={editor:u.store.appEditorStore.editor,..._};Ze(T)?(T(N),u.hide()):Ze(O)&&(O(N),u.hide())}};return c.jsx("div",{className:w,ref:g,style:b.popper,...v.popper,children:c.jsx(sf,{show:!!n,...SP,unmount:!1,children:c.jsx(Gn,{padding:!1,className:y,classNameBody:S,children:r.map((P,T)=>h.createElement(wa,{onItemClick:t,...P,key:P.id??T,className:C,classNameLabel:x,action:E(P),onActive:()=>f(P),active:d===P}))})})})}),Sh="gs-cmp-tooltip";function Dt({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:o="bottom",children:s,title:a,onClick:i,inline:l,size:u}){const[d,f]=h.useState(!1),[p,g]=h.useState(!1),m=Nt(u),[b,v]=h.useState(null),[w,y]=h.useState(null),S=ui(b,w,{...wh(),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(()=>f(p),10);return()=>clearTimeout(E)},[p]);const C=M(`${Sh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=M(`${Sh}-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:M(Sh,"gs-utl-relative",t),children:[c.jsx("span",{ref:v,className:C,onMouseEnter:()=>a&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:M(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),i==null||i()},children:s})}),!!p&&c.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(sf,{show:!!d,unmount:!1,...C1,children:c.jsx(Gn,{className:x1.txt,bg:x1.bg,size:"s",border:!1,children:a})})})]})}function bt({children:e,title:t,classNameWrp:n,tooltipProps:r,...o}){return c.jsx(Dt,{title:t,classNameWrp:n,...r,children:c.jsx(qe,{...o,children:e})})}const Ma="gs-cmp-ai-chat-assets",cI=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},uI=e=>e.mediaType==="application/pdf",Fw=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${Ma}__asset-item`,a=M(`${Ma}__asset-image`,"gs-utl-object-cover",oe.rnd,Vl.m),i=M(`${Ma}__asset-pdf`,"gs-utl-overflow-hidden",oe.rnd,Vl.m),l=M(`${Ma}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",oe.rnd,Vl.m,U.bgH2),u=M(`${Ma}__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",Vl.s,oe.pill,U.bgRed,U.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const f=(p,g)=>{const m={params:{num:g+1}},b=e.t(`${d}.imageAlt`,m),v=e.t(`${d}.pdfTitle`,m);return cI(p)?c.jsx("img",{src:p.src,alt:b,className:a}):uI(p)?c.jsx("iframe",{src:p.src,title:v,className:i}):c.jsx("div",{className:l,children:c.jsx(se,{icon:W2,size:le.l})})};return c.jsx(I,{className:M(Ma,n),gap:"xs",wrap:"wrap",style:o,children:t.map((p,g)=>c.jsxs("div",{className:M(s,"gs-utl-relative gs-utl-inline-block"),children:[f(p,g),r&&c.jsx(bt,{title:e.t(`${d}.remove`),icon:{icon:X.close,size:le.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},p.src))})},sn="gs-cmp-ai-chat-input",dI=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 f=`${sn}__attach-btn`,p=`${sn}__file-input`,g=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=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(ae.layoutRemove,{id:E});r.runCommand(ae.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:b,icon:X.trayArrowDown,onClick:()=>{var T;return(T=d.current)==null?void 0:T.click()}},{id:"assets",label:v,icon:eC,onClick:()=>{r.Assets.open({onSelect:({asset:T})=>{const O=T.getSrc();O&&u(O)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:p,style:{display:"none"}}),c.jsx(bt,{className:M(f,oe.pill,t),style:n,title:g?y:w,icon:X.plus,border:!1,onClick:C,disabled:o||g,size:"s",block:!0})]})},fI=({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=`${sn}__context`,d=`${sn}__context-icon`,f=`${sn}__context-badge`,p=`${sn}__context-name`,g=`${sn}__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:M(u,o&&Pe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:X.target,size:le.sx,className:M(d,U.txtLowEmphasis)}),c.jsx(Ho,{className:M(f,T1(b).bg,Ee.xyS2),s:"s",children:c.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&eb(b),c.jsx("div",{className:M(p,Pe.txtEllips,"gs-utl-max-w-36"),children:w}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M(g,oe.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(bt,{title:e.t(`${i}.clear`),icon:{icon:X.close,size:le.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function Bw(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function pI(){const[e,t]=h.useState(""),[n,r]=h.useState(!1),[o,s]=h.useState(!1),a=h.useRef();h.useEffect(()=>s(!!Bw()),[]);const i=()=>{const u=Bw();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=f=>{const g=Array.from(f.results).map(m=>m[0].transcript).join("");t(g)},d.onerror=f=>{console.error("Speech recognition error",f),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 hI=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:o,style:s})=>{const a=`${sn}__dictate`,{transcript:i,isSupported:l,isListening:u,start:d,stop:f}=pI(),p="aiChat.input.dictate",g=e.t(`${p}.start`),m=e.t(`${p}.stop`),b=u?m:g;return h.useEffect(()=>{i&&n(i)},[i]),h.useEffect(()=>{r==null||r(u)},[u]),l?c.jsx(bt,{block:!0,size:"s",border:!1,className:M(a,oe.pill,o),style:s,title:b,disabled:t,icon:u?fC:dC,onClick:u?f:d,variant:u?"danger":"out-clear"}):null},gI=({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})},zw=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},Uw=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,mI=({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:f,assetsSectionProps:p,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:b,value:v})=>{const[w,y]=h.useState(v||""),[S,C]=h.useState(""),[x,E]=h.useState(!1),[P,T]=h.useState([]),[O,_]=h.useState(!1),N="aiChat.input",L=r.runCommand(wr.getChatApi),k=r.runCommand(wr.getChatState),{status:B,stop:$,sendMessage:z,setError:K}=n||L,F=B==="streaming"||B==="submitted",V=P.length>0,D=S?Uw(w,S):w,A=!O&&(F||D.trim()||V),j={input:D,assets:P},q=we=>{const et=o-P.length,tt=we.slice(0,et);if(tt.length===0)return;const gt=tt.map(Ne=>({src:URL.createObjectURL(Ne),file:Ne,mediaType:Ne.type}));T(Ne=>[...Ne,...gt])},G=we=>{P.length>=o||T(et=>[...et,{src:we,mediaType:"image/*"}])},Y=we=>{const et=P[we];et!=null&&et.file&&zw([et.src]),T(tt=>tt.filter((gt,Ne)=>Ne!==we))},Q=async we=>{if(we.preventDefault(),F||O)return;const et=()=>Z();if(u){u({event:we,submit:et,state:j});return}et()},Z=async()=>{if(F||O)return;const we=D.trim();if(!we&&!V)return;const et=P.filter(Ne=>Ne.file).map(Ne=>Ne.file);let gt=P.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src,mediaType:Ne.mediaType}));if(et.length>0){_(!0);try{const dt=await async function(Fe){return a?await a({files:Fe}):new Promise((Yt,ge)=>{try{const Ve={dataTransfer:{files:Fe}};r.Assets.FileUploader().uploadFile(Ve,({data:je})=>{Yt(je)})}catch(Ve){ge(Ve)}})}(et),st=P.filter(Fe=>Fe.file).map(Fe=>Fe.src);gt=[...gt,...dt.map(Fe=>({type:"file",url:Fe.src,mediaType:Fe.mimeType}))],zw(st)}catch(Ne){const dt=r.t(`${N}.uploadError`);K(Ne instanceof Error?Ne:new Error(dt)),_(!1);return}finally{_(!1)}}z({text:we,files:gt.length>0?gt:void 0,metadata:{createdAt:Date.now()}}),y(""),T([])},W=we=>{we.key==="Enter"&&!we.shiftKey&&(we.preventDefault(),Q(we))};h.useEffect(()=>{x||y(we=>Uw(we,S)),C("")},[x]);const R=`${sn}__root`,re=`${sn}__actions`,fe=`${sn}__actions-left`,xe=`${sn}__actions-right`,ne=`${sn}__submit-btn`,Oe=M(`${sn}__textarea gs-utl-w-full`,U.bgTr,Co.inputText,Pe.noFocusOut,Pe.noResize),Ie=r.t(`${N}.placeholder`),ut=i==null?void 0:i({state:j}),ot=l==null?void 0:l({state:j});return c.jsxs("form",{onSubmit:Q,className:M(sn,Ee.s,oe.bt,U.br,e),style:t,children:[ut&&Rt(r,ut),c.jsxs(I,{className:M(R,oe.b,oe.rndLg,U.br,U.bg,Ee.s,"gs-utl-relative"),col:!0,gap:"s",children:[O&&c.jsx(hs,{abs:!0,full:!0,className:U.bgH25}),c.jsx(fI,{editor:r,disabled:F,contextComponents:k.contextComponents,...d}),c.jsx(gI,{value:D,name:"prompt",onChange:we=>y(we.target.value),onKeyDown:W,placeholder:Ie,readOnly:x,disabled:F,className:Oe,style:{minHeight:40,maxHeight:100},autoResize:!0,...f}),c.jsx(Fw,{editor:r,assets:P,onRemove:Y,...p}),c.jsxs(I,{className:re,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(I,{className:fe,gap:"s",items:"center",children:c.jsx(dI,{editor:r,disabled:F,maxAssets:o,currentAssetsCount:P.length,acceptAssetType:s,onFilesSelected:q,onAssetSelected:G,...g})}),c.jsxs(I,{className:xe,gap:"s",items:"center",children:[c.jsx(hI,{editor:r,disabled:F,onTranscript:C,onListeningChange:E,...m}),c.jsx(qe,{className:M(ne,oe.pill),size:"s",type:F?"button":"submit",onClick:F?$:void 0,icon:F?X.stop:X.arrowUp,variant:F?"out-clear":"pr",disabled:!A,disabledClassName:Pe.disabledM,...b})]})]})]}),ot&&Rt(r,ot)]})},bI="gs-cmp-ai-chat-loading-state",vI=({className:e,chatContext:t,editor:n,...r})=>c.jsx(I,{className:M(bI,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(hs,{})}),yI="file-refs",Ww="gs-cmp-ai-chat-markdown",ht=`${Ww}__el`,wI={ul:({children:e})=>c.jsx("ul",{className:`${ht}-ul ${Lt.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${ht}-ol ${Lt.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${ht}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${ht}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${ht}-h1 ${Lt.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${ht}-h2 ${Lt.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${ht}-h3 ${Lt.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${ht}-h4 ${Lt.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${ht}-h5 ${Lt.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${ht}-h6 ${Lt.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${ht}-a ${Co.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${ht}-code-inline ${Lt.codeInline}`,children:e}):c.jsx("code",{className:`${ht}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${ht}-pre ${Lt.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${ht}-blockquote ${Lt.blockquote} ${U.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${ht}-hr ${Lt.hr} ${U.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${ht}-strong ${Lt.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${ht}-em ${Lt.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${ht}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${ht}-table ${Lt.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${ht}-thead ${Lt.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${ht}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${ht}-tr ${Lt.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${ht}-th ${Lt.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${ht}-td ${Lt.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${ht}-checkbox gs-utl-mr-2`,readOnly:!0}),[yI]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function SI(e){return Qw.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const CI=h.memo(function({content:t}){return c.jsx(Rw,{components:wI,remarkPlugins:[eS],children:t})},(e,t)=>e.content===t.content),Gw=h.memo(function({content:t,id:n,className:r}){const o=h.useMemo(()=>SI(t),[t]);return c.jsx("div",{className:`${Ww} ${r||""}`,children:o.map((s,a)=>c.jsx(CI,{content:s},`${n}-block_${a}`))})});function qw(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function xI(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Ch="gs-cmp-ai-chat-message",sl="aiChat.message",EI=h.memo(function({className:t,style:n,message:r,isStreaming:o,editor:s,chatContext:a,layoutBeforeMessage:i,layoutAfterMessage:l,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:f,layoutPartToolResult:p}){const g=r.parts||[],m=g.filter(Ln.isFileUIPart),b=g.filter(T=>!Ln.isFileUIPart(T)),v=m.map(T=>({src:T.url,mediaType:T.mediaType??"image/*"})),w=b.length-1,y=r.role==="user",S=M(Ch,`${Ch}--${r.role}`,t),C=M(`${Ch}__content gs-utl-break-words`,y?M(U.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Ee.xyS,oe.rnd):"gs-utl-w-full"),x={editor:s,chatContext:a,message:r},E=i==null?void 0:i(x),P=l==null?void 0:l(x);return c.jsxs(I,{col:!0,gap:"s",className:S,style:n,children:[E&&Rt(s,E),c.jsxs(I,{gap:"s",className:M(C,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((T,O)=>c.jsx(PI,{part:T,messageId:r.id,partIndex:O,isStreamingPart:O===w&&o,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:f,layoutPartToolResult:p,layoutProps:x},`${r.id}-part-${O}`)),c.jsx(Fw,{editor:s,assets:v,className:"gs-utl-justify-end"})]}),P&&Rt(s,P)]})}),fo="gs-cmp-ai-chat-message-part",PI=h.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d;if(s){const f=s({...u,part:t,partIndex:r});if(f)return Rt(u.editor,f)}if(Ln.isReasoningUIPart(t)){const{text:f,state:p}=t,g=f==null?void 0:f.trim(),m=o&&p==="streaming",b=`${fo} ${fo}__reasoning`,v=u.editor.t(`${sl}.reasoning`);return!!g&&c.jsx(lo,{className:M(b,U.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(I,{className:M(`${b}-label`,cn.semibold),items:"center",gap:"s",children:[m?c.jsx(hs,{size:"xs",currentColor:!0}):c.jsx(ka,{path:oC,size:le.s2x}),c.jsx("div",{children:v})]}),children:c.jsx("div",{className:M(`${b}-text`,U.txtLowEmphasis,Bn.xs,cn.italic),children:c.jsx(Gw,{id:`${n}-${r}`,content:g})})})}if(Ln.isTextUIPart(t)){const f=t.text;if(!f)return null;const p=`${fo} ${fo}__text`;return c.jsx(Gw,{content:f,id:`${n}-${r}`,className:p})}if(Ln.isToolUIPart(t)){const{type:f,toolCallId:p,input:g="",output:m="",errorText:b}=t,v=f.replace("tool-","").replace("dynamic-",""),w=typeof g=="string"?g:JSON.stringify(g),y=typeof m=="string"?m:JSON.stringify(m),S=typeof t.state=="string"?t.state:void 0,C=S==="output-available",x=o&&(S==="input-streaming"||S==="input-available"),E=`${fo}__tool`,P=`${fo}__tool-result`,T=`${E}-detail`,O=M(T,"gs-utl-max-w-full"),_="gs-utl-max-w-full gs-utl-whitespace-normal",N=M(`${T}-info gs-utl-max-h-24 gs-utl-overflow-auto`,_,U.txtLowEmphasis,Bn.xs),L=M(`${fo}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,_,U.txtLowEmphasis,Bn.xs),k=`${E}-section-label`,B=w&&w!=="{}",$=y&&y!=="{}",z=!!b,K=B||$||z,F=u.editor.t(`${sl}.tool.input`),V=u.editor.t(`${sl}.tool.output`),D=u.editor.t(`${sl}.tool.error`),j=u.editor.runCommand(wr.getChatManager).tools[v],q={...u,part:t,partIndex:r,toolName:v},G=a==null?void 0:a(q),Y=i==null?void 0:i(q),Q=(l==null?void 0:l(q))||((d=j==null?void 0:j.layoutToolResult)==null?void 0:d.call(j,q)),Z=G?Rt(u.editor,G):v,W=Q?Rt(u.editor,Q):null,R=Y?Rt(u.editor,Y):c.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[B&&c.jsxs(I,{className:M(O,`${T}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:k,children:F}),c.jsx("pre",{className:N,children:w})]}),$&&c.jsxs(I,{className:M(O,`${T}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:k,children:V}),c.jsx("pre",{className:N,children:y})]}),z&&c.jsxs(I,{className:M(O,`${T}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:k,children:D}),c.jsx("pre",{className:N,children:b})]})]});return c.jsxs(I,{className:M(`${fo} ${E}`,U.bgH2,oe.rnd,Ee.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(lo,{disabled:!K&&!Y,handler:c.jsxs(I,{className:M(`${E}-label`),items:"center",gap:"s",children:[c.jsx("div",{className:`${E}-status`,children:C?c.jsx(ka,{className:`${E}-status-success`,path:zh,size:le.s2x}):x?c.jsx(hs,{className:`${E}-status-processing`,size:"xs",currentColor:!0}):c.jsx(ka,{className:`${E}-status-error`,path:Uh,size:le.s2x})}),c.jsx("div",{className:M(`${E}-name`),children:Z})]}),children:R}),c.jsx(_I,{toolCallId:p,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:L}),!!W&&c.jsx("div",{className:P,children:W})]})}if(qw(t)||xI(t)){const f=`${fo}__source`,g=qw(t)?t.url:void 0,m=t.title,b=u.editor.t(`${sl}.source.document`),v=m||g||b,w=g?new URL(g).hostname:"",y=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:M(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:M(`${f}-title`,cn.semibold,Bn.sm,"gs-utl-truncate"),children:v}),w&&c.jsx("div",{className:M(`${f}-url`,U.txtLowEmphasis,Bn.xs,"gs-utl-truncate"),children:w})]}),g&&c.jsx(ka,{className:M(`${f}-icon`,U.txtLowEmphasis),path:Wh,size:le.s2x})]}),S=M(f,U.bgH2,oe.rnd,Ee.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",g&&Pe.hoverM);return g?c.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:S,children:y}):c.jsx("div",{className:S,children:y})}return null}),_I=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})}),TI="gs-cmp-ai-chat-messages-status",OI=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=M(U.bgA,Pe.dot,Pe.bounce);return o?c.jsxs(I,{items:"center",gap:"xs",className:M(TI,e),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},AI="gs-cmp-ai-chat-messages";function NI({editor:e,chatContext:t,messages:n,pluginOptions:r}){const o=h.useRef(null),{status:s}=t,a=s==="streaming"||s==="submitted",i=M(AI,Ee.s,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-y-auto gs-utl-overflow-x-hidden");return h.useEffect(()=>{var l;(l=o.current)==null||l.scrollIntoView({behavior:"smooth"})},[n]),c.jsxs(I,{className:i,gap:"s",col:!0,nowrap:!0,children:[n.length===0?Rt(e,{type:"aiChatEmptyState",chatContext:t},r):n.map((l,u)=>c.jsx(h.Fragment,{children:Rt(e,{type:"aiChatMessage",chatContext:t,message:l,isStreaming:a&&u===n.length-1},r)},l.id)),Rt(e,{type:"aiChatMessagesStatus",chatContext:t},r),c.jsx("div",{ref:o})]})}const Kw=h.createContext(void 0),MI=({chatManager:e,children:t})=>{const n=e.currentChatState,r=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(Kw.Provider,{value:r,children:t})},LI=()=>h.useContext(Kw),$I="gs-cmp-ai-chat-panel";function kI({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=LI(),[,s]=h.useState(0),[a,i]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:f}=o;h.useEffect(()=>o.onUpdate(()=>s(E=>++E)),[]);const p=Jt.useChat({chat:o.chat}),{messages:g,sendMessage:m,status:b,setMessages:v,error:w}=p,y=w||a,S=h.useMemo(()=>({id:p.id,messages:g,setMessages:v,sendMessage:m,status:b,stop:()=>(l.forEach(x=>x.abort()),l.clear(),p.stop()),addToolApprovalResponse:p.addToolApprovalResponse,addToolOutput:p.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{p.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,b,g,y]),C=M($I,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:f?c.jsxs(c.Fragment,{children:[Rt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(NI,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Rt(e,{type:"aiChatError",chatContext:S},t),Rt(e,{type:"aiChatInput",chatContext:S},t)]}):Rt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const VI=(e,t,n)=>(e.runCommand(ae.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(MI,{chatManager:n,children:c.jsx(kI,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:TP})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:_P})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:vI})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:mI})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:PP})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:EI})}),e.runCommand(ae.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:OI})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(ae.layoutComponentRemove,{type:r})})}),II={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",tool:{input:"Input",output:"Output",error:"Error"},source:{document:"Document"}}}},jI="aiChat",DI=Fs.startup;return PS(function(e,t={}){t.getAccessToken&&(Gt.getAccessToken=t.getAccessToken),$h();const n=new QS(e,t),{Commands:r}=e;r.add(wr.getChatManager,()=>n),r.add(wr.getChatState,()=>n.currentChatState),r.add(wr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:II});const o=VI(e,t,n),s=()=>{delete r.commands[wr.getChatManager],delete r.commands[wr.getChatState],delete r.commands[wr.getChatApi],o(),OS()};_S({editor:e,licenseKey:t.licenseKey,plan:DI,pluginName:jI,onLicenseCheckResponse:a=>{a?Gt.license=a:Gt.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(iS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const ZV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},YV=(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([]))},XV=()=>{const{baseApiUrl:e}=vv();return`${e}/sdk/projects`},aS=e=>`${XV()}/${e}`,JV=async({licenseKey:e,projectId:t,...n})=>{const r=await kr.put(aS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},QV=async(e,t)=>await kr.put(t,{body:e,headers:{"Content-Type":"application/json"}}),RV=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await JV({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 QV(o,a)},eH=(e,t,n)=>kr.get(aS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),tH=async e=>await kr.get(e),nH=async(e,t,n,r)=>{const o=await eH(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 tH(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},rH=(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:f,autosaveChanges:p,autosaveIntervalMs:g}=l;let m,v,b,w;if(s)b=d,w=f,m=p,v=g;else if(a){const E=i.licenseKey,T=n.sdkProjectId,_=n.sdkIdentityId,O=10,P=1e4;w=({project:A})=>RV(A,E,T,_),b=({editor:A})=>nH(A,E,T,_),m=Math.max(O,p??O),g&&(v=Math.max(P,g))}const{Storage:y,events:S}=e,{events:C}=y;let x=!1;if(e.once(S.projectLoad,E=>{x=!!E.loaded}),e.once("change:readyLoad",()=>{var T;const E=(T=i.project)==null?void 0:T.default;!x&&E&&e.loadProjectData(E)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(b||u)&&w){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await b({editor:e})).project},async store(T){await w({project:T,editor:e})}}),e.on(C.errorLoad,T=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:T.message})}),e.on(C.errorStore,T=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:T.message})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const T=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(T))})}},$u="select-target",iS="enable-sm";function oH(e,t){var L,D,W,F;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:f,nextProjectData:p,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,T=(D=(L=g.gjsOptions)==null?void 0:L.assetManager)==null?void 0:D.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Ht(T)&&(y.getConfig().custom=T),p&&(w.projectData=p,r.setNextProjectData()),f){const k=S.getConfig().options;k&&(k.local.key=f)}e.on(E.projectLoad,({project:k})=>{var H;n.setProjectDataCustom(k.custom||{projectType:(H=r.sdkOptions.project)==null?void 0:H.type}),d.loadFonts()}),e.on(E.projectGet,({project:k})=>{k.custom=Sa(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:O}=e,P=Fo(()=>r.setCanvasPanning(!1),200);e.on(O.events.coords,()=>{r.setCanvasPanning(!0),P()}),e.on(O.events.frameLoad,({el:k})=>{k.tabIndex=-1});const{Parser:A}=e,M=((W=r.sdkOptions.parser)==null?void 0:W.showErrors)!==!1;(F=A.events)!=null&&F.css&&M&&e.on(A.events.css,k=>{const{error:H}=k;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})}}),[{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:re.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:re.symbolDetach}].forEach(({id:k,keys:H,cmd:V})=>{e.Keymaps.add(`preset:${k}`,H,V,{prevent:!0})}),e.on(`${x.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),pb(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),pb(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const $="target-selection",{Components:j}=e;C.add($u,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(k,H){const V={id:$,type:"target",component:H};H?O.addSpot(V):O.removeSpots(V)},beforeSelect(k,H={}){H.abort=!0,H.useValid=!1,this.opts.onSelect(k),e.stopCommand($u)},run(k,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),O.removeSpots({id:$}),r.setSelectingTarget(!1)}}),C.add(iS,()=>{r.setSelectedDesignerTab("style")}),C.add(re.toastAdd,(k,H,V)=>{s.add(V.id,V)}),C.add(re.toastRemove,(k,H,V)=>{s.remove(V.id)}),C.add(re.dialogOpen,(k,H,V)=>{a.open(V)}),C.add(re.dialogClose,()=>{a.close()}),C.add(re.dialogExportCode,()=>{a.open({title:e.t("actions.showCode.title"),content:()=>{var k,H;return h.createElement(dN,{options:(H=(k=g.commands)==null?void 0:k.options)==null?void 0:H[vr.showCode]})}})}),C.add(re.dialogImportCode,()=>{a.open({title:e.t("actions.importCode.title"),content:()=>h.createElement(fb)})}),C.add(re.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(re.sidebarLeftSet,(k,H,V)=>{r.setLeftSidebarOpen(!!V.visible)}),C.add(re.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(re.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(re.sidebarRightSet,(k,H,V)=>{r.setRightSidebarOpen(!!V.visible)}),C.add(re.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(re.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(re.sidebarTopSet,(k,H,V)=>{r.setTopSidebarOpen(!!V.visible)}),C.add(re.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(re.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(re.sidebarBottomSet,(k,H,V)=>{r.setBottomSidebarOpen(!!V.visible)}),C.add(re.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(re.layoutAdd,(k,H,V)=>{V.id&&i.add(V.id,V)}),C.add(re.layoutRemove,(k,H,V)=>{const{id:U,...J}=V;i.remove(U,J)}),C.add(re.layoutToggle,(k,H,V)=>{const{id:U,...J}=V;U&&(i.get(U)?i.remove(U,J):i.add(U,J))}),C.add(re.layoutUpdate,(k,H,V)=>{const U=V;e.runCommand(re.layoutRemove,{id:U.id,layout:{placer:{...U.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(re.layoutAdd,{...U}))}),C.add(re.layoutGet,(k,H,V)=>[To(i.get(V.id))]),C.add(re.layoutConfigGet,()=>To(i.customConfig)),C.add(re.layoutConfigSet,(k,H,V)=>{const U=V;i.setCustomConfig(U)}),C.add(re.layoutComponentAdd,(k,H,V)=>{const{type:U,component:J}=V;U&&J&&i.addCustomLayoutComponent(U,J)}),C.add(re.layoutComponentGet,(k,H,V)=>i.getCustomLayoutComponent(V.type)),C.add(re.layoutComponentRemove,(k,H,V)=>{i.removeCustomLayoutComponent(V.type)}),C.add(re.layoutComponentRender,(k,H,V)=>h.createElement(kV,{components:V.components})),C.add(re.getStateTheme,()=>r.publicStateTheme),C.add(re.setStateTheme,(k,H,V)=>r.setPublicStateTheme(V)),C.add(re.getPagesConfig,()=>r.sdkPagesConfig),C.add(re.setPagesConfig,(k,H,V)=>{const{config:U}=V||{};Ht(U)&&r.setSdkPagesConfig(U)}),C.add(re.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(re.setPageSettings,(k,H,V)=>{r.setPanelPageSettings(V)}),C.add(re.clearPage,()=>{const k=H=>e.t(`actions.${H}`);a.confirm({title:k("clearCanvas.title"),content:k("clearCanvas.content"),confirmButton:{variant:"danger",children:k("clearCanvas.title")},onConfirm:()=>{V3(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(re.projectFiles,(k,H,V)=>{var X,Q;const U=(X=r.sdkOptions.dataSources)==null?void 0:X.exportConfig,J=((Q=V.exportConfig)==null?void 0:Q.exportPreset)??U,Y={isMJML:r.isProjectTypeEmail,exportConfig:J,...V};return DV(k,Y)}),C.add(re.validateCode,(k,H,V)=>qv({...V,appStore:n})),C.add(re.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(re.setBlocksPanel,(k,H,V)=>{const U=V||{};Ht(U.isOpen)&&o.setOpen(U.isOpen)}),C.add(re.canvasReload,()=>{const k=e.getSelected(),H=O.getCanvasView(),{frames:V}=O.canvas;V.once("loaded:all",()=>{const U=k==null?void 0:k.getView();U&&!U.isInViewport()&&U.el.scrollIntoView({block:"center"})}),H.renderFrames()}),C.add(re.contextMenuComponent,(k,H,V)=>{const{component:U,...J}=V;l.showForComponent(U,J)}),C.add(re.getStateContextMenu,()=>l.publicState),C.add(re.setStateContextMenu,(k,H,V)=>{l.setPublicState(V)}),C.add(re.symbolAdd,(k,H,V)=>{const U=V.component||e.getSelected();if(U)return j.getSymbolInfo(U).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:on.Warning}):j.addSymbol(U)}),C.add(re.symbolDetach,(k,H,V)=>{const U=V.component||e.getSelected();U&&j.getSymbolInfo(U).isRoot&&j.detachSymbol(U)}),C.add(re.symbolOverride,(k,H,V)=>{const U=V.component||e.getSelected();U&&(U.setSymbolOverride(V.override),e.Layers.updateLayer(U))}),C.add(re.symbolPropagateStyles,(k,H,V)=>{const U=V.component||e.getSelected();if(!U)return;const{Css:J}=e,Y=J.getComponentRules(U,{current:!0})[0];if(Y){const{state:X,mediaText:Q}=Y.attributes,ee=Y.getStyle();j.getSymbolInfo(U).relatives.forEach(G=>{J.setIdRule(G.getId(),ee,{state:X,mediaText:Q})})}V.deep&&U.components().forEach(X=>e.runCommand(re.symbolPropagateStyles,{...V,component:X}))}),C.add(re.assetProviderGet,()=>To(u.allProviders)),C.add(re.assetProviderAdd,(k,H,{provider:V,index:U})=>{u.addProvider(V,U)}),C.add(re.assetProviderRemove,(k,H,{id:V})=>{const U=u.allProviders.filter(J=>J.id!==V);u.setAllProviders(U)}),C.add(re.fontGet,()=>To(d.fonts)),C.add(re.fontAdd,(k,H,{font:V})=>{d.addFont(V)}),C.add(re.fontRemove,(k,H,{family:V})=>{d.removeFont(V)}),C.add(re.fontManagerOpen,(k,H,V)=>{nh(k,V)}),C.add(re.menuFontLoad,(k,H,{font:V})=>kf(V,!1)),C.add(re.toggleStateDataSource,()=>(_=!_,e.trigger(Pn.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),C.add(re.getStateDataSource,()=>({showPlaceholder:_})),C.add(re.dataSourceSetGlobalData,(k,H,{globalData:V})=>{const U=ly(V);return e.DataSources.get(Hs.globalData).setRecords(U)}),C.add(re.setDragAbsolute,(k,H,{enabled:V})=>{r.setIsDraggingAbsolute(!!V)}),C.add(re.dataSourceSetImporter,(k,H,V)=>{e.on(e.Parser.events.htmlBefore,U=>{U.input=V.import(U.input)})}),C.add(re.dataSourceSetExporter,(k,H,V)=>{e.config.optsHtml={...e.config.optsHtml,exporter:V}}),YV(e,t),rH(e,t),ZV(e,t),KV(e),FV(e),DM(e),BV(e,t),qV(e,t)}const sH=/\s(?![^(]*\))/,lS=/^-?[0-9]+[a-zA-Z%]{0,}$/;function cS(e){const t=e.split(sH),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!lS.test(d))[0]||"currentColor",s=r.filter(d=>lS.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=["%"],Iu=["s","ms"],wl=["deg","rad","grad"],Qr=["px","%","em","rem","vw","vh"],uS={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},aH=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Vu=e=>({id:e,label:e.split("-").map(Pr).join(" ")}),dS=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)}},iH=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}=Tu(a);return{[t]:i,[n]:l}}):[]}},fS=e=>{const t={[bl]:e};if(e.indexOf("url(")>-1)t[Xr]=ss.Image;else if(e.indexOf("gradient(")>-1){const n=Lh(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[Xr]=ss.Color:t[Xr]=ss.Gradient}else t[Xr]=ss.Color,t[bl]=aH(e);return t},pS=(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}=Tu(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:dS(n)},{property:n,type:"integer"}]}},Hu=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:Qr,...t},s={property:`${e}-y`,type:"integer",units:Qr,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,f]=u.getProperties(),[p,g]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||p||"",[f.getId()]:a[f.getName()]||g||p||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),f=a[u.getId()],p=a[d.getId()];return{[i]:f===p?f:`${f} ${p}`}}}}},lH=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Vu),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Vu),["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"})),Hu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Vu),US("(?<!\\(.*[^)]),(?![^()]*\\))"),ss.Image,ss.Gradient,ss.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:Qr,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:Qr,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:Qr})),["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"})),Hu("overflow",{x:uS,y:uS,mergable:!0}),pS(),pS("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(Vu),Iu[0],Iu[0],iH("transform"),lH("transform","0"),dS("transform-value"),Hu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Hu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function hS(e,t){return[n=>KM(n,t),...qM[e],n=>oH(n,t),zM(e,t)]}class cH{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,sn(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield dH()).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=[...hS(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 uH={db:Um.gjsStudio},dH=()=>new Promise(async e=>{let t=[];try{t=await s3(mc.Settings,"plugins",uH)||[]}catch(n){Tr()&&console.error(n)}e(t)}),fH=h.createContext(void 0);class pH{constructor(t){this.blockManagerStore=new c4(this),this.appEditorStore=new G3(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new hL(t==null?void 0:t.localSettingsStore),this.toastStore=new l4(this),this.modalStore=new gL(this),this.i18nStore=new n4(this),this.pluginStore=new cH(this),this.pointerBadgeStore=new a4(this),this.contextMenu=new hH(this),this.layoutStore=new o4(this),this.templatesStore=new i4(this),this.assetsStore=new e4(this),this.globalStylesStore=new uL(this),this.fontsStore=new t4(this),this.appEditorStore.init(),zu()&&(window.__gjss=this)}}const En=()=>{const e=h.useContext(fH);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Dh=()=>{throw new Error("Store has not been initialized")};class hH{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=ws(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"),f=[u&&{id:Ho.selectParent,icon:q.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:Ho.duplicate,icon:q.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:Ho.symbolCreate,icon:q.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(re.symbolAdd)}},s&&a&&{id:Ho.symbolDetach,icon:q.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(re.symbolDetach)}},s&&!i&&{id:Ho.symbolOverride,icon:q.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(re.symbolOverride,{override:!0})}},s&&i&&{id:Ho.symbolOverrideClear,icon:q.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(re.symbolOverride)}},l&&{id:Ho.delete,icon:q.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),p=n.get("contextMenu"),g={...r,items:f,component:n,editor:o,type:n.get("type")||"default",source:r.source||Nf.canvas},m=yield gS(p,g),v=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield gS(v,{...g,items:m})}),this.store=t,sn(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 gS=async(e,t)=>et(e)?(await e(t)).filter(Boolean):t.items,gH=()=>En().contextMenu,mS=Tr()&&document.body,Fh=(e={})=>({...ap,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??mS}},{name:"preventOverflow",options:{boundary:e.boundary??mS}}]}),mH=Fh(),ju="gs-ctx-menu-list",vH=ce(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=gH(),[d,f]=h.useState(),[p,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:v,attributes:b}=wi(m,p,mH),w=N(`${ju}-wrp gs-utl-z-20`,l),y=N(`${ju} gs-utl-z-20`),S=N(`${ju}-body gs-utl-max-w-56`),C=N(`${ju}-item`),x="gs-utl-max-w-40",E=T=>{const{action:_,onClick:O}=T;if(_||O)return P=>{const A={editor:u.store.appEditorStore.editor,...P};et(_)?(_(A),u.hide()):et(O)&&(O(A),u.hide())}};return c.jsx("div",{className:w,ref:g,style:v.popper,...b.popper,children:c.jsx(gf,{show:!!n,...gT,unmount:!1,children:c.jsx(Yn,{padding:!1,className:y,classNameBody:S,children:r.map((T,_)=>h.createElement(Pa,{onItemClick:t,...T,key:T.id??_,className:C,classNameLabel:x,action:E(T),onActive:()=>f(T),active:d===T}))})})})}),Bh="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,f]=h.useState(!1),[p,g]=h.useState(!1),m=Ht(u),[v,b]=h.useState(null),[w,y]=h.useState(null),S=wi(v,w,{...Fh(),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(()=>f(p),10);return()=>clearTimeout(E)},[p]);const C=N(`${Bh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=N(`${Bh}-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(Bh,"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})}),!!p&&c.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(gf,{show:!!d,unmount:!1,...S1,children:c.jsx(Yn,{className:C1.txt,bg:C1.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 ja="gs-cmp-ai-chat-assets",bH=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},yH=e=>e.mediaType==="application/pdf",vS=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${ja}__asset-item`,a=N(`${ja}__asset-image`,"gs-utl-object-cover",te.rnd,Wl.m),i=N(`${ja}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,Wl.m),l=N(`${ja}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,Wl.m,z.bgH2),u=N(`${ja}__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",Wl.s,te.pill,z.bgRed,z.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const f=(p,g)=>{const m={params:{num:g+1}},v=e.t(`${d}.imageAlt`,m),b=e.t(`${d}.pdfTitle`,m);return bH(p)?c.jsx("img",{src:p.src,alt:v,className:a}):yH(p)?c.jsx("iframe",{src:p.src,title:b,className:i}):c.jsx("div",{className:l,children:c.jsx(ne,{icon:XC,size:se.l})})};return c.jsx(I,{className:N(ja,n),gap:"xs",wrap:"wrap",style:o,children:t.map((p,g)=>c.jsxs("div",{className:N(s,"gs-utl-relative gs-utl-inline-block"),children:[f(p,g),r&&c.jsx(Ct,{title:e.t(`${d}.remove`),icon:{icon:q.close,size:se.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},p.src))})},hn="gs-cmp-ai-chat-input",wH=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 f=`${hn}__attach-btn`,p=`${hn}__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",T=()=>r.runCommand(re.layoutRemove,{id:E});r.runCommand(re.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:T,items:[{id:"upload",label:v,icon:q.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:b,icon:a2,onClick:()=>{r.Assets.open({onSelect:({asset:_})=>{const O=_.getSrc();O&&u(O)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:p,style:{display:"none"}}),c.jsx(Ct,{className:N(f,te.pill,t),style:n,title:g?y:w,icon:q.plus,border:!1,onClick:C,disabled:o||g,size:"s",block:!0})]})},SH=({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=`${hn}__context`,d=`${hn}__context-icon`,f=`${hn}__context-badge`,p=`${hn}__context-name`,g=`${hn}__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(I,{className:N(u,o&&Pe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.target,size:se.sx,className:N(d,z.txtLowEmphasis)}),c.jsx(Ko,{className:N(f,P1(v).bg,Te.xyS2),s:"s",children:c.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&lv(v),c.jsx("div",{className:N(p,Pe.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:q.close,size:se.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function bS(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function CH(){const[e,t]=h.useState(""),[n,r]=h.useState(!1),[o,s]=h.useState(!1),a=h.useRef();h.useEffect(()=>s(!!bS()),[]);const i=()=>{const u=bS();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=f=>{const g=Array.from(f.results).map(m=>m[0].transcript).join("");t(g)},d.onerror=f=>{console.error("Speech recognition error",f),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 xH=({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:f}=CH(),p="aiChat.input.dictate",g=e.t(`${p}.start`),m=e.t(`${p}.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?b2:v2,onClick:u?f:d,variant:u?"danger":"out-clear"}):null},EH=({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})},yS=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},wS=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,TH=({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:f,assetsSectionProps:p,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[w,y]=h.useState(b||""),[S,C]=h.useState(""),[x,E]=h.useState(!1),[T,_]=h.useState([]),[O,P]=h.useState(!1),A="aiChat.input",M=r.runCommand(pr.getChatApi),$=r.runCommand(pr.getChatState),{status:j,stop:L,sendMessage:D,setError:W}=n||M,F=j==="streaming"||j==="submitted",k=T.length>0,H=S?wS(w,S):w,V=!O&&(F||H.trim()||k),U={input:H,assets:T},J=Se=>{const ot=o-T.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=>{T.length>=o||_(ot=>[...ot,{src:Se,mediaType:"image/*"}])},X=Se=>{const ot=T[Se];ot!=null&&ot.file&&yS([ot.src]),_(st=>st.filter((wt,Ne)=>Ne!==Se))},Q=async Se=>{if(Se.preventDefault(),F||O)return;const ot=()=>ee();if(u){u({event:Se,submit:ot,state:U});return}ot()},ee=async()=>{if(F||O)return;const Se=H.trim();if(!Se&&!k)return;const ot=T.filter(Ne=>Ne.file).map(Ne=>Ne.file);let wt=T.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src.trim(),mediaType:Ne.mediaType}));if(ot.length>0){P(!0);try{const mt=await async function(Ue){return a?await a({files:Ue}):new Promise((en,he)=>{try{const De={dataTransfer:{files:Ue}};r.Assets.FileUploader().uploadFile(De,({data:Fe})=>{en(Fe)})}catch(De){he(De)}})}(ot),dt=T.filter(Ue=>Ue.file).map(Ue=>Ue.src);wt=[...wt,...mt.map(Ue=>({type:"file",url:Ue.src,mediaType:Ue.mimeType}))],yS(dt)}catch(Ne){const mt=r.t(`${A}.uploadError`);W(Ne instanceof Error?Ne:new Error(mt)),P(!1);return}finally{P(!1)}}D({text:Se,files:wt.length>0?wt:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},G=Se=>{Se.key==="Enter"&&!Se.shiftKey&&(Se.preventDefault(),Q(Se))};h.useEffect(()=>{x||y(Se=>wS(Se,S)),C("")},[x]);const R=`${hn}__root`,le=`${hn}__actions`,ge=`${hn}__actions-left`,Ee=`${hn}__actions-right`,Ce=`${hn}__submit-btn`,tt=N(`${hn}__textarea gs-utl-w-full`,z.bgTr,Ao.inputText,Pe.noFocusOut,Pe.noResize),Qe=r.t(`${A}.placeholder`),Ot=i==null?void 0:i({state:U}),ut=l==null?void 0:l({state:U});return c.jsxs("form",{onSubmit:Q,className:N(hn,Te.s,te.bt,z.br,e),style:t,children:[Ot&&Jt(r,Ot),c.jsxs(I,{className:N(R,te.b,te.rndLg,z.br,z.bg,Te.s,"gs-utl-relative"),col:!0,gap:"s",children:[O&&c.jsx(Lo,{abs:!0,full:!0,className:z.bgH25}),c.jsx(SH,{editor:r,disabled:F,contextComponents:$.contextComponents,...d}),c.jsx(EH,{value:H,name:"prompt",onChange:Se=>y(Se.target.value),onKeyDown:G,placeholder:Qe,readOnly:x,disabled:F,className:tt,style:{minHeight:40,maxHeight:100},autoResize:!0,...f}),c.jsx(vS,{editor:r,assets:T,onRemove:X,...p}),c.jsxs(I,{className:le,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(I,{className:ge,gap:"s",items:"center",children:c.jsx(wH,{editor:r,disabled:F,maxAssets:o,currentAssetsCount:T.length,acceptAssetType:s,onFilesSelected:J,onAssetSelected:Y,...g})}),c.jsxs(I,{className:Ee,gap:"s",items:"center",children:[c.jsx(xH,{editor:r,disabled:F,onTranscript:C,onListeningChange:E,...m}),c.jsx(Ke,{className:N(Ce,te.pill),size:"s",type:F?"button":"submit",onClick:F?L:void 0,icon:F?q.stop:q.arrowUp,variant:F?"out-clear":"pr",disabled:!V,disabledClassName:Pe.disabledM,...v})]})]})]}),ut&&Jt(r,ut)]})},PH="gs-cmp-ai-chat-loading-state",OH=({className:e,chatContext:t,editor:n,...r})=>c.jsx(I,{className:N(PH,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(Lo,{})}),_H="file-refs",SS="gs-cmp-ai-chat-markdown",yt=`${SS}__el`,AH={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 ${Ao.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} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${yt}-hr ${jt.hr} ${z.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}),[_H]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function LH(e){return AS.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const MH=h.memo(function({content:t}){return c.jsx(LS,{components:AH,remarkPlugins:[MS],children:t})},(e,t)=>e.content===t.content),CS=h.memo(function({content:t,id:n,className:r}){const o=h.useMemo(()=>LH(t),[t]);return c.jsx("div",{className:`${SS} ${r||""}`,children:o.map((s,a)=>c.jsx(MH,{content:s},`${n}-block_${a}`))})});function zh(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function xS(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Uh="gs-cmp-ai-chat-message",Da="aiChat.message",NH=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:f,layoutPartToolDetail:p,layoutPartToolResult:g}){const m=r.parts||[],v=m.filter(sr.isFileUIPart),b=m.filter(O=>!sr.isFileUIPart(O)&&(s||!zh(O)&&!xS(O))),w=v.map(O=>({src:O.url,mediaType:O.mediaType??"image/*"})),y=b.length-1,S=r.role==="user",C=N(Uh,`${Uh}--${r.role}`,Te.s,t),x=N(`${Uh}__content gs-utl-break-words`,S?N(z.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},T=l==null?void 0:l(E),_=u==null?void 0:u(E);return c.jsxs(I,{col:!0,gap:"s",className:C,style:n,children:[T&&Jt(a,T),c.jsxs(I,{gap:"s",className:N(x,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((O,P)=>c.jsx($H,{part:O,messageId:r.id,partIndex:P,isStreamingPart:P===y&&o,layoutPart:d,layoutPartToolLabel:f,layoutPartToolDetail:p,layoutPartToolResult:g,layoutProps:E},`${r.id}-part-${P}`)),c.jsx(vS,{editor:a,assets:w,className:"gs-utl-justify-end"})]}),_&&Jt(a,_)]})}),yo="gs-cmp-ai-chat-message-part",$H=h.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d,f;if(s){const p=s({...u,part:t,partIndex:r});if(p)return Jt(u.editor,p)}if(sr.isReasoningUIPart(t)){const{text:p,state:g}=t,m=p==null?void 0:p.trim(),v=o&&g==="streaming",b=`${yo} ${yo}__reasoning`,w=u.editor.t(`${Da}.reasoning`);return!!m&&c.jsx(mo,{className:N(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(I,{className:N(`${b}-label`,mn.semibold),items:"center",gap:"s",children:[v?c.jsx(Lo,{size:"xs",currentColor:!0}):c.jsx(Ba,{path:u2,size:se.s2x}),c.jsx("div",{children:w})]}),children:c.jsx("div",{className:N(`${b}-text`,z.txtLowEmphasis,vn.xs,mn.italic),children:c.jsx(CS,{id:`${n}-${r}`,content:m})})})}if(sr.isTextUIPart(t)){const p=t.text;if(!p)return null;const g=`${yo} ${yo}__text`;return c.jsx(CS,{content:p,id:`${n}-${r}`,className:g})}if(sr.isToolUIPart(t)){const{type:p,toolCallId:g,input:m="",output:v="",errorText:b}=t,w=p.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"),T=`${yo}__tool`,_=`${yo}__tool-result`,O=`${T}-detail`,P=N(O,"gs-utl-max-w-full"),A="gs-utl-max-w-full gs-utl-whitespace-normal",M=N(`${O}-info gs-utl-max-h-24 gs-utl-overflow-auto`,A,z.txtLowEmphasis,vn.xs),$=N(`${yo}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,A,z.txtLowEmphasis,vn.xs),j=`${T}-section-label`,L=y&&y!=="{}",D=S&&S!=="{}",W=!!b,F=L||D||W,k=u.editor.t(`${Da}.tool.input`),H=u.editor.t(`${Da}.tool.output`),V=u.editor.t(`${Da}.tool.error`),J=u.editor.t(`${Da}.tools.${w}`,{params:m||{}})||w,X=u.editor.runCommand(pr.getChatManager).tools[w],Q={...u,part:t,partIndex:r,toolName:w,isCompleted:x,isProcessing:E,input:t.input,output:t.output},ee=(a==null?void 0:a(Q))||((d=X==null?void 0:X.layoutToolLabel)==null?void 0:d.call(X,Q)),G=i==null?void 0:i(Q),R=(l==null?void 0:l(Q))||((f=X==null?void 0:X.layoutToolResult)==null?void 0:f.call(X,Q)),le=ee?Jt(u.editor,ee):J,ge=R?Jt(u.editor,R):null,Ee=G?Jt(u.editor,G):c.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[L&&c.jsxs(I,{className:N(P,`${O}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:k}),c.jsx("pre",{className:M,children:y})]}),D&&c.jsxs(I,{className:N(P,`${O}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:H}),c.jsx("pre",{className:M,children:S})]}),W&&c.jsxs(I,{className:N(P,`${O}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:V}),c.jsx("pre",{className:M,children:b})]})]});return c.jsxs(I,{className:N(`${yo} ${T}`,z.bgH2,te.rnd,Te.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(mo,{disabled:!F&&!G,handler:c.jsxs(I,{className:N(`${T}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${T}-status`,children:x?c.jsx(Ba,{className:`${T}-status-success`,path:ng,size:se.s2x}):E?c.jsx(Lo,{className:`${T}-status-processing`,size:"xs",currentColor:!0}):c.jsx(Ba,{className:`${T}-status-error`,path:rg,size:se.s2x})}),c.jsx("div",{className:N(`${T}-name`,mT.all),children:le})]}),children:Ee}),c.jsx(kH,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:$}),!!ge&&c.jsx("div",{className:_,children:ge})]})}if(zh(t)||xS(t)){const p=`${yo}__source`,m=zh(t)?t.url:void 0,v=t.title,b=u.editor.t(`${Da}.source.document`),w=v||m||b,y=m?new URL(m).hostname:"",S=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${p}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${p}-title`,mn.semibold,vn.sm,"gs-utl-truncate"),children:w}),y&&c.jsx("div",{className:N(`${p}-url`,z.txtLowEmphasis,vn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(Ba,{className:N(`${p}-icon`,z.txtLowEmphasis),path:og,size:se.s2x})]}),C=N(p,z.bgH2,te.rnd,Te.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Pe.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}),kH=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})}),IH="gs-cmp-ai-chat-messages-status",VH=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=N(z.bgA,Pe.dot,Pe.bounce);return o?c.jsxs(I,{items:"center",gap:"xs",className:N(IH,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},Wh="gs-cmp-ai-chat-messages";function HH({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(Wh,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>Td(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},r),[t,e,l,n.length,r]),f=h.useCallback(()=>({type:"column",className:`${Wh}__footer`,children:Td(e,{type:"aiChatMessagesStatus",chatContext:t},r)}),[t,e,r]),p=g=>{requestAnimationFrame(()=>{s==null||s.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{p(!0)},[n]),h.useEffect(()=>{p()},[s]),c.jsx(I,{ref:o,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?Jt(e,{type:"aiChatEmptyState",chatContext:t},r):Jt(e,{type:"virtualList",className:`${Wh}__list`,itemsPerRow:1,items:n,onRef:a,itemLayout:d,footerLayout:f})})}const ES=h.createContext(void 0),jH=({chatManager:e,children:t})=>{const n=e.currentChatState,r=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(ES.Provider,{value:r,children:t})},DH=()=>h.useContext(ES),FH="gs-cmp-ai-chat-panel";function BH({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=DH(),[,s]=h.useState(0),[a,i]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:f}=o;h.useEffect(()=>o.onUpdate(()=>s(E=>++E)),[]);const p=rn.useChat({chat:o.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:w}=p,y=w||a,S=h.useMemo(()=>({id:p.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(x=>x.abort()),l.clear(),p.stop()),addToolApprovalResponse:p.addToolApprovalResponse,addToolOutput:p.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{p.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),C=N(FH,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:f?c.jsxs(c.Fragment,{children:[Jt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(HH,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Jt(e,{type:"aiChatError",chatContext:S},t),Jt(e,{type:"aiChatInput",chatContext:S},t)]}):Jt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const zH=(e,t,n)=>(e.runCommand(re.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(jH,{chatManager:n,children:c.jsx(BH,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:r5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:n5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:OH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:TH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:t5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:NH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:VH})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(re.layoutComponentRemove,{type:r})})}),UH={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"}}}},WH="aiChat",GH=Ys.startup;return nC(function(e,t={}){t.getAccessToken&&(Xt.getAccessToken=t.getAccessToken),_1();const n=new QT(e,t),{Commands:r}=e;r.add(pr.getChatManager,()=>n),r.add(pr.getChatState,()=>n.currentChatState),r.add(pr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:UH});const o=zH(e,t,n),s=()=>{delete r.commands[pr.getChatManager],delete r.commands[pr.getChatState],delete r.commands[pr.getChatApi],o(),bT()};rC({editor:e,licenseKey:t.licenseKey,plan:GH,pluginName:WH,onLicenseCheckResponse:a=>{a?Xt.license=a:Xt.license=void 0},cleanup:s})})});
|