webim-adapter 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,5 +10,5 @@ Error generating stack: `+e.message+`
10
10
  `)}var ee=[{key:`tablet`,max:991},{key:`mobileLandscape`,max:767},{key:`mobile`,max:478}],S=e=>Object.entries(m(e)).map(([e,t])=>`${y(e)}: ${t} !important;`).join(` `);function C(e,t){return ee.map(({key:n,max:r})=>{let i=t?.[n]?S(t[n]):``;return i?`@media (max-width: ${r}px) { [data-wb="${e}"] { ${i} } }`:``}).filter(Boolean).join(`
11
11
  `)}function te(e,t){let n=[],r=e=>{for(let[t,r]of Object.entries(e||{})){let e=C(t,r.props);e&&n.push(e)}};r(e);for(let e of Object.values(t||{}))r(e.template?.nodes);return n.join(`
12
12
  `)}function ne(e,t){let n=[],r=e=>{for(let[t,r]of Object.entries(e||{})){let e=x(t,r.props);e&&n.push(e)}};r(e);for(let e of Object.values(t||{}))r(e.template?.nodes);return n.join(`
13
- `)}var re=`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,w={light:{background:`#ffffff`,text:`#111827`,accent:`#111827`,accentText:`#ffffff`,primary:{light:`#4b5563`,main:`#111827`,dark:`#030712`,contrastText:`#ffffff`},secondary:{light:`#a5b4fc`,main:`#6366f1`,dark:`#4338ca`,contrastText:`#ffffff`}},dark:{background:`#0f172a`,text:`#e2e8f0`,accent:`#6366f1`,accentText:`#ffffff`,primary:{light:`#a5b4fc`,main:`#6366f1`,dark:`#4338ca`,contrastText:`#ffffff`},secondary:{light:`#5eead4`,main:`#14b8a6`,dark:`#0f766e`,contrastText:`#052e2b`}}},ie={font:`system`,headingFont:`inherit`,light:w.light,dark:w.dark},ae={system:{label:`System`,value:re},inter:{label:`Inter`,value:`"Inter", ${re}`},outfit:{label:`Outfit`,value:`"Outfit", ${re}`},serif:{label:`Serif`,value:`Georgia, "Times New Roman", serif`},mono:{label:`Mono`,value:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`}},oe=(e,t)=>ae[e]?.value??t,se=(e,...t)=>{let n=Object.assign({},e,...t);return n.primary={...e.primary,...t.reduce((e,t)=>({...e,...t?.primary}),{})},n.secondary={...e.secondary,...t.reduce((e,t)=>({...e,...t?.secondary}),{})},n};function ce(e){let{light:t,dark:n,font:r,headingFont:i,...a}=e??{};return{font:r??ie.font,headingFont:i??ie.headingFont,light:se(w.light,a,t),dark:se(w.dark,n)}}function le(e){return{"--page-bg":e.background,"--page-text":e.text,"--page-accent":e.accent,"--page-accent-text":e.accentText,"--page-primary-light":e.primary.light,"--page-primary":e.primary.main,"--page-primary-dark":e.primary.dark,"--page-primary-contrast":e.primary.contrastText,"--page-secondary-light":e.secondary.light,"--page-secondary":e.secondary.main,"--page-secondary-dark":e.secondary.dark,"--page-secondary-contrast":e.secondary.contrastText}}function ue(e){let t=ce(e);return{backgroundColor:`var(--page-bg)`,color:`var(--page-text)`,fontFamily:oe(t.font,re),"--page-heading-font":t.headingFont===`inherit`?`inherit`:oe(t.headingFont,`inherit`)}}function T(e,t=`light`){let n=ce(e);return{...ue(e),...le(n[t]??n.light)}}function E(e,t){return e?.themeRef&&t?.[e.themeRef]||e?.theme}function de({page:e,settings:t,tenant:n,apiUrl:r,locale:i}){let a={...t?.global??{},...t?.tenant??{}},o=e.meta??{};return{schema:1,title:e.title,slug:e.slug,blocks:i&&o.i18n?.[i]?.blocks||e.blocks,theme:E(o,a.builder_themes?.themes),components:a.builder_components?.components??{},custom:o.custom,seo:o.seo,direction:o.direction,locale:i||a.locales?.default,locales:a.locales,tenant:n??``,apiUrl:r??``}}var fe=async e=>{let t=await e.json().catch(()=>null);if(!e.ok||t?.success===!1)throw Error(t?.error?.message||`Request failed (${e.status})`);return t?.payload??t};async function pe({apiUrl:e,tenant:t,slug:n,locale:r,preview:i,fetch:a}){if(!e)throw Error(`fetchPage: apiUrl is required`);if(!n)throw Error(`fetchPage: slug is required`);let o=a??fetch,s=e.replace(/\/$/,``),c=t?{"x-tenant":t}:{},[l,u]=await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i?`?preview=${encodeURIComponent(i)}`:``}`,{headers:c}).then(fe),o(`${s}/settings/public`,{headers:c}).then(fe)]),d=de({page:l,settings:u,tenant:t,apiUrl:s,locale:r}),f=[...new Set(Object.values(d.blocks??{}).map(e=>e?.type?.resolvedName===`CollectionList`?e.props?.collection:e?.type?.resolvedName===`TableBlock`?e.props?.source:null).filter(Boolean))];if(f.length){let e=e=>e.startsWith(`api:`)?`${s}/data/${encodeURIComponent(e.slice(4))}`:`${s}/dynamic/${encodeURIComponent(e)}${r?`?locale=${encodeURIComponent(r)}`:``}`,t=await Promise.all(f.map(t=>o(e(t),{headers:c}).then(fe).then(e=>[t,Array.isArray(e)?e:[]]).catch(()=>[t,[]])));d.datasets=Object.fromEntries(t)}return d}new Map([{family:`Bebas Neue`,fallback:`sans-serif`},{family:`Crimson Text`,fallback:`serif`},{family:`DM Sans`,fallback:`sans-serif`},{family:`Fira Sans`,fallback:`sans-serif`},{family:`Inter`,fallback:`sans-serif`},{family:`JetBrains Mono`,fallback:`monospace`},{family:`Josefin Sans`,fallback:`sans-serif`},{family:`Karla`,fallback:`sans-serif`},{family:`Lato`,fallback:`sans-serif`},{family:`Lora`,fallback:`serif`},{family:`Manrope`,fallback:`sans-serif`},{family:`Merriweather`,fallback:`serif`},{family:`Montserrat`,fallback:`sans-serif`},{family:`Nunito`,fallback:`sans-serif`},{family:`Open Sans`,fallback:`sans-serif`},{family:`Oswald`,fallback:`sans-serif`},{family:`Outfit`,fallback:`sans-serif`},{family:`Playfair Display`,fallback:`serif`},{family:`Poppins`,fallback:`sans-serif`},{family:`Quicksand`,fallback:`sans-serif`},{family:`Raleway`,fallback:`sans-serif`},{family:`Roboto`,fallback:`sans-serif`},{family:`Rubik`,fallback:`sans-serif`},{family:`Source Sans 3`,fallback:`sans-serif`},{family:`Space Grotesk`,fallback:`sans-serif`},{family:`Work Sans`,fallback:`sans-serif`}].map(e=>[e.family,e]));function me(e){return e.length?`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.replace(/ /g,`+`)}:wght@100..900`).join(`&`)}&display=swap`:null}var D=e=>me([e]),O=e=>{let t=typeof e==`string`&&e.match(/^"([^"]+)"/);return t?t[1]:null};function he(e,t){let n=new Set,r=e=>{for(let t of Object.values(e||{}))for(let e of[`style`,`hover`,`pressed`,`focused`]){let r=O(t.props?.[e]?.fontFamily);r&&n.add(r)}};r(e);for(let e of Object.values(t||{}))r(e.template?.nodes);return[...n].sort()}var ge=new Set([`ar`,`he`,`fa`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`]),_e=e=>ge.has(String(e||``).toLowerCase().split(/[-_]/)[0])?`rtl`:`ltr`,ve=(e,t)=>e===`ltr`||e===`rtl`?e:t?_e(t):void 0,ye=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),k=e(((e,t)=>{t.exports=ye()}))(),be=(0,l.createContext)({tenant:``,apiUrl:`/api`}),xe=(0,l.createContext)(null),Se=(0,l.createContext)(null),Ce=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function we(e,t){if(t)return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e&&typeof e==`object`?e[t]:void 0,e):e?.[t]}var Te=e=>{let t=[];for(let[n,r]of Object.entries(e??{})){if(!/^[\w-]+$/.test(n))continue;t.push(n);let e=Array.isArray(r)?r[0]:r,i=Array.isArray(r)?`${n}.0`:n;if(e&&typeof e==`object`&&!Array.isArray(e))for(let n of Object.keys(e))/^[\w-]+$/.test(n)&&t.push(`${i}.${n}`)}return t};function Ee(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>typeof e==`string`?e:Array.isArray(e?.parts)?e.parts.map(e=>e?.text??``).join(``):Array.isArray(e?.items)?e.items.map(e=>e?.text??``).join(` `):``).filter(Boolean).join(` `):``}function De(e,t){let n=t?.data??{},r=Te(n);if(!r.length)return e;let i=RegExp(`:(${r.map(Ce).sort((e,t)=>t.length-e.length).join(`|`)})`,`g`),a=e=>typeof e==`string`?e.replace(i,(e,t)=>Ee(we(n,t))):Array.isArray(e)?e.map(a):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,a(t)])):e;return a(e)}var Oe={margin:0,fontWeight:700,lineHeight:1.2,fontFamily:`var(--page-heading-font, inherit)`},ke={margin:0},Ae={display:`inline-block`,textDecoration:`none`,cursor:`pointer`,backgroundColor:`var(--page-accent, #111827)`,color:`var(--page-accent-text, #ffffff)`},je={flexGrow:1,display:`flex`,flexDirection:`column`,position:`relative`},Me={display:`flex`,flexDirection:`column`};function Ne({style:e}){let t=e?.backgroundVideo;if(!t)return null;let n={position:`absolute`,inset:0,width:`100%`,height:`100%`,zIndex:-1,pointerEvents:`none`},r=e?.overlayColor?`color-mix(in srgb, ${e.overlayColor} ${e.overlayOpacity??50}%, transparent)`:null;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`video`,{src:t,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,style:{...n,objectFit:`cover`}}),r&&(0,k.jsx)(`div`,{style:{...n,background:r}})]})}var Pe=(e,t)=>e?.backgroundVideo?{position:`relative`,...t,...m(e)}:{...t,...m(e)};function Fe({style:e,nodeRef:t,children:n}){return(0,k.jsxs)(`div`,{ref:t,style:{...je,...m(e)},children:[(0,k.jsx)(Ne,{style:e}),n]})}function Ie({style:e,nodeRef:t,children:n}){return(0,k.jsxs)(`section`,{ref:t,style:Pe(e,Me),children:[(0,k.jsx)(Ne,{style:e}),n]})}function Le({style:e,freeLayout:t,nodeRef:n,children:r}){let i=t?{position:`relative`,minHeight:240}:null;return(0,k.jsxs)(`div`,{ref:n,style:i?{...i,...Pe(e)}:Pe(e),children:[(0,k.jsx)(Ne,{style:e}),r]})}function Re({text:e,parts:t,tag:n=`h2`,style:r,linked:i,nodeRef:a}){return(0,k.jsx)(n,{ref:a,style:{...Oe,...m(r)},children:Ve(t,e,i)})}var ze={fontFamily:ae.mono.value,background:`rgba(148, 163, 184, 0.18)`,padding:`1px 5px`,borderRadius:4,fontSize:`0.9em`};function Be(e,t=[],n,r){let i=e;return t.includes(`sup`)?i=(0,k.jsx)(`sup`,{children:i}):t.includes(`sub`)&&(i=(0,k.jsx)(`sub`,{children:i})),t.includes(`code`)&&(i=(0,k.jsx)(`code`,{style:ze,children:i})),t.includes(`strike`)&&(i=(0,k.jsx)(`s`,{children:i})),t.includes(`underline`)&&(i=(0,k.jsx)(`u`,{children:i})),t.includes(`italic`)&&(i=(0,k.jsx)(`em`,{children:i})),t.includes(`bold`)&&(i=(0,k.jsx)(`strong`,{children:i})),n&&(i=(0,k.jsx)(`a`,{href:n,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{color:`inherit`},children:i})),i}function Ve(e,t,n){return e?.length?e.map((e,t)=>{if(e.slot)return(0,k.jsx)(l.Fragment,{children:n?.[e.slot]??null},t);if(e.parts)return(0,k.jsx)(l.Fragment,{children:Ve(e.parts,``,n)},t);let r=e.text;return e.sup?r=(0,k.jsx)(`sup`,{children:r}):e.sub&&(r=(0,k.jsx)(`sub`,{children:r})),e.code&&(r=(0,k.jsx)(`code`,{style:ze,children:r})),e.strike&&(r=(0,k.jsx)(`s`,{children:r})),e.underline&&(r=(0,k.jsx)(`u`,{children:r})),e.italic&&(r=(0,k.jsx)(`em`,{children:r})),e.bold&&(r=(0,k.jsx)(`strong`,{children:r})),(e.color||e.background)&&(r=(0,k.jsx)(`span`,{style:{...e.color&&{color:e.color},...e.background&&{backgroundColor:e.background}},children:r})),e.href&&(r=(0,k.jsx)(`a`,{href:e.href,target:e.target||void 0,rel:e.target===`_blank`?`noopener noreferrer`:void 0,style:{color:e.color??`inherit`},children:r})),(0,k.jsx)(l.Fragment,{children:r},t)}):t}function He({parts:e,text:t,marks:n,href:r,target:i,style:a}){return(0,k.jsx)(`span`,{style:m(a),children:e?.length?Ve(e,t):Be(t,n,r,i)})}var Ue={h1:40,h2:32,h3:26,h4:22,h5:19,h6:16};function We({align:e=`center`,width:t,wrap:n}={}){let r=t?`${t}%`:void 0;if(e===`full`)return{width:`100%`};let i=e===`left`||e===`right`;return i&&(n??!0)?{float:e,width:r??`50%`,maxWidth:`100%`,marginTop:`4px`,marginBottom:`12px`,...e===`left`?{marginRight:`20px`,marginLeft:0}:{marginLeft:`20px`,marginRight:0}}:i?{width:r??`fit-content`,maxWidth:`100%`,...e===`left`?{marginLeft:0,marginRight:`auto`}:{marginLeft:`auto`,marginRight:0}}:{width:r??`fit-content`,maxWidth:`100%`,marginLeft:`auto`,marginRight:`auto`}}function Ge(e=[],t,n){let r=n??((e,n)=>Ve(e,n,t));return e.map((t,n)=>{let i={marginTop:0,marginBottom:n===e.length-1?0:14};if(t.type===`image`){if(!t.src)return null;let e=(0,k.jsx)(`img`,{src:t.src,alt:t.alt||``,style:{width:`100%`,display:`block`,borderRadius:6}});return(0,k.jsxs)(`figure`,{style:{marginLeft:0,marginRight:0,...i,...We(t)},children:[t.href?(0,k.jsx)(`a`,{href:t.href,target:t.target||void 0,rel:t.target===`_blank`?`noopener noreferrer`:void 0,style:{display:`block`},children:e}):e,t.caption&&(0,k.jsx)(`figcaption`,{style:{fontSize:13,opacity:.65,marginTop:6,textAlign:`center`},children:t.caption})]},n)}if(t.type===`video`)return nt(t.url)?(0,k.jsx)(`div`,{style:{...i,...We({align:t.align,wrap:t.wrap,width:t.width??100})},children:(0,k.jsx)(rt,{url:t.url,autoplay:t.autoplay,muted:t.muted,loop:t.loop,controls:t.controls??!0,start:t.start})},n):null;if(t.type===`divider`)return(0,k.jsx)(`hr`,{style:{...i,border:0,borderTop:`1px solid rgba(148, 163, 184, 0.4)`}},n);if(t.type===`ul`||t.type===`ol`){let e=t.type;return(0,k.jsx)(e,{style:{...i,paddingLeft:24},children:(t.items??[]).map((e,t)=>(0,k.jsx)(`li`,{style:{marginBottom:4},children:r(e.parts,e.text)},t))},n)}if(t.type===`quote`)return(0,k.jsx)(`blockquote`,{style:{...qe,...i},children:r(t.parts,t.text)},n);if(Ue[t.type]){let e=t.type;return(0,k.jsx)(e,{style:{...Oe,fontSize:Ue[t.type],...i},children:r(t.parts,t.text)},n)}return(0,k.jsx)(`p`,{style:{...ke,...i},children:r(t.parts,t.text)},n)})}function Ke({content:e,style:t,linked:n,nodeRef:r}){return(0,k.jsx)(`div`,{ref:r,style:{display:`flow-root`,...m(t)},children:Ge(e,n)})}var qe={margin:0,padding:`8px 0 8px 20px`,borderLeft:`4px solid var(--page-accent, rgba(148, 163, 184, 0.6))`};function Je({text:e,parts:t,style:n,linked:r,nodeRef:i}){return(0,k.jsx)(`blockquote`,{ref:i,style:{...qe,...m(n)},children:Ve(t,e,r)})}function Ye({ordered:e,items:t=[],style:n,nodeRef:r}){return(0,k.jsx)(e?`ol`:`ul`,{ref:r,style:{margin:0,paddingLeft:24,...m(n)},children:t.map((e,t)=>(0,k.jsx)(`li`,{style:{marginBottom:4},children:Ve(e.parts,e.text)},t))})}function Xe({text:e,parts:t,style:n,linked:r,nodeRef:i}){return(0,k.jsx)(`p`,{ref:i,style:{...ke,...m(n)},children:Ve(t,e,r)})}var Ze={color:`var(--page-accent, inherit)`,textDecoration:`underline`,textUnderlineOffset:3,cursor:`pointer`};function Qe({text:e,parts:t,href:n,target:r,style:i,linked:a,nodeRef:o}){return(0,k.jsx)(`a`,{ref:o,href:n||`#`,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{...Ze,...m(i)},children:Ve(t,e,a)})}function $e({text:e,parts:t,href:n,target:r,style:i,linked:a,nodeRef:o}){return(0,k.jsx)(`a`,{ref:o,href:n||`#`,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{...Ae,...m(i)},children:Ve(t,e,a)})}function et({src:e,alt:t,style:n,nodeRef:r}){return e?(0,k.jsx)(`img`,{ref:r,src:e,alt:t||``,style:{display:`block`,maxWidth:`100%`,...m(n)}}):null}function tt({src:e,poster:t,controls:n=!0,autoplay:r=!1,loop:i=!1,muted:a=!1,style:o,nodeRef:s}){return e?(0,k.jsx)(`video`,{ref:s,src:e,poster:t||void 0,controls:n,autoPlay:r,muted:a||r,loop:i,playsInline:!0,style:{display:`block`,width:`100%`,maxWidth:`100%`,...m(o)}}):null}var nt=(e=``)=>(e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/)||e.match(/^([\w-]{11})$/))?.[1];function rt({url:e,autoplay:t=!1,muted:n=!1,loop:r=!1,controls:i=!0,start:a,style:o,nodeRef:s}){let c=nt(e);if(!c)return null;let l=new URLSearchParams({rel:`0`});return t&&l.set(`autoplay`,`1`),(n||t)&&l.set(`mute`,`1`),i||l.set(`controls`,`0`),r&&(l.set(`loop`,`1`),l.set(`playlist`,c)),Number(a)>0&&l.set(`start`,String(Math.floor(Number(a)))),(0,k.jsx)(`div`,{ref:s,style:{position:`relative`,width:`100%`,paddingTop:`56.25%`,...m(o)},children:(0,k.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${c}?${l}`,title:`YouTube video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,border:0}})})}function it({src:e,title:t,allowFullscreen:n=!0,style:r,nodeRef:i}){return e?(0,k.jsx)(`iframe`,{ref:i,src:e,title:t||`Embedded frame`,loading:`lazy`,allowFullScreen:n,style:{display:`block`,width:`100%`,height:300,border:0,...m(r)}}):null}function at({code:e,runScripts:t=!0,style:n,nodeRef:r}){let[i,a]=(0,l.useState)(null);return(0,l.useEffect)(()=>{i&&(i.innerHTML=e||``,t&&i.querySelectorAll(`script`).forEach(e=>{let t=document.createElement(`script`);for(let{name:n,value:r}of e.attributes)t.setAttribute(n,r);t.text=e.textContent,e.replaceWith(t)}))},[i,e,t]),(0,k.jsx)(`div`,{ref:e=>{a(e),r&&r(e)},style:m(n)})}function ot({height:e,nodeRef:t}){return(0,k.jsx)(`div`,{ref:t,style:{height:e||32,flexShrink:0,alignSelf:`stretch`}})}function st({style:e,nodeRef:t}){return(0,k.jsx)(`div`,{ref:t,style:{height:1,alignSelf:`stretch`,flexShrink:0,...m(e)}})}var ct={position:`absolute`,top:`50%`,transform:`translateY(-50%)`,width:36,height:36,borderRadius:`50%`,border:0,cursor:`pointer`,background:`rgba(17, 24, 39, 0.45)`,color:`#fff`,fontSize:20,lineHeight:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:0},lt={bottom:{inset:`auto 0 0 0`,padding:`40px 24px 20px`,background:`linear-gradient(transparent, rgba(0, 0, 0, 0.55))`},top:{inset:`0 0 auto 0`,padding:`20px 24px 40px`,background:`linear-gradient(rgba(0, 0, 0, 0.55), transparent)`},middle:{inset:0,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:24,textShadow:`0 2px 12px rgba(0, 0, 0, 0.6)`}},ut=48;function dt({count:e,renderSlide:t,autoplay:n=!0,interval:r=5,height:i=320,swipe:a=!0,style:o,nodeRef:s}){let[c,u]=(0,l.useState)(0),[d,f]=(0,l.useState)(!1),[p,h]=(0,l.useState)(null),g=e?Math.min(c,e-1):0;if((0,l.useEffect)(()=>{if(!n||d||p||e<2)return;let t=setInterval(()=>u(t=>(t+1)%e),Math.max(2,Number(r)||5)*1e3);return()=>clearInterval(t)},[n,d,p,r,e]),!e)return null;let _=t=>u((t+e)%e),v=()=>{if(!p)return;let{dx:e}=p;h(null),e<-48?_(g+1):e>ut&&_(g-1)};return(0,k.jsxs)(`div`,{ref:s,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onPointerDown:a&&e>1?e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button`)||(e.currentTarget.setPointerCapture(e.pointerId),h({startX:e.clientX,dx:0}))}:void 0,onPointerMove:p?e=>h(t=>t&&{...t,dx:e.clientX-t.startX}):void 0,onPointerUp:v,onPointerCancel:v,style:{position:`relative`,overflow:`hidden`,width:`100%`,touchAction:`pan-y`,userSelect:p?`none`:void 0,cursor:p?`grabbing`:void 0,...m(o)},children:[(0,k.jsx)(`div`,{style:{display:`flex`,height:i,transform:`translateX(calc(${-g*100}% + ${p?.dx??0}px))`,transition:p?`none`:`transform 450ms ease`},children:Array.from({length:e},(e,n)=>(0,k.jsx)(`div`,{style:{position:`relative`,width:`100%`,flexShrink:0,overflow:`hidden`},children:t(n)},n))}),e>1&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,"aria-label":`Previous slide`,style:{...ct,left:12},onClick:()=>_(g-1),children:`‹`}),(0,k.jsx)(`button`,{type:`button`,"aria-label":`Next slide`,style:{...ct,right:12},onClick:()=>_(g+1),children:`›`}),(0,k.jsx)(`div`,{style:{position:`absolute`,bottom:10,left:0,right:0,display:`flex`,justifyContent:`center`,gap:6},children:Array.from({length:e},(e,t)=>(0,k.jsx)(`button`,{type:`button`,"aria-label":`Go to slide ${t+1}`,onClick:()=>_(t),style:{width:8,height:8,borderRadius:`50%`,border:0,padding:0,cursor:`pointer`,background:t===g?`#ffffff`:`rgba(255, 255, 255, 0.45)`}},t))})]})]})}var ft=(e,t)=>({position:`absolute`,inset:0,backgroundImage:e?`url(${e})`:`none`,backgroundColor:t||(e?void 0:`rgba(148, 163, 184, 0.25)`),backgroundSize:`cover`,backgroundPosition:`center`});function pt({slides:e=[],captionPosition:t=`bottom`,captionAlign:n=`left`,...r}){return e.length?(0,k.jsx)(dt,{...r,count:e.length,renderSlide:r=>{let i=e[r];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{style:ft(i.image)}),(i.title||i.text)&&(0,k.jsxs)(`div`,{style:{position:`absolute`,color:`#fff`,textAlign:n,...lt[t]??lt.bottom},children:[i.title&&(0,k.jsx)(`div`,{style:{fontSize:22,fontWeight:700},children:i.title}),i.text&&(0,k.jsx)(`div`,{style:{fontSize:14,opacity:.9,marginTop:4},children:i.text})]})]})}}):null}function mt({slides:e=[],linked:t,...n}){return e.length?(0,k.jsx)(dt,{...n,count:e.length,renderSlide:n=>{let r=e[n];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{style:ft(r.image,r.color)}),(0,k.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`},children:t?.[r.key]??null})]})}}):null}var A={color:`inherit`,textDecoration:`none`,fontSize:14,opacity:.85},ht={background:`var(--page-bg, #ffffff)`,color:`var(--page-text, #111827)`,border:`1px solid rgba(148, 163, 184, 0.25)`,boxShadow:`0 16px 40px rgba(15, 23, 42, 0.16)`,zIndex:60};function gt({brand:e,logo:t,links:n=[],style:r,nodeRef:i,menu:a=`auto`,breakpoint:o=768}){let[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!s)return;let e=new ResizeObserver(()=>d(s.offsetWidth<o));return e.observe(s),()=>e.disconnect()},[s,o]);let _=a===`hamburger`||a===`auto`&&u,v=(e,t)=>(0,k.jsxs)(`a`,{href:e.href||`#`,style:{...A,display:`block`,...t},children:[e.label,e.desc&&(0,k.jsx)(`span`,{style:{display:`block`,fontSize:12,opacity:.6,marginTop:2},children:e.desc})]},e.key);return(0,k.jsxs)(`nav`,{ref:e=>{c(e),i&&i(e)},style:{display:`flex`,alignItems:`center`,gap:24,flexWrap:`wrap`,padding:`14px 24px`,width:`100%`,position:`relative`,...m(r)},children:[t&&(0,k.jsx)(`img`,{src:t,alt:e||`Logo`,style:{height:28,display:`block`}}),e&&(0,k.jsx)(`div`,{style:{fontWeight:700,fontSize:18,fontFamily:`var(--page-heading-font, inherit)`},children:e}),(0,k.jsx)(`div`,{style:{flexGrow:1}}),_?(0,k.jsx)(`button`,{type:`button`,"aria-label":f?`Close menu`:`Open menu`,onClick:()=>p(!f),style:{background:`transparent`,border:0,color:`inherit`,cursor:`pointer`,fontSize:20,lineHeight:1,padding:4},children:f?`✕`:`☰`}):(0,k.jsx)(`div`,{style:{display:`flex`,gap:20,alignItems:`center`,flexWrap:`wrap`},children:n.map(e=>{let t=e.children??[];if(!t.length)return(0,k.jsx)(`a`,{href:e.href||`#`,style:A,children:e.label},e.key);let n=e.type===`mega`;return(0,k.jsxs)(`span`,{style:{position:n?`static`:`relative`,display:`inline-flex`},onMouseEnter:()=>g(e.key),onMouseLeave:()=>g(null),children:[(0,k.jsxs)(`a`,{href:e.href||`#`,style:{...A,cursor:`pointer`},children:[e.label,` `,(0,k.jsx)(`span`,{style:{fontSize:9,opacity:.6},children:`▼`})]}),h===e.key&&(n?(0,k.jsx)(`div`,{style:{...ht,position:`absolute`,left:0,right:0,top:`100%`,padding:24,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(170px, 1fr))`,gap:16},children:t.map(e=>v(e,{padding:`6px 8px`,borderRadius:6}))}):(0,k.jsx)(`div`,{style:{...ht,position:`absolute`,top:`100%`,left:0,minWidth:190,borderRadius:8,padding:8,display:`flex`,flexDirection:`column`},children:t.map(e=>v(e,{padding:`8px 12px`,borderRadius:6}))}))]},e.key)})}),_&&f&&(0,k.jsx)(`div`,{style:{flexBasis:`100%`,width:`100%`,display:`flex`,flexDirection:`column`,paddingTop:10},children:n.map(e=>(0,k.jsxs)(l.Fragment,{children:[(0,k.jsx)(`a`,{href:e.href||`#`,style:{...A,padding:`10px 4px`,fontWeight:(e.children??[]).length?600:400,opacity:1},children:e.label}),(e.children??[]).map(e=>v(e,{padding:`8px 4px 8px 22px`}))]},e.key))})]})}function _t({tabs:e=[],linked:t,style:n,nodeRef:r}){let[i,a]=(0,l.useState)(0),o=e.length?Math.min(i,e.length-1):0;return e.length?(0,k.jsxs)(`div`,{ref:r,style:{width:`100%`,...m(n)},children:[(0,k.jsx)(`div`,{style:{display:`flex`,gap:4,borderBottom:`1px solid rgba(148, 163, 184, 0.35)`},children:e.map((e,t)=>(0,k.jsx)(`button`,{type:`button`,onClick:()=>a(t),style:{background:`transparent`,border:0,padding:`10px 16px`,fontSize:14,fontFamily:`inherit`,color:`inherit`,cursor:`pointer`,opacity:t===o?1:.6,fontWeight:t===o?600:500,boxShadow:t===o?`inset 0 -2px 0 var(--page-accent, #111827)`:`none`},children:e.label||`Tab ${t+1}`},e.key))}),e.map((e,n)=>(0,k.jsx)(`div`,{style:{display:n===o?`flex`:`none`,flexDirection:`column`},children:t?.[e.key]??null},e.key))]}):null}function vt({items:e=[],linked:t,multiple:n=!1,style:r,nodeRef:i}){let[a,o]=(0,l.useState)(()=>new Set(e.length?[e[0].key]:[]));if(!e.length)return null;let s=e=>o(t=>{let r=new Set(n?t:[]);return t.has(e)?r.delete(e):r.add(e),r});return(0,k.jsx)(`div`,{ref:i,style:{width:`100%`,...m(r)},children:e.map((n,r)=>{let i=a.has(n.key);return(0,k.jsxs)(`div`,{style:{borderBottom:r<e.length-1?`1px solid rgba(148, 163, 184, 0.35)`:`none`},children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>s(n.key),style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,background:`transparent`,border:0,padding:`14px 4px`,fontSize:15,fontWeight:600,fontFamily:`inherit`,color:`inherit`,textAlign:`left`,cursor:`pointer`},children:[n.title||`Item ${r+1}`,(0,k.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:12,opacity:.6,transform:i?`rotate(180deg)`:`none`,transition:`transform 180ms`},children:`▼`})]}),(0,k.jsx)(`div`,{style:{display:i?`flex`:`none`,flexDirection:`column`},children:t?.[n.key]??null})]},n.key)})})}var yt={display:`flex`,flexDirection:`column`,gap:`12px`},bt={fontSize:`14px`,fontWeight:500,color:`var(--page-text, #111827)`},xt={padding:`10px 12px`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontFamily:`inherit`,width:`100%`,boxSizing:`border-box`,backgroundColor:`#ffffff`,color:`#111827`},St={display:`flex`,alignItems:`center`,gap:`8px`,fontSize:`14px`,color:`var(--page-text, #111827)`},Ct=e=>e?{readOnly:!0,tabIndex:-1,onMouseDown:e=>e.preventDefault()}:{};function wt(e,t){if(!e)return!0;let n=t[e.field],r=n==null||n===``?``:String(n),i=e.value??``;switch(e.op){case`eq`:return r===i;case`neq`:return r!==i;case`contains`:return r.toLowerCase().includes(i.toLowerCase());case`gt`:return Number(r)>Number(i);case`lt`:return Number(r)<Number(i);case`empty`:return r===``;case`notEmpty`:return r!==``;default:return!1}}var Tt={display:`flex`,flexDirection:`column`,gap:6},Et={font:`inherit`,fontSize:15,padding:`10px 12px`,borderRadius:8,border:`1px solid rgba(148, 163, 184, 0.55)`,background:`transparent`,color:`inherit`,width:`100%`,boxSizing:`border-box`};function j({field:e,value:t,onChange:n,inert:r}){let i=(0,k.jsxs)(`span`,{style:{...bt,fontSize:14},children:[e.label,e.required?` *`:``]}),a={name:e.name,required:e.required||void 0,placeholder:e.placeholder||void 0,disabled:r||void 0,style:Et,value:t??``,onChange:t=>n(e.name,t.target.value)};return e.type===`display`?(0,k.jsx)(e.variant&&e.variant!==`p`?e.variant:`p`,{style:{margin:0,color:e.color||`inherit`,fontSize:{h1:32,h2:26,h3:21,h4:18,h5:16,h6:14,p:15}[e.variant]??16,fontWeight:e.variant===`p`?400:700,lineHeight:1.35},children:e.label}):e.type===`image`?e.src?(0,k.jsx)(`img`,{src:e.src,alt:e.label??``,style:{width:`100%`,borderRadius:8,display:`block`}}):null:e.type===`video`?e.src?/youtube\.com|youtu\.be|vimeo\.com/i.test(e.src)?(0,k.jsx)(rt,{url:e.src,style:{width:`100%`}}):(0,k.jsx)(`video`,{src:e.src,controls:!0,style:{width:`100%`,borderRadius:8,display:`block`}}):null:(0,k.jsxs)(`label`,{style:Tt,children:[i,e.type===`textarea`||e.multiline?(0,k.jsx)(`textarea`,{...a,rows:4,style:{...Et,resize:`vertical`}}):e.type===`select`?(0,k.jsxs)(`select`,{...a,children:[(0,k.jsx)(`option`,{value:``,children:e.placeholder||`—`}),(e.options??[]).map((e,t)=>(0,k.jsx)(`option`,{value:typeof e==`string`?e:e.value,children:typeof e==`string`?e:e.label??e.value},t))]}):e.type===`checkbox`?(0,k.jsx)(`input`,{type:`checkbox`,name:e.name,required:e.required||void 0,disabled:r||void 0,checked:!!t,onChange:t=>n(e.name,t.target.checked),style:{width:18,height:18}}):e.type===`upload`?(0,k.jsx)(`input`,{type:`file`,name:e.name,accept:e.accept||void 0,required:e.required||void 0,disabled:r||void 0,onChange:t=>n(e.name,t.target.files?.[0]?.name??``),style:{font:`inherit`,fontSize:14}}):(0,k.jsx)(`input`,{...a,type:{email:`email`,number:`number`,date:`date`,datetime:`datetime-local`,phone:`tel`,link:`url`}[e.type]??`text`}),e.help&&(0,k.jsx)(`span`,{style:{fontSize:12,opacity:.65},children:e.help})]})}function Dt({style:e,action:t,method:n,name:r,enctype:i,formSlug:a,auto:o,submitLabel:s,nodeRef:c,inert:u,children:d,linked:f,show:p}){let{tenant:h,apiUrl:g}=(0,l.useContext)(be),[_,v]=(0,l.useState)(`form`),[y,b]=(0,l.useState)(null),[x,ee]=(0,l.useState)({}),[S,C]=(0,l.useState)(0),te=u?p||`form`:_;(0,l.useEffect)(()=>{if(!o||!a)return;let e=!0;return fetch(`${g||`/api`}/forms/${encodeURIComponent(a)}`,{headers:h?{"x-tenant":h}:{}}).then(e=>e.json()).then(t=>e&&b(t?.payload&&typeof t.payload==`object`?t.payload:null)).catch(()=>e&&b(null)),()=>{e=!1}},[o,a,h,g]);let ne=[{section:null,fields:[]}];for(let e of Array.isArray(y?.fields)?y.fields:[])e.type===`section`?ne.push({section:e,fields:[]}):ne[ne.length-1].fields.push(e);let re=ne.filter(e=>e.section||e.fields.length),w=re.filter(e=>!e.section||wt(e.section.condition,x)).map(e=>({...e,fields:e.fields.filter(e=>wt(e.condition,x))})),ie=re.length>1,ae=Math.min(S,Math.max(0,w.length-1)),oe=ie?w[ae]?.fields??[]:w.flatMap(e=>e.fields),se=oe.filter(e=>{let t=x[e.name];return e.required&&(t==null||t===``||t===!1)}),ce=ae>=w.length-1,le=(e,t)=>ee(n=>({...n,[e]:t}));return(0,k.jsxs)(`div`,{ref:c,style:m(e),children:[(0,k.jsx)(`form`,{action:t||void 0,method:n||`post`,name:r||void 0,encType:i||void 0,onSubmit:async e=>{if(e.preventDefault(),!u){if(a){let t={};if(o)for(let[e,n]of Object.entries(x))n!=null&&n!==``&&(t[e]=n);else for(let[n,r]of new FormData(e.currentTarget).entries())typeof r==`string`&&(t[n]=r===`on`||r);try{let e=await fetch(`${g||`/api`}/forms/${a}/submit`,{method:`post`,headers:{"content-type":`application/json`,...h?{"x-tenant":h}:{}},body:JSON.stringify(t)}),n=await e.json().catch(()=>null);v(e.ok&&n?.success!==!1?`success`:`error`)}catch{v(`error`)}return}if(!t){v(`success`);return}try{let r=await fetch(t,{method:n||`post`,body:new FormData(e.currentTarget)});v(r.ok?`success`:`error`)}catch{v(`error`)}}},style:{...yt,display:te===`success`?`none`:`flex`},children:o&&a?(0,k.jsxs)(k.Fragment,{children:[ie&&(0,k.jsx)(zt,{steps:w.map(e=>({label:e.section?.label??`Start`})),active:ae+1,style:{marginBottom:8}}),ie&&w[ae]?.section?.help&&(0,k.jsx)(`p`,{style:{margin:0,fontSize:14,opacity:.7},children:w[ae].section.help}),oe.map(e=>(0,k.jsx)(j,{field:e,value:x[e.name],onChange:le,inert:u},e.name)),(0,k.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`center`,marginTop:4},children:[ie&&ae>0&&(0,k.jsx)(`button`,{type:`button`,disabled:u||void 0,onClick:()=>C(ae-1),style:{...Ae,background:`transparent`,color:`inherit`,border:0,padding:`10px 16px`,cursor:`pointer`},children:`Back`}),ie&&!ce?(0,k.jsx)(`button`,{type:`button`,disabled:u||se.length>0,onClick:()=>C(ae+1),style:{...Ae,border:0,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,cursor:`pointer`,opacity:se.length?.5:1},children:`Next`}):(0,k.jsx)(`button`,{type:`submit`,disabled:u||void 0,style:{...Ae,border:0,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,cursor:`pointer`},children:s||`Submit`})]})]}):d}),(0,k.jsx)(`div`,{style:{display:te===`success`?`block`:`none`},children:f?.success??null}),(0,k.jsx)(`div`,{style:{display:te===`error`?`block`:`none`,marginTop:12},children:f?.error??null})]})}function Ot({text:e,parts:t,style:n,nodeRef:r,linked:i}){return(0,k.jsx)(`label`,{ref:r,style:{...bt,...m(n)},children:Ve(t,e,i)})}function kt({type:e=`text`,name:t,placeholder:n,required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsx)(`input`,{ref:a,type:e,name:t||void 0,placeholder:n,required:!o&&!!r,style:{...xt,...m(i)},...Ct(o)})}function At({name:e,placeholder:t,rows:n=4,required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsx)(`textarea`,{ref:a,name:e||void 0,placeholder:t,rows:n,required:!o&&!!r,style:{...xt,resize:`vertical`,...m(i)},...Ct(o)})}function jt({kind:e=`checkbox`,label:t,name:n,value:r,required:i,style:a,nodeRef:o,inert:s}){return(0,k.jsxs)(`label`,{ref:o,style:{...St,...m(a)},children:[(0,k.jsx)(`input`,{type:e,name:n||void 0,value:r||void 0,required:!s&&!!i,onClick:s?e=>e.preventDefault():void 0,tabIndex:s?-1:void 0,style:{margin:0,accentColor:`var(--page-accent, #111827)`}}),t]})}function Mt({name:e,placeholder:t,options:n=[],required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsxs)(`select`,{ref:a,name:e||void 0,required:!o&&!!r,defaultValue:``,onMouseDown:o?e=>e.preventDefault():void 0,tabIndex:o?-1:void 0,style:{...xt,appearance:`auto`,...m(i)},children:[t!==``&&(0,k.jsx)(`option`,{value:``,disabled:!0,children:t??`Select…`}),n.map((e,t)=>(0,k.jsx)(`option`,{value:e,children:e},t))]})}function Nt({name:e,accept:t,required:n,text:r=`Choose a file…`,style:i,nodeRef:a,inert:o}){let[s,c]=(0,l.useState)(null);return(0,k.jsxs)(`label`,{ref:a,style:{...xt,display:`flex`,alignItems:`center`,gap:`8px`,cursor:o?`default`:`pointer`,borderStyle:`dashed`,color:s?`#111827`:`#6b7280`,...m(i)},children:[(0,k.jsx)(`input`,{type:`file`,name:e||void 0,accept:t||void 0,required:!o&&!!n,disabled:!!o,onChange:e=>c(e.target.files?.[0]?.name??null),style:{display:`none`}}),(0,k.jsx)(`span`,{"aria-hidden":!0,children:`📎`}),s??r]})}function Pt({text:e=`Submit`,style:t,nodeRef:n,inert:r}){return(0,k.jsx)(`button`,{ref:n,type:r?`button`:`submit`,style:{...Ae,border:0,cursor:`pointer`,alignSelf:`flex-start`,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,lineHeight:1.4,fontFamily:`inherit`,...m(t)},children:e})}function Ft({cols:e=2,rows:t=1,style:n,nodeRef:r,linked:i}){let a=Math.max(1,(Number(e)||1)*(Number(t)||1));return(0,k.jsx)(`div`,{ref:r,style:{display:`grid`,gridTemplateColumns:`repeat(${Math.max(1,Number(e)||1)}, minmax(0, 1fr))`,gap:16,width:`100%`,...m(n)},children:Array.from({length:a},(e,t)=>(0,k.jsx)(`div`,{style:{minWidth:0},children:i?.[`cell-${t}`]??null},t))})}function It({collection:e,limit:t=6,layout:n=`grid`,columns:r=3,imageField:i,titleField:a=`name`,textField:o,custom:s,templateId:c,style:u,nodeRef:d}){let{tenant:f,apiUrl:p}=(0,l.useContext)(be),h=(0,l.useContext)(Se),g=(0,l.useContext)(xe)?.[e],[_,v]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!e||g)return;let t=!0,n=e.startsWith(`api:`)?`${p}/data/${encodeURIComponent(e.slice(4))}`:`${p}/dynamic/${encodeURIComponent(e)}`;return fetch(n,{headers:f?{"x-tenant":f}:{}}).then(e=>e.json()).then(e=>t&&v(Array.isArray(e?.payload)?e.payload.filter(e=>e&&typeof e==`object`):[])).catch(()=>t&&v([])),()=>{t=!1}},[e,f,p,g]),!e)return null;let y=(g??_??[]).slice(0,Math.max(1,Number(t)||6)),b=Math.min(Math.max(Number(r)||3,1),6),x=n===`list`?{display:`flex`,flexDirection:`column`,gap:20}:{display:`grid`,gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gap:24};return s&&c&&h?.render?(0,k.jsx)(`div`,{ref:d,style:{width:`100%`,...x,...m(u)},children:y.map(e=>(0,k.jsx)(`div`,{style:{minWidth:0},children:h.render(c,t=>De(t,e))},e.id??e?.data?.slug))}):(0,k.jsx)(`div`,{ref:d,style:{width:`100%`,...x,...m(u)},children:y.map(e=>{let t=i?we(e?.data,i):null,r=a?Ee(we(e?.data,a)):null,s=o?we(e?.data,o):null,c=Array.isArray(s)?s:null,l=c||s==null?null:Ee(s),u=n===`list`;return(0,k.jsxs)(`div`,{style:{display:`flex`,flexDirection:u?`row`:`column`,gap:u?20:12,alignItems:u?`center`:`stretch`,minWidth:0},children:[t&&(0,k.jsx)(`img`,{src:t,alt:r??``,style:{width:u?160:`100%`,aspectRatio:`3 / 2`,objectFit:`cover`,borderRadius:10,flexShrink:0,display:`block`}}),(0,k.jsxs)(`div`,{style:{minWidth:0},children:[r&&(0,k.jsx)(`h3`,{style:{margin:0,fontSize:18,fontWeight:700},children:r}),l&&(0,k.jsx)(`p`,{style:{margin:`6px 0 0`,fontSize:14,lineHeight:1.55,opacity:.75},children:l}),c&&(0,k.jsx)(`div`,{style:{marginTop:6,fontSize:14,lineHeight:1.55,opacity:.85},children:Ge(c)})]})]},e.id??e?.data?.slug)})})}function Lt({items:e=[],separator:t=`/`,style:n,nodeRef:r}){return e.length?(0,k.jsx)(`nav`,{ref:r,"aria-label":`Breadcrumb`,style:{...m(n)},children:(0,k.jsx)(`ol`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8,listStyle:`none`,margin:0,padding:0,fontSize:14},children:e.map((n,r)=>{let i=r===e.length-1;return(0,k.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[r>0&&(0,k.jsx)(`span`,{style:{opacity:.4},"aria-hidden":!0,children:t}),i||!n.href?(0,k.jsx)(`span`,{style:{fontWeight:i?600:400,opacity:i?1:.7},"aria-current":i?`page`:void 0,children:n.label}):(0,k.jsx)(`a`,{href:n.href,style:{color:`inherit`,opacity:.7,textDecoration:`none`},children:n.label})]},r)})})}):null}function Rt({pages:e=5,current:t=1,prevNext:n=!0,href:r=`#`,style:i,nodeRef:a}){let o=Math.min(Math.max(Number(e)||1,1),50),s=Math.min(Math.max(Number(t)||1,1),o),c=e=>r&&r!==`#`?r.replace(`{page}`,String(e)):`#`,l=e=>({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,height:36,padding:`0 8px`,borderRadius:8,fontSize:14,textDecoration:`none`,color:e?`var(--page-accent-text, #ffffff)`:`inherit`,background:e?`var(--page-accent, #111827)`:`transparent`,border:e?`1px solid transparent`:`1px solid rgba(148, 163, 184, 0.4)`});return(0,k.jsxs)(`nav`,{ref:a,"aria-label":`Pagination`,style:{display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`,...m(i)},children:[n&&(0,k.jsx)(`a`,{href:s>1?c(s-1):`#`,"aria-label":`Previous`,style:{...l(!1),opacity:s>1?1:.4},children:`‹`}),Array.from({length:o},(e,t)=>t+1).map(e=>(0,k.jsx)(`a`,{href:c(e),"aria-current":e===s?`page`:void 0,style:l(e===s),children:e},e)),n&&(0,k.jsx)(`a`,{href:s<o?c(s+1):`#`,"aria-label":`Next`,style:{...l(!1),opacity:s<o?1:.4},children:`›`})]})}function zt({steps:e=[],active:t=1,vertical:n=!1,style:r,nodeRef:i}){if(!e.length)return null;let a=Math.min(Math.max(Number(t)||1,1),e.length),o=e=>({width:32,height:32,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:14,fontWeight:600,flexShrink:0,color:e===`todo`?`inherit`:`var(--page-accent-text, #ffffff)`,background:e===`todo`?`transparent`:`var(--page-accent, #111827)`,border:e===`todo`?`1px solid rgba(148, 163, 184, 0.5)`:`1px solid transparent`,opacity:e===`todo`?.6:1,boxShadow:e===`active`?`0 0 0 4px rgba(99, 102, 241, 0.2)`:`none`}),s=e=>({flexGrow:1,alignSelf:`center`,background:e?`var(--page-accent, #111827)`:`rgba(148, 163, 184, 0.4)`,...n?{width:2,minHeight:24,marginLeft:15,alignSelf:`auto`}:{height:2,minWidth:24}});return(0,k.jsx)(`div`,{ref:i,style:{display:`flex`,flexDirection:n?`column`:`row`,alignItems:n?`stretch`:`flex-start`,gap:n?4:8,...m(r)},children:e.map((e,t)=>{let r=t+1,i=r<a?`done`:r===a?`active`:`todo`;return(0,k.jsxs)(l.Fragment,{children:[t>0&&(0,k.jsx)(`div`,{style:s(r<=a),"aria-hidden":!0}),(0,k.jsxs)(`div`,{style:{display:`flex`,flexDirection:n?`row`:`column`,alignItems:`center`,gap:8,minWidth:0,textAlign:n?`left`:`center`},children:[(0,k.jsx)(`div`,{style:o(i),children:i===`done`?`✓`:r}),(0,k.jsxs)(`div`,{style:{minWidth:0},children:[(0,k.jsx)(`div`,{style:{fontSize:13,fontWeight:i===`active`?700:500,opacity:i===`todo`?.6:1},children:e.label}),e.description&&(0,k.jsx)(`div`,{style:{fontSize:12,opacity:.6},children:e.description})]})]})]},t)})})}function Bt({columns:e=[],rows:t=[],source:n,limit:r=10,striped:i=!0,bordered:a=!1,compact:o=!1,style:s,nodeRef:c}){let{tenant:u,apiUrl:d}=(0,l.useContext)(be),f=(0,l.useContext)(xe)?.[n],[p,h]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!n||f)return;let e=!0,t=n.startsWith(`api:`)?`${d}/data/${encodeURIComponent(n.slice(4))}`:`${d}/dynamic/${encodeURIComponent(n)}`;return fetch(t,{headers:u?{"x-tenant":u}:{}}).then(e=>e.json()).then(t=>e&&h(Array.isArray(t?.payload)?t.payload:[])).catch(()=>e&&h([])),()=>{e=!1}},[n,u,d,f]),!e.length)return null;let g=n?(f??p??[]).slice(0,Math.max(1,Number(r)||10)):null,_=g?g.map(t=>e.map(e=>Ee(we(t?.data,e.field)))):t,v=o?`6px 10px`:`10px 14px`,y=`1px solid rgba(148, 163, 184, 0.35)`,b=a?{border:y}:{borderBottom:y};return(0,k.jsx)(`div`,{ref:c,style:{width:`100%`,overflowX:`auto`,...m(s)},children:(0,k.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:14,...a?{border:y}:{}},children:[(0,k.jsx)(`thead`,{children:(0,k.jsx)(`tr`,{children:e.map((e,t)=>(0,k.jsx)(`th`,{style:{textAlign:`left`,fontWeight:600,padding:v,background:`rgba(148, 163, 184, 0.12)`,...b},children:e.label??e},t))})}),(0,k.jsx)(`tbody`,{children:_.map((t,n)=>(0,k.jsx)(`tr`,{style:i&&n%2==1?{background:`rgba(148, 163, 184, 0.07)`}:void 0,children:e.map((e,n)=>(0,k.jsx)(`td`,{style:{padding:v,...b},children:t?.[n]??``},n))},n))})]})})}var Vt={PageRoot:Fe,Section:Ie,Container:Le,Heading:Re,TextBlock:Xe,ButtonBlock:$e,ImageBlock:et,Spacer:ot,Divider:st,SliderBlock:pt,CanvasSlider:mt,TabsBlock:_t,QuickStack:Ft,CollectionList:It,BreadcrumbsBlock:Lt,PaginationBlock:Rt,StepperBlock:zt,TableBlock:Bt,AccordionBlock:vt,NavbarBlock:gt,ListBlock:Ye,TextSpan:He,QuoteBlock:Je,TextLink:Qe,RichTextBlock:Ke,RichContentBlock:Ke,VideoBlock:tt,YouTubeBlock:rt,IframeBlock:it,EmbedBlock:at,FormBlock:Dt,FormLabel:Ot,FormInput:kt,FormTextarea:At,FormCheckbox:e=>(0,k.jsx)(jt,{kind:`checkbox`,...e}),FormRadio:e=>(0,k.jsx)(jt,{kind:`radio`,...e}),FormSelect:Mt,FormFile:Nt,FormSubmit:Pt};function Ht(e,t,n,r=new Set,i=void 0){let a=t[e];if(!a||a.hidden)return null;let o=a.type?.resolvedName,s=i?.mapProps?i.mapProps(a.props??{},o):a.props??{};if(o===`ComponentInstance`){let t=a.props?.componentId,o=n?.[t];if(!o?.template||r.has(t))return null;let s=new Set(r).add(t);return(0,k.jsx)(l.Fragment,{children:Ht(o.template.rootId,o.template.nodes,n,s,i)},e)}let c=Vt[o];if(!c)return null;let u=(a.nodes??[]).map(e=>Ht(e,t,n,r,i)).filter(Boolean),d=Object.entries(a.linkedNodes??{}),f=d.length?Object.fromEntries(d.map(([e,i])=>[e,Ht(i,t,n,r)])):void 0;return(0,k.jsx)(c,{...s,...o===`CollectionList`?{templateId:a.linkedNodes?.card}:null,linked:f,nodeRef:t=>{t&&(t.setAttribute(`data-wb`,e),v(t,s))},children:u.length?u:void 0},e)}var Ut=e=>Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(` `);function Wt({blocks:e,theme:t,components:n,mode:r=`auto`,style:i,custom:a,tenant:o,apiUrl:s,datasets:c,locale:u,direction:d}){let f=a?.js?.trim();if((0,l.useEffect)(()=>{if(!f)return;let e=document.createElement(`script`);return e.text=f,document.body.appendChild(e),()=>e.remove()},[f]),!e?.ROOT)return null;let p={lang:u||void 0,dir:ve(d,u)},m={minHeight:`100%`,display:`flex`,flexDirection:`column`},h=Ht(`ROOT`,e,n),g=(0,l.useMemo)(()=>({render:(t,r)=>Ht(t,e,n,void 0,{mapProps:r})}),[e,n]),_=ne(e,n),v=te(e,n),y=a?.css?.trim(),b=he(e,n).map(e=>(0,k.jsx)(`link`,{rel:`stylesheet`,precedence:`default`,href:D(e)},e));if(r!==`auto`)return(0,k.jsx)(be.Provider,{value:{tenant:o||``,apiUrl:s||`/api`},children:(0,k.jsx)(xe.Provider,{value:c??null,children:(0,k.jsx)(Se.Provider,{value:g,children:(0,k.jsxs)(`div`,{...p,style:{...m,...T(t,r),...i},children:[b,_&&(0,k.jsx)(`style`,{children:_}),v&&(0,k.jsx)(`style`,{children:v}),y&&(0,k.jsx)(`style`,{children:y}),h]})})})});let x=ce(t);return(0,k.jsx)(be.Provider,{value:{tenant:o||``,apiUrl:s||`/api`},children:(0,k.jsx)(xe.Provider,{value:c??null,children:(0,k.jsx)(Se.Provider,{value:g,children:(0,k.jsxs)(`div`,{...p,className:`webim-page`,style:{...m,...ue(t),...i},children:[(0,k.jsx)(`style`,{children:`.webim-page { ${Ut(le(x.light))} }
14
- @media (prefers-color-scheme: dark) { .webim-page { ${Ut(le(x.dark))} } }`}),b,_&&(0,k.jsx)(`style`,{children:_}),v&&(0,k.jsx)(`style`,{children:v}),y&&(0,k.jsx)(`style`,{children:y}),h]})})})})}function Gt({bundle:e,mode:t=`auto`,style:n}){return e?.blocks?.ROOT?(0,k.jsx)(Wt,{blocks:e.blocks,theme:e.theme,components:e.components,custom:e.custom,tenant:e.tenant,apiUrl:e.apiUrl,datasets:e.datasets,locale:e.locale,direction:e.direction,mode:t,style:n}):null}function Kt({apiUrl:e,tenant:t,slug:n,locale:r,preview:i,mode:a=`auto`,style:o,fallback:s=null,errorFallback:c=null,onLoad:u,onError:d}){let[f,p]=(0,l.useState)({status:`loading`}),m=(0,l.useRef)({onLoad:u,onError:d});return m.current={onLoad:u,onError:d},(0,l.useEffect)(()=>{let a=!0;return p({status:`loading`}),pe({apiUrl:e,tenant:t,slug:n,locale:r,preview:i}).then(e=>{a&&(p({status:`ready`,bundle:e}),m.current.onLoad?.(e))}).catch(e=>{a&&(p({status:`error`,error:e}),m.current.onError?.(e))}),()=>{a=!1}},[e,t,n,r,i]),f.status===`loading`?s:f.status===`error`?typeof c==`function`?c(f.error):c:(0,k.jsx)(Gt,{bundle:f.bundle,mode:a,style:o})}function qt(e,t={}){let n=(0,u.createRoot)(e);return n.render((0,k.jsx)(Kt,{apiUrl:t.apiUrl||t.api,tenant:t.tenant,slug:t.slug,locale:t.locale||void 0,mode:t.mode||`auto`,onError:e=>console.error(`[webim-embed]`,t.slug,e)})),n}function Jt(e=document){for(let t of e.querySelectorAll(`[data-webim-page]:not([data-webim-mounted])`))t.setAttribute(`data-webim-mounted`,``),qt(t,t.dataset)}var Yt=document.currentScript,Xt=()=>{if(Jt(),Yt?.dataset.slug){let e=document.createElement(`div`);e.setAttribute(`data-webim-mounted`,``),Yt.parentElement&&Yt.parentElement!==document.head?Yt.insertAdjacentElement(`beforebegin`,e):document.body.appendChild(e),qt(e,Yt.dataset)}};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Xt,{once:!0}):Xt(),window.WebimEmbed={mount:qt,scan:Jt}})();
13
+ `)}var re=`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,w={light:{background:`#ffffff`,text:`#111827`,accent:`#111827`,accentText:`#ffffff`,primary:{light:`#4b5563`,main:`#111827`,dark:`#030712`,contrastText:`#ffffff`},secondary:{light:`#a5b4fc`,main:`#6366f1`,dark:`#4338ca`,contrastText:`#ffffff`}},dark:{background:`#0f172a`,text:`#e2e8f0`,accent:`#6366f1`,accentText:`#ffffff`,primary:{light:`#a5b4fc`,main:`#6366f1`,dark:`#4338ca`,contrastText:`#ffffff`},secondary:{light:`#5eead4`,main:`#14b8a6`,dark:`#0f766e`,contrastText:`#052e2b`}}},ie={font:`system`,headingFont:`inherit`,light:w.light,dark:w.dark},ae={system:{label:`System`,value:re},inter:{label:`Inter`,value:`"Inter", ${re}`},outfit:{label:`Outfit`,value:`"Outfit", ${re}`},serif:{label:`Serif`,value:`Georgia, "Times New Roman", serif`},mono:{label:`Mono`,value:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`}},oe=(e,t)=>ae[e]?.value??t,se=(e,...t)=>{let n=Object.assign({},e,...t);return n.primary={...e.primary,...t.reduce((e,t)=>({...e,...t?.primary}),{})},n.secondary={...e.secondary,...t.reduce((e,t)=>({...e,...t?.secondary}),{})},n};function ce(e){let{light:t,dark:n,font:r,headingFont:i,...a}=e??{};return{font:r??ie.font,headingFont:i??ie.headingFont,light:se(w.light,a,t),dark:se(w.dark,n)}}function le(e){return{"--page-bg":e.background,"--page-text":e.text,"--page-accent":e.accent,"--page-accent-text":e.accentText,"--page-primary-light":e.primary.light,"--page-primary":e.primary.main,"--page-primary-dark":e.primary.dark,"--page-primary-contrast":e.primary.contrastText,"--page-secondary-light":e.secondary.light,"--page-secondary":e.secondary.main,"--page-secondary-dark":e.secondary.dark,"--page-secondary-contrast":e.secondary.contrastText}}function ue(e){let t=ce(e);return{backgroundColor:`var(--page-bg)`,color:`var(--page-text)`,fontFamily:oe(t.font,re),"--page-heading-font":t.headingFont===`inherit`?`inherit`:oe(t.headingFont,`inherit`)}}function T(e,t=`light`){let n=ce(e);return{...ue(e),...le(n[t]??n.light)}}function E(e,t){return e?.themeRef&&t?.[e.themeRef]||e?.theme}function de({page:e,settings:t,tenant:n,apiUrl:r,locale:i}){let a={...t?.global??{},...t?.tenant??{}},o=e.meta??{};return{schema:1,title:e.title,slug:e.slug,blocks:i&&o.i18n?.[i]?.blocks||e.blocks,theme:E(o,a.builder_themes?.themes),components:a.builder_components?.components??{},custom:o.custom,seo:o.seo,direction:o.direction,locale:i||a.locales?.default,locales:a.locales,tenant:n??``,apiUrl:r??``}}var fe=async e=>{let t=await e.json().catch(()=>null);if(!e.ok||t?.success===!1)throw Error(t?.error?.message||`Request failed (${e.status})`);return t?.payload??t};async function pe({apiUrl:e,tenant:t,slug:n,locale:r,preview:i,token:a,fetch:o}){if(!e)throw Error(`fetchPage: apiUrl is required`);if(!n)throw Error(`fetchPage: slug is required`);let s=o??fetch,c=e.replace(/\/$/,``),l={...t?{"x-tenant":t}:{},...a?{authorization:`Bearer ${a}`}:{}},[u,d]=await Promise.all([s(`${c}/render/${encodeURIComponent(n)}${i?`?preview=${encodeURIComponent(i)}`:``}`,{headers:l}).then(fe),s(`${c}/settings/public`,{headers:l}).then(fe)]),f=de({page:u,settings:d,tenant:t,apiUrl:c,locale:r}),p=[...new Set(Object.values(f.blocks??{}).map(e=>e?.type?.resolvedName===`CollectionList`?e.props?.collection:e?.type?.resolvedName===`TableBlock`||e?.type?.resolvedName===`OrgChartBlock`?e.props?.source:null).filter(Boolean))];if(p.length){let e=e=>e.startsWith(`api:`)?`${c}/data/${encodeURIComponent(e.slice(4))}`:`${c}/dynamic/${encodeURIComponent(e)}${r?`?locale=${encodeURIComponent(r)}`:``}`,t=await Promise.all(p.map(t=>s(e(t),{headers:l}).then(fe).then(e=>[t,Array.isArray(e)?e:Array.isArray(e?.data)?e.data:[]]).catch(()=>[t,[]])));f.datasets=Object.fromEntries(t)}return f}new Map([{family:`Bebas Neue`,fallback:`sans-serif`},{family:`Crimson Text`,fallback:`serif`},{family:`DM Sans`,fallback:`sans-serif`},{family:`Fira Sans`,fallback:`sans-serif`},{family:`Inter`,fallback:`sans-serif`},{family:`JetBrains Mono`,fallback:`monospace`},{family:`Josefin Sans`,fallback:`sans-serif`},{family:`Karla`,fallback:`sans-serif`},{family:`Lato`,fallback:`sans-serif`},{family:`Lora`,fallback:`serif`},{family:`Manrope`,fallback:`sans-serif`},{family:`Merriweather`,fallback:`serif`},{family:`Montserrat`,fallback:`sans-serif`},{family:`Nunito`,fallback:`sans-serif`},{family:`Open Sans`,fallback:`sans-serif`},{family:`Oswald`,fallback:`sans-serif`},{family:`Outfit`,fallback:`sans-serif`},{family:`Playfair Display`,fallback:`serif`},{family:`Poppins`,fallback:`sans-serif`},{family:`Quicksand`,fallback:`sans-serif`},{family:`Raleway`,fallback:`sans-serif`},{family:`Roboto`,fallback:`sans-serif`},{family:`Rubik`,fallback:`sans-serif`},{family:`Source Sans 3`,fallback:`sans-serif`},{family:`Space Grotesk`,fallback:`sans-serif`},{family:`Work Sans`,fallback:`sans-serif`}].map(e=>[e.family,e]));function me(e){return e.length?`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.replace(/ /g,`+`)}:wght@100..900`).join(`&`)}&display=swap`:null}var D=e=>me([e]),O=e=>{let t=typeof e==`string`&&e.match(/^"([^"]+)"/);return t?t[1]:null};function he(e,t){let n=new Set,r=e=>{for(let t of Object.values(e||{}))for(let e of[`style`,`hover`,`pressed`,`focused`]){let r=O(t.props?.[e]?.fontFamily);r&&n.add(r)}};r(e);for(let e of Object.values(t||{}))r(e.template?.nodes);return[...n].sort()}var ge=new Set([`ar`,`he`,`fa`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`]),_e=e=>ge.has(String(e||``).toLowerCase().split(/[-_]/)[0])?`rtl`:`ltr`,ve=(e,t)=>e===`ltr`||e===`rtl`?e:t?_e(t):void 0,ye=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),k=e(((e,t)=>{t.exports=ye()}))(),be=(0,l.createContext)({tenant:``,apiUrl:`/api`,locale:``}),xe=(0,l.createContext)(null),Se=(0,l.createContext)(null),Ce=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function we(e,t){if(t)return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e&&typeof e==`object`?e[t]:void 0,e):e?.[t]}var Te=e=>{let t=[];for(let[n,r]of Object.entries(e??{})){if(!/^[\w-]+$/.test(n))continue;t.push(n);let e=Array.isArray(r)?r[0]:r,i=Array.isArray(r)?`${n}.0`:n;if(e&&typeof e==`object`&&!Array.isArray(e))for(let n of Object.keys(e))/^[\w-]+$/.test(n)&&t.push(`${i}.${n}`)}return t};function Ee(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):typeof e==`object`&&!Array.isArray(e)&&(`label`in e||`name`in e||`slug`in e)?String(e.label??e.name??e.slug??``):Array.isArray(e)?e.map(e=>typeof e==`string`?e:Array.isArray(e?.parts)?e.parts.map(e=>e?.text??``).join(``):Array.isArray(e?.items)?e.items.map(e=>e?.text??``).join(` `):e&&(e.label!=null||e.name!=null||e.slug!=null)?String(e.label??e.name??e.slug):``).filter(Boolean).join(` `):``}function De(e,t){let n=t?.data??{},r=Te(n);if(!r.length)return e;let i=RegExp(`:(${r.map(Ce).sort((e,t)=>t.length-e.length).join(`|`)})`,`g`),a=e=>typeof e==`string`?e.replace(i,(e,t)=>Ee(we(n,t))):Array.isArray(e)?e.map(a):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,a(t)])):e;return a(e)}var Oe={margin:0,fontWeight:700,lineHeight:1.2,fontFamily:`var(--page-heading-font, inherit)`},ke={margin:0},Ae={display:`inline-block`,textDecoration:`none`,cursor:`pointer`,backgroundColor:`var(--page-accent, #111827)`,color:`var(--page-accent-text, #ffffff)`},je={flexGrow:1,display:`flex`,flexDirection:`column`,position:`relative`},Me={display:`flex`,flexDirection:`column`};function Ne({style:e}){let t=e?.backgroundVideo;if(!t)return null;let n={position:`absolute`,inset:0,width:`100%`,height:`100%`,zIndex:-1,pointerEvents:`none`},r=e?.overlayColor?`color-mix(in srgb, ${e.overlayColor} ${e.overlayOpacity??50}%, transparent)`:null;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`video`,{src:t,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,style:{...n,objectFit:`cover`}}),r&&(0,k.jsx)(`div`,{style:{...n,background:r}})]})}var Pe=(e,t)=>e?.backgroundVideo?{position:`relative`,...t,...m(e)}:{...t,...m(e)};function Fe({style:e,nodeRef:t,children:n}){return(0,k.jsxs)(`div`,{ref:t,style:{...je,...m(e)},children:[(0,k.jsx)(Ne,{style:e}),n]})}function Ie({style:e,nodeRef:t,children:n}){return(0,k.jsxs)(`section`,{ref:t,style:Pe(e,Me),children:[(0,k.jsx)(Ne,{style:e}),n]})}function Le({style:e,freeLayout:t,nodeRef:n,children:r}){let i=t?{position:`relative`,minHeight:240}:null;return(0,k.jsxs)(`div`,{ref:n,style:i?{...i,...Pe(e)}:Pe(e),children:[(0,k.jsx)(Ne,{style:e}),r]})}function Re({text:e,parts:t,tag:n=`h2`,style:r,linked:i,nodeRef:a}){return(0,k.jsx)(n,{ref:a,style:{...Oe,...m(r)},children:Ve(t,e,i)})}var ze={fontFamily:ae.mono.value,background:`rgba(148, 163, 184, 0.18)`,padding:`1px 5px`,borderRadius:4,fontSize:`0.9em`};function Be(e,t=[],n,r){let i=e;return t.includes(`sup`)?i=(0,k.jsx)(`sup`,{children:i}):t.includes(`sub`)&&(i=(0,k.jsx)(`sub`,{children:i})),t.includes(`code`)&&(i=(0,k.jsx)(`code`,{style:ze,children:i})),t.includes(`strike`)&&(i=(0,k.jsx)(`s`,{children:i})),t.includes(`underline`)&&(i=(0,k.jsx)(`u`,{children:i})),t.includes(`italic`)&&(i=(0,k.jsx)(`em`,{children:i})),t.includes(`bold`)&&(i=(0,k.jsx)(`strong`,{children:i})),n&&(i=(0,k.jsx)(`a`,{href:n,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{color:`inherit`},children:i})),i}function Ve(e,t,n){return e?.length?e.map((e,t)=>{if(e.slot)return(0,k.jsx)(l.Fragment,{children:n?.[e.slot]??null},t);if(e.parts)return(0,k.jsx)(l.Fragment,{children:Ve(e.parts,``,n)},t);let r=e.text;return e.sup?r=(0,k.jsx)(`sup`,{children:r}):e.sub&&(r=(0,k.jsx)(`sub`,{children:r})),e.code&&(r=(0,k.jsx)(`code`,{style:ze,children:r})),e.strike&&(r=(0,k.jsx)(`s`,{children:r})),e.underline&&(r=(0,k.jsx)(`u`,{children:r})),e.italic&&(r=(0,k.jsx)(`em`,{children:r})),e.bold&&(r=(0,k.jsx)(`strong`,{children:r})),(e.color||e.background)&&(r=(0,k.jsx)(`span`,{style:{...e.color&&{color:e.color},...e.background&&{backgroundColor:e.background}},children:r})),e.href&&(r=(0,k.jsx)(`a`,{href:e.href,target:e.target||void 0,rel:e.target===`_blank`?`noopener noreferrer`:void 0,style:{color:e.color??`inherit`},children:r})),(0,k.jsx)(l.Fragment,{children:r},t)}):t}function He({parts:e,text:t,marks:n,href:r,target:i,style:a}){return(0,k.jsx)(`span`,{style:m(a),children:e?.length?Ve(e,t):Be(t,n,r,i)})}var Ue={h1:40,h2:32,h3:26,h4:22,h5:19,h6:16};function We({align:e=`center`,width:t,wrap:n}={}){let r=t?`${t}%`:void 0;if(e===`full`)return{width:`100%`};let i=e===`left`||e===`right`;return i&&(n??!0)?{float:e,width:r??`50%`,maxWidth:`100%`,marginTop:`4px`,marginBottom:`12px`,...e===`left`?{marginRight:`20px`,marginLeft:0}:{marginLeft:`20px`,marginRight:0}}:i?{width:r??`fit-content`,maxWidth:`100%`,...e===`left`?{marginLeft:0,marginRight:`auto`}:{marginLeft:`auto`,marginRight:0}}:{width:r??`fit-content`,maxWidth:`100%`,marginLeft:`auto`,marginRight:`auto`}}function Ge(e=[],t,n){let r=n??((e,n)=>Ve(e,n,t));return e.map((t,n)=>{let i={marginTop:0,marginBottom:n===e.length-1?0:14};if(t.type===`image`){if(!t.src)return null;let e=(0,k.jsx)(`img`,{src:t.src,alt:t.alt||``,style:{width:`100%`,display:`block`,borderRadius:6}});return(0,k.jsxs)(`figure`,{style:{marginLeft:0,marginRight:0,...i,...We(t)},children:[t.href?(0,k.jsx)(`a`,{href:t.href,target:t.target||void 0,rel:t.target===`_blank`?`noopener noreferrer`:void 0,style:{display:`block`},children:e}):e,t.caption&&(0,k.jsx)(`figcaption`,{style:{fontSize:13,opacity:.65,marginTop:6,textAlign:`center`},children:t.caption})]},n)}if(t.type===`video`)return nt(t.url)?(0,k.jsx)(`div`,{style:{...i,...We({align:t.align,wrap:t.wrap,width:t.width??100})},children:(0,k.jsx)(rt,{url:t.url,autoplay:t.autoplay,muted:t.muted,loop:t.loop,controls:t.controls??!0,start:t.start})},n):null;if(t.type===`divider`)return(0,k.jsx)(`hr`,{style:{...i,border:0,borderTop:`1px solid rgba(148, 163, 184, 0.4)`}},n);if(t.type===`ul`||t.type===`ol`){let e=t.type;return(0,k.jsx)(e,{style:{...i,paddingLeft:24},children:(t.items??[]).map((e,t)=>(0,k.jsx)(`li`,{style:{marginBottom:4},children:r(e.parts,e.text)},t))},n)}if(t.type===`quote`)return(0,k.jsx)(`blockquote`,{style:{...qe,...i},children:r(t.parts,t.text)},n);if(Ue[t.type]){let e=t.type;return(0,k.jsx)(e,{style:{...Oe,fontSize:Ue[t.type],...i},children:r(t.parts,t.text)},n)}return(0,k.jsx)(`p`,{style:{...ke,...i},children:r(t.parts,t.text)},n)})}function Ke({content:e,style:t,linked:n,nodeRef:r}){return(0,k.jsx)(`div`,{ref:r,style:{display:`flow-root`,...m(t)},children:Ge(e,n)})}var qe={margin:0,padding:`8px 0 8px 20px`,borderLeft:`4px solid var(--page-accent, rgba(148, 163, 184, 0.6))`};function Je({text:e,parts:t,style:n,linked:r,nodeRef:i}){return(0,k.jsx)(`blockquote`,{ref:i,style:{...qe,...m(n)},children:Ve(t,e,r)})}function Ye({ordered:e,items:t=[],style:n,nodeRef:r}){return(0,k.jsx)(e?`ol`:`ul`,{ref:r,style:{margin:0,paddingLeft:24,...m(n)},children:t.map((e,t)=>(0,k.jsx)(`li`,{style:{marginBottom:4},children:Ve(e.parts,e.text)},t))})}function Xe({text:e,parts:t,style:n,linked:r,nodeRef:i}){return(0,k.jsx)(`p`,{ref:i,style:{...ke,...m(n)},children:Ve(t,e,r)})}var Ze={color:`var(--page-accent, inherit)`,textDecoration:`underline`,textUnderlineOffset:3,cursor:`pointer`};function Qe({text:e,parts:t,href:n,target:r,style:i,linked:a,nodeRef:o}){return(0,k.jsx)(`a`,{ref:o,href:n||`#`,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{...Ze,...m(i)},children:Ve(t,e,a)})}function $e({text:e,parts:t,href:n,target:r,style:i,linked:a,nodeRef:o}){return(0,k.jsx)(`a`,{ref:o,href:n||`#`,target:r||void 0,rel:r===`_blank`?`noopener noreferrer`:void 0,style:{...Ae,...m(i)},children:Ve(t,e,a)})}function et({src:e,alt:t,style:n,nodeRef:r}){return e?(0,k.jsx)(`img`,{ref:r,src:e,alt:t||``,style:{display:`block`,maxWidth:`100%`,...m(n)}}):null}function tt({src:e,poster:t,controls:n=!0,autoplay:r=!1,loop:i=!1,muted:a=!1,style:o,nodeRef:s}){return e?(0,k.jsx)(`video`,{ref:s,src:e,poster:t||void 0,controls:n,autoPlay:r,muted:a||r,loop:i,playsInline:!0,style:{display:`block`,width:`100%`,maxWidth:`100%`,...m(o)}}):null}var nt=(e=``)=>(e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/)||e.match(/^([\w-]{11})$/))?.[1];function rt({url:e,autoplay:t=!1,muted:n=!1,loop:r=!1,controls:i=!0,start:a,style:o,nodeRef:s}){let c=nt(e);if(!c)return null;let l=new URLSearchParams({rel:`0`});return t&&l.set(`autoplay`,`1`),(n||t)&&l.set(`mute`,`1`),i||l.set(`controls`,`0`),r&&(l.set(`loop`,`1`),l.set(`playlist`,c)),Number(a)>0&&l.set(`start`,String(Math.floor(Number(a)))),(0,k.jsx)(`div`,{ref:s,style:{position:`relative`,width:`100%`,paddingTop:`56.25%`,...m(o)},children:(0,k.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${c}?${l}`,title:`YouTube video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowFullScreen:!0,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,border:0}})})}function it({src:e,title:t,allowFullscreen:n=!0,style:r,nodeRef:i}){return e?(0,k.jsx)(`iframe`,{ref:i,src:e,title:t||`Embedded frame`,loading:`lazy`,allowFullScreen:n,style:{display:`block`,width:`100%`,height:300,border:0,...m(r)}}):null}function at({code:e,runScripts:t=!0,style:n,nodeRef:r}){let[i,a]=(0,l.useState)(null);return(0,l.useEffect)(()=>{i&&(i.innerHTML=e||``,t&&i.querySelectorAll(`script`).forEach(e=>{let t=document.createElement(`script`);for(let{name:n,value:r}of e.attributes)t.setAttribute(n,r);t.text=e.textContent,e.replaceWith(t)}))},[i,e,t]),(0,k.jsx)(`div`,{ref:e=>{a(e),r&&r(e)},style:m(n)})}function ot({height:e,nodeRef:t}){return(0,k.jsx)(`div`,{ref:t,style:{height:e||32,flexShrink:0,alignSelf:`stretch`}})}function st({style:e,nodeRef:t}){return(0,k.jsx)(`div`,{ref:t,style:{height:1,alignSelf:`stretch`,flexShrink:0,...m(e)}})}var ct={position:`absolute`,top:`50%`,transform:`translateY(-50%)`,width:36,height:36,borderRadius:`50%`,border:0,cursor:`pointer`,background:`rgba(17, 24, 39, 0.45)`,color:`#fff`,fontSize:20,lineHeight:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:0},lt={bottom:{inset:`auto 0 0 0`,padding:`40px 24px 20px`,background:`linear-gradient(transparent, rgba(0, 0, 0, 0.55))`},top:{inset:`0 0 auto 0`,padding:`20px 24px 40px`,background:`linear-gradient(rgba(0, 0, 0, 0.55), transparent)`},middle:{inset:0,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:24,textShadow:`0 2px 12px rgba(0, 0, 0, 0.6)`}},ut=48;function dt({count:e,renderSlide:t,autoplay:n=!0,interval:r=5,height:i=320,swipe:a=!0,style:o,nodeRef:s}){let[c,u]=(0,l.useState)(0),[d,f]=(0,l.useState)(!1),[p,h]=(0,l.useState)(null),g=e?Math.min(c,e-1):0;if((0,l.useEffect)(()=>{if(!n||d||p||e<2)return;let t=setInterval(()=>u(t=>(t+1)%e),Math.max(2,Number(r)||5)*1e3);return()=>clearInterval(t)},[n,d,p,r,e]),!e)return null;let _=t=>u((t+e)%e),v=()=>{if(!p)return;let{dx:e}=p;h(null),e<-48?_(g+1):e>ut&&_(g-1)};return(0,k.jsxs)(`div`,{ref:s,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onPointerDown:a&&e>1?e=>{e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button`)||(e.currentTarget.setPointerCapture(e.pointerId),h({startX:e.clientX,dx:0}))}:void 0,onPointerMove:p?e=>h(t=>t&&{...t,dx:e.clientX-t.startX}):void 0,onPointerUp:v,onPointerCancel:v,style:{position:`relative`,overflow:`hidden`,width:`100%`,touchAction:`pan-y`,userSelect:p?`none`:void 0,cursor:p?`grabbing`:void 0,...m(o)},children:[(0,k.jsx)(`div`,{style:{display:`flex`,height:i,transform:`translateX(calc(${-g*100}% + ${p?.dx??0}px))`,transition:p?`none`:`transform 450ms ease`},children:Array.from({length:e},(e,n)=>(0,k.jsx)(`div`,{style:{position:`relative`,width:`100%`,flexShrink:0,overflow:`hidden`},children:t(n)},n))}),e>1&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,"aria-label":`Previous slide`,style:{...ct,left:12},onClick:()=>_(g-1),children:`‹`}),(0,k.jsx)(`button`,{type:`button`,"aria-label":`Next slide`,style:{...ct,right:12},onClick:()=>_(g+1),children:`›`}),(0,k.jsx)(`div`,{style:{position:`absolute`,bottom:10,left:0,right:0,display:`flex`,justifyContent:`center`,gap:6},children:Array.from({length:e},(e,t)=>(0,k.jsx)(`button`,{type:`button`,"aria-label":`Go to slide ${t+1}`,onClick:()=>_(t),style:{width:8,height:8,borderRadius:`50%`,border:0,padding:0,cursor:`pointer`,background:t===g?`#ffffff`:`rgba(255, 255, 255, 0.45)`}},t))})]})]})}var ft=(e,t)=>({position:`absolute`,inset:0,backgroundImage:e?`url(${e})`:`none`,backgroundColor:t||(e?void 0:`rgba(148, 163, 184, 0.25)`),backgroundSize:`cover`,backgroundPosition:`center`});function pt({slides:e=[],captionPosition:t=`bottom`,captionAlign:n=`left`,...r}){return e.length?(0,k.jsx)(dt,{...r,count:e.length,renderSlide:r=>{let i=e[r];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{style:ft(i.image)}),(i.title||i.text)&&(0,k.jsxs)(`div`,{style:{position:`absolute`,color:`#fff`,textAlign:n,...lt[t]??lt.bottom},children:[i.title&&(0,k.jsx)(`div`,{style:{fontSize:22,fontWeight:700},children:i.title}),i.text&&(0,k.jsx)(`div`,{style:{fontSize:14,opacity:.9,marginTop:4},children:i.text})]})]})}}):null}function mt({slides:e=[],linked:t,...n}){return e.length?(0,k.jsx)(dt,{...n,count:e.length,renderSlide:n=>{let r=e[n];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{style:ft(r.image,r.color)}),(0,k.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`},children:t?.[r.key]??null})]})}}):null}var A={color:`inherit`,textDecoration:`none`,fontSize:14,opacity:.85},ht={background:`var(--page-bg, #ffffff)`,color:`var(--page-text, #111827)`,border:`1px solid rgba(148, 163, 184, 0.25)`,boxShadow:`0 16px 40px rgba(15, 23, 42, 0.16)`,zIndex:60};function gt({brand:e,logo:t,links:n=[],style:r,nodeRef:i,menu:a=`auto`,breakpoint:o=768}){let[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!s)return;let e=new ResizeObserver(()=>d(s.offsetWidth<o));return e.observe(s),()=>e.disconnect()},[s,o]);let _=a===`hamburger`||a===`auto`&&u,v=(e,t)=>(0,k.jsxs)(`a`,{href:e.href||`#`,style:{...A,display:`block`,...t},children:[e.label,e.desc&&(0,k.jsx)(`span`,{style:{display:`block`,fontSize:12,opacity:.6,marginTop:2},children:e.desc})]},e.key);return(0,k.jsxs)(`nav`,{ref:e=>{c(e),i&&i(e)},style:{display:`flex`,alignItems:`center`,gap:24,flexWrap:`wrap`,padding:`14px 24px`,width:`100%`,position:`relative`,...m(r)},children:[t&&(0,k.jsx)(`img`,{src:t,alt:e||`Logo`,style:{height:28,display:`block`}}),e&&(0,k.jsx)(`div`,{style:{fontWeight:700,fontSize:18,fontFamily:`var(--page-heading-font, inherit)`},children:e}),(0,k.jsx)(`div`,{style:{flexGrow:1}}),_?(0,k.jsx)(`button`,{type:`button`,"aria-label":f?`Close menu`:`Open menu`,onClick:()=>p(!f),style:{background:`transparent`,border:0,color:`inherit`,cursor:`pointer`,fontSize:20,lineHeight:1,padding:4},children:f?`✕`:`☰`}):(0,k.jsx)(`div`,{style:{display:`flex`,gap:20,alignItems:`center`,flexWrap:`wrap`},children:n.map(e=>{let t=e.children??[];if(!t.length)return(0,k.jsx)(`a`,{href:e.href||`#`,style:A,children:e.label},e.key);let n=e.type===`mega`;return(0,k.jsxs)(`span`,{style:{position:n?`static`:`relative`,display:`inline-flex`},onMouseEnter:()=>g(e.key),onMouseLeave:()=>g(null),children:[(0,k.jsxs)(`a`,{href:e.href||`#`,style:{...A,cursor:`pointer`},children:[e.label,` `,(0,k.jsx)(`span`,{style:{fontSize:9,opacity:.6},children:`▼`})]}),h===e.key&&(n?(0,k.jsx)(`div`,{style:{...ht,position:`absolute`,left:0,right:0,top:`100%`,padding:24,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(170px, 1fr))`,gap:16},children:t.map(e=>v(e,{padding:`6px 8px`,borderRadius:6}))}):(0,k.jsx)(`div`,{style:{...ht,position:`absolute`,top:`100%`,left:0,minWidth:190,borderRadius:8,padding:8,display:`flex`,flexDirection:`column`},children:t.map(e=>v(e,{padding:`8px 12px`,borderRadius:6}))}))]},e.key)})}),_&&f&&(0,k.jsx)(`div`,{style:{flexBasis:`100%`,width:`100%`,display:`flex`,flexDirection:`column`,paddingTop:10},children:n.map(e=>(0,k.jsxs)(l.Fragment,{children:[(0,k.jsx)(`a`,{href:e.href||`#`,style:{...A,padding:`10px 4px`,fontWeight:(e.children??[]).length?600:400,opacity:1},children:e.label}),(e.children??[]).map(e=>v(e,{padding:`8px 4px 8px 22px`}))]},e.key))})]})}function _t({tabs:e=[],linked:t,style:n,nodeRef:r}){let[i,a]=(0,l.useState)(0),o=e.length?Math.min(i,e.length-1):0;return e.length?(0,k.jsxs)(`div`,{ref:r,style:{width:`100%`,...m(n)},children:[(0,k.jsx)(`div`,{style:{display:`flex`,gap:4,borderBottom:`1px solid rgba(148, 163, 184, 0.35)`},children:e.map((e,t)=>(0,k.jsx)(`button`,{type:`button`,onClick:()=>a(t),style:{background:`transparent`,border:0,padding:`10px 16px`,fontSize:14,fontFamily:`inherit`,color:`inherit`,cursor:`pointer`,opacity:t===o?1:.6,fontWeight:t===o?600:500,boxShadow:t===o?`inset 0 -2px 0 var(--page-accent, #111827)`:`none`},children:e.label||`Tab ${t+1}`},e.key))}),e.map((e,n)=>(0,k.jsx)(`div`,{style:{display:n===o?`flex`:`none`,flexDirection:`column`},children:t?.[e.key]??null},e.key))]}):null}function vt({items:e=[],linked:t,multiple:n=!1,style:r,nodeRef:i}){let[a,o]=(0,l.useState)(()=>new Set(e.length?[e[0].key]:[]));if(!e.length)return null;let s=e=>o(t=>{let r=new Set(n?t:[]);return t.has(e)?r.delete(e):r.add(e),r});return(0,k.jsx)(`div`,{ref:i,style:{width:`100%`,...m(r)},children:e.map((n,r)=>{let i=a.has(n.key);return(0,k.jsxs)(`div`,{style:{borderBottom:r<e.length-1?`1px solid rgba(148, 163, 184, 0.35)`:`none`},children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>s(n.key),style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,background:`transparent`,border:0,padding:`14px 4px`,fontSize:15,fontWeight:600,fontFamily:`inherit`,color:`inherit`,textAlign:`left`,cursor:`pointer`},children:[n.title||`Item ${r+1}`,(0,k.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:12,opacity:.6,transform:i?`rotate(180deg)`:`none`,transition:`transform 180ms`},children:`▼`})]}),(0,k.jsx)(`div`,{style:{display:i?`flex`:`none`,flexDirection:`column`},children:t?.[n.key]??null})]},n.key)})})}var yt={display:`flex`,flexDirection:`column`,gap:`12px`},bt={fontSize:`14px`,fontWeight:500,color:`var(--page-text, #111827)`},xt={padding:`10px 12px`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontFamily:`inherit`,width:`100%`,boxSizing:`border-box`,backgroundColor:`#ffffff`,color:`#111827`},St={display:`flex`,alignItems:`center`,gap:`8px`,fontSize:`14px`,color:`var(--page-text, #111827)`},Ct=e=>e?{readOnly:!0,tabIndex:-1,onMouseDown:e=>e.preventDefault()}:{};function wt(e,t){if(!e)return!0;let n=t[e.field],r=n==null||n===``?``:String(n),i=e.value??``;switch(e.op){case`eq`:return r===i;case`neq`:return r!==i;case`contains`:return r.toLowerCase().includes(i.toLowerCase());case`gt`:return Number(r)>Number(i);case`lt`:return Number(r)<Number(i);case`empty`:return r===``;case`notEmpty`:return r!==``;default:return!1}}var Tt={display:`flex`,flexDirection:`column`,gap:6},Et={font:`inherit`,fontSize:15,padding:`10px 12px`,borderRadius:8,border:`1px solid rgba(148, 163, 184, 0.55)`,background:`transparent`,color:`inherit`,width:`100%`,boxSizing:`border-box`};function j(e,t){let n=Array.isArray(e?.options)?e.options:[];if(!e?.parentField)return n;let r=t?.[e.parentField];return r?n.filter(e=>typeof e==`string`?!1:!e.parent||e.parent===r):[]}function Dt({field:e,value:t,onChange:n,inert:r,values:i}){let a=(0,k.jsxs)(`span`,{style:{...bt,fontSize:14},children:[e.label,e.required?` *`:``]}),o={name:e.name,required:e.required||void 0,placeholder:e.placeholder||void 0,disabled:r||void 0,style:Et,value:t??``,onChange:t=>n(e.name,t.target.value)};return e.type===`display`?(0,k.jsx)(e.variant&&e.variant!==`p`?e.variant:`p`,{style:{margin:0,color:e.color||`inherit`,fontSize:{h1:32,h2:26,h3:21,h4:18,h5:16,h6:14,p:15}[e.variant]??16,fontWeight:e.variant===`p`?400:700,lineHeight:1.35},children:e.label}):e.type===`image`?e.src?(0,k.jsx)(`img`,{src:e.src,alt:e.label??``,style:{width:`100%`,borderRadius:8,display:`block`}}):null:e.type===`video`?e.src?/youtube\.com|youtu\.be|vimeo\.com/i.test(e.src)?(0,k.jsx)(rt,{url:e.src,style:{width:`100%`}}):(0,k.jsx)(`video`,{src:e.src,controls:!0,style:{width:`100%`,borderRadius:8,display:`block`}}):null:(0,k.jsxs)(`label`,{style:Tt,children:[a,e.type===`textarea`||e.multiline?(0,k.jsx)(`textarea`,{...o,rows:4,style:{...Et,resize:`vertical`}}):e.type===`select`?(0,k.jsxs)(`select`,{...o,disabled:o.disabled||!!e.parentField&&!i?.[e.parentField],children:[(0,k.jsx)(`option`,{value:``,children:e.placeholder||`—`}),j(e,i).map((e,t)=>(0,k.jsx)(`option`,{value:typeof e==`string`?e:e.value,children:typeof e==`string`?e:e.label??e.value},t))]}):e.type===`checkbox`?(0,k.jsx)(`input`,{type:`checkbox`,name:e.name,required:e.required||void 0,disabled:r||void 0,checked:!!t,onChange:t=>n(e.name,t.target.checked),style:{width:18,height:18}}):e.type===`upload`?(0,k.jsx)(`input`,{type:`file`,name:e.name,accept:e.accept||void 0,required:e.required||void 0,disabled:r||void 0,onChange:t=>n(e.name,t.target.files?.[0]?.name??``),style:{font:`inherit`,fontSize:14}}):(0,k.jsx)(`input`,{...o,type:{email:`email`,number:`number`,date:`date`,datetime:`datetime-local`,phone:`tel`,link:`url`}[e.type]??`text`}),e.help&&(0,k.jsx)(`span`,{style:{fontSize:12,opacity:.65},children:e.help})]})}function Ot({style:e,action:t,method:n,name:r,enctype:i,formSlug:a,auto:o,submitLabel:s,nodeRef:c,inert:u,children:d,linked:f,show:p}){let{tenant:h,apiUrl:g}=(0,l.useContext)(be),[_,v]=(0,l.useState)(`form`),[y,b]=(0,l.useState)(null),[x,ee]=(0,l.useState)({}),[S,C]=(0,l.useState)(0),te=u?p||`form`:_;(0,l.useEffect)(()=>{if(!o||!a)return;let e=!0;return fetch(`${g||`/api`}/forms/${encodeURIComponent(a)}`,{headers:h?{"x-tenant":h}:{}}).then(e=>e.json()).then(t=>e&&b(t?.payload&&typeof t.payload==`object`?t.payload:null)).catch(()=>e&&b(null)),()=>{e=!1}},[o,a,h,g]);let ne=[{section:null,fields:[]}];for(let e of Array.isArray(y?.fields)?y.fields:[])e.type===`section`?ne.push({section:e,fields:[]}):ne[ne.length-1].fields.push(e);let re=ne.filter(e=>e.section||e.fields.length),w=re.filter(e=>!e.section||wt(e.section.condition,x)).map(e=>({...e,fields:e.fields.filter(e=>wt(e.condition,x))})),ie=re.length>1,ae=Math.min(S,Math.max(0,w.length-1)),oe=ie?w[ae]?.fields??[]:w.flatMap(e=>e.fields),se=oe.filter(e=>{let t=x[e.name];return e.required&&(t==null||t===``||t===!1)}),ce=ae>=w.length-1,le=(e,t)=>ee(n=>{let r={...n,[e]:t};for(let t of Array.isArray(y?.fields)?y.fields:[])t?.parentField===e&&delete r[t.name];return r});return(0,k.jsxs)(`div`,{ref:c,style:m(e),children:[(0,k.jsx)(`form`,{action:t||void 0,method:n||`post`,name:r||void 0,encType:i||void 0,onSubmit:async e=>{if(e.preventDefault(),!u){if(a){let t={};if(o)for(let[e,n]of Object.entries(x))n!=null&&n!==``&&(t[e]=n);else for(let[n,r]of new FormData(e.currentTarget).entries())typeof r==`string`&&(t[n]=r===`on`||r);try{let e=await fetch(`${g||`/api`}/forms/${a}/submit`,{method:`post`,headers:{"content-type":`application/json`,...h?{"x-tenant":h}:{}},body:JSON.stringify(t)}),n=await e.json().catch(()=>null);v(e.ok&&n?.success!==!1?`success`:`error`)}catch{v(`error`)}return}if(!t){v(`success`);return}try{let r=await fetch(t,{method:n||`post`,body:new FormData(e.currentTarget)});v(r.ok?`success`:`error`)}catch{v(`error`)}}},style:{...yt,display:te===`success`?`none`:`flex`},children:o&&a?(0,k.jsxs)(k.Fragment,{children:[ie&&(0,k.jsx)(Bt,{steps:w.map(e=>({label:e.section?.label??`Start`})),active:ae+1,style:{marginBottom:8}}),ie&&w[ae]?.section?.help&&(0,k.jsx)(`p`,{style:{margin:0,fontSize:14,opacity:.7},children:w[ae].section.help}),oe.map(e=>(0,k.jsx)(Dt,{field:e,value:x[e.name],values:x,onChange:le,inert:u},e.name)),(0,k.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`center`,marginTop:4},children:[ie&&ae>0&&(0,k.jsx)(`button`,{type:`button`,disabled:u||void 0,onClick:()=>C(ae-1),style:{...Ae,background:`transparent`,color:`inherit`,border:0,padding:`10px 16px`,cursor:`pointer`},children:`Back`}),ie&&!ce?(0,k.jsx)(`button`,{type:`button`,disabled:u||se.length>0,onClick:()=>C(ae+1),style:{...Ae,border:0,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,cursor:`pointer`,opacity:se.length?.5:1},children:`Next`}):(0,k.jsx)(`button`,{type:`submit`,disabled:u||void 0,style:{...Ae,border:0,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,cursor:`pointer`},children:s||`Submit`})]})]}):d}),(0,k.jsx)(`div`,{style:{display:te===`success`?`block`:`none`},children:f?.success??null}),(0,k.jsx)(`div`,{style:{display:te===`error`?`block`:`none`,marginTop:12},children:f?.error??null})]})}function kt({text:e,parts:t,style:n,nodeRef:r,linked:i}){return(0,k.jsx)(`label`,{ref:r,style:{...bt,...m(n)},children:Ve(t,e,i)})}function At({type:e=`text`,name:t,placeholder:n,required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsx)(`input`,{ref:a,type:e,name:t||void 0,placeholder:n,required:!o&&!!r,style:{...xt,...m(i)},...Ct(o)})}function jt({name:e,placeholder:t,rows:n=4,required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsx)(`textarea`,{ref:a,name:e||void 0,placeholder:t,rows:n,required:!o&&!!r,style:{...xt,resize:`vertical`,...m(i)},...Ct(o)})}function Mt({kind:e=`checkbox`,label:t,name:n,value:r,required:i,style:a,nodeRef:o,inert:s}){return(0,k.jsxs)(`label`,{ref:o,style:{...St,...m(a)},children:[(0,k.jsx)(`input`,{type:e,name:n||void 0,value:r||void 0,required:!s&&!!i,onClick:s?e=>e.preventDefault():void 0,tabIndex:s?-1:void 0,style:{margin:0,accentColor:`var(--page-accent, #111827)`}}),t]})}function Nt({name:e,placeholder:t,options:n=[],required:r,style:i,nodeRef:a,inert:o}){return(0,k.jsxs)(`select`,{ref:a,name:e||void 0,required:!o&&!!r,defaultValue:``,onMouseDown:o?e=>e.preventDefault():void 0,tabIndex:o?-1:void 0,style:{...xt,appearance:`auto`,...m(i)},children:[t!==``&&(0,k.jsx)(`option`,{value:``,disabled:!0,children:t??`Select…`}),n.map((e,t)=>(0,k.jsx)(`option`,{value:e,children:e},t))]})}function Pt({name:e,accept:t,required:n,text:r=`Choose a file…`,style:i,nodeRef:a,inert:o}){let[s,c]=(0,l.useState)(null);return(0,k.jsxs)(`label`,{ref:a,style:{...xt,display:`flex`,alignItems:`center`,gap:`8px`,cursor:o?`default`:`pointer`,borderStyle:`dashed`,color:s?`#111827`:`#6b7280`,...m(i)},children:[(0,k.jsx)(`input`,{type:`file`,name:e||void 0,accept:t||void 0,required:!o&&!!n,disabled:!!o,onChange:e=>c(e.target.files?.[0]?.name??null),style:{display:`none`}}),(0,k.jsx)(`span`,{"aria-hidden":!0,children:`📎`}),s??r]})}function Ft({text:e=`Submit`,style:t,nodeRef:n,inert:r}){return(0,k.jsx)(`button`,{ref:n,type:r?`button`:`submit`,style:{...Ae,border:0,cursor:`pointer`,alignSelf:`flex-start`,padding:`10px 22px`,borderRadius:8,fontSize:15,fontWeight:600,lineHeight:1.4,fontFamily:`inherit`,...m(t)},children:e})}function It({cols:e=2,rows:t=1,style:n,nodeRef:r,linked:i}){let a=Math.max(1,(Number(e)||1)*(Number(t)||1));return(0,k.jsx)(`div`,{ref:r,style:{display:`grid`,gridTemplateColumns:`repeat(${Math.max(1,Number(e)||1)}, minmax(0, 1fr))`,gap:16,width:`100%`,...m(n)},children:Array.from({length:a},(e,t)=>(0,k.jsx)(`div`,{style:{minWidth:0},children:i?.[`cell-${t}`]??null},t))})}function Lt({collection:e,limit:t=6,layout:n=`grid`,columns:r=3,imageField:i,titleField:a=`name`,textField:o,custom:s,templateId:c,style:u,nodeRef:d}){let{tenant:f,apiUrl:p,locale:h}=(0,l.useContext)(be),g=(0,l.useContext)(Se),_=(0,l.useContext)(xe)?.[e],[v,y]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!e||_)return;let t=!0,n=e.startsWith(`api:`)?`${p}/data/${encodeURIComponent(e.slice(4))}`:`${p}/dynamic/${encodeURIComponent(e)}${h?`?locale=${encodeURIComponent(h)}`:``}`;return fetch(n,{headers:f?{"x-tenant":f}:{}}).then(e=>e.json()).then(e=>{let n=Array.isArray(e?.payload)?e.payload:Array.isArray(e?.payload?.data)?e.payload.data:[];return t&&y(n.filter(e=>e&&typeof e==`object`))}).catch(()=>t&&y([])),()=>{t=!1}},[e,f,p,h,_]),!e)return null;let b=(_??v??[]).slice(0,Math.max(1,Number(t)||6)),x=Math.min(Math.max(Number(r)||3,1),6),ee=n===`list`?{display:`flex`,flexDirection:`column`,gap:20}:{display:`grid`,gridTemplateColumns:`repeat(${x}, minmax(0, 1fr))`,gap:24};return s&&c&&g?.render?(0,k.jsx)(`div`,{ref:d,style:{width:`100%`,...ee,...m(u)},children:b.map(e=>(0,k.jsx)(`div`,{style:{minWidth:0},children:g.render(c,t=>De(t,e))},e.id??e?.data?.slug))}):(0,k.jsx)(`div`,{ref:d,style:{width:`100%`,...ee,...m(u)},children:b.map(e=>{let t=i?we(e?.data,i):null,r=a?Ee(we(e?.data,a)):null,s=o?we(e?.data,o):null,c=Array.isArray(s)?s:null,l=c||s==null?null:Ee(s),u=n===`list`;return(0,k.jsxs)(`div`,{style:{display:`flex`,flexDirection:u?`row`:`column`,gap:u?20:12,alignItems:u?`center`:`stretch`,minWidth:0},children:[t&&(0,k.jsx)(`img`,{src:t,alt:r??``,style:{width:u?160:`100%`,aspectRatio:`3 / 2`,objectFit:`cover`,borderRadius:10,flexShrink:0,display:`block`}}),(0,k.jsxs)(`div`,{style:{minWidth:0},children:[r&&(0,k.jsx)(`h3`,{style:{margin:0,fontSize:18,fontWeight:700},children:r}),l&&(0,k.jsx)(`p`,{style:{margin:`6px 0 0`,fontSize:14,lineHeight:1.55,opacity:.75},children:l}),c&&(0,k.jsx)(`div`,{style:{marginTop:6,fontSize:14,lineHeight:1.55,opacity:.85},children:Ge(c)})]})]},e.id??e?.data?.slug)})})}function Rt({items:e=[],separator:t=`/`,style:n,nodeRef:r}){return e.length?(0,k.jsx)(`nav`,{ref:r,"aria-label":`Breadcrumb`,style:{...m(n)},children:(0,k.jsx)(`ol`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8,listStyle:`none`,margin:0,padding:0,fontSize:14},children:e.map((n,r)=>{let i=r===e.length-1;return(0,k.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[r>0&&(0,k.jsx)(`span`,{style:{opacity:.4},"aria-hidden":!0,children:t}),i||!n.href?(0,k.jsx)(`span`,{style:{fontWeight:i?600:400,opacity:i?1:.7},"aria-current":i?`page`:void 0,children:n.label}):(0,k.jsx)(`a`,{href:n.href,style:{color:`inherit`,opacity:.7,textDecoration:`none`},children:n.label})]},r)})})}):null}function zt({pages:e=5,current:t=1,prevNext:n=!0,href:r=`#`,style:i,nodeRef:a}){let o=Math.min(Math.max(Number(e)||1,1),50),s=Math.min(Math.max(Number(t)||1,1),o),c=e=>r&&r!==`#`?r.replace(`{page}`,String(e)):`#`,l=e=>({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:36,height:36,padding:`0 8px`,borderRadius:8,fontSize:14,textDecoration:`none`,color:e?`var(--page-accent-text, #ffffff)`:`inherit`,background:e?`var(--page-accent, #111827)`:`transparent`,border:e?`1px solid transparent`:`1px solid rgba(148, 163, 184, 0.4)`});return(0,k.jsxs)(`nav`,{ref:a,"aria-label":`Pagination`,style:{display:`flex`,flexWrap:`wrap`,gap:8,alignItems:`center`,...m(i)},children:[n&&(0,k.jsx)(`a`,{href:s>1?c(s-1):`#`,"aria-label":`Previous`,style:{...l(!1),opacity:s>1?1:.4},children:`‹`}),Array.from({length:o},(e,t)=>t+1).map(e=>(0,k.jsx)(`a`,{href:c(e),"aria-current":e===s?`page`:void 0,style:l(e===s),children:e},e)),n&&(0,k.jsx)(`a`,{href:s<o?c(s+1):`#`,"aria-label":`Next`,style:{...l(!1),opacity:s<o?1:.4},children:`›`})]})}function Bt({steps:e=[],active:t=1,vertical:n=!1,style:r,nodeRef:i}){if(!e.length)return null;let a=Math.min(Math.max(Number(t)||1,1),e.length),o=e=>({width:32,height:32,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:14,fontWeight:600,flexShrink:0,color:e===`todo`?`inherit`:`var(--page-accent-text, #ffffff)`,background:e===`todo`?`transparent`:`var(--page-accent, #111827)`,border:e===`todo`?`1px solid rgba(148, 163, 184, 0.5)`:`1px solid transparent`,opacity:e===`todo`?.6:1,boxShadow:e===`active`?`0 0 0 4px rgba(99, 102, 241, 0.2)`:`none`}),s=e=>({flexGrow:1,alignSelf:`center`,background:e?`var(--page-accent, #111827)`:`rgba(148, 163, 184, 0.4)`,...n?{width:2,minHeight:24,marginLeft:15,alignSelf:`auto`}:{height:2,minWidth:24}});return(0,k.jsx)(`div`,{ref:i,style:{display:`flex`,flexDirection:n?`column`:`row`,alignItems:n?`stretch`:`flex-start`,gap:n?4:8,...m(r)},children:e.map((e,t)=>{let r=t+1,i=r<a?`done`:r===a?`active`:`todo`;return(0,k.jsxs)(l.Fragment,{children:[t>0&&(0,k.jsx)(`div`,{style:s(r<=a),"aria-hidden":!0}),(0,k.jsxs)(`div`,{style:{display:`flex`,flexDirection:n?`row`:`column`,alignItems:`center`,gap:8,minWidth:0,textAlign:n?`left`:`center`},children:[(0,k.jsx)(`div`,{style:o(i),children:i===`done`?`✓`:r}),(0,k.jsxs)(`div`,{style:{minWidth:0},children:[(0,k.jsx)(`div`,{style:{fontSize:13,fontWeight:i===`active`?700:500,opacity:i===`todo`?.6:1},children:e.label}),e.description&&(0,k.jsx)(`div`,{style:{fontSize:12,opacity:.6},children:e.description})]})]})]},t)})})}var Vt={small:{w:132,h:46,name:11.5,title:10,avatar:28},medium:{w:168,h:56,name:13,title:11,avatar:36},large:{w:210,h:70,name:15.5,title:12.5,avatar:46}},Ht=e=>Vt[e]??Vt.medium;Vt.medium.w,Vt.medium.h;function Ut(e,{size:t=`medium`,horizontal:n=!1}={}){let r=Ht(t),i=n?r.h:r.w,a=n?16:20,o=(n?r.w:r.h)+(n?56:48),s=Array.isArray(e)?e.filter(e=>e&&e.id):[],c=new Set(s.map(e=>e.id)),l=new Map,u=[];for(let e of s)e.parent&&c.has(e.parent)&&e.parent!==e.id?(l.has(e.parent)||l.set(e.parent,[]),l.get(e.parent).push(e)):u.push(e);let d=new Map,f=(e,t)=>{if(t.has(e.id))return 0;t.add(e.id);let n=(l.get(e.id)??[]).reduce((e,n,r)=>e+f(n,t)+(r?a:0),0),r=Math.max(i,n);return d.set(e.id,r),r};u.forEach(e=>f(e,new Set));let p=[],m=[],h=0,g=(e,t,s,c)=>{if(c.has(e.id))return;c.add(e.id);let u=t+((d.get(e.id)??i)-i)/2,f=s*o,_=n?f:u,v=n?u:f;p.push({node:e,x:_,y:v}),h=Math.max(h,f+(n?r.w:r.h));let y=t;for(let t of l.get(e.id)??[]){let e=y+((d.get(t.id)??i)-i)/2+i/2,l=(s+1)*o;m.push(n?{from:{x:f+r.w,y:u+r.h/2},to:{x:l,y:e}}:{from:{x:u+r.w/2,y:f+r.h},to:{x:e,y:l}}),g(t,y,s+1,c),y+=(d.get(t.id)??i)+a}},_=0,v=new Set;for(let e of u)g(e,_,0,v),_+=(d.get(e.id)??i)+a;let y=Math.max(_-a,i);return{boxes:p,links:m,width:n?Math.max(h,r.w):y,height:n?y:Math.max(h,r.h),horizontal:n}}var Wt=(e,t)=>{let n=String(e??``);return n.length>t?`${n.slice(0,t-1)}…`:n},Gt=e=>{let t=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i.exec(String(e??``).trim());if(!t)return`#ffffff`;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=parseInt(n,16);return .299*(r>>16&255)+.587*(r>>8&255)+.114*(r&255)>150?`#111827`:`#ffffff`},Kt=e=>!!(e?.cv?.trim?.()||e?.photo);function qt(e,t={}){let n=Array.isArray(e)?e.filter(e=>e&&typeof e==`object`&&e.id):[],r=e=>Array.isArray(e)?e[0]:e,i=e=>e==null?``:Ee(e);return n.map(e=>{let n=e.data??{},a=r(n[t.parentField]),o=a&&typeof a==`object`?a.id??null:a||null;return{id:e.id,name:i(n[t.nameField||`name`])||i(n.name)||`Untitled`,title:t.titleField?i(n[t.titleField]):``,photo:t.photoField&&r(n[t.photoField])||``,parent:t.parentField?o:null,cv:t.cvField?i(n[t.cvField]):``,href:t.hrefField?i(n[t.hrefField]):``}})}var Jt={size:36,pad:10};function Yt({node:e,onClose:t}){return(0,l.useEffect)(()=>{let e=e=>e.key===`Escape`&&t();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,k.jsx)(`div`,{onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":e.name,style:{position:`fixed`,inset:0,zIndex:1e3,background:`rgba(15, 23, 42, 0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16},children:(0,k.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{background:`var(--page-bg, #ffffff)`,color:`var(--page-text, #111827)`,borderRadius:14,maxWidth:420,width:`100%`,maxHeight:`80vh`,overflowY:`auto`,padding:24,position:`relative`,boxShadow:`0 24px 64px rgba(15, 23, 42, 0.35)`},children:[(0,k.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:t,style:{position:`absolute`,top:10,right:10,width:30,height:30,border:0,borderRadius:8,background:`transparent`,color:`inherit`,fontSize:18,lineHeight:1,cursor:`pointer`,opacity:.6},children:`×`}),(0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,marginBottom:e.cv?14:0},children:[e.photo&&(0,k.jsx)(`img`,{src:e.photo,alt:``,style:{width:72,height:72,borderRadius:`50%`,objectFit:`cover`,flexShrink:0}}),(0,k.jsxs)(`div`,{style:{minWidth:0},children:[(0,k.jsx)(`div`,{style:{fontSize:18,fontWeight:700},children:e.name}),e.title&&(0,k.jsx)(`div`,{style:{fontSize:13,opacity:.65},children:e.title})]})]}),e.cv&&String(e.cv).split(/\n+/).map((e,t)=>(0,k.jsx)(`p`,{style:{fontSize:14,lineHeight:1.6,margin:`0 0 10px`},children:e},t)),e.href&&(0,k.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,style:{display:`inline-block`,marginTop:6,padding:`8px 14px`,borderRadius:8,fontSize:13,fontWeight:600,textDecoration:`none`,background:`var(--page-accent, #4f46e5)`,color:`var(--page-accent-text, #ffffff)`},children:`Open profile ↗`})]})})}function Xt({nodes:e=[],source:t,nameField:n,titleField:r,photoField:i,parentField:a,cvField:o,hrefField:s,size:c=`medium`,horizontal:u=!1,style:d,nodeRef:f,interactive:p=!0}){let h=(0,l.useId)(),[g,_]=(0,l.useState)(null),{tenant:v,apiUrl:y}=(0,l.useContext)(be),b=(0,l.useContext)(xe)?.[t],[x,ee]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!t||b)return;let e=!0;return fetch(`${y}/dynamic/${encodeURIComponent(t)}`,{headers:v?{"x-tenant":v}:{}}).then(e=>e.json()).then(t=>{let n=Array.isArray(t?.payload)?t.payload:Array.isArray(t?.payload?.data)?t.payload.data:[];e&&ee(n)}).catch(()=>e&&ee([])),()=>{e=!1}},[t,v,y,b]);let S=t?qt(b??x??[],{nameField:n,titleField:r,photoField:i,parentField:a,cvField:o,hrefField:s}):e,C=Ht(c),{boxes:te,links:ne,width:re,height:w}=Ut(S,{size:c,horizontal:u});if(!te.length)return!p&&t?(0,k.jsxs)(`div`,{ref:f,style:{padding:18,border:`1px dashed rgba(148, 163, 184, 0.6)`,borderRadius:10,fontSize:13,opacity:.7,textAlign:`center`,...m(d)},children:[`Org Chart — no published entries in “`,t,`” yet`]}):null;let ie=new Set(te.filter(e=>e.node.parent==null||e.node.parent===``).map(e=>e.node.id));return(0,k.jsxs)(`div`,{ref:f,style:{maxWidth:`100%`,overflowX:`auto`,...m(d)},children:[(0,k.jsxs)(`svg`,{viewBox:`0 0 ${re} ${w}`,role:`img`,"aria-label":`Organization chart`,style:{display:`block`,width:`100%`,maxWidth:re,height:`auto`,margin:`0 auto`},children:[ne.map((e,t)=>(0,k.jsx)(`path`,{d:u?`M ${e.from.x} ${e.from.y} H ${(e.from.x+e.to.x)/2} V ${e.to.y} H ${e.to.x}`:`M ${e.from.x} ${e.from.y} V ${(e.from.y+e.to.y)/2} H ${e.to.x} V ${e.to.y}`,fill:`none`,stroke:`rgba(148, 163, 184, 0.7)`,strokeWidth:`1.5`},t)),te.map(({node:e,x:t,y:n})=>{let r=ie.has(e.id),i=!!e.color2,a=!!e.color||r||i,o=e.color||(r?`var(--page-accent, #4f46e5)`:`var(--page-bg, #ffffff)`),s=e.color?Gt(e.color):r?`var(--page-accent-text, #ffffff)`:`var(--page-text, #111827)`,c=i?Gt(e.color2):s,l=p&&(Kt(e)||e.href),u=()=>Kt(e)?_(e):window.open(e.href,`_blank`,`noreferrer`),d=e.photo?t+Jt.pad+C.avatar+8:t+C.w/2,f=e.photo?`start`:`middle`,m=e.photo?Math.floor((C.w-C.avatar-26)/7):Math.floor(C.w/7.6),g=C.h/2,v=[e.name,e.title].map(e=>String(e??``).trim()).filter(Boolean);return(0,k.jsxs)(`g`,{onClick:l?u:void 0,style:l?{cursor:`pointer`}:void 0,role:l?`button`:void 0,"aria-label":l?`Open ${e.name||e.title}'s profile`:void 0,children:[i&&e.gradient?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`linearGradient`,{id:`${h}-${e.id}-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,k.jsx)(`stop`,{offset:`0%`,stopColor:e.color||`var(--page-accent, #4f46e5)`}),(0,k.jsx)(`stop`,{offset:`100%`,stopColor:e.color2})]}),(0,k.jsx)(`rect`,{x:t,y:n,width:C.w,height:C.h,rx:`10`,fill:`url(#${h}-${e.id}-grad)`})]}):i?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`clipPath`,{id:`${h}-${e.id}-box`,children:(0,k.jsx)(`rect`,{x:t,y:n,width:C.w,height:C.h,rx:`10`})}),(0,k.jsxs)(`g`,{clipPath:`url(#${h}-${e.id}-box)`,children:[(0,k.jsx)(`rect`,{x:t,y:n,width:C.w,height:g,fill:o}),(0,k.jsx)(`rect`,{x:t,y:n+g,width:C.w,height:C.h-g,fill:e.color2})]})]}):(0,k.jsx)(`rect`,{x:t,y:n,width:C.w,height:C.h,rx:`10`,fill:o,stroke:a?`none`:`var(--page-accent, #4f46e5)`,strokeWidth:a?0:1.5}),e.photo&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`clipPath`,{id:`${h}-${e.id}`,children:(0,k.jsx)(`circle`,{cx:t+Jt.pad+C.avatar/2,cy:n+C.h/2,r:C.avatar/2})}),(0,k.jsx)(`image`,{href:e.photo,x:t+Jt.pad,y:n+(C.h-C.avatar)/2,width:C.avatar,height:C.avatar,preserveAspectRatio:`xMidYMid slice`,clipPath:`url(#${h}-${e.id})`})]}),i&&!e.gradient?(0,k.jsxs)(k.Fragment,{children:[e.title&&(0,k.jsx)(`text`,{x:d,y:n+g/2+C.title*.35,textAnchor:f,fontSize:C.title,fontWeight:`600`,fill:s,children:Wt(e.title,m+4)}),e.name&&(0,k.jsx)(`text`,{x:d,y:n+g+g/2+C.name*.35,textAnchor:f,fontSize:C.name,fontWeight:`600`,fill:c,children:Wt(e.name,m)})]}):(0,k.jsxs)(k.Fragment,{children:[v[0]&&(0,k.jsx)(`text`,{x:d,y:n+(v[1]?C.h*.43:C.h*.57),textAnchor:f,fontSize:C.name,fontWeight:`600`,fill:s,children:Wt(v[0],m)}),v[1]&&(0,k.jsx)(`text`,{x:d,y:n+C.h*.73,textAnchor:f,fontSize:C.title,opacity:`0.7`,fill:s,children:Wt(v[1],m+4)})]})]},e.id)})]}),g&&(0,k.jsx)(Yt,{node:g,onClose:()=>_(null)})]})}function Zt({columns:e=[],rows:t=[],source:n,limit:r=10,striped:i=!0,bordered:a=!1,compact:o=!1,style:s,nodeRef:c}){let{tenant:u,apiUrl:d}=(0,l.useContext)(be),f=(0,l.useContext)(xe)?.[n],[p,h]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!n||f)return;let e=!0,t=n.startsWith(`api:`)?`${d}/data/${encodeURIComponent(n.slice(4))}`:`${d}/dynamic/${encodeURIComponent(n)}`;return fetch(t,{headers:u?{"x-tenant":u}:{}}).then(e=>e.json()).then(t=>e&&h(Array.isArray(t?.payload)?t.payload:[])).catch(()=>e&&h([])),()=>{e=!1}},[n,u,d,f]),!e.length)return null;let g=n?(f??p??[]).slice(0,Math.max(1,Number(r)||10)):null,_=g?g.map(t=>e.map(e=>Ee(we(t?.data,e.field)))):t,v=o?`6px 10px`:`10px 14px`,y=`1px solid rgba(148, 163, 184, 0.35)`,b=a?{border:y}:{borderBottom:y};return(0,k.jsx)(`div`,{ref:c,style:{width:`100%`,overflowX:`auto`,...m(s)},children:(0,k.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:14,...a?{border:y}:{}},children:[(0,k.jsx)(`thead`,{children:(0,k.jsx)(`tr`,{children:e.map((e,t)=>(0,k.jsx)(`th`,{style:{textAlign:`left`,fontWeight:600,padding:v,background:`rgba(148, 163, 184, 0.12)`,...b},children:e.label??e},t))})}),(0,k.jsx)(`tbody`,{children:_.map((t,n)=>(0,k.jsx)(`tr`,{style:i&&n%2==1?{background:`rgba(148, 163, 184, 0.07)`}:void 0,children:e.map((e,n)=>(0,k.jsx)(`td`,{style:{padding:v,...b},children:t?.[n]??``},n))},n))})]})})}var Qt={PageRoot:Fe,Section:Ie,Container:Le,Heading:Re,TextBlock:Xe,ButtonBlock:$e,ImageBlock:et,Spacer:ot,Divider:st,SliderBlock:pt,CanvasSlider:mt,TabsBlock:_t,QuickStack:It,CollectionList:Lt,BreadcrumbsBlock:Rt,PaginationBlock:zt,StepperBlock:Bt,OrgChartBlock:Xt,TableBlock:Zt,AccordionBlock:vt,NavbarBlock:gt,ListBlock:Ye,TextSpan:He,QuoteBlock:Je,TextLink:Qe,RichTextBlock:Ke,RichContentBlock:Ke,VideoBlock:tt,YouTubeBlock:rt,IframeBlock:it,EmbedBlock:at,FormBlock:Ot,FormLabel:kt,FormInput:At,FormTextarea:jt,FormCheckbox:e=>(0,k.jsx)(Mt,{kind:`checkbox`,...e}),FormRadio:e=>(0,k.jsx)(Mt,{kind:`radio`,...e}),FormSelect:Nt,FormFile:Pt,FormSubmit:Ft};function $t(e,t,n,r=new Set,i=void 0){let a=t[e];if(!a||a.hidden)return null;let o=a.type?.resolvedName,s=i?.mapProps?i.mapProps(a.props??{},o):a.props??{};if(o===`ComponentInstance`){let t=a.props?.componentId,o=n?.[t];if(!o?.template||r.has(t))return null;let s=new Set(r).add(t);return(0,k.jsx)(l.Fragment,{children:$t(o.template.rootId,o.template.nodes,n,s,i)},e)}let c=Qt[o];if(!c)return null;let u=(a.nodes??[]).map(e=>$t(e,t,n,r,i)).filter(Boolean),d=Object.entries(a.linkedNodes??{}),f=d.length?Object.fromEntries(d.map(([e,i])=>[e,$t(i,t,n,r)])):void 0;return(0,k.jsx)(c,{...s,...o===`CollectionList`?{templateId:a.linkedNodes?.card}:null,linked:f,nodeRef:t=>{t&&(t.setAttribute(`data-wb`,e),v(t,s))},children:u.length?u:void 0},e)}var en=e=>Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(` `);function tn({blocks:e,theme:t,components:n,mode:r=`auto`,style:i,custom:a,tenant:o,apiUrl:s,datasets:c,locale:u,direction:d}){let f=a?.js?.trim();if((0,l.useEffect)(()=>{if(!f)return;let e=document.createElement(`script`);return e.text=f,document.body.appendChild(e),()=>e.remove()},[f]),!e?.ROOT)return null;let p={lang:u||void 0,dir:ve(d,u)},m={minHeight:`100%`,display:`flex`,flexDirection:`column`},h=$t(`ROOT`,e,n),g=(0,l.useMemo)(()=>({render:(t,r)=>$t(t,e,n,void 0,{mapProps:r})}),[e,n]),_=ne(e,n),v=te(e,n),y=a?.css?.trim(),b=he(e,n).map(e=>(0,k.jsx)(`link`,{rel:`stylesheet`,precedence:`default`,href:D(e)},e));if(r!==`auto`)return(0,k.jsx)(be.Provider,{value:{tenant:o||``,apiUrl:s||`/api`,locale:u||``},children:(0,k.jsx)(xe.Provider,{value:c??null,children:(0,k.jsx)(Se.Provider,{value:g,children:(0,k.jsxs)(`div`,{...p,style:{...m,...T(t,r),...i},children:[b,_&&(0,k.jsx)(`style`,{children:_}),v&&(0,k.jsx)(`style`,{children:v}),y&&(0,k.jsx)(`style`,{children:y}),h]})})})});let x=ce(t);return(0,k.jsx)(be.Provider,{value:{tenant:o||``,apiUrl:s||`/api`,locale:u||``},children:(0,k.jsx)(xe.Provider,{value:c??null,children:(0,k.jsx)(Se.Provider,{value:g,children:(0,k.jsxs)(`div`,{...p,className:`webim-page`,style:{...m,...ue(t),...i},children:[(0,k.jsx)(`style`,{children:`.webim-page { ${en(le(x.light))} }
14
+ @media (prefers-color-scheme: dark) { .webim-page { ${en(le(x.dark))} } }`}),b,_&&(0,k.jsx)(`style`,{children:_}),v&&(0,k.jsx)(`style`,{children:v}),y&&(0,k.jsx)(`style`,{children:y}),h]})})})})}function nn({bundle:e,mode:t=`auto`,style:n}){return e?.blocks?.ROOT?(0,k.jsx)(tn,{blocks:e.blocks,theme:e.theme,components:e.components,custom:e.custom,tenant:e.tenant,apiUrl:e.apiUrl,datasets:e.datasets,locale:e.locale,direction:e.direction,mode:t,style:n}):null}function rn({apiUrl:e,tenant:t,slug:n,locale:r,preview:i,token:a,mode:o=`auto`,style:s,fallback:c=null,errorFallback:u=null,onLoad:d,onError:f}){let[p,m]=(0,l.useState)({status:`loading`}),h=(0,l.useRef)({onLoad:d,onError:f});return h.current={onLoad:d,onError:f},(0,l.useEffect)(()=>{let o=!0;return m({status:`loading`}),pe({apiUrl:e,tenant:t,slug:n,locale:r,preview:i,token:a}).then(e=>{o&&(m({status:`ready`,bundle:e}),h.current.onLoad?.(e))}).catch(e=>{o&&(m({status:`error`,error:e}),h.current.onError?.(e))}),()=>{o=!1}},[e,t,n,r,i,a]),p.status===`loading`?c:p.status===`error`?typeof u==`function`?u(p.error):u:(0,k.jsx)(nn,{bundle:p.bundle,mode:o,style:s})}function an(e,t={}){let n=(0,u.createRoot)(e);return n.render((0,k.jsx)(rn,{apiUrl:t.apiUrl||t.api,tenant:t.tenant,slug:t.slug,locale:t.locale||void 0,token:t.token||void 0,mode:t.mode||`auto`,onError:e=>console.error(`[webim-embed]`,t.slug,e)})),n}function on(e=document){for(let t of e.querySelectorAll(`[data-webim-page]:not([data-webim-mounted])`))t.setAttribute(`data-webim-mounted`,``),an(t,t.dataset)}var sn=document.currentScript,cn=()=>{if(on(),sn?.dataset.slug){let e=document.createElement(`div`);e.setAttribute(`data-webim-mounted`,``),sn.parentElement&&sn.parentElement!==document.head?sn.insertAdjacentElement(`beforebegin`,e):document.body.appendChild(e),an(e,sn.dataset)}};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,cn,{once:!0}):cn(),window.WebimEmbed={mount:an,scan:on}})();