@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
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/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -0,0 +1,453 @@
|
|
|
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:{}};/*!
|
|
35
|
+
Copyright (c) 2018 Jed Watson.
|
|
36
|
+
Licensed under the MIT License (MIT), see
|
|
37
|
+
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})()})(rg);var JC=rg.exports;const M=Au(JC);var te={},QC={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(t,n){return"Cannot apply '"+t+"' to '"+n.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(t,n){return"[mobx.array] Index out of bounds, "+t+" is larger than "+n},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(t){return"Cannot initialize from classes that inherit from Map: "+t.constructor.name},20:function(t){return"Cannot initialize map from "+t},21:function(t){return"Cannot convert to map from '"+t+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(t){return"Cannot obtain administration from "+t},25:function(t,n){return"the entry '"+t+"' does not exist in the observable map '"+n+"'"},26:"please specify a property",27:function(t,n){return"no observable property '"+t.toString()+"' found on the observable object '"+n+"'"},28:function(t){return"Cannot obtain atom from "+t},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(t,n){return"Cycle detected in computation "+t+": "+n},33:function(t){return"The setter of computed value '"+t+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(t){return"[ComputedValue '"+t+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(t){return"[mobx] `observableArray."+t+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+t+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},RC=te.NODE_ENV!=="production"?QC:{};function me(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(te.NODE_ENV!=="production"){var o=typeof e=="string"?e:RC[e];throw typeof o=="function"&&(o=o.apply(null,n)),new Error("[MobX] "+o)}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 dl(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:ex}var og=Object.assign,fl=Object.getOwnPropertyDescriptor,Sr=Object.defineProperty,Va=Object.prototype,pl=[];Object.freeze(pl);var sg={};Object.freeze(sg);var tx=typeof Proxy<"u",nx=Object.toString();function ag(){tx||me(te.NODE_ENV!=="production"?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function Ia(e){te.NODE_ENV!=="production"&&ce.verifyProxies&&me("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function nr(){return++ce.mobxGuid}function ju(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var zs=function(){};function Mt(e){return typeof e=="function"}function ss(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function hl(e){return e!==null&&typeof e=="object"}function wn(e){if(!hl(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 ig(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function ja(e,t,n){Sr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function lg(e,t,n){Sr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function mo(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return hl(r)&&r[n]===!0}}function Us(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 Kr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var cg=typeof Object.getOwnPropertySymbols<"u";function ox(e){var t=Object.keys(e);if(!cg)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Va.propertyIsEnumerable.call(e,r)})):t}var Ws=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:cg?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Du(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function ug(e){return e===null?null:typeof e=="object"?""+e:e}function kn(e,t){return Va.hasOwnProperty.call(e,t)}var sx=Object.getOwnPropertyDescriptors||function(t){var n={};return Ws(t).forEach(function(r){n[r]=fl(t,r)}),n};function Sn(e,t){return!!(e&t)}function Cn(e,t,n){return n?e|=t:e&=~t,e}function dg(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 Gs(e,t,n){return t&&ax(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qs(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.
|
|
39
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yr(){return Yr=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},Yr.apply(null,arguments)}function fg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Hu(e,t)}function Hu(e,t){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Hu(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 dg(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)?dg(e,t):void 0}}var ln=Symbol("mobx-stored-annotations");function Cr(e){function t(n,r){if(Ha(r))return e.decorate_20223_(n,r);Da(n,r,e)}return Object.assign(t,e)}function Da(e,t,n){if(kn(e,ln)||ja(e,ln,Yr({},e[ln])),te.NODE_ENV!=="production"&&vl(n)&&!kn(e[ln],t)){var r=e.constructor.name+".prototype."+t.toString();me("'"+r+"' is decorated with 'override', but no such decorated member was found on prototype.")}ux(e,n,t),vl(n)||(e[ln][t]=n)}function ux(e,t,n){if(te.NODE_ENV!=="production"&&!vl(t)&&kn(e[ln],n)){var r=e.constructor.name+".prototype."+n.toString(),o=e[ln][n].annotationType_,s=t.annotationType_;me("Cannot apply '@"+s+"' to '"+r+"':"+(`
|
|
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={};/**
|
|
68
|
+
* @license React
|
|
69
|
+
* use-sync-external-store-shim.production.min.js
|
|
70
|
+
*
|
|
71
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the MIT license found in the
|
|
74
|
+
* 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
|
+
* use-sync-external-store-shim.development.js
|
|
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`,`
|
|
84
|
+
font-size: .6rem;
|
|
85
|
+
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(b=>` - ${b}`).join(`
|
|
88
|
+
`)].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`
|
|
90
|
+
@font-face {
|
|
91
|
+
font-family: ${e};
|
|
92
|
+
src: url('${t}');
|
|
93
|
+
${p.join(`
|
|
94
|
+
`)}
|
|
95
|
+
}
|
|
96
|
+
`},Wm=(e={})=>{const t=Object.entries(e).map(([r,o])=>hi(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=JA(o)+`
|
|
97
|
+
`;return n.trim()},Gm="data-project-fonts",qm="true",QA=`${Gm}="${qm}"`,Km=(e={})=>{const t=Wm(e);return t?`<style ${QA}>
|
|
98
|
+
${t}
|
|
99
|
+
</style>`:""},RA=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),eN=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),Ym=e=>!!e.id,pa=e=>t=>(t.tagName||"").toLowerCase()===e,Mr=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),tN=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},ha=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},No=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},gi=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},mi=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},nN=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),_f=(e,t,n="html")=>{const{Pages:r}=e,o=nn({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":al(o||t.getName())}.${n}`},rN=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},sc="custom-html-body",ac="data-custom-html-body",Zm="data-global-custom-html-head",Xm="data-global-custom-html-body",Jm="global",oN=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Of(t.appStore);let a=o.querySelector(`[${Zm}]`);a||(a=o.createElement("div"),a.setAttribute(Zm,"true"),o.head.insertBefore(a,o.head.firstChild));const i=Km(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
|
|
100
|
+
`);a.innerHTML=u,Ah(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Of(t.appStore);let a=o.querySelector(`[${Xm}]`);if(!a){a=o.createElement("div"),a.setAttribute(Xm,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",Ah(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(yn.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(sc,{isComponent:o=>gi(o,ac),model:{defaults:{attributes:{[ac]:!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(Jm)&&f.push(m)}),f.forEach(m=>{const b=m.toHTML();a.includes(b)||(a+=b),m.remove()});const p=[];u.findType(sc).forEach(m=>{m.has(Jm)&&p.push(m)}),p.forEach(m=>{const b=m.getInnerHTML();i.includes(b)||(i+=b),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},bi="page://",ic="href-params__",sN=`data-gjs-${ic}`,lc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},cc=e=>!!lc(e),Qm=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},aN=e=>!!(e!=null&&e.Components.getType("mjml")),Rm=e=>cc(e)?X.database:Tf(e)?X.home:"",eb=e=>!!e.getSymbolOverride()?c.jsx(se,{icon:X.rhombusOutline,size:le.s3x}):c.jsx(w1,{className:M("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),tb=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Tf=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},it={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"}},nb=e=>{for(const t in it){const n=t;if(it[n]({cmp:e}))return n}},rb=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(sc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},iN=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.forEach(u=>{it.title({cmp:u})?(u.components(t.title),delete n.title):it.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):it.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):it.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):it.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):it.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):it.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):nb(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=rb(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:sc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},lN=(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});it.title({cmp:i})?n.title=i.getInnerHTML():it.favicon({cmp:i})?n.favicon=u:it.description({cmp:i})?n.description=l:it.keywords({cmp:i})?n.keywords=l:it.socialTitle({cmp:i})?n.socialTitle=l:it.socialDescription({cmp:i})?n.socialDescription=l:it.socialImage({cmp:i})?n.socialImage=l:nb(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
|
|
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--),!YN(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Pt("InvalidTag",f,rn(e,s))}const u=UN(e,s);if(u===!1)return Pt("InvalidAttr","Attributes for '"+l+"' have open quote.",rn(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=Sb(d,t);if(p===!0)r=!0;else return Pt(p.err.code,p.err.msg,rn(e,f+p.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return Pt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",rn(e,a));if(n.length===0)return Pt("InvalidTag","Closing tag '"+l+"' has not been opened.",rn(e,a));{const f=n.pop();if(l!==f.tagName){let p=rn(e,f.tagStartPos);return Pt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",rn(e,a))}n.length==0&&(o=!0)}}else return Pt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",rn(e,s));else{const f=Sb(d,t);if(f!==!0)return Pt(f.err.code,f.err.msg,rn(e,s-d.length+f.err.line));if(o===!0)return Pt("InvalidXml","Multiple possible root nodes found.",rn(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=wb(e,s);continue}else if(e[s+1]==="?"){if(s=yb(e,++s),s.err)return s}else break;else if(e[s]==="&"){const f=qN(e,s);if(f==-1)return Pt("InvalidChar","char '&' is not expected.",rn(e,s));s=f}else if(o===!0&&!vb(e[s]))return Pt("InvalidXml","Extra text at the end",rn(e,s));e[s]==="<"&&s--}}else{if(vb(e[s]))continue;return Pt("InvalidChar","char '"+e[s]+"' is not expected.",rn(e,s))}if(r){if(n.length==1)return Pt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",rn(e,n[0].tagStartPos));if(n.length>0)return Pt("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Pt("InvalidXml","Start tag expected.",1);return!0}function vb(e){return e===" "||e===" "||e===`
|
|
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 _s("!xml");let n=t,r="",o="";const s=new JN(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=Os(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=Lf(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 _s(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=Os(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=Os(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=Lf(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 b=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let v="";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,v=y.tagContent}const w=new _s(u);u!==f&&p&&(w[":@"]=this.buildAttributesMap(f,o,u)),v&&(v=this.parseTextData(v,u,o,!0,p,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,v),this.addChild(n,w,o,b)}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 v=new _s(u);u!==f&&p&&(v[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,v,o,b),o=o.substr(0,o.lastIndexOf("."))}else{const v=new _s(u);this.tagsNodeStack.push(n),u!==f&&p&&(v[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,v,o,b),n=v}r="",a=g}}else r+=e[a];return t.child};function p3(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 h3=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 g3(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 m3(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function b3(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 Os(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Lf(e,t,n,r=">"){const o=b3(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 v3(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=Os(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=Os(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Os(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Os(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Lf(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function $f(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:t3(e,n)}else return DN(e)?e:""}const kf=_s.getMetaDataSymbol();function y3(e,t){return xb(e,t)}function xb(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=w3(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=xb(a[i],t,l);const d=C3(u,t);a[kf]!==void 0&&(u[kf]=a[kf]),a[":@"]?S3(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 w3(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function S3(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 C3(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 x3{constructor(t){this.externalEntities={},this.options=XN(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=FN(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new a3(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:y3(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 _s.getMetaDataSymbol()}}const E3=`
|
|
105
|
+
`;function P3(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=E3),Eb(e,t,"",n)}function Eb(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=_3(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];T3(u,t)||(m=t.tagValueProcessor(l,m),m=_b(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=Pb(i[":@"],t),b=l==="?xml"?"":r;let v=i[l][0][t.textNodeName];v=v.length!==0?" "+v:"",o+=b+`<${l}${v}${m}?>`,s=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const f=Pb(i[":@"],t),p=r+`<${l}${f}`,g=Eb(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 _3(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 Pb(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=_b(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function T3(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 _b(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 O3={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 $o(e){this.options=Object.assign({},O3,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Cb(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=M3),this.processTextOrObjNode=A3,this.options.format?(this.indentate=N3,this.tagEndChar=`>
|
|
106
|
+
`,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:`
|
|
108
|
+
<svg viewBox="0 0 24 24">
|
|
109
|
+
<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
|
+
</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:v=>{v.getSelected().components().add({type:s})}}],styles:`
|
|
112
|
+
.${a} {
|
|
113
|
+
display: flex;
|
|
114
|
+
justify-content: flex-start;
|
|
115
|
+
align-items: stretch;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
min-height: auto;
|
|
118
|
+
padding: 10px 0;
|
|
119
|
+
}
|
|
120
|
+
@media (max-width: 992px) {
|
|
121
|
+
.${a} {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`}}}),n.addType(s,{isComponent:v=>No(v,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Mr(o),resizable:{...l,bc:0,keyWidth:u,currentUnit:p,minDim:d,step:f},icon:`
|
|
126
|
+
<svg viewBox="0 0 24 24">
|
|
127
|
+
<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
|
+
</svg>
|
|
129
|
+
`,unstylable:["width"],"stylable-require":["flex-basis","flex-item-behaviour","flex-item-h-align","flex-order"],traits:[{label:"Center content",name:"center-content",type:"checkbox",changeProp:!0}],styles:`
|
|
130
|
+
.${i} {
|
|
131
|
+
flex: 1 1 0%;
|
|
132
|
+
padding: 5px 0;
|
|
133
|
+
}
|
|
134
|
+
`},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const v=this.get("center-content");this.addStyle({display:v?"flex":"block","align-items":v?"center":"","justify-content":v?"center":""})}}});const g={label:o,content:{type:o,components:[{type:s},{type:s},{type:s}]},...t.block},m={merge:!0},b=v=>{var w;return((w=r.get(v))==null?void 0:w.category)||g.category};r.add(kb,{...g,category:b(kb),content:{type:o,components:[{type:s}]}},m),r.add(Vb,{...g,category:b(Vb),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(Ib,{...g,category:b(Ib),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(If,{...g,category:b(If),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},xi="section",jf="container",Df="gjs-section",Hf="gjs-container",B3=function(e,t={}){const{Components:n,Blocks:r}=e;r.add(xi,{label:xi,media:`
|
|
135
|
+
<svg viewBox="0 0 24 24">
|
|
136
|
+
<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
|
+
</svg>
|
|
138
|
+
`,content:{type:xi},...t.block},{at:mi(e,If)+1}),n.addType(xi,{isComponent:o=>No(o,Df),model:{defaults:{tagName:"section",emptyState:!0,draggable:Mr("wrapper"),droppable:Mr(jf),attributes:{class:Df},components:{type:jf},styles:`
|
|
139
|
+
.${Df} {
|
|
140
|
+
display: flex;
|
|
141
|
+
padding: 50px 0;
|
|
142
|
+
}
|
|
143
|
+
`}}}),n.addType(jf,{isComponent:o=>No(o,Hf),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Hf},styles:`
|
|
144
|
+
.${Hf} {
|
|
145
|
+
width: 90%;
|
|
146
|
+
margin: 0 auto;
|
|
147
|
+
max-width: 1200px;
|
|
148
|
+
}
|
|
149
|
+
`}}})},z3=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
|
|
150
|
+
<svg viewBox="0 0 24 24">
|
|
151
|
+
<path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
|
|
152
|
+
</svg>
|
|
153
|
+
`,content:{type:o},...t.block},{at:mi(e,xi)+1}),n.addType(o,{isComponent:a=>No(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
|
+
.${s} {
|
|
155
|
+
height: 3px;
|
|
156
|
+
width: 100%;
|
|
157
|
+
margin: 10px;
|
|
158
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
159
|
+
}
|
|
160
|
+
`}}})},U3=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(bi)){const f=d.replace(bi,""),p=e.Pages.get(f);if(u.href=p?`./${_f(e,p)}`:"##",p&&cc(p)){const g={id:cN(this,"id")},m=sb(p,{currentItem:g});u.href=m.fullPath,dN(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)}}})},W3=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,media:`
|
|
161
|
+
<svg viewBox="0 0 24 24">
|
|
162
|
+
<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
|
+
</svg>
|
|
164
|
+
`,content:{type:o,components:"Insert your text here"},...t.block},{at:mi(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>tN(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}]}}})},G3=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
|
+
<svg viewBox="0 0 24 24">
|
|
166
|
+
<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
|
+
</svg>
|
|
168
|
+
`,content:{type:s},...t.block},{at:mi(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>No(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
|
+
.${a} {
|
|
170
|
+
height: 200px;
|
|
171
|
+
width: 100%;
|
|
172
|
+
}
|
|
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()}}})},q3=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,media:`
|
|
174
|
+
<svg viewBox="0 0 24 24">
|
|
175
|
+
<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
|
+
</svg>
|
|
177
|
+
`,content:{type:o},...t.block},{at:mi(e,"link")+1}),n.addType(o,{isComponent:a=>No(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
|
|
178
|
+
.${s} {
|
|
179
|
+
color: inherit;
|
|
180
|
+
display: inline-block;
|
|
181
|
+
vertical-align: top;
|
|
182
|
+
padding: 10px;
|
|
183
|
+
max-width: 100%;
|
|
184
|
+
text-decoration: none;
|
|
185
|
+
}
|
|
186
|
+
`}}})};function K3(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 Y3={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},jb=`<svg viewBox="0 0 24 24">
|
|
187
|
+
<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>`,Z3=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:jb,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>No(i,s)||gi(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:Y3,components:jb,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:Lo(({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
|
+
.${s} {
|
|
190
|
+
display: inline-block;
|
|
191
|
+
text-decoration: none;
|
|
192
|
+
color: inherit;
|
|
193
|
+
vertical-align: middle;
|
|
194
|
+
fill: currentColor;
|
|
195
|
+
width: 50px;
|
|
196
|
+
height: 50px;
|
|
197
|
+
}
|
|
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")})}}})},Ff="__nc",X3=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 J3(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=X3(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((b,v)=>(b[v.id]=v.value||"",b),{});i.addAttributes(m)}d()},addItem:()=>({id:Ff,value:!1}),labelItem:i=>i.id===Ff||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===Ff?"":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 Q3="Basic";function Bf(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=K3;const r=e.Parser.getConfig().optionsHtml;r.htmlType="text/html";const o=n.sdkOptions.pages||{};(Nt(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:Q3,select:!0,activate:!0};oN(e,t),U3(e),F3(e,{block:a}),W3(e,{block:a}),B3(e,{block:a}),z3(e,{block:a}),G3(e,{block:a}),q3(e,{block:a}),Z3(e,{block:a}),J3(e)}function Db(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,b=Tb(u,{sanitizer:m});if(g.htmlType==="text/xml"){const w=d.parseFromString(`<div>${b}</div>`,"text/xml").querySelector("parsererror div");f.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(pc,{mjml:b})),p=b}else{const g=d.parseFromString(u,"text/html");Hb(g.documentElement);const m=g.querySelectorAll("style"),b=[];m.forEach(w=>b.push(w.innerHTML));const v=b.filter(Boolean).join(`
|
|
199
|
+
`).trim();v&&(l==null||l.Parser.parserCss.parse(v,{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 Hb(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)Hb(r)}function R3(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fb(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 Bb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fb(Object(n),!0).forEach(function(r){R3(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function e4(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 t4(e,t){if(e==null)return{};var n=e4(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 n4(e,t){return r4(e)||o4(e,t)||s4(e,t)||a4()}function r4(e){if(Array.isArray(e))return e}function o4(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 s4(e,t){if(e){if(typeof e=="string")return zb(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 zb(e,t)}}function zb(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 a4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
200
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i4(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ub(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 Wb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ub(Object(n),!0).forEach(function(r){i4(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ub(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function l4(){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 Ei(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function hc(e){return{}.toString.call(e).includes("Object")}function c4(e){return!Object.keys(e).length}function Pi(e){return typeof e=="function"}function u4(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d4(e,t){return hc(t)||Vo("changeType"),Object.keys(t).some(function(n){return!u4(e,n)})&&Vo("changeField"),t}function f4(e){Pi(e)||Vo("selectorType")}function p4(e){Pi(e)||hc(e)||Vo("handlerType"),hc(e)&&Object.values(e).some(function(t){return!Pi(t)})&&Vo("handlersType")}function h4(e){e||Vo("initialIsRequired"),hc(e)||Vo("initialType"),c4(e)&&Vo("initialContent")}function g4(e,t){throw new Error(e[t]||e.default)}var m4={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"},Vo=Ei(g4)(m4),gc={changes:d4,selector:f4,handler:p4,initial:h4};function b4(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};gc.initial(e),gc.handler(t);var n={current:e},r=Ei(w4)(n,t),o=Ei(y4)(n),s=Ei(gc.changes)(e),a=Ei(v4)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return gc.selector(u),u(n.current)}function l(u){l4(r,o,s,a)(u)}return[i,l]}function v4(e,t){return Pi(t)?t(e.current):t}function y4(e,t){return e.current=Wb(Wb({},e.current),t),t}function w4(e,t,n){return Pi(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 S4={create:b4},C4={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function x4(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 E4(e){return{}.toString.call(e).includes("Object")}function P4(e){return e||qb("configIsRequired"),E4(e)||qb("configType"),e.urls?(_4(),{paths:{vs:e.urls.monacoBase}}):e}function _4(){console.warn(Gb.deprecation)}function T4(e,t){throw new Error(e[t]||e.default)}var Gb={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
|
+
You are using deprecated way of configuration.
|
|
202
|
+
|
|
203
|
+
Instead of using
|
|
204
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
205
|
+
use
|
|
206
|
+
monaco.config({ paths: { vs: '...' } })
|
|
207
|
+
|
|
208
|
+
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=`
|
|
210
|
+
[data-gjs-type="${t}"]${a}:empty {
|
|
211
|
+
text-decoration: none;
|
|
212
|
+
padding: 5px;
|
|
213
|
+
${r.limitW?"min-width: 50px;":""}
|
|
214
|
+
${i}
|
|
215
|
+
}
|
|
216
|
+
[data-gjs-type="${t}"]${a}:empty:before {
|
|
217
|
+
background-color: #ddd;
|
|
218
|
+
color: #000;
|
|
219
|
+
font-size: 16px;
|
|
220
|
+
font-weight: bold;
|
|
221
|
+
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
222
|
+
height: 100%;
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
min-height: 30px;
|
|
227
|
+
padding: 0 10px;
|
|
228
|
+
opacity: 0.3;
|
|
229
|
+
border-radius: 3px;
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
text-overflow: ellipsis;
|
|
233
|
+
content: "${n}";
|
|
234
|
+
${r.limitH?"height: auto;":""}
|
|
235
|
+
${r.smallH?"min-height: 30px;":""}
|
|
236
|
+
${l}
|
|
237
|
+
}`,s.appendChild(u)}},av=(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;lM(t,s,n.getName({noCustom:!0}),a)},cM=function(t){const{Components:n}=t,r=o=>{const{id:s}=o;n.addType(s,{extendFnView:["onRender"],view:{onRender(){av(s,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)};function uM(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=Ci,{attributes:d,class:f,font:p,all:g,preview:m,title:b,style:v,breakpoint:w}=Vf,{wrapper:y,section:S,column:C,text:x,button:E,image:P,divider:T,group:O,social:_,socialElement:N,spacer:L,navbar:k,navbarLink:B,table:$,raw:z}=ko,{model:K}=n.getType("default"),{model:F}=n.getType(i),{model:V}=n.getType(u),{model:D}=n.getType(p),{model:A,view:j}=n.getType(l),{model:q,view:G}=n.getType(k),{model:Y,view:Q}=n.getType(B),{model:Z,view:W}=n.getType(y),{model:R,view:re}=n.getType(S),{model:fe,view:xe}=n.getType(C),{model:ne,view:Oe}=n.getType(x),{model:Ie,view:ut}=n.getType(E),{model:ot}=n.getType(P),{model:we,view:et}=n.getType(T),{model:tt,view:gt}=n.getType(L),{view:Ne,model:dt}=n.getType(_),{view:st,model:Fe}=n.getType(N),{view:Yt,model:ge}=n.getType(O),Ve=As.globalStyles,je="css-class",ke={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Et={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Ht={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},po={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},js={label:"Content",getValue:({component:J})=>J.getInnerHTML(),setValue:({component:J,value:pe})=>J.components(pe)},Ye=J=>{o.open({title:J.getName({noCustom:!0}),content:()=>c.jsx(ov,{content:"",code:J.getInnerHTML(),onAction:pe=>J.components(pe),buttonProps:{children:s.t("save")}})})},mt=J=>{var he;const pe=J.getChildrenContainer();((he=pe==null?void 0:pe.innerHTML)==null?void 0:he.trim())===""&&(pe.innerHTML="")},Zt=J=>J.set({void:!1},{silent:!0});function Qn(J={}){return K.prototype.toHTML.call(this,J)}function Wt(J){const pe=J.closestType(i),he=pe==null?void 0:pe.findType(l)[0];return(he==null?void 0:he.toHTML())||""}function Ds(J){const pe=J.toHTML(),he=e.runCommand(pc,{mjml:pe}),kt=new DOMParser().parseFromString(he.html,"text/html");return{mjml:pe,mjmlToHtml:he,document:kt}}const vn=function(J){const pe=J.model,he=Lo(()=>{var Ae;return(Ae=pe.closestType(i))==null?void 0:Ae.trigger("rerender")});J.listenTo(pe.components(),"add remove reset change",he)},ho=(J,pe)=>J.replace(`<${i}>`,`<${i}>${Wt(pe)}`),Jo=J=>`cls-${J.tagName}-${J.getId()}`,Qo=(J,pe)=>{const he={...J.get("attributes")||{}};return delete he.style,{...he,[je]:`${he[je]||""} ${Jo(J)}`.trim()}},Ro=(J,pe)=>{const he=J.closestType(i),Ae=(he==null?void 0:he.findFirstType(l))||(he==null?void 0:he.append({type:l})[0]);Ae==null||Ae.trigger(pe?"rerenderHeadImmediate":"rerenderHead")},es=J=>function(){return Qo(this)},an=(J,pe)=>function(he){const Ae=he.querySelector(`.${Jo(this.model)}`);return(pe?Ae:Ae==null?void 0:Ae.outerHTML)||J.prototype.getTemplateFromEl.call(this,he)},br=J=>function(...pe){const he=J.prototype.toJSON.apply(this,pe),Ae=he.attributes||{};return delete he.style,delete Ae.style,delete Ae.__p,he},Eu=J=>function(...pe){const he=J.prototype.getAttrToHTML.apply(this,pe);return delete he.__p,he};function La(){return{start:`<mjml>${Wt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function HI(){var he;const J=(he=this.model.parent())==null?void 0:he.is(d),pe=Yw(this.model,{withSiblings:!J,withHead:!J,beforeRootEnd:J?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:pe.start,end:pe.end}}function FI(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const Yw=(J,pe={})=>{var er;const he=J.parents().filter(Mn=>Mn.tagName.startsWith("mj-")),Ae=he.map(Mn=>`<${Mn.tagName}>`).reverse().join(""),kt=he.map(Mn=>`</${Mn.tagName}>`).join(""),Tt=pe.withHead?Wt(J):"",Rn=pe.withSiblings?(er=J.parent())==null?void 0:er.components().filter(Mn=>Mn!==J).map(({tagName:Mn})=>`<${Mn}></${Mn}>`).join(""):"";return{start:`<${i}>${Tt}${Ae}`,end:`${Rn||""}${kt}${pe.beforeRootEnd||""}</${i}>`}},Xt=({model:J,noVoid:pe})=>({init(){const he={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",he),this.set("style",he),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),pe&&Zt(this)},handleStyleChange(he,Ae,kt){if(kt.fromAttr||kt.fromSync)return;const Tt=this.getStylesToAttributes();this.set("attributes",Tt,{...kt,fromStyle:!0,fromSync:!0})},handleAttributeChange(he,Ae,kt){if(kt.fromStyle||kt.fromSync)return;const Tt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(Tt,{...kt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const he=this.getStyle({skipResolve:!0})||{};return delete he.__p,he},getAttrToHTML:Eu(J),getMjmlAttributes:es(),toJSON:br(J)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:J=>J.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...Xt({model:F}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:Qn},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:br(A)},view:{init(){this.renderHeadDebounced=Lo(this.renderHead,30);const{em:J,el:pe,model:he}=this,Ae=he.components(),kt="core:preview",Tt=J.Commands.events;this.listenTo(J,`${Tt.runCommand}${kt}`,()=>{pe.style.display="none"}),this.listenTo(J,`${Tt.stopCommand}${kt}`,()=>{pe.style.display=""}),this.listenTo(Ae,"change",this.onComponentsChange),this.listenTo(Ae,"add remove reset",this.renderHead),this.listenTo(he,"rerenderHead",this.renderHeadDebounced),this.listenTo(he,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(J){const pe=Object.keys(J.changedAttributes());pe.length===1&&pe[0]==="status"||this.renderHead()},renderHead(){var er;const{model:J,el:pe}=this,he=pe.ownerDocument;if(!(he&&he!==document))return;const kt=J.closestType(i),Tt=kt&&Ds(kt),Rn=(er=Tt==null?void 0:Tt.document)==null?void 0:er.head;if(Rn){const Mn="mjml-head-result",xh=he.querySelector(Mn)||he.createElement(Mn);xh.innerHTML=Rn.innerHTML,!he.head.contains(xh)&&he.head.prepend(xh)}},render(...J){const pe=j.prototype.render.apply(this,J);return this.renderHeadDebounced(),pe}}}),n.addType(d,{isComponent:pa(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Mr(l),traits:[]},toJSON:br(K)},view:{onRender(){this.el.style.display="none"},init(){vn(this)}}}),n.addType(f,{isComponent:pa(f),model:{defaults:{tagName:f,name:"Class",stylable:!1,draggable:Mr(d),traits:[]},toJSON:br(K)}}),n.addType(p,{model:{...Xt({model:D}),defaults:{tagName:p,name:"Font",stylable:!1,draggable:Mr(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:pa(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Mr(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:pa(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Mr(d),traits:[]},toHTML(...J){return F.prototype.toHTML.apply(this,J)},toJSON:br(K)}}),n.addType(m,{isComponent:pa(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Mr(l),traits:[js],icon:`<svg viewBox="0 0 24 24">
|
|
238
|
+
<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:br(K)},view:{tagName:()=>"div",init(){const J=this.model.components();this.onRender=Lo(this.onRender,1),this.listenTo(J,"add remove reset change",this.onRender)},onRender(){const{model:J,el:pe}=this,he=J.getName({noCustom:!0}),Ae=J.getInnerHTML();pe.innerHTML=`<b>${he}</b>: ${Ae}`,pe.style.padding="5px 10px",pe.style.fontFamily="system-ui"}}}),n.addType(b,{isComponent:pa(b),extend:m,model:{defaults:{tagName:b,name:"Title",icon:'<svg viewBox="0 0 24 24"><path d="M5,4V7H10.5V19H13.5V7H19V4H5Z" /></svg>'}}}),n.addType(v,{model:{defaults:{tagName:v,name:"Style",droppable:!1,layerable:!1,stylable:!1,traits:[]},toJSON:br(K)},view:{render(){return this}}}),n.addType(u,{model:{...Xt({model:V,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:{...Xt({model:Z,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:[Ht]}},view:{attributes:{},getMjmlTemplate:HI,getTemplateFromEl:an(W),init:FI}}),n.addType(S,{model:{...Xt({model:R,noVoid:!0}),defaults:{tagName:S,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[po,Ht],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:an(re),getMjmlTemplate(){const{start:J,end:pe}=re.prototype.getMjmlTemplate.call(this);return{start:ho(J,this.model),end:pe}},render(){return mt(this),this},attributes:{}}}),n.addType(O,{model:{...Xt({model:ge,noVoid:!0}),defaults:{tagName:O,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[po]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:an(Yt,!0),getChildrenContainer(){return this.el},getMjmlTemplate(){return{start:"<mjml><mj-body><mj-section>",end:"</mj-section></mj-body></mjml>"}},render(){const J=this.getTemplateFromMjml(),pe=nS(J);return this.renderAttributes(),this.$el.attr(pe),this.el.innerHTML=J.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const BI=[x,P,E,T,L,_,N,z,$,O,k,B,ko.carousel,ko.carouselImage,ko.accordion,ko.accordionElement,ko.accordionTitle,ko.accordionText];n.addType(C,{model:{...Xt({model:fe,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:[...fe.getDefaults().stylable,"inner-background-color"],droppable:J=>BI.includes(J.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var he;const J=(he=this.model.parent())==null?void 0:he.is(d),pe=Yw(this.model,{withSiblings:!J,withHead:!J,beforeRootEnd:J?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:pe.start,end:pe.end}},getTemplateFromEl:an(xe,!0),getChildrenContainer(){const{el:J}=this;return J.querySelector("td > table tbody")||J.querySelector("table tbody")||J},render(){this.renderAttributes();const J=this.getTemplateFromMjml();return this.el.innerHTML=J.content,this.$el.attr(J.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),Ro(this.model,!0),this}}}),n.addType(x,{model:{...Xt({model:ne}),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:La,getTemplateFromEl:an(Oe),attributes:{style:"display: table; width: 100%"}}}),n.addType(E,{model:{...Xt({model:Ie,noVoid:!0}),defaults:{tagName:E,traits:[ke],stylable:[...Ie.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:La,getTemplateFromEl:an(ut)}}),n.addType(P,{model:{...Xt({model:ot}),defaults:{tagName:P,"style-default":{align:"center"},traits:[Et,{id:"altText",name:"alt",placeholder:"Image description"},"title",ke,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const J=ot.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete J.src,J},getMjmlAttributes(){const J=Qo(this);return this.isDefaultSrc()&&delete J.src,J}},view:{updateSrc(){const{model:J}=this,pe=J.get("src",{skipResolve:!0})||J.getSrcResult();J.addAttributes({src:pe}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Wt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(J){var pe,he,Ae;return(Ae=(he=(pe=J.querySelector("img"))==null?void 0:pe.closest("table"))==null?void 0:he.closest("tr"))==null?void 0:Ae.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(T,{model:{...Xt({model:we}),defaults:{tagName:T,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(se,{icon:X.alignHorizontalLeft,size:le.sx})},{id:"center",title:"Center",labelReact:c.jsx(se,{icon:X.alignHorizontalCenter,size:le.sx})},{id:"right",title:"Right",labelReact:c.jsx(se,{icon:X.alignHorizontalRight,size:le.sx})}]}]}},view:{getMjmlTemplate:La,getTemplateFromEl:an(et)}}),n.addType(_,{model:{...Xt({model:dt}),defaults:{tagName:_,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...dt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:La,getTemplateFromEl:an(Ne)}}),n.addType(N,{model:{...Xt({model:Fe,noVoid:!0}),defaults:{tagName:N,"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"}]},Et,ke,js]},getMjmlAttributes(){const J=Qo(this);return{...this.getDefaultIconProps()[J.name],...J}},getAttrToHTML(){const J=Fe.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[J.name],...J}},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:J,end:pe}=st.prototype.getMjmlTemplate.call(this);return{start:ho(J,this.model),end:pe}},getInnerMjmlTemplate(){var Ae;const{start:J,end:pe}=st.prototype.getInnerMjmlTemplate.call(this),he=((Ae=this.model.getInnerHTML())==null?void 0:Ae.trim())||"";return{start:`${J}${he}`,end:pe}},getChildrenContainer(){var Ae;const{el:J}=this,pe=(Ae=J.querySelector("tbody > tr > td"))==null?void 0:Ae.nextElementSibling;return(pe==null?void 0:pe.firstElementChild)||J.querySelector("img")||J}}}),n.addType(L,{model:{...Xt({model:tt}),defaults:{tagName:L,traits:[]}},view:{getMjmlTemplate:La,getTemplateFromEl:an(gt)}}),n.addType(k,{model:{...Xt({model:q}),defaults:{tagName:k,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:La,getTemplateFromEl:an(G,!0),render(){this.renderAttributes();const J=this.getTemplateFromMjml();return this.el.innerHTML=J.content,this.$el.attr(J.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),Ro(this.model),this}}}),n.addType(B,{model:{...Xt({model:Y}),defaults:{tagName:B,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:J,end:pe}=Q.prototype.getMjmlTemplate.call(this);return{start:ho(J,this.model),end:pe}},getTemplateFromEl(J){return J.querySelector(".mj-inline-links").innerHTML}}}),n.addType(z,{extendFn:["initToolbar"],model:{defaults:{tagName:z,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){rN(this,{id:"edit",command:()=>Ye(this),label:`<svg viewBox="0 0 24 24">
|
|
240
|
+
<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:br(K)},view:{events:{dblclick:"onActive"},onActive(){Ye(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:J=>{var pe,he;if(((pe=J.tagName)==null?void 0:pe.toLowerCase())===v&&((he=J.getAttribute)==null?void 0:he.call(J,"css-class"))===Ve)return{type:"textnode",components:[],content:""}}});const zI=J=>{const{id:pe,view:he}=J,Ae=he.prototype;n.addType(pe,{view:{render(){return Ae.render.apply(this,arguments),av(pe,this),this}}})};[u,S,C,x,k,_,z].forEach(J=>zI(n.getType(J))),n.getTypes().forEach(({id:J,view:pe})=>{pe.prototype.disableEditing&&n.addType(J,{view:{onDisable(he={}){this.disableEditing({...he,parserOptions:{htmlType:"text/html"}})}}})});const Zw=()=>{const J="projectFonts",he=e.Components.getWrapper().findFirstType(i),Ae=he.findFirstType(l)||he.append({type:l})[0];Ae.findType(v).filter(er=>er.getAttributes()[je]===J||er.attributes[Gm]===qm).forEach(er=>er.remove());const Tt=Wm(a.fonts);if(!Tt)return;const Rn=Ae.append({type:v,content:Tt})[0];Rn==null||Rn.addAttributes({[je]:J})},Xw=()=>{const J=e.Css.rules.filter(Tt=>{const Rn=Tt.attributes.groups;return!!(Rn!=null&&Rn.some(er=>er.startsWith(`${Ve}:`)))}).map(Tt=>Tt.toCSS());if(!J.length)return;const he=e.Components.getWrapper().findFirstType(Ci.root),Ae=he.findFirstType(l)||he.append({type:l})[0];(Ae.findType(v).find(Tt=>Tt.getAttributes()[je]===Ve)||Ae.append({type:v,attributes:{[je]:Ve}})[0]).set("content",J.join(`
|
|
242
|
+
`))},UI=Lo(Xw,100);e.on(yn.pageSettingsUpdate,J=>{J.page||Zw()}),e.on(e.events.projectLoad,({loaded:J})=>{J&&(Xw(),Zw())}),e.on(e.Parser.events.htmlBefore,J=>{var he;const pe=(he=e.Parser.config.optionsHtml)==null?void 0:he.codeSanitizer;J.input=Tb(J.input,{sanitizer:pe})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${Ve}`,UI)})}function dM(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
|
+
<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
|
+
</svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),i("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
|
|
245
|
+
<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
|
+
</svg>`,content:"<mj-button>Button</mj-button>"}),i("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
|
|
247
|
+
<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="${pS}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
|
|
249
|
+
<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
|
+
</svg>`,content:"<mj-divider/>"}),i("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
|
|
251
|
+
<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" />
|
|
252
|
+
</svg>`,content:`<mj-social font-size="12px" icon-size="24px" border-radius="12px" mode="horizontal">
|
|
253
|
+
<mj-social-element name="facebook"></mj-social-element>
|
|
254
|
+
<mj-social-element name="linkedin"></mj-social-element>
|
|
255
|
+
<mj-social-element name="twitter"></mj-social-element>
|
|
256
|
+
</mj-social>`}),i("mj-social-element",{label:"Social Element",media:`<svg viewBox="0 0 24 24">
|
|
257
|
+
<path 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 12S8.96 11.53 8.91 11.3L15.96 7.19C16.5 7.69 17.21 8 18 8C19.66 8 21 6.66 21 5S19.66 2 18 2 15 3.34 15 5C15 5.24 15.04 5.47 15.09 5.7L8.04 9.81C7.5 9.31 6.79 9 6 9C4.34 9 3 10.34 3 12S4.34 15 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.91S20.92 20.61 20.92 19C20.92 17.39 19.61 16.08 18 16.08M18 4C18.55 4 19 4.45 19 5S18.55 6 18 6 17 5.55 17 5 17.45 4 18 4M6 13C5.45 13 5 12.55 5 12S5.45 11 6 11 7 11.45 7 12 6.55 13 6 13M18 20C17.45 20 17 19.55 17 19S17.45 18 18 18 19 18.45 19 19 18.55 20 18 20Z" />
|
|
258
|
+
</svg>`,content:'<mj-social-element name="facebook">Facebook</mj-social-element>'}),i("mj-spacer",{label:"Spacer",media:`<svg viewBox="0 0 24 24">
|
|
259
|
+
<path fill="currentColor" d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
|
|
260
|
+
</svg>`,content:"<mj-spacer/>"}),i("mj-navbar",{label:"Navbar",media:`<svg viewBox="0 0 24 24">
|
|
261
|
+
<path fill="currentColor" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" />
|
|
262
|
+
</svg>`,content:`<mj-navbar>
|
|
263
|
+
<mj-navbar-link>HOME</mj-navbar-link>
|
|
264
|
+
<mj-navbar-link>ABOUT</mj-navbar-link>
|
|
265
|
+
<mj-navbar-link>CONTACT</mj-navbar-link>
|
|
266
|
+
<mj-navbar-link>BLOG</mj-navbar-link>
|
|
267
|
+
</mj-navbar>`}),i("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
|
|
268
|
+
<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="${Mh({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
|
|
270
|
+
<mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
|
|
271
|
+
Heading title
|
|
272
|
+
</mj-text>
|
|
273
|
+
<mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center">
|
|
274
|
+
Place here your hero content text
|
|
275
|
+
</mj-text>
|
|
276
|
+
<mj-button href="https://mjml.io/" align="center">
|
|
277
|
+
Call to action!
|
|
278
|
+
</mj-button>
|
|
279
|
+
</mj-hero>`}),i("mj-raw",{label:"HTML block",activate:!0,media:`<svg viewBox="0 0 24 24">
|
|
280
|
+
<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
|
+
</svg>`,content:`<mj-raw>
|
|
282
|
+
<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(H,{className:a,grow:!0})}),content:`<mj-section>
|
|
284
|
+
<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(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0})]}),content:`<mj-section>
|
|
286
|
+
<mj-column></mj-column>
|
|
287
|
+
<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(H,{className:ue(a,"gs-utl-basis-1/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-3/4")})]}),content:`<mj-section>
|
|
289
|
+
<mj-column width="25%"></mj-column>
|
|
290
|
+
<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(H,{className:ue(a,"gs-utl-basis-1/3")}),c.jsx(H,{className:ue(a,"gs-utl-basis-2/3")})]}),content:`<mj-section>
|
|
292
|
+
<mj-column width="33%"></mj-column>
|
|
293
|
+
<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(H,{className:ue(a,"gs-utl-basis-2/3")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/3")})]}),content:`<mj-section>
|
|
295
|
+
<mj-column width="67%"></mj-column>
|
|
296
|
+
<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(H,{className:ue(a,"gs-utl-basis-3/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
298
|
+
<mj-column width="75%"></mj-column>
|
|
299
|
+
<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(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0})]}),content:`<mj-section>
|
|
301
|
+
<mj-column></mj-column>
|
|
302
|
+
<mj-column></mj-column>
|
|
303
|
+
<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(H,{className:ue(a,"gs-utl-basis-1/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-2/4")})]}),content:`<mj-section>
|
|
305
|
+
<mj-column width="25%"></mj-column>
|
|
306
|
+
<mj-column width="25%"></mj-column>
|
|
307
|
+
<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(H,{className:ue(a,"gs-utl-basis-1/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-2/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
309
|
+
<mj-column width="25%"></mj-column>
|
|
310
|
+
<mj-column width="50%"></mj-column>
|
|
311
|
+
<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(H,{className:ue(a,"gs-utl-basis-2/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/4")}),c.jsx(H,{className:ue(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
313
|
+
<mj-column width="50%"></mj-column>
|
|
314
|
+
<mj-column width="25%"></mj-column>
|
|
315
|
+
<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(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0}),c.jsx(H,{className:a,grow:!0})]}),content:`<mj-section>
|
|
317
|
+
<mj-column></mj-column>
|
|
318
|
+
<mj-column></mj-column>
|
|
319
|
+
<mj-column></mj-column>
|
|
320
|
+
<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 {
|
|
322
|
+
$2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
|
|
323
|
+
}
|
|
324
|
+
$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:`
|
|
326
|
+
.gs-banner {
|
|
327
|
+
box-shadow: 0 0 5px #1c1b1b21;
|
|
328
|
+
padding: 30px 10px;
|
|
329
|
+
border-radius: 10px;
|
|
330
|
+
margin: 5px;
|
|
331
|
+
font-size: 30px;
|
|
332
|
+
background-color: ${o};
|
|
333
|
+
color: ${s};
|
|
334
|
+
width: 95%;
|
|
335
|
+
}
|
|
336
|
+
.gs-banner-row {
|
|
337
|
+
justify-content: center;
|
|
338
|
+
align-items: center;
|
|
339
|
+
display: flex;
|
|
340
|
+
gap: 10px;
|
|
341
|
+
}
|
|
342
|
+
.gs-gs-logo {
|
|
343
|
+
width: 35px;
|
|
344
|
+
}
|
|
345
|
+
`}),c.jsx(Gn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx(xc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),zM=()=>`https://grapesjs.com?ref=${window.location.host}`,UM=h.memo(de(function(){const{updateStudio:e,showPoweredBy:t}=ye(),{isDarkTheme:n}=Lr(),r=h.useRef(null),{bg:o,text:s,link:a}=_1(n);return Ev({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
|
+
.gs-banner {
|
|
347
|
+
box-shadow: 0 0 5px #1c1b1b21;
|
|
348
|
+
padding: 5px 10px;
|
|
349
|
+
border-radius: 9999px;
|
|
350
|
+
margin: 5px;
|
|
351
|
+
font-size: 12px;
|
|
352
|
+
background-color: ${o};
|
|
353
|
+
color: ${s};
|
|
354
|
+
}
|
|
355
|
+
.gs-banner-row {
|
|
356
|
+
justify-content: center;
|
|
357
|
+
align-items: center;
|
|
358
|
+
display: flex;
|
|
359
|
+
gap: 3px;
|
|
360
|
+
}
|
|
361
|
+
.gs-link {
|
|
362
|
+
color: ${a};
|
|
363
|
+
text-decoration: none;
|
|
364
|
+
}
|
|
365
|
+
.gs-logo {
|
|
366
|
+
width: 20px;
|
|
367
|
+
}
|
|
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:`
|
|
369
|
+
* { box-sizing: border-box; }
|
|
370
|
+
[data-body] {
|
|
371
|
+
margin: 0;
|
|
372
|
+
background-color: white;
|
|
373
|
+
width: 100%;
|
|
374
|
+
height: 100%;
|
|
375
|
+
color: initial;
|
|
376
|
+
font-family: initial;
|
|
377
|
+
font-weight: initial;
|
|
378
|
+
line-height: initial;
|
|
379
|
+
}
|
|
380
|
+
[data-body]:before {
|
|
381
|
+
content: "";
|
|
382
|
+
display: block;
|
|
383
|
+
height: 0px;
|
|
384
|
+
overflow: hidden;
|
|
385
|
+
}
|
|
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:`
|
|
388
|
+
To pick up a draggable item, press the space bar.
|
|
389
|
+
While dragging, use the arrow keys to move the item.
|
|
390
|
+
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:`
|
|
392
|
+
.prv-rule {
|
|
393
|
+
background-color: #fff;
|
|
394
|
+
padding: 5px;
|
|
395
|
+
}
|
|
396
|
+
.prv-rule, ${p}
|
|
397
|
+
`})}},[s,p]),c.jsx(Gn,{padding:!1,className:ue("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(I,{className:ue("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:s,className:ue("relative flex items-center justify-center")})}),c.jsxs(I,{className:ue("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(I,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(H,{grow:!0,children:c.jsx("pre",{className:ue("text-xs bg-white/10",U.txt,oe.rnd,Ee.xyS),children:v})}),!!u&&u.getWidthMedia()&&c.jsx(H,{children:c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(se,{icon:X.cellphoneLink,size:le.sx})})}),!!d&&c.jsx(H,{children:c.jsx(Dt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(se,{icon:X.flare,size:le.sx})})})]}),c.jsxs(I,{nowrap:!0,className:ue(Pe.txtEllips),space:"s",children:[c.jsx(H,{className:ue("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(qe,{onClick:w,className:ue("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(hr,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(bt,{title:l.t("selectorManager.showCSS"),children:c.jsx(se,{icon:X.codeBraces,size:le.sx})}),children:({close:C})=>c.jsxs(I,{className:ue("relative w-80 h-48"),col:!0,children:[c.jsx(H,{grow:!0,children:c.jsx(so,{defaultValue:Rf(p),onChange:b,language:"css",padding:5,isDarkTheme:f,clean:!0})}),c.jsx(qe,{className:ue("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{S(),C()},children:l.t("update")})]})}),c.jsx(Hc,{onConfirm:y,className:ue("w-48"),children:c.jsx(bt,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(se,{icon:X.delete,size:le.sx})})})]})]})]},t.cid)})}),c7=de(function(){const[t]=Af(),n=ma(),r=$e(),[o,s]=h.useState(""),[a,i]=h.useState(""),u=ye().editor,[d,f]=h.useState(u.Css.getRules("")),p=u.Devices.getDevices().map(b=>({id:b.id,label:b.getName()})),g=d.filter(b=>{var v;return!(o&&!Hs(b.selectorsToString(),o)||a&&((v=b.getDevice())==null?void 0:v.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(H,{children:c.jsx(Re,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(H,{children:c.jsx(Te,{includeEmpty:!0,size:"s",value:a,options:p,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:b=>c.jsxs(I,{space:"s",items:"center",children:[c.jsx(se,{icon:X.cellphoneLink,size:le.sx}),c.jsx("span",{children:b.label})]})})})]}),c.jsx(H,{className:ue("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(Dc,{data:g,listClassName:ue("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(b,v)=>c.jsx(l7,{rule:v,onRemove:m,onSelect:n.close},v.cid)},t):c.jsx(I,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),u7=de(function({selector:t,className:n,removable:r,toggleable:o}){const s=$e(),a=ye(),[i,l]=h.useState(),[u,d]=h.useState(t.getActive()),f=a.editor,{Selectors:p}=f,g=t.getLabel(),m=c.jsx(se,{icon:X.dotsVertical,size:le.sx}),b=()=>{p.removeSelected(t)},v=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:b},o&&{id:"active",label:s.t(u?"disable":"enable"),action:y}].filter(Boolean),x=(E,P)=>T=>{E(),Ze(P)&&P(T)};return c.jsx(Ho,{className:ue(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",U.sel,n]),s:"s",children:c.jsxs(I,{items:"center",children:[c.jsx(H,{className:ue("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(Y0,{value:g,onChange:v,active:!!i,unstyled:!0})}),c.jsx(I,{className:ue("absolute h-full right-0 transition-opacity",U.sel,U.selBr,oe.bl),children:c.jsx(hr,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>C.map(P=>c.jsx(wa,{className:ue(U.txt),label:P.label,action:x(E,P.action)},P.id))})})]})})}),d7=e=>(e==null?void 0:e.get("groups"))||[],f7=/^\.[a-zA-Z_][\w-]*$/;function p7(e,t={}){const n=e.Css.getAll().filter(r=>d7(r).some(o=>o.startsWith(As.globalStyles)));return t.withSingleClass?n.filter(r=>f7.test(r.getSelectorsString())):n}const h7=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())},g7=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?p7(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...h7(e).map(i=>({id:i,label:i.getLabel()})),...s]},m7=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
|
+
${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${Ve?` ${Ve}`:""}>
|
|
401
|
+
<head${je?` ${je}`:""}>
|
|
402
|
+
${re.join(`
|
|
403
|
+
`)}
|
|
404
|
+
</head>
|
|
405
|
+
${ne}
|
|
406
|
+
</html>
|
|
407
|
+
`;return{filename:_f(e,_),content:Ow(Et,b,{pathPfx:v}),mimeType:"text/html"}};m.forEach(_=>{if(lc(_)){const L=_.getMainComponent(),{dataSourceItem:k}=t,B=k?[k]:L.getDataSourceItems(),$=L.resolverCurrentItem;Object.entries(B).forEach(([z,K])=>{const F=K;L.setResolverCurrentItem(F.id??z);const V=O(_,{pageSettingOpts:{replaceDataSources:!0}}),{path:D,filename:A}=sb(_,{currentItem:F});V.path=D,V.filename=A,T.push(V)}),L.setResolverCurrentItem($)}else T.push(O(_))}),g.push(...T),i&&m.forEach(_=>{g.push({filename:_f(e,_,"mjml"),content:_.getMainComponent().toHTML(p),mimeType:"text/mjml"})});for(const _ in b){const N=b[_];N.found&&g.push({path:o,filename:N.name,content:atob(N.base64),mimeType:N.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 MV(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 LV=(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(ae.contextMenuComponent,{component:u,event:i,x:i.clientX*f+d.left,y:i.clientY*f+d.top})}})})};function $V(e,t){var g;const{Components:n,I18n:r}=e,{appStore:o}=t,s=r.t("dataSources.collection"),a=Vt.collection,i=Vt.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 b=m.is(a)?m:m.closestType(a);if(!b)return;const v="dataCollectionPicker",w={id:v,header:!1,layout:{type:"panelDataCollectionPicker",component:b,onConfirm:()=>e.runCommand(ae.layoutRemove,{id:v})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(ae.layoutToggle,{...w})},p=({items:m,component:b})=>[{id:`open-${a}-picker`,label:Cp,command:()=>f(b)},...m];n.addType(i,{isComponent:m=>ha(m,i),model:{defaults:{...Pp(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=>gi(m,l)||ha(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...xp},model:{defaults:{...Ep(o),icon:u,name:s,attributes:{[l]:!0},toolbarItems:p},init(){const m="collection-";if(!this.getCollectionId()){const v=m+Math.random().toString(36).substring(2,9);this.setCollectionId(v)}}},view:{onActive(m){m==null||m.stopPropagation(),f(this.model)}}})}function kV(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=Vt.condition,f=Vt.conditionTrue,p=Vt.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
|
|
408
|
+
<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>`,b=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(ae.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(ae.layoutToggle,{...x})},v=({items:y,component:S})=>[{id:`open-${d}-picker`,label:Cp,command:()=>b(S)},...y];n.addType(f,{isComponent:y=>ha(y,f),model:{defaults:{...Pp(l),tagName:"span",name:s,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:v}}}),n.addType(p,{isComponent:y=>ha(y,p),model:{defaults:{...Pp(l),tagName:"span",name:a,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:v}}}),n.addType(d,{isComponent:y=>gi(y,g)||ha(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}]},...xp},model:{defaults:{...Ep(l),icon:m,name:o,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:v}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,yn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),b(this.model))},getConditionString(){const{model:y}=this,{operator:S,statements:C=[]}=y.getCondition(),x=S==="AND"?" AND ":" OR ",P=C.map(T=>{const{left:O="",operator:_="",right:N=""}=T,L=A0(O),k=A0(N);return`(${L} ${_} ${k})`}).join(x);return`${o}: ${P}`},renderDataResolver(){const y=this.model,S=y.getIfTrueContent(),C=y.getIfFalseContent(),x=S==null?void 0:S.getEl(),E=C==null?void 0:C.getEl();if(e.runCommand(ae.getStateDataSource).showPlaceholder){x&&(x.style.display="",x.style.setProperty(Ls,`"${this.getConditionString()} "`)),E&&(E.style.display="",E.style.setProperty(Ls,`" ${i} "`));return}const T=y.isTrue();x&&(x.style.removeProperty(Ls),x.style.display=T?"":"none"),E&&(E.style.removeProperty(Ls),E.style.display=T?"none":"")}}})}function VV(e,t){var f;const{Components:n,I18n:r}=e,o=Vt.variable,s="data-type-data-variable",a="Variable",i=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${kl.codeBraces}"/></svg>`,{appStore:l}=t,u=(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(ae.layoutRemove,{id:g})},placer:{type:"dialog",title:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(ae.layoutToggle,{...m})};n.addType(o,{isComponent:p=>gi(p,s)||ha(p,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...xp},model:{defaults:{...Ep(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:p,component:g})=>[{id:`open-${o}-modal`,label:Cp,command:()=>d(g)},...p]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:p}=this;this.listenTo(p,yn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(p){e.getEditing()||(p==null||p.stopPropagation(),d(this.model))},renderDataResolver(){const{model:p,el:g}=this;if(e.runCommand(ae.getStateDataSource).showPlaceholder){const b=p.getPath();g.textContent="",g.style.setProperty(Ls,`"${N0(b)}"`);return}g.style.removeProperty(Ls),g.textContent=p.getDataValue()}}})}const Na=(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 bu({component:e,value:t,getCustomPath:n}){if(Gr(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 IV(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}`}Na(e,Vt.variable,{toHTML(s){var v;const a=s.skipTags??t,i=s.exporter,l=s.wrapTemplateContent??r,u=w=>l({component:this,content:w}),d=this.tagName,f=this.__attrToString(s),p=(v=this.getDataResolver)==null?void 0:v.call(this),g=bu({component:this,value:p,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:g}),b=u(m);return a?b:`<${d}${f?` ${f}`:""}>${b}</${d}>`}}),Na(e,Vt.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 b="";if(p){const E=a.getConditionElseSyntax(u);b=`
|
|
410
|
+
${l(E)}
|
|
411
|
+
${p.toHTML(s)??""}`}const v=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
|
|
412
|
+
${`${l(v)}
|
|
413
|
+
${(f==null?void 0:f.toHTML(s))??""}${b}
|
|
414
|
+
${l(w)}`}
|
|
415
|
+
`},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(s6(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:bu({...i,value:s.left}),right:bu({...i,value:s.right})}}}),Na(e,Vt.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=P=>l({component:this,content:P}),d={component:this},f=this.getDataResolver(),p={...f,dataSource:bu({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}),b=i.getCollectionEndSyntax(d),v=(g==null?void 0:g.toHTML(s))??"",w=`${u(m)}
|
|
416
|
+
${v}
|
|
417
|
+
${u(b)}`;if(a)return`
|
|
418
|
+
${w}
|
|
419
|
+
`;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",x=`<${y}${C}>`,E=`</${y}>`;return`
|
|
420
|
+
${x}${w}${E}
|
|
421
|
+
`}}),Na(e,Vt.conditionTrue,{toHTML:o}),Na(e,Vt.conditionFalse,{toHTML:o}),Na(e,Vt.collectionItem,{toHTML:o})}const jV=function(e,t){const{Components:n,Canvas:r,events:o}=e;if(!n.getType(Vt.conditionTrue))return;const{isProjectTypeEmail:s,sdkOptions:a}=t.appStore,{dataSources:i}=a;i!=null&&i.globalData&&e.on(o.projectLoad,()=>{e.DataSources.add({id:As.globalData,records:M0(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=[Vt.variable,Vt.condition,Vt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);p.setAttribute(u,""),p.textContent=`
|
|
422
|
+
${g.join(",")} {
|
|
423
|
+
outline: 2px dotted #8b5cf6;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.gjs-dashed *[data-gjs-type="data-condition-true-content"],
|
|
427
|
+
.gjs-dashed *[data-gjs-type="data-condition-false-content"] {
|
|
428
|
+
outline: none !important;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
[data-gjs-type="data-variable"]::before,
|
|
432
|
+
[data-gjs-type="data-condition-true-content"]::before,
|
|
433
|
+
[data-gjs-type="data-condition-false-content"]::before {
|
|
434
|
+
content: var(${Ls});
|
|
435
|
+
font-style: italic;
|
|
436
|
+
color: #666;
|
|
437
|
+
white-space: nowrap;
|
|
438
|
+
overflow: hidden;
|
|
439
|
+
text-overflow: ellipsis;
|
|
440
|
+
max-width: 100%;
|
|
441
|
+
font-size: .9rem;
|
|
442
|
+
font-weight: 500;
|
|
443
|
+
font-family: sans-serif;
|
|
444
|
+
}
|
|
445
|
+
`,d.head.appendChild(p)}),VV(e,t),kV(e,t),$V(e,t),IV(e,{isProjectTypeEmail:s})};function DV(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
|
+
.gjs-typed {
|
|
447
|
+
padding: 5px;
|
|
448
|
+
}
|
|
449
|
+
`}}})}if(["tabs","tab-content","tab-contents","tab","tab-container"].indexOf(o)>=0){const i={emptyState:!0,icon:o==="tabs"?`
|
|
450
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
451
|
+
<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
|
+
</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})})});
|