@yext/visual-editor 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/visual-editor.cjs +1 -1
- package/dist/visual-editor.js +7 -2
- package/package.json +1 -1
package/dist/visual-editor.cjs
CHANGED
|
@@ -173,4 +173,4 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var R=Te(q,J,z,W,L+"."+J
|
|
|
173
173
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
174
174
|
|
|
175
175
|
Defaulting to \`null\`.`}var gp=fp,ED=pp;const vp=v.forwardRef(({className:e,value:t,...r},n)=>y.jsx(gp,{ref:n,className:Me("ve-relative ve-h-4 ve-w-full ve-overflow-hidden ve-rounded-full ve-bg-secondary",e),...r,children:y.jsx(ED,{className:"ve-h-full ve-w-full ve-flex-1 ve-bg-primary ve-transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));vp.displayName=gp.displayName;function SD({progress:e}){return y.jsxs("div",{className:"ve-flex ve-h-screen ve-loading-wrapper ve-w-screen ve-flex-col ve-items-center ve-justify-center",children:[y.jsx(vp,{className:"ve-w-1/3 ve-loading-progress",value:e}),y.jsx("div",{children:"Loading Visual Editor..."})]})}var jc=["light","dark"],CD="(prefers-color-scheme: dark)",_D=v.createContext(void 0),$D={setTheme:e=>{},themes:[]},TD=()=>{var e;return(e=v.useContext(_D))!=null?e:$D};v.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:o,defaultTheme:a,value:i,attrs:s,nonce:l})=>{let c=a==="system",u=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,p=o?jc.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(b,g=!1,m=!0)=>{let w=i?i[b]:b,C=g?b+"|| ''":`'${w}'`,E="";return o&&m&&!g&&jc.includes(b)&&(E+=`d.style.colorScheme = '${b}';`),r==="class"?g||w?E+=`c.add(${C})`:E+="null":w&&(E+=`d[s](n,${C})`),E},h=e?`!function(){${u}${f(e)}}()`:n?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${c})){var t='${CD}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${f(i?"x[e]":"e",!0)}}${c?"":"else{"+f(a,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${f(i?"x[e]":"e",!0)}}else{${f(a,!1,!1)};}${p}}catch(t){}}();`;return v.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:h}})});var AD=e=>{switch(e){case"success":return PD;case"info":return ND;case"warning":return MD;case"error":return DD;default:return null}},OD=Array(12).fill(0),RD=({visible:e})=>d.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},d.createElement("div",{className:"sonner-spinner"},OD.map((t,r)=>d.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),PD=d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},d.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),MD=d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},d.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ND=d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},d.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),DD=d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},d.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),kD=()=>{let[e,t]=d.useState(document.hidden);return d.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},za=1,jD=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:za++,a=this.toasts.find(s=>s.id===o),i=e.dismissible===void 0?!0:e.dismissible;return a?this.toasts=this.toasts.map(s=>s.id===o?(this.publish({...s,...e,id:o,title:r}),{...s,...e,id:o,dismissible:i,title:r}):s):this.addToast({title:r,...n,dismissible:i,id:o}),o},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),o=r!==void 0;return n.then(async a=>{if(FD(a)&&!a.ok){o=!1;let i=typeof t.error=="function"?await t.error(`HTTP error! status: ${a.status}`):t.error,s=typeof t.description=="function"?await t.description(`HTTP error! status: ${a.status}`):t.description;this.create({id:r,type:"error",message:i,description:s})}else if(t.success!==void 0){o=!1;let i=typeof t.success=="function"?await t.success(a):t.success,s=typeof t.description=="function"?await t.description(a):t.description;this.create({id:r,type:"success",message:i,description:s})}}).catch(async a=>{if(t.error!==void 0){o=!1;let i=typeof t.error=="function"?await t.error(a):t.error,s=typeof t.description=="function"?await t.description(a):t.description;this.create({id:r,type:"error",message:i,description:s})}}).finally(()=>{var a;o&&(this.dismiss(r),r=void 0),(a=t.finally)==null||a.call(t)}),r},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||za++;return this.create({jsx:e(r),id:r,...t}),r},this.subscribers=[],this.toasts=[]}},Ge=new jD,ID=(e,t)=>{let r=(t==null?void 0:t.id)||za++;return Ge.addToast({title:e,...t,id:r}),r},FD=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",LD=ID,BD=()=>Ge.toasts;Object.assign(LD,{success:Ge.success,info:Ge.info,warning:Ge.warning,error:Ge.error,custom:Ge.custom,message:Ge.message,promise:Ge.promise,dismiss:Ge.dismiss,loading:Ge.loading},{getHistory:BD});function HD(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}HD(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
176
|
-
`);function Un(e){return e.label!==void 0}var zD=3,UD="32px",GD=4e3,WD=356,VD=14,YD=20,KD=200;function qD(...e){return e.filter(Boolean).join(" ")}var XD=e=>{var t,r,n,o,a,i,s,l,c,u;let{invert:p,toast:f,unstyled:h,interacting:b,setHeights:g,visibleToasts:m,heights:w,index:C,toasts:E,expanded:_,removeToast:S,defaultRichColors:O,closeButton:M,style:I,cancelButtonStyle:U,actionButtonStyle:V,className:K="",descriptionClassName:F="",duration:Y,position:G,gap:te,loadingIcon:H,expandByDefault:oe,classNames:N,icons:Z,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:T,cn:D}=e,[k,z]=d.useState(!1),[W,L]=d.useState(!1),[q,X]=d.useState(!1),[re,J]=d.useState(!1),[Te,R]=d.useState(0),[Ae,Ie]=d.useState(0),Fe=d.useRef(null),ke=d.useRef(null),$t=C===0,Tt=C+1<=m,Ce=f.type,it=f.dismissible!==!1,Ur=f.className||"",At=f.descriptionClassName||"",gt=d.useMemo(()=>w.findIndex(ne=>ne.toastId===f.id)||0,[w,f.id]),Gr=d.useMemo(()=>{var ne;return(ne=f.closeButton)!=null?ne:M},[f.closeButton,M]),se=d.useMemo(()=>f.duration||Y||GD,[f.duration,Y]),ae=d.useRef(0),ue=d.useRef(0),Ke=d.useRef(0),Ze=d.useRef(null),[Wr,Vr]=G.split("-"),Tn=d.useMemo(()=>w.reduce((ne,ge,ve)=>ve>=gt?ne:ne+ge.height,0),[w,gt]),An=kD(),Fo=f.invert||p,Yr=Ce==="loading";ue.current=d.useMemo(()=>gt*te+Tn,[gt,Tn]),d.useEffect(()=>{z(!0)},[]),d.useLayoutEffect(()=>{if(!k)return;let ne=ke.current,ge=ne.style.height;ne.style.height="auto";let ve=ne.getBoundingClientRect().height;ne.style.height=ge,Ie(ve),g(De=>De.find(Le=>Le.toastId===f.id)?De.map(Le=>Le.toastId===f.id?{...Le,height:ve}:Le):[{toastId:f.id,height:ve,position:f.position},...De])},[k,f.title,f.description,g,f.id]);let st=d.useCallback(()=>{L(!0),R(ue.current),g(ne=>ne.filter(ge=>ge.toastId!==f.id)),setTimeout(()=>{S(f)},KD)},[f,S,g,ue]);d.useEffect(()=>{if(f.promise&&Ce==="loading"||f.duration===1/0||f.type==="loading")return;let ne,ge=se;return _||b||T&&An?(()=>{if(Ke.current<ae.current){let ve=new Date().getTime()-ae.current;ge=ge-ve}Ke.current=new Date().getTime()})():ge!==1/0&&(ae.current=new Date().getTime(),ne=setTimeout(()=>{var ve;(ve=f.onAutoClose)==null||ve.call(f,f),st()},ge)),()=>clearTimeout(ne)},[_,b,oe,f,se,st,f.promise,Ce,T,An]),d.useEffect(()=>{let ne=ke.current;if(ne){let ge=ne.getBoundingClientRect().height;return Ie(ge),g(ve=>[{toastId:f.id,height:ge,position:f.position},...ve]),()=>g(ve=>ve.filter(De=>De.toastId!==f.id))}},[g,f.id]),d.useEffect(()=>{f.delete&&st()},[st,f.delete]);function Lo(){return Z!=null&&Z.loading?d.createElement("div",{className:"sonner-loader","data-visible":Ce==="loading"},Z.loading):H?d.createElement("div",{className:"sonner-loader","data-visible":Ce==="loading"},H):d.createElement(RD,{visible:Ce==="loading"})}return d.createElement("li",{"aria-live":f.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:ke,className:D(K,Ur,N==null?void 0:N.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,N==null?void 0:N.default,N==null?void 0:N[Ce],(r=f==null?void 0:f.classNames)==null?void 0:r[Ce]),"data-sonner-toast":"","data-rich-colors":(n=f.richColors)!=null?n:O,"data-styled":!(f.jsx||f.unstyled||h),"data-mounted":k,"data-promise":!!f.promise,"data-removed":W,"data-visible":Tt,"data-y-position":Wr,"data-x-position":Vr,"data-index":C,"data-front":$t,"data-swiping":q,"data-dismissible":it,"data-type":Ce,"data-invert":Fo,"data-swipe-out":re,"data-expanded":!!(_||oe&&k),style:{"--index":C,"--toasts-before":C,"--z-index":E.length-C,"--offset":`${W?Te:ue.current}px`,"--initial-height":oe?"auto":`${Ae}px`,...I,...f.style},onPointerDown:ne=>{Yr||!it||(Fe.current=new Date,R(ue.current),ne.target.setPointerCapture(ne.pointerId),ne.target.tagName!=="BUTTON"&&(X(!0),Ze.current={x:ne.clientX,y:ne.clientY}))},onPointerUp:()=>{var ne,ge,ve,De;if(re||!it)return;Ze.current=null;let Le=Number(((ne=ke.current)==null?void 0:ne.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Ot=new Date().getTime()-((ge=Fe.current)==null?void 0:ge.getTime()),On=Math.abs(Le)/Ot;if(Math.abs(Le)>=YD||On>.11){R(ue.current),(ve=f.onDismiss)==null||ve.call(f,f),st(),J(!0);return}(De=ke.current)==null||De.style.setProperty("--swipe-amount","0px"),X(!1)},onPointerMove:ne=>{var ge;if(!Ze.current||!it)return;let ve=ne.clientY-Ze.current.y,De=ne.clientX-Ze.current.x,Le=(Wr==="top"?Math.min:Math.max)(0,ve),Ot=ne.pointerType==="touch"?10:2;Math.abs(Le)>Ot?(ge=ke.current)==null||ge.style.setProperty("--swipe-amount",`${ve}px`):Math.abs(De)>Ot&&(Ze.current=null)}},Gr&&!f.jsx?d.createElement("button",{"aria-label":$,"data-disabled":Yr,"data-close-button":!0,onClick:Yr||!it?()=>{}:()=>{var ne;st(),(ne=f.onDismiss)==null||ne.call(f,f)},className:D(N==null?void 0:N.closeButton,(o=f==null?void 0:f.classNames)==null?void 0:o.closeButton)},d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},d.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,f.jsx||d.isValidElement(f.title)?f.jsx||f.title:d.createElement(d.Fragment,null,Ce||f.icon||f.promise?d.createElement("div",{"data-icon":"",className:D(N==null?void 0:N.icon,(a=f==null?void 0:f.classNames)==null?void 0:a.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Lo():null,f.type!=="loading"?f.icon||(Z==null?void 0:Z[Ce])||AD(Ce):null):null,d.createElement("div",{"data-content":"",className:D(N==null?void 0:N.content,(i=f==null?void 0:f.classNames)==null?void 0:i.content)},d.createElement("div",{"data-title":"",className:D(N==null?void 0:N.title,(s=f==null?void 0:f.classNames)==null?void 0:s.title)},f.title),f.description?d.createElement("div",{"data-description":"",className:D(F,At,N==null?void 0:N.description,(l=f==null?void 0:f.classNames)==null?void 0:l.description)},f.description):null),d.isValidElement(f.cancel)?f.cancel:f.cancel&&Un(f.cancel)?d.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||U,onClick:ne=>{var ge,ve;Un(f.cancel)&&it&&((ve=(ge=f.cancel).onClick)==null||ve.call(ge,ne),st())},className:D(N==null?void 0:N.cancelButton,(c=f==null?void 0:f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,d.isValidElement(f.action)?f.action:f.action&&Un(f.action)?d.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||V,onClick:ne=>{var ge,ve;Un(f.action)&&(ne.defaultPrevented||((ve=(ge=f.action).onClick)==null||ve.call(ge,ne),st()))},className:D(N==null?void 0:N.actionButton,(u=f==null?void 0:f.classNames)==null?void 0:u.actionButton)},f.action.label):null))};function Ic(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var JD=e=>{let{invert:t,position:r="bottom-right",hotkey:n=["altKey","KeyT"],expand:o,closeButton:a,className:i,offset:s,theme:l="light",richColors:c,duration:u,style:p,visibleToasts:f=zD,toastOptions:h,dir:b=Ic(),gap:g=VD,loadingIcon:m,icons:w,containerAriaLabel:C="Notifications",pauseWhenPageIsHidden:E,cn:_=qD}=e,[S,O]=d.useState([]),M=d.useMemo(()=>Array.from(new Set([r].concat(S.filter(T=>T.position).map(T=>T.position)))),[S,r]),[I,U]=d.useState([]),[V,K]=d.useState(!1),[F,Y]=d.useState(!1),[G,te]=d.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=d.useRef(null),oe=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=d.useRef(null),Z=d.useRef(!1),$=d.useCallback(T=>{var D;(D=S.find(k=>k.id===T.id))!=null&&D.delete||Ge.dismiss(T.id),O(k=>k.filter(({id:z})=>z!==T.id))},[S]);return d.useEffect(()=>Ge.subscribe(T=>{if(T.dismiss){O(D=>D.map(k=>k.id===T.id?{...k,delete:!0}:k));return}setTimeout(()=>{Ya.flushSync(()=>{O(D=>{let k=D.findIndex(z=>z.id===T.id);return k!==-1?[...D.slice(0,k),{...D[k],...T},...D.slice(k+1)]:[T,...D]})})})}),[]),d.useEffect(()=>{if(l!=="system"){te(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?te("dark"):te("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:T})=>{te(T?"dark":"light")})},[l]),d.useEffect(()=>{S.length<=1&&K(!1)},[S]),d.useEffect(()=>{let T=D=>{var k,z;n.every(W=>D[W]||D.code===W)&&(K(!0),(k=H.current)==null||k.focus()),D.code==="Escape"&&(document.activeElement===H.current||(z=H.current)!=null&&z.contains(document.activeElement))&&K(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[n]),d.useEffect(()=>{if(H.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,Z.current=!1)}},[H.current]),S.length?d.createElement("section",{"aria-label":`${C} ${oe}`,tabIndex:-1},M.map((T,D)=>{var k;let[z,W]=T.split("-");return d.createElement("ol",{key:T,dir:b==="auto"?Ic():b,tabIndex:-1,ref:H,className:i,"data-sonner-toaster":!0,"data-theme":G,"data-y-position":z,"data-x-position":W,style:{"--front-toast-height":`${((k=I[0])==null?void 0:k.height)||0}px`,"--offset":typeof s=="number"?`${s}px`:s||UD,"--width":`${WD}px`,"--gap":`${g}px`,...p},onBlur:L=>{Z.current&&!L.currentTarget.contains(L.relatedTarget)&&(Z.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:L=>{L.target instanceof HTMLElement&&L.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,N.current=L.relatedTarget)},onMouseEnter:()=>K(!0),onMouseMove:()=>K(!0),onMouseLeave:()=>{F||K(!1)},onPointerDown:L=>{L.target instanceof HTMLElement&&L.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},S.filter(L=>!L.position&&D===0||L.position===T).map((L,q)=>{var X,re;return d.createElement(XD,{key:L.id,icons:w,index:q,toast:L,defaultRichColors:c,duration:(X=h==null?void 0:h.duration)!=null?X:u,className:h==null?void 0:h.className,descriptionClassName:h==null?void 0:h.descriptionClassName,invert:t,visibleToasts:f,closeButton:(re=h==null?void 0:h.closeButton)!=null?re:a,interacting:F,position:T,style:h==null?void 0:h.style,unstyled:h==null?void 0:h.unstyled,classNames:h==null?void 0:h.classNames,cancelButtonStyle:h==null?void 0:h.cancelButtonStyle,actionButtonStyle:h==null?void 0:h.actionButtonStyle,removeToast:$,toasts:S.filter(J=>J.position==L.position),heights:I.filter(J=>J.position==L.position),setHeights:U,expandByDefault:o,gap:g,loadingIcon:m,expanded:V,pauseWhenPageIsHidden:E,cn:_})}))})):null};const ZD=({...e})=>{const{theme:t="system"}=TD();return y.jsx(JD,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:ve-bg-background group-[.toaster]:ve-text-foreground group-[.toaster]:ve-border-border group-[.toaster]:ve-shadow-lg",description:"group-[.toast]:ve-text-muted-foreground",actionButton:"group-[.toast]:ve-bg-primary group-[.toast]:ve-text-primary-foreground",cancelButton:"group-[.toast]:ve-bg-muted group-[.toast]:ve-text-muted-foreground"}},...e})},bp=(e,t,r="*")=>t==null?void 0:t.postMessage(e,{targetOrigin:r}),lt=(e,t)=>{const[r,n]=d.useState("pending");return mp(e,t,QD(n)),{sendToParent:a=>{if(!window.parent)throw new Error("Parent window has closed");n("pending");for(const i of t)bp({...a,type:e},window.parent,i)},status:r}},Dt=(e,t,r)=>{mp(e,t,(o,a,i)=>{const{type:s,payload:l}=o;s===e&&typeof r=="function"&&r(c=>bp({...c,type:e},i,a),l)})},mp=(e,t,r)=>{const[n,o]=d.useState(),[a,i]=d.useState(),s=d.useRef(),l=d.useRef();s.current=n,l.current=a;const c=d.useCallback(({origin:u,source:p,data:f})=>{var b;if((b=f==null?void 0:f.source)!=null&&b.startsWith("react-devtools")||!t.includes(u))return;const{type:h}=f;h===e&&(i(p),o(u),r(f,u,p))},[e,t,i,o,r]);d.useEffect(()=>(window.addEventListener("message",c),()=>window.removeEventListener("message",c)),[e,a,n,c])},QD=e=>(t,r,n)=>{const{status:o}=t;o==="success"?e("success"):o==="error"&&e("error")};class ek{constructor(t=!1){Kr(this,"enable",t=>{this.enabled=t,this.enabled&&console.log("[DEBUG] xYextDebug enabled")});Kr(this,"logData",(t,r)=>{this.enabled&&console.log("[DEBUG]",t,"-",r)});Kr(this,"logFunc",t=>{this.enabled&&console.log("[DEBUG] -->",t,"called")});Kr(this,"log",t=>{this.enabled&&console.log("[DEBUG]",t)});this.enabled=t,this.enabled&&console.log("[DEBUG] xYextDebug enabled")}}const tk={GLOBAL:"global",INDIVIDUAL:"individual"},Ne=["http://localhost","https://dev.yext.com","https://qa.yext.com","https://sandbox.yext.com","https://www.yext.com","https://app-qa.eu.yext.com","https://app.eu.yext.com"],xe=new ek,rk=({document:e,componentRegistry:t,themeConfig:r})=>{const[n,o]=d.useState(),[a,i]=d.useState(!1),[s,l]=d.useState(),[c,u]=d.useState(!1),[p,f]=d.useState(),[h,b]=d.useState(!1),[g,m]=d.useState(void 0),[w,C]=d.useState(void 0),[E,_]=d.useState(),[S,O]=d.useState(),[M,I]=d.useState(!1),[U,V]=d.useState(!1),[K,F]=d.useState({history:[{}],index:0}),[Y,G]=d.useState(!1),[te,H]=d.useState(),[oe,N]=d.useState(!1),[Z,$]=d.useState(void 0),[T,D]=d.useState(!1);e&&xe.logData("DOCUMENT",e);const k=d.useCallback(()=>E?$a(E.isDevMode&&!E.devOverride,E.role,E.templateId,E.layoutId,E.entityId):"",[E]),z=d.useCallback(()=>E?Ws(E.isDevMode,E.siteId,E.themeEntityId):"",[E]);d.useEffect(()=>{if(typeof window<"u"){const se=window.location.ancestorOrigins;se.length===0||!se[0].includes("pagescdn")&&!se[0].includes("yext.com")&&!se[0].includes("localhost")?window.location.assign("/404.html"):I(!0)}},[]),Dt("getTemplateMetadata",Ne,(se,ae)=>{const ue=t.get(ae.templateId);O(ue);const Ke=ae;_(ae),xe.enable(Ke.isxYextDebug),xe.logData("TEMPLATE_METADATA",Ke),xe.logData("PUCK_CONFIG",ue),se({status:"success",payload:{message:"payload received"}})}),d.useEffect(()=>{if(E!=null&&E.isDevMode)try{m(pageSets),C(siteStream)}catch{console.warn("pageSets are not defined")}},[E==null?void 0:E.isDevMode]);const W=()=>{E!=null&&E.isThemeMode?q():L()},L=()=>{xe.logFunc("clearVisualConfigLocalStorage"),window.localStorage.removeItem(k())},q=()=>{xe.logFunc("clearThemeLocalStorage"),window.localStorage.removeItem(z())},X=()=>{xe.logFunc("clearHistory"),W(),ke(),Ce()},re=d.useRef(!0);d.useEffect(()=>{if(re.current){re.current=!1;return}J(),Te()},[E,h,c,oe,T]);const J=d.useCallback(()=>{if(!c||!h||!E)return;if(xe.logFunc("loadPuckInitialHistory"),E.isDevMode&&!E.devOverride){const ue=window.localStorage.getItem(k());if(ue){xe.log("Dev Mode - Using localStorage");const Ke=JSON.parse(ue),Ze=Ke.length-1;o({histories:Ke,index:Ze,appendData:!1}),i(!0);return}xe.log("Dev Mode - No localStorage. Using data from Content"),s&&o({histories:[{id:"root",state:{data:s}}],appendData:!1}),i(!0);return}if(!p){W(),xe.log("Prod Mode - No saveState. Using data from Content"),s&&o({histories:[{id:"root",state:{data:s}}],appendData:!1}),i(!0);return}const se=window.localStorage.getItem(k());if(!se){xe.log("Prod Mode - No localStorage. Using saveState"),o({histories:s?[{id:"root",state:{data:s}},{id:p.hash,state:nn(p.history)}]:[{id:p.hash,state:nn(p.history)}],index:s?1:0,appendData:!1}),i(!0);return}const ae=JSON.parse(se).findIndex(ue=>ue.id===(p==null?void 0:p.hash));if(ae!==-1){xe.log("Prod Mode - Using localStorage"),o({histories:JSON.parse(se),index:ae,appendData:!1}),i(!0);return}W()},[o,i,W,$a]);d.useEffect(()=>{n&&xe.logData("PUCK_INITIAL_HISTORY",n)},[n]);const Te=d.useCallback(()=>{if(console.log(`themeData is ${JSON.stringify(te)}, themeSaveState is ${JSON.stringify(Z)}`),!(!T||!E||!E.isThemeMode)){if(xe.logFunc("loadThemeHistory"),E.isDevMode&&!E.devOverride){const se=window.localStorage.getItem(z());if(se){xe.log("Dev Mode - Using theme localStorage");const ae=JSON.parse(se),ue=ae.length-1;F({history:ae,index:ue}),G(!0);return}xe.log("Dev Mode - No localStorage. Using theme data from Content"),te&&(console.log(`starting fresh from content: ${te}`),F({history:[te],index:0})),G(!0);return}if(!Z){W(),xe.log("Prod Mode - No saveState. Using theme data from Content"),te&&F({history:[te],index:0}),G(!0);return}if(te){xe.log("Prod Mode - No themeLocalStorage. Using themeSaveState");const se=te?[te,...Z.history]:[...Z.history],ae={history:se,index:se.length-1};F(ae),G(!0),console.log(`themeInitialHistory is ${JSON.stringify(ae)}`);return}console.log("Setting blank now"),F({history:[{}],index:0}),G(!0)}},[F,G,W,Ws]),{sendToParent:R}=lt("iFrameLoaded",Ne),{sendToParent:Ae}=lt("sendDevSaveStateData",Ne);d.useEffect(()=>{R({payload:{message:"iFrame is loaded"}})},[]),d.useEffect(()=>{var se;if(E!=null&&E.isDevMode){const ae=window.localStorage.getItem(k()),ue=ae?JSON.parse(ae):[],Ke=JSON.stringify(ue.length>0?(se=ue[ue.length-1].data)==null?void 0:se.data:{});Ae({payload:{devSaveStateData:Ke}})}},[E]),Dt("getSaveState",Ne,(se,ae)=>{xe.logData("SAVE_STATE",ae),f(ae),b(!0),se({status:"success",payload:{message:"saveState received"}})}),Dt("getThemeSaveState",Ne,(se,ae)=>{xe.logData("THEME_SAVE_STATE",ae),console.log("themeSaveState",JSON.stringify(ae));const ue={history:ae!=null&&ae.history?nn(ae==null?void 0:ae.history):[],index:(ae==null?void 0:ae.index)??0};$(ue),D(!0),se({status:"success",payload:{message:"themeSaveState received"}})}),Dt("getVisualConfigurationData",Ne,(se,ae)=>{const ue=nn(ae.visualConfigurationData);xe.logData("VISUAL_CONFIGURATION_DATA",ue),l(ue),u(!0),se({status:"success",payload:{message:"getVisualConfigurationData received"}})}),Dt("getThemeData",Ne,(se,ae)=>{console.log(`payload in getThemeData is ${JSON.stringify(ae)}`);const ue=nn(ae);xe.logData("THEME_DATA",ue),H(ue),N(!0),se({status:"success",payload:{message:"getThemeData received"}})});const{sendToParent:Ie}=lt("pushPageSets",Ne);d.useEffect(()=>{typeof window<"u"&&(E!=null&&E.isDevMode)&&g&&Ie({payload:{...g,siteStream:w}})},[E==null?void 0:E.isDevMode,g]);const{sendToParent:Fe}=lt("saveSaveState",Ne),{sendToParent:ke}=lt("deleteSaveState",Ne),{sendToParent:$t}=lt("saveVisualConfigData",Ne),{sendToParent:Tt}=lt("saveThemeSaveState",Ne),{sendToParent:Ce}=lt("deleteThemeSaveState",Ne),{sendToParent:it}=lt("saveThemeData",Ne),{sendToParent:Ur}=lt("openQuickFind",Ne),At=se=>{(se.ctrlKey||se.metaKey)&&se.key==="k"&&Ur()};d.useEffect(()=>(window.addEventListener("keydown",At),()=>{window.removeEventListener("keydown",At)}),[]);const gt=!S||!E||!e||!h||!c||!a||E.isThemeMode&&(!oe||!T||!Y);d.useEffect(()=>{console.log("theme useEffect"),U&&K&&r&&(xe.logData("THEME_INITIAL_HISTORY",K),gi(K.history[K.index],r))},[K,r,U]);const Gr=100*(!!S+!!E+!!e+h+c+a+(E!=null&&E.isThemeMode?oe+T+Y:0))/(E!=null&&E.isThemeMode?9:6);return y.jsxs(y.Fragment,{children:[gt?M&&y.jsx(SD,{progress:Gr}):y.jsx(gD,{puckConfig:S,isLoading:gt,puckInitialHistory:n,clearHistory:E.isDevMode&&!E.devOverride?W:X,templateMetadata:E,saveState:p,saveSaveState:Fe,saveVisualConfigData:$t,sendDevSaveStateData:Ae,saveThemeData:it,buildVisualConfigLocalStorageKey:k,devLogger:xe,themeConfig:r,themeData:te,saveThemeSaveState:Tt,themeHistory:K,setThemeHistory:F,setPuckRendered:V}),y.jsx(ZD,{closeButton:!0,richColors:!0})]})},nn=e=>JSON.parse(e.replace(/\\"/g,'"')),nk=()=>{const[e,t]=d.useState(void 0);return Dt("getTemplateStream",Ne,(r,n)=>{t(n.stream.schema.fields),r({status:"success",payload:{message:"templateStream received"}})}),Dt("getDevEntityFields",Ne,(r,n)=>{t(ok(n)),r({status:"success",payload:{message:"getDevEntityFields received"}})}),e},ok=e=>e.map(t=>({name:t.name,definition:{name:t.name,typeName:t.typeName,type:t.type,registryId:t.registryId,typeRegistryId:t.typeRegistryId,isList:t.isList},children:t.children??[]})),yp=v.createContext(void 0),ak=({entityFields:e,children:t})=>y.jsx(yp.Provider,{value:e,children:t}),xp=()=>{const e=v.useContext(yp);if(!e)throw new Error("useEntityFields must be used within a DocumentProvider");return e},ik=["uid","meta","slug","c_visualConfigurations","c_pages_layouts"],sk=[],wp=e=>Ep(e,""),Ep=(e,t)=>{var o,a,i;const r=t?`${t}.${e.name}`:e.name;if(sk.includes(Sp(e)))return[{name:r,schemaField:e}];if(e.definition.isList)return[];const n=[{name:r,schemaField:e}];if((o=e.children)!=null&&o.fields&&((i=(a=e.children)==null?void 0:a.fields)==null?void 0:i.length)>0)for(const s of e.children.fields)n.push(...Ep(s,r));return n},Sp=e=>e.definition.typeName||e.definition.typeRegistryId||Object.entries(e.definition.type)[0][1];function lk(e,t,r){const n=e.get(t)||[];return n.push(r),e.set(t,n),e}const ck=e=>e.reduce((t,r)=>{const n=wp(r);for(const o of n){const a=Sp(o.schemaField);a&&(t=lk(t,a,o.name))}return t},new Map),uk=e=>{let r=xp().filter(o=>!ik.includes(o.name));if(e!=null&&e.allowList){const o=r.map(a=>a.name);e.allowList.forEach(a=>{o.includes(a)||console.warn(`The entity field filter allowList included ${a}, which does not exist in the stream.`)}),r=r.filter(a=>e.allowList.includes(a.name))}e!=null&&e.disallowList&&(r=r.filter(o=>!e.disallowList.includes(o.name)));let n=[];for(const o of r){const a=wp(o);for(const i of a)n.push({...i.schemaField,name:i.name})}if(e!=null&&e.types){const o=ck(n),a=[];e.types.forEach(i=>{a.push(...n.filter(s=>{var l;return(l=o.get(i))==null?void 0:l.includes(s.name)}))}),n=a}return n};function Cp(e,t=[]){let r=[];function n(a,i){const s=v.createContext(i),l=r.length;r=[...r,i];const c=p=>{var w;const{scope:f,children:h,...b}=p,g=((w=f==null?void 0:f[e])==null?void 0:w[l])||s,m=v.useMemo(()=>b,Object.values(b));return y.jsx(g.Provider,{value:m,children:h})};c.displayName=a+"Provider";function u(p,f){var g;const h=((g=f==null?void 0:f[e])==null?void 0:g[l])||s,b=v.useContext(h);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[c,u]}const o=()=>{const a=r.map(i=>v.createContext(i));return function(s){const l=(s==null?void 0:s[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[n,fk(o,...t)]}function fk(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=n.reduce((s,{useScope:l,scopeName:c})=>{const p=l(a)[`__scope${c}`];return{...s,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function dk(e){const t=e+"CollectionProvider",[r,n]=zt(t),[o,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:b,children:g}=h,m=d.useRef(null),w=d.useRef(new Map).current;return y.jsx(o,{scope:b,itemMap:w,collectionRef:m,children:g})};i.displayName=t;const s=e+"CollectionSlot",l=d.forwardRef((h,b)=>{const{scope:g,children:m}=h,w=a(s,g),C=Pe(b,w.collectionRef);return y.jsx(Yt,{ref:C,children:m})});l.displayName=s;const c=e+"CollectionItemSlot",u="data-radix-collection-item",p=d.forwardRef((h,b)=>{const{scope:g,children:m,...w}=h,C=d.useRef(null),E=Pe(b,C),_=a(c,g);return d.useEffect(()=>(_.itemMap.set(C,{ref:C,...w}),()=>void _.itemMap.delete(C))),y.jsx(Yt,{[u]:"",ref:E,children:m})});p.displayName=c;function f(h){const b=a(e+"CollectionConsumer",h);return d.useCallback(()=>{const m=b.collectionRef.current;if(!m)return[];const w=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(b.itemMap.values()).sort((_,S)=>w.indexOf(_.ref.current)-w.indexOf(S.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:l,ItemSlot:p},f,n]}var pk=v.createContext(void 0);function _p(e){const t=v.useContext(pk);return e||t||"ltr"}var pa="rovingFocusGroup.onEntryFocus",hk={bubbles:!1,cancelable:!0},Io="RovingFocusGroup",[Ua,$p,gk]=dk(Io),[vk,Tp]=zt(Io,[gk]),[bk,mk]=vk(Io),Ap=v.forwardRef((e,t)=>y.jsx(Ua.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(Ua.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(yk,{...e,ref:t})})}));Ap.displayName=Io;var yk=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...p}=e,f=v.useRef(null),h=Pe(t,f),b=_p(a),[g=null,m]=gn({prop:i,defaultProp:s,onChange:l}),[w,C]=v.useState(!1),E=yt(c),_=$p(r),S=v.useRef(!1),[O,M]=v.useState(0);return v.useEffect(()=>{const I=f.current;if(I)return I.addEventListener(pa,E),()=>I.removeEventListener(pa,E)},[E]),y.jsx(bk,{scope:r,orientation:n,dir:b,loop:o,currentTabStopId:g,onItemFocus:v.useCallback(I=>m(I),[m]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>M(I=>I+1),[]),onFocusableItemRemove:v.useCallback(()=>M(I=>I-1),[]),children:y.jsx($e.div,{tabIndex:w||O===0?-1:0,"data-orientation":n,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{S.current=!0}),onFocus:Se(e.onFocus,I=>{const U=!S.current;if(I.target===I.currentTarget&&U&&!w){const V=new CustomEvent(pa,hk);if(I.currentTarget.dispatchEvent(V),!V.defaultPrevented){const K=_().filter(H=>H.focusable),F=K.find(H=>H.active),Y=K.find(H=>H.id===g),te=[F,Y,...K].filter(Boolean).map(H=>H.ref.current);Pp(te,u)}}S.current=!1}),onBlur:Se(e.onBlur,()=>C(!1))})})}),Op="RovingFocusGroupItem",Rp=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:a,...i}=e,s=ln(),l=a||s,c=mk(Op,r),u=c.currentTabStopId===l,p=$p(r),{onFocusableItemAdd:f,onFocusableItemRemove:h}=c;return v.useEffect(()=>{if(n)return f(),()=>h()},[n,f,h]),y.jsx(Ua.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:y.jsx($e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:Se(e.onMouseDown,b=>{n?c.onItemFocus(l):b.preventDefault()}),onFocus:Se(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Se(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){c.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const g=Ek(b,c.orientation,c.dir);if(g!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=p().filter(C=>C.focusable).map(C=>C.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const C=w.indexOf(b.currentTarget);w=c.loop?Sk(w,C+1):w.slice(C+1)}setTimeout(()=>Pp(w))}})})})});Rp.displayName=Op;var xk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ek(e,t,r){const n=wk(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return xk[n]}function Pp(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Sk(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Ck=Ap,_k=Rp;function $k(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var Mp=e=>{const{present:t,children:r}=e,n=Tk(t),o=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),a=Pe(n.ref,Ak(o));return typeof r=="function"||n.isPresent?v.cloneElement(o,{ref:a}):null};Mp.displayName="Presence";function Tk(e){const[t,r]=v.useState(),n=v.useRef({}),o=v.useRef(e),a=v.useRef("none"),i=e?"mounted":"unmounted",[s,l]=$k(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const c=Gn(n.current);a.current=s==="mounted"?c:"none"},[s]),mt(()=>{const c=n.current,u=o.current;if(u!==e){const f=a.current,h=Gn(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),mt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,p=h=>{const g=Gn(n.current).includes(h.animationName);if(h.target===t&&g&&(l("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},f=h=>{h.target===t&&(a.current=Gn(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(c=>{c&&(n.current=getComputedStyle(c)),r(c)},[])}}function Gn(e){return(e==null?void 0:e.animationName)||"none"}function Ak(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var us="Radio",[Ok,Np]=Cp(us),[Rk,Pk]=Ok(us),Dp=v.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:o=!1,required:a,disabled:i,value:s="on",onCheck:l,form:c,...u}=e,[p,f]=v.useState(null),h=Pe(t,m=>f(m)),b=v.useRef(!1),g=p?c||!!p.closest("form"):!0;return y.jsxs(Rk,{scope:r,checked:o,disabled:i,children:[y.jsx($e.button,{type:"button",role:"radio","aria-checked":o,"data-state":Ip(o),"data-disabled":i?"":void 0,disabled:i,value:s,...u,ref:h,onClick:Se(e.onClick,m=>{o||l==null||l(),g&&(b.current=m.isPropagationStopped(),b.current||m.stopPropagation())})}),g&&y.jsx(Mk,{control:p,bubbles:!b.current,name:n,value:s,checked:o,required:a,disabled:i,form:c,style:{transform:"translateX(-100%)"}})]})});Dp.displayName=us;var kp="RadioIndicator",jp=v.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...o}=e,a=Pk(kp,r);return y.jsx(Mp,{present:n||a.checked,children:y.jsx($e.span,{"data-state":Ip(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t})})});jp.displayName=kp;var Mk=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=v.useRef(null),i=Qu(r),s=ni(t);return v.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==r&&p){const f=new Event("click",{bubbles:n});p.call(l,r),l.dispatchEvent(f)}},[i,r,n]),y.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ip(e){return e?"checked":"unchecked"}var Nk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],fs="RadioGroup",[Dk,rj]=Cp(fs,[Tp,Np]),Fp=Tp(),Lp=Np(),[kk,jk]=Dk(fs),Bp=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:o,value:a,required:i=!1,disabled:s=!1,orientation:l,dir:c,loop:u=!0,onValueChange:p,...f}=e,h=Fp(r),b=_p(c),[g,m]=gn({prop:a,defaultProp:o,onChange:p});return y.jsx(kk,{scope:r,name:n,required:i,disabled:s,value:g,onValueChange:m,children:y.jsx(Ck,{asChild:!0,...h,orientation:l,dir:b,loop:u,children:y.jsx($e.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":s?"":void 0,dir:b,...f,ref:t})})})});Bp.displayName=fs;var Hp="RadioGroupItem",zp=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...o}=e,a=jk(Hp,r),i=a.disabled||n,s=Fp(r),l=Lp(r),c=v.useRef(null),u=Pe(t,c),p=a.value===o.value,f=v.useRef(!1);return v.useEffect(()=>{const h=g=>{Nk.includes(g.key)&&(f.current=!0)},b=()=>f.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",b)}},[]),y.jsx(_k,{asChild:!0,...s,focusable:!i,active:p,children:y.jsx(Dp,{disabled:i,required:a.required,checked:p,...l,...o,name:a.name,ref:u,onCheck:()=>a.onValueChange(o.value),onKeyDown:Se(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Se(o.onFocus,()=>{var h;f.current&&((h=c.current)==null||h.click())})})})});zp.displayName=Hp;var Ik="RadioGroupIndicator",Up=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,o=Lp(r);return y.jsx(jp,{...o,...n,ref:t})});Up.displayName=Ik;var Gp=Bp,Wp=zp,Fk=Up;const Vp=v.forwardRef(({className:e,...t},r)=>y.jsx(Gp,{className:Me("ve-grid ve-gap-2",e),...t,ref:r}));Vp.displayName=Gp.displayName;const Ga=v.forwardRef(({className:e,...t},r)=>y.jsx(Wp,{ref:r,className:Me("ve-aspect-square ve-h-4 ve-w-4 ve-rounded-full ve-border ve-border-[#dcdcdc] ve-ring-offset focus:ve-outline-none focus-visible:ve-ring-2 focus-visible:ve-ring-offset-2 disabled:ve-cursor-not-allowed disabled:ve-opacity-50",e),...t,children:y.jsx(Fk,{className:"ve-flex ve-items-center ve-justify-center",children:y.jsx(gh,{className:"ve-h-2.5 ve-w-2.5 ve-fill-current ve-text-current"})})}));Ga.displayName=Wp.displayName;var Lk="Label",Yp=v.forwardRef((e,t)=>y.jsx($e.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Yp.displayName=Lk;var Kp=Yp;const Bk=po("ve-text-sm ve-font-medium ve-leading-none peer-disabled:ve-cursor-not-allowed peer-disabled:ve-opacity-70"),Wa=v.forwardRef(({className:e,...t},r)=>y.jsx(Kp,{ref:r,className:Me(Bk(),e),...t}));Wa.displayName=Kp.displayName;const Hk=["type.string","type.phone"],zk=e=>{for(const t of Hk)if(e.includes(t))return!0},Uk=e=>({type:"custom",label:e.label,render:({field:t,value:r,onChange:n})=>{const o=uk(e.filter),a=i=>{n({field:(r==null?void 0:r.field)??"",constantValue:(r==null?void 0:r.constantValue)??"",constantValueEnabled:i})};return y.jsxs(y.Fragment,{children:[zk(e.filter.types)&&y.jsx(Gk,{constantValueEnabled:r==null?void 0:r.constantValueEnabled,toggleConstantValueEnabled:a}),r!=null&&r.constantValueEnabled?y.jsx(ut.FieldLabel,{label:"Constant Value",className:"entityField-constantValue",children:y.jsx(ut.AutoField,{onChange:i=>n({field:(r==null?void 0:r.field)??"",constantValue:i,constantValueEnabled:!0}),value:r==null?void 0:r.constantValue,field:{type:"text"}})}):y.jsx(ut.FieldLabel,{label:t.label||"Label is undefined",className:"ve-mt-2.5",children:y.jsx(ut.AutoField,{field:{type:"select",options:[{value:"",label:"Select a Content field"},...o.map(i=>({label:i.name,value:i.name}))]},onChange:i=>{n({field:i,constantValue:(r==null?void 0:r.constantValue)??"",constantValueEnabled:!1})},value:r==null?void 0:r.field})})]})}}),Gk=({constantValueEnabled:e,toggleConstantValueEnabled:t})=>y.jsx("div",{className:"ve-mb-2 ve-w-full",children:y.jsxs(Vp,{defaultValue:(e==null?void 0:e.toString())??"false",children:[y.jsxs("div",{className:"ve-flex ve-items-center ve-space-x-2",children:[y.jsx(Ga,{value:"false",id:"ve-use-entity-value",onClick:()=>t(!1)}),y.jsx(Wa,{htmlFor:"ve-use-entity-value",children:"Use Entity Value"})]}),y.jsxs("div",{className:"ve-flex ve-items-center ve-space-x-2",children:[y.jsx(Ga,{value:"true",id:"ve-use-constant-value",onClick:()=>t(!0)}),y.jsx(Wa,{htmlFor:"ve-use-constant-value",children:"Use Constant Value"})]})]})}),Wk=()=>{const[e,t]=d.useState();return Dt("getEntityDocument",Ne,(r,n)=>{t(n),r({status:"success",payload:{message:"getEntityDocument received"}})}),e},Va=JSON.stringify({root:{},content:[],zones:{}});function Vk(e,t){var s,l,c;if(!t)throw new Error("Unable to parse puck data, template name must be defined in config.");const{document:r}=e,n=r.visualConfigurations??[],o=r.pageLayouts??[],a=(s=r._site)==null?void 0:s.defaultLayouts;for(const u of n)if(u.pageSet===t){const p=JSON.parse(ha(u.data,t));return{...e,document:{...r,visualTemplate:p}}}for(const u of o)if(((l=u.visualConfiguration)==null?void 0:l.pageSet)===t){const p=JSON.parse(ha(u.visualConfiguration.data,t));return{...e,document:{...r,visualTemplate:p}}}if(a){for(const u of a)if(((c=u.visualConfiguration)==null?void 0:c.pageSet)===t){const p=JSON.parse(ha(u.visualConfiguration.data,t));return{...e,document:{...r,visualTemplate:p}}}}console.warn(`Unable to find puck data for pageSet: ${t}`);const i=JSON.parse(Va);return{...e,document:{...r,visualTemplate:i}}}function ha(e,t){if(!e||e.length<1)return console.warn(`Missing visual editor data for template: ${t}`),Va;try{JSON.parse(e)}catch{return console.warn(`Invalid visual editor data for template: ${t}`),Va}return e}const Yk=(e,t)=>{if(!(!t||typeof t!="object"||!("field"in t)||!("constantValue"in t))){if(t.constantValueEnabled)return t.constantValue;if(t.field!==""){try{const r=t.field.split(".");let n=!1,o=e;for(let a=0;a<r.length;a++)if((o==null?void 0:o[r[a]])!==void 0)o=o[r[a]];else{n=!0;break}if(!n)return o}catch(r){console.error("Error in resolveYextEntityField:",r)}console.warn(`The field ${t.field} was not found in the document.`)}}},qp=(e,t="")=>{const r={};for(const n in e){const o=e[n];"default"in o?r[n]=`var(--${t}-${n})`:"styles"in o&&(r[n]=qp(o.styles,`${t}-${n}`))}return r},Kk=e=>{const t={};for(const r in e){const n=e[r];t[r]=qp(n.styles,r)}return t},Xp=(e,t)=>{const r={...t};for(const n in e)if(n in e){const o=e[n],a=r[n];Fc(o)&&Fc(a)?r[n]=Xp(o,a):(o&&a&&console.warn(`Both theme.config.ts and tailwind.config.ts provided a value for ${n}. Using the value from theme.config.ts (${a})`),r[n]=a??o)}return r},Fc=e=>e!==null&&typeof e=="object",qk=(e,t)=>{const r=Kk(t);return Xp(e,r)};exports.ColorSelector=lp;exports.Editor=rk;exports.EntityField=Rb;exports.EntityFieldsProvider=ak;exports.YextEntityFieldSelector=Uk;exports.applyTheme=Db;exports.resolveVisualEditorData=Vk;exports.resolveYextEntityField=Yk;exports.themeResolver=qk;exports.useEntityFields=xp;exports.usePlatformBridgeDocument=Wk;exports.usePlatformBridgeEntityFields=nk;
|
|
176
|
+
`);function Un(e){return e.label!==void 0}var zD=3,UD="32px",GD=4e3,WD=356,VD=14,YD=20,KD=200;function qD(...e){return e.filter(Boolean).join(" ")}var XD=e=>{var t,r,n,o,a,i,s,l,c,u;let{invert:p,toast:f,unstyled:h,interacting:b,setHeights:g,visibleToasts:m,heights:w,index:C,toasts:E,expanded:_,removeToast:S,defaultRichColors:O,closeButton:M,style:I,cancelButtonStyle:U,actionButtonStyle:V,className:K="",descriptionClassName:F="",duration:Y,position:G,gap:te,loadingIcon:H,expandByDefault:oe,classNames:N,icons:Z,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:T,cn:D}=e,[k,z]=d.useState(!1),[W,L]=d.useState(!1),[q,X]=d.useState(!1),[re,J]=d.useState(!1),[Te,R]=d.useState(0),[Ae,Ie]=d.useState(0),Fe=d.useRef(null),ke=d.useRef(null),$t=C===0,Tt=C+1<=m,Ce=f.type,it=f.dismissible!==!1,Ur=f.className||"",At=f.descriptionClassName||"",gt=d.useMemo(()=>w.findIndex(ne=>ne.toastId===f.id)||0,[w,f.id]),Gr=d.useMemo(()=>{var ne;return(ne=f.closeButton)!=null?ne:M},[f.closeButton,M]),se=d.useMemo(()=>f.duration||Y||GD,[f.duration,Y]),ae=d.useRef(0),ue=d.useRef(0),Ke=d.useRef(0),Ze=d.useRef(null),[Wr,Vr]=G.split("-"),Tn=d.useMemo(()=>w.reduce((ne,ge,ve)=>ve>=gt?ne:ne+ge.height,0),[w,gt]),An=kD(),Fo=f.invert||p,Yr=Ce==="loading";ue.current=d.useMemo(()=>gt*te+Tn,[gt,Tn]),d.useEffect(()=>{z(!0)},[]),d.useLayoutEffect(()=>{if(!k)return;let ne=ke.current,ge=ne.style.height;ne.style.height="auto";let ve=ne.getBoundingClientRect().height;ne.style.height=ge,Ie(ve),g(De=>De.find(Le=>Le.toastId===f.id)?De.map(Le=>Le.toastId===f.id?{...Le,height:ve}:Le):[{toastId:f.id,height:ve,position:f.position},...De])},[k,f.title,f.description,g,f.id]);let st=d.useCallback(()=>{L(!0),R(ue.current),g(ne=>ne.filter(ge=>ge.toastId!==f.id)),setTimeout(()=>{S(f)},KD)},[f,S,g,ue]);d.useEffect(()=>{if(f.promise&&Ce==="loading"||f.duration===1/0||f.type==="loading")return;let ne,ge=se;return _||b||T&&An?(()=>{if(Ke.current<ae.current){let ve=new Date().getTime()-ae.current;ge=ge-ve}Ke.current=new Date().getTime()})():ge!==1/0&&(ae.current=new Date().getTime(),ne=setTimeout(()=>{var ve;(ve=f.onAutoClose)==null||ve.call(f,f),st()},ge)),()=>clearTimeout(ne)},[_,b,oe,f,se,st,f.promise,Ce,T,An]),d.useEffect(()=>{let ne=ke.current;if(ne){let ge=ne.getBoundingClientRect().height;return Ie(ge),g(ve=>[{toastId:f.id,height:ge,position:f.position},...ve]),()=>g(ve=>ve.filter(De=>De.toastId!==f.id))}},[g,f.id]),d.useEffect(()=>{f.delete&&st()},[st,f.delete]);function Lo(){return Z!=null&&Z.loading?d.createElement("div",{className:"sonner-loader","data-visible":Ce==="loading"},Z.loading):H?d.createElement("div",{className:"sonner-loader","data-visible":Ce==="loading"},H):d.createElement(RD,{visible:Ce==="loading"})}return d.createElement("li",{"aria-live":f.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:ke,className:D(K,Ur,N==null?void 0:N.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,N==null?void 0:N.default,N==null?void 0:N[Ce],(r=f==null?void 0:f.classNames)==null?void 0:r[Ce]),"data-sonner-toast":"","data-rich-colors":(n=f.richColors)!=null?n:O,"data-styled":!(f.jsx||f.unstyled||h),"data-mounted":k,"data-promise":!!f.promise,"data-removed":W,"data-visible":Tt,"data-y-position":Wr,"data-x-position":Vr,"data-index":C,"data-front":$t,"data-swiping":q,"data-dismissible":it,"data-type":Ce,"data-invert":Fo,"data-swipe-out":re,"data-expanded":!!(_||oe&&k),style:{"--index":C,"--toasts-before":C,"--z-index":E.length-C,"--offset":`${W?Te:ue.current}px`,"--initial-height":oe?"auto":`${Ae}px`,...I,...f.style},onPointerDown:ne=>{Yr||!it||(Fe.current=new Date,R(ue.current),ne.target.setPointerCapture(ne.pointerId),ne.target.tagName!=="BUTTON"&&(X(!0),Ze.current={x:ne.clientX,y:ne.clientY}))},onPointerUp:()=>{var ne,ge,ve,De;if(re||!it)return;Ze.current=null;let Le=Number(((ne=ke.current)==null?void 0:ne.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Ot=new Date().getTime()-((ge=Fe.current)==null?void 0:ge.getTime()),On=Math.abs(Le)/Ot;if(Math.abs(Le)>=YD||On>.11){R(ue.current),(ve=f.onDismiss)==null||ve.call(f,f),st(),J(!0);return}(De=ke.current)==null||De.style.setProperty("--swipe-amount","0px"),X(!1)},onPointerMove:ne=>{var ge;if(!Ze.current||!it)return;let ve=ne.clientY-Ze.current.y,De=ne.clientX-Ze.current.x,Le=(Wr==="top"?Math.min:Math.max)(0,ve),Ot=ne.pointerType==="touch"?10:2;Math.abs(Le)>Ot?(ge=ke.current)==null||ge.style.setProperty("--swipe-amount",`${ve}px`):Math.abs(De)>Ot&&(Ze.current=null)}},Gr&&!f.jsx?d.createElement("button",{"aria-label":$,"data-disabled":Yr,"data-close-button":!0,onClick:Yr||!it?()=>{}:()=>{var ne;st(),(ne=f.onDismiss)==null||ne.call(f,f)},className:D(N==null?void 0:N.closeButton,(o=f==null?void 0:f.classNames)==null?void 0:o.closeButton)},d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},d.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,f.jsx||d.isValidElement(f.title)?f.jsx||f.title:d.createElement(d.Fragment,null,Ce||f.icon||f.promise?d.createElement("div",{"data-icon":"",className:D(N==null?void 0:N.icon,(a=f==null?void 0:f.classNames)==null?void 0:a.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Lo():null,f.type!=="loading"?f.icon||(Z==null?void 0:Z[Ce])||AD(Ce):null):null,d.createElement("div",{"data-content":"",className:D(N==null?void 0:N.content,(i=f==null?void 0:f.classNames)==null?void 0:i.content)},d.createElement("div",{"data-title":"",className:D(N==null?void 0:N.title,(s=f==null?void 0:f.classNames)==null?void 0:s.title)},f.title),f.description?d.createElement("div",{"data-description":"",className:D(F,At,N==null?void 0:N.description,(l=f==null?void 0:f.classNames)==null?void 0:l.description)},f.description):null),d.isValidElement(f.cancel)?f.cancel:f.cancel&&Un(f.cancel)?d.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||U,onClick:ne=>{var ge,ve;Un(f.cancel)&&it&&((ve=(ge=f.cancel).onClick)==null||ve.call(ge,ne),st())},className:D(N==null?void 0:N.cancelButton,(c=f==null?void 0:f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,d.isValidElement(f.action)?f.action:f.action&&Un(f.action)?d.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||V,onClick:ne=>{var ge,ve;Un(f.action)&&(ne.defaultPrevented||((ve=(ge=f.action).onClick)==null||ve.call(ge,ne),st()))},className:D(N==null?void 0:N.actionButton,(u=f==null?void 0:f.classNames)==null?void 0:u.actionButton)},f.action.label):null))};function Ic(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var JD=e=>{let{invert:t,position:r="bottom-right",hotkey:n=["altKey","KeyT"],expand:o,closeButton:a,className:i,offset:s,theme:l="light",richColors:c,duration:u,style:p,visibleToasts:f=zD,toastOptions:h,dir:b=Ic(),gap:g=VD,loadingIcon:m,icons:w,containerAriaLabel:C="Notifications",pauseWhenPageIsHidden:E,cn:_=qD}=e,[S,O]=d.useState([]),M=d.useMemo(()=>Array.from(new Set([r].concat(S.filter(T=>T.position).map(T=>T.position)))),[S,r]),[I,U]=d.useState([]),[V,K]=d.useState(!1),[F,Y]=d.useState(!1),[G,te]=d.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=d.useRef(null),oe=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=d.useRef(null),Z=d.useRef(!1),$=d.useCallback(T=>{var D;(D=S.find(k=>k.id===T.id))!=null&&D.delete||Ge.dismiss(T.id),O(k=>k.filter(({id:z})=>z!==T.id))},[S]);return d.useEffect(()=>Ge.subscribe(T=>{if(T.dismiss){O(D=>D.map(k=>k.id===T.id?{...k,delete:!0}:k));return}setTimeout(()=>{Ya.flushSync(()=>{O(D=>{let k=D.findIndex(z=>z.id===T.id);return k!==-1?[...D.slice(0,k),{...D[k],...T},...D.slice(k+1)]:[T,...D]})})})}),[]),d.useEffect(()=>{if(l!=="system"){te(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?te("dark"):te("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:T})=>{te(T?"dark":"light")})},[l]),d.useEffect(()=>{S.length<=1&&K(!1)},[S]),d.useEffect(()=>{let T=D=>{var k,z;n.every(W=>D[W]||D.code===W)&&(K(!0),(k=H.current)==null||k.focus()),D.code==="Escape"&&(document.activeElement===H.current||(z=H.current)!=null&&z.contains(document.activeElement))&&K(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[n]),d.useEffect(()=>{if(H.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,Z.current=!1)}},[H.current]),S.length?d.createElement("section",{"aria-label":`${C} ${oe}`,tabIndex:-1},M.map((T,D)=>{var k;let[z,W]=T.split("-");return d.createElement("ol",{key:T,dir:b==="auto"?Ic():b,tabIndex:-1,ref:H,className:i,"data-sonner-toaster":!0,"data-theme":G,"data-y-position":z,"data-x-position":W,style:{"--front-toast-height":`${((k=I[0])==null?void 0:k.height)||0}px`,"--offset":typeof s=="number"?`${s}px`:s||UD,"--width":`${WD}px`,"--gap":`${g}px`,...p},onBlur:L=>{Z.current&&!L.currentTarget.contains(L.relatedTarget)&&(Z.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:L=>{L.target instanceof HTMLElement&&L.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,N.current=L.relatedTarget)},onMouseEnter:()=>K(!0),onMouseMove:()=>K(!0),onMouseLeave:()=>{F||K(!1)},onPointerDown:L=>{L.target instanceof HTMLElement&&L.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},S.filter(L=>!L.position&&D===0||L.position===T).map((L,q)=>{var X,re;return d.createElement(XD,{key:L.id,icons:w,index:q,toast:L,defaultRichColors:c,duration:(X=h==null?void 0:h.duration)!=null?X:u,className:h==null?void 0:h.className,descriptionClassName:h==null?void 0:h.descriptionClassName,invert:t,visibleToasts:f,closeButton:(re=h==null?void 0:h.closeButton)!=null?re:a,interacting:F,position:T,style:h==null?void 0:h.style,unstyled:h==null?void 0:h.unstyled,classNames:h==null?void 0:h.classNames,cancelButtonStyle:h==null?void 0:h.cancelButtonStyle,actionButtonStyle:h==null?void 0:h.actionButtonStyle,removeToast:$,toasts:S.filter(J=>J.position==L.position),heights:I.filter(J=>J.position==L.position),setHeights:U,expandByDefault:o,gap:g,loadingIcon:m,expanded:V,pauseWhenPageIsHidden:E,cn:_})}))})):null};const ZD=({...e})=>{const{theme:t="system"}=TD();return y.jsx(JD,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:ve-bg-background group-[.toaster]:ve-text-foreground group-[.toaster]:ve-border-border group-[.toaster]:ve-shadow-lg",description:"group-[.toast]:ve-text-muted-foreground",actionButton:"group-[.toast]:ve-bg-primary group-[.toast]:ve-text-primary-foreground",cancelButton:"group-[.toast]:ve-bg-muted group-[.toast]:ve-text-muted-foreground"}},...e})},bp=(e,t,r="*")=>t==null?void 0:t.postMessage(e,{targetOrigin:r}),lt=(e,t)=>{const[r,n]=d.useState("pending");return mp(e,t,QD(n)),{sendToParent:a=>{if(!window.parent)throw new Error("Parent window has closed");n("pending");for(const i of t)bp({...a,type:e},window.parent,i)},status:r}},Dt=(e,t,r)=>{mp(e,t,(o,a,i)=>{const{type:s,payload:l}=o;s===e&&typeof r=="function"&&r(c=>bp({...c,type:e},i,a),l)})},mp=(e,t,r)=>{const[n,o]=d.useState(),[a,i]=d.useState(),s=d.useRef(),l=d.useRef();s.current=n,l.current=a;const c=d.useCallback(({origin:u,source:p,data:f})=>{var b;if((b=f==null?void 0:f.source)!=null&&b.startsWith("react-devtools")||!t.includes(u))return;const{type:h}=f;h===e&&(i(p),o(u),r(f,u,p))},[e,t,i,o,r]);d.useEffect(()=>(window.addEventListener("message",c),()=>window.removeEventListener("message",c)),[e,a,n,c])},QD=e=>(t,r,n)=>{const{status:o}=t;o==="success"?e("success"):o==="error"&&e("error")};class ek{constructor(t=!1){Kr(this,"enable",t=>{this.enabled=t,this.enabled&&console.log("[DEBUG] xYextDebug enabled")});Kr(this,"logData",(t,r)=>{this.enabled&&console.log("[DEBUG]",t,"-",r)});Kr(this,"logFunc",t=>{this.enabled&&console.log("[DEBUG] -->",t,"called")});Kr(this,"log",t=>{this.enabled&&console.log("[DEBUG]",t)});this.enabled=t,this.enabled&&console.log("[DEBUG] xYextDebug enabled")}}const tk={GLOBAL:"global",INDIVIDUAL:"individual"},Ne=["http://localhost","https://dev.yext.com","https://qa.yext.com","https://sandbox.yext.com","https://www.yext.com","https://app-qa.eu.yext.com","https://app.eu.yext.com"],xe=new ek,rk=({document:e,componentRegistry:t,themeConfig:r})=>{const[n,o]=d.useState(),[a,i]=d.useState(!1),[s,l]=d.useState(),[c,u]=d.useState(!1),[p,f]=d.useState(),[h,b]=d.useState(!1),[g,m]=d.useState(void 0),[w,C]=d.useState(void 0),[E,_]=d.useState(),[S,O]=d.useState(),[M,I]=d.useState(!1),[U,V]=d.useState(!1),[K,F]=d.useState({history:[{}],index:0}),[Y,G]=d.useState(!1),[te,H]=d.useState(),[oe,N]=d.useState(!1),[Z,$]=d.useState(void 0),[T,D]=d.useState(!1);e&&xe.logData("DOCUMENT",e);const k=d.useCallback(()=>E?$a(E.isDevMode&&!E.devOverride,E.role,E.templateId,E.layoutId,E.entityId):"",[E]),z=d.useCallback(()=>E?Ws(E.isDevMode,E.siteId,E.themeEntityId):"",[E]);d.useEffect(()=>{if(typeof window<"u"){const se=window.location.ancestorOrigins;se.length===0||!se[0].includes("pagescdn")&&!se[0].includes("yext.com")&&!se[0].includes("localhost")?window.location.assign("/404.html"):I(!0)}},[]),Dt("getTemplateMetadata",Ne,(se,ae)=>{const ue=t.get(ae.templateId);O(ue);const Ke=ae;_(ae),xe.enable(Ke.isxYextDebug),xe.logData("TEMPLATE_METADATA",Ke),xe.logData("PUCK_CONFIG",ue),se({status:"success",payload:{message:"payload received"}})}),d.useEffect(()=>{if(E!=null&&E.isDevMode)try{m(pageSets),C(siteStream)}catch{console.warn("pageSets are not defined")}},[E==null?void 0:E.isDevMode]);const W=()=>{E!=null&&E.isThemeMode?q():L()},L=()=>{xe.logFunc("clearVisualConfigLocalStorage"),window.localStorage.removeItem(k())},q=()=>{xe.logFunc("clearThemeLocalStorage"),window.localStorage.removeItem(z())},X=()=>{xe.logFunc("clearHistory"),W(),ke(),Ce()},re=d.useRef(!0);d.useEffect(()=>{if(re.current){re.current=!1;return}J(),Te()},[E,h,c,oe,T]);const J=d.useCallback(()=>{if(!c||!h||!E)return;if(xe.logFunc("loadPuckInitialHistory"),E.isDevMode&&!E.devOverride){const ue=window.localStorage.getItem(k());if(ue){xe.log("Dev Mode - Using localStorage");const Ke=JSON.parse(ue),Ze=Ke.length-1;o({histories:Ke,index:Ze,appendData:!1}),i(!0);return}xe.log("Dev Mode - No localStorage. Using data from Content"),s&&o({histories:[{id:"root",state:{data:s}}],appendData:!1}),i(!0);return}if(!p){W(),xe.log("Prod Mode - No saveState. Using data from Content"),s&&o({histories:[{id:"root",state:{data:s}}],appendData:!1}),i(!0);return}const se=window.localStorage.getItem(k());if(!se){xe.log("Prod Mode - No localStorage. Using saveState"),o({histories:s?[{id:"root",state:{data:s}},{id:p.hash,state:nn(p.history)}]:[{id:p.hash,state:nn(p.history)}],index:s?1:0,appendData:!1}),i(!0);return}const ae=JSON.parse(se).findIndex(ue=>ue.id===(p==null?void 0:p.hash));if(ae!==-1){xe.log("Prod Mode - Using localStorage"),o({histories:JSON.parse(se),index:ae,appendData:!1}),i(!0);return}W()},[o,i,W,$a]);d.useEffect(()=>{n&&xe.logData("PUCK_INITIAL_HISTORY",n)},[n]);const Te=d.useCallback(()=>{if(console.log(`themeData is ${JSON.stringify(te)}, themeSaveState is ${JSON.stringify(Z)}`),!(!T||!E||!E.isThemeMode)){if(xe.logFunc("loadThemeHistory"),E.isDevMode&&!E.devOverride){const se=window.localStorage.getItem(z());if(se){xe.log("Dev Mode - Using theme localStorage");const ae=JSON.parse(se),ue=ae.length-1;F({history:ae,index:ue}),G(!0);return}xe.log("Dev Mode - No localStorage. Using theme data from Content"),te&&(console.log(`starting fresh from content: ${te}`),F({history:[te],index:0})),G(!0);return}if(!Z){W(),xe.log("Prod Mode - No saveState. Using theme data from Content"),te&&F({history:[te],index:0}),G(!0);return}if(te){xe.log("Prod Mode - No themeLocalStorage. Using themeSaveState");const se=te?[te,...Z.history]:[...Z.history],ae={history:se,index:se.length-1};F(ae),G(!0),console.log(`themeInitialHistory is ${JSON.stringify(ae)}`);return}console.log("Setting blank now"),F({history:[{}],index:0}),G(!0)}},[F,G,W,Ws]),{sendToParent:R}=lt("iFrameLoaded",Ne),{sendToParent:Ae}=lt("sendDevSaveStateData",Ne);d.useEffect(()=>{R({payload:{message:"iFrame is loaded"}})},[]),d.useEffect(()=>{var se;if(E!=null&&E.isDevMode){const ae=window.localStorage.getItem(k()),ue=ae?JSON.parse(ae):[],Ke=JSON.stringify(ue.length>0?(se=ue[ue.length-1].data)==null?void 0:se.data:{});Ae({payload:{devSaveStateData:Ke}})}},[E]),Dt("getSaveState",Ne,(se,ae)=>{xe.logData("SAVE_STATE",ae),f(ae),b(!0),se({status:"success",payload:{message:"saveState received"}})}),Dt("getThemeSaveState",Ne,(se,ae)=>{xe.logData("THEME_SAVE_STATE",ae),console.log("themeSaveState",JSON.stringify(ae));const ue={history:ae!=null&&ae.history?nn(ae==null?void 0:ae.history):[],index:(ae==null?void 0:ae.index)??0};$(ue),D(!0),se({status:"success",payload:{message:"themeSaveState received"}})}),Dt("getVisualConfigurationData",Ne,(se,ae)=>{const ue=nn(ae.visualConfigurationData);xe.logData("VISUAL_CONFIGURATION_DATA",ue),l(ue),u(!0),se({status:"success",payload:{message:"getVisualConfigurationData received"}})}),Dt("getThemeData",Ne,(se,ae)=>{console.log(`payload in getThemeData is ${JSON.stringify(ae)}`);const ue=nn(ae);xe.logData("THEME_DATA",ue),H(ue),N(!0),se({status:"success",payload:{message:"getThemeData received"}})});const{sendToParent:Ie}=lt("pushPageSets",Ne);d.useEffect(()=>{typeof window<"u"&&(E!=null&&E.isDevMode)&&g&&Ie({payload:{...g,siteStream:w}})},[E==null?void 0:E.isDevMode,g]);const{sendToParent:Fe}=lt("saveSaveState",Ne),{sendToParent:ke}=lt("deleteSaveState",Ne),{sendToParent:$t}=lt("saveVisualConfigData",Ne),{sendToParent:Tt}=lt("saveThemeSaveState",Ne),{sendToParent:Ce}=lt("deleteThemeSaveState",Ne),{sendToParent:it}=lt("saveThemeData",Ne),{sendToParent:Ur}=lt("openQuickFind",Ne),At=se=>{(se.ctrlKey||se.metaKey)&&se.key==="k"&&Ur()};d.useEffect(()=>(window.addEventListener("keydown",At),()=>{window.removeEventListener("keydown",At)}),[]);const gt=!S||!E||!e||!h||!c||!a||E.isThemeMode&&(!oe||!T||!Y);d.useEffect(()=>{console.log("theme useEffect"),U&&K&&r&&(E!=null&&E.isThemeMode)&&(xe.logData("THEME_INITIAL_HISTORY",K),gi(K.history[K.index],r))},[K,r,U,E==null?void 0:E.isThemeMode]);const Gr=100*(!!S+!!E+!!e+h+c+a+(E!=null&&E.isThemeMode?oe+T+Y:0))/(E!=null&&E.isThemeMode?9:6);return y.jsxs(y.Fragment,{children:[gt?M&&y.jsx(SD,{progress:Gr}):y.jsx(gD,{puckConfig:S,isLoading:gt,puckInitialHistory:n,clearHistory:E.isDevMode&&!E.devOverride?W:X,templateMetadata:E,saveState:p,saveSaveState:Fe,saveVisualConfigData:$t,sendDevSaveStateData:Ae,saveThemeData:it,buildVisualConfigLocalStorageKey:k,devLogger:xe,themeConfig:r,themeData:te,saveThemeSaveState:Tt,themeHistory:K,setThemeHistory:F,setPuckRendered:V}),y.jsx(ZD,{closeButton:!0,richColors:!0})]})},nn=e=>JSON.parse(e.replace(/\\"/g,'"')),nk=()=>{const[e,t]=d.useState(void 0);return Dt("getTemplateStream",Ne,(r,n)=>{t(n.stream.schema.fields),r({status:"success",payload:{message:"templateStream received"}})}),Dt("getDevEntityFields",Ne,(r,n)=>{t(ok(n)),r({status:"success",payload:{message:"getDevEntityFields received"}})}),e},ok=e=>e.map(t=>({name:t.name,definition:{name:t.name,typeName:t.typeName,type:t.type,registryId:t.registryId,typeRegistryId:t.typeRegistryId,isList:t.isList},children:t.children??[]})),yp=v.createContext(void 0),ak=({entityFields:e,children:t})=>y.jsx(yp.Provider,{value:e,children:t}),xp=()=>{const e=v.useContext(yp);if(!e)throw new Error("useEntityFields must be used within a DocumentProvider");return e},ik=["uid","meta","slug","c_visualConfigurations","c_pages_layouts"],sk=[],wp=e=>Ep(e,""),Ep=(e,t)=>{var o,a,i;const r=t?`${t}.${e.name}`:e.name;if(sk.includes(Sp(e)))return[{name:r,schemaField:e}];if(e.definition.isList)return[];const n=[{name:r,schemaField:e}];if((o=e.children)!=null&&o.fields&&((i=(a=e.children)==null?void 0:a.fields)==null?void 0:i.length)>0)for(const s of e.children.fields)n.push(...Ep(s,r));return n},Sp=e=>e.definition.typeName||e.definition.typeRegistryId||Object.entries(e.definition.type)[0][1];function lk(e,t,r){const n=e.get(t)||[];return n.push(r),e.set(t,n),e}const ck=e=>e.reduce((t,r)=>{const n=wp(r);for(const o of n){const a=Sp(o.schemaField);a&&(t=lk(t,a,o.name))}return t},new Map),uk=e=>{let r=xp().filter(o=>!ik.includes(o.name));if(e!=null&&e.allowList){const o=r.map(a=>a.name);e.allowList.forEach(a=>{o.includes(a)||console.warn(`The entity field filter allowList included ${a}, which does not exist in the stream.`)}),r=r.filter(a=>e.allowList.includes(a.name))}e!=null&&e.disallowList&&(r=r.filter(o=>!e.disallowList.includes(o.name)));let n=[];for(const o of r){const a=wp(o);for(const i of a)n.push({...i.schemaField,name:i.name})}if(e!=null&&e.types){const o=ck(n),a=[];e.types.forEach(i=>{a.push(...n.filter(s=>{var l;return(l=o.get(i))==null?void 0:l.includes(s.name)}))}),n=a}return n};function Cp(e,t=[]){let r=[];function n(a,i){const s=v.createContext(i),l=r.length;r=[...r,i];const c=p=>{var w;const{scope:f,children:h,...b}=p,g=((w=f==null?void 0:f[e])==null?void 0:w[l])||s,m=v.useMemo(()=>b,Object.values(b));return y.jsx(g.Provider,{value:m,children:h})};c.displayName=a+"Provider";function u(p,f){var g;const h=((g=f==null?void 0:f[e])==null?void 0:g[l])||s,b=v.useContext(h);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[c,u]}const o=()=>{const a=r.map(i=>v.createContext(i));return function(s){const l=(s==null?void 0:s[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[n,fk(o,...t)]}function fk(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=n.reduce((s,{useScope:l,scopeName:c})=>{const p=l(a)[`__scope${c}`];return{...s,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function dk(e){const t=e+"CollectionProvider",[r,n]=zt(t),[o,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:b,children:g}=h,m=d.useRef(null),w=d.useRef(new Map).current;return y.jsx(o,{scope:b,itemMap:w,collectionRef:m,children:g})};i.displayName=t;const s=e+"CollectionSlot",l=d.forwardRef((h,b)=>{const{scope:g,children:m}=h,w=a(s,g),C=Pe(b,w.collectionRef);return y.jsx(Yt,{ref:C,children:m})});l.displayName=s;const c=e+"CollectionItemSlot",u="data-radix-collection-item",p=d.forwardRef((h,b)=>{const{scope:g,children:m,...w}=h,C=d.useRef(null),E=Pe(b,C),_=a(c,g);return d.useEffect(()=>(_.itemMap.set(C,{ref:C,...w}),()=>void _.itemMap.delete(C))),y.jsx(Yt,{[u]:"",ref:E,children:m})});p.displayName=c;function f(h){const b=a(e+"CollectionConsumer",h);return d.useCallback(()=>{const m=b.collectionRef.current;if(!m)return[];const w=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(b.itemMap.values()).sort((_,S)=>w.indexOf(_.ref.current)-w.indexOf(S.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:l,ItemSlot:p},f,n]}var pk=v.createContext(void 0);function _p(e){const t=v.useContext(pk);return e||t||"ltr"}var pa="rovingFocusGroup.onEntryFocus",hk={bubbles:!1,cancelable:!0},Io="RovingFocusGroup",[Ua,$p,gk]=dk(Io),[vk,Tp]=zt(Io,[gk]),[bk,mk]=vk(Io),Ap=v.forwardRef((e,t)=>y.jsx(Ua.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(Ua.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(yk,{...e,ref:t})})}));Ap.displayName=Io;var yk=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...p}=e,f=v.useRef(null),h=Pe(t,f),b=_p(a),[g=null,m]=gn({prop:i,defaultProp:s,onChange:l}),[w,C]=v.useState(!1),E=yt(c),_=$p(r),S=v.useRef(!1),[O,M]=v.useState(0);return v.useEffect(()=>{const I=f.current;if(I)return I.addEventListener(pa,E),()=>I.removeEventListener(pa,E)},[E]),y.jsx(bk,{scope:r,orientation:n,dir:b,loop:o,currentTabStopId:g,onItemFocus:v.useCallback(I=>m(I),[m]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>M(I=>I+1),[]),onFocusableItemRemove:v.useCallback(()=>M(I=>I-1),[]),children:y.jsx($e.div,{tabIndex:w||O===0?-1:0,"data-orientation":n,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{S.current=!0}),onFocus:Se(e.onFocus,I=>{const U=!S.current;if(I.target===I.currentTarget&&U&&!w){const V=new CustomEvent(pa,hk);if(I.currentTarget.dispatchEvent(V),!V.defaultPrevented){const K=_().filter(H=>H.focusable),F=K.find(H=>H.active),Y=K.find(H=>H.id===g),te=[F,Y,...K].filter(Boolean).map(H=>H.ref.current);Pp(te,u)}}S.current=!1}),onBlur:Se(e.onBlur,()=>C(!1))})})}),Op="RovingFocusGroupItem",Rp=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:a,...i}=e,s=ln(),l=a||s,c=mk(Op,r),u=c.currentTabStopId===l,p=$p(r),{onFocusableItemAdd:f,onFocusableItemRemove:h}=c;return v.useEffect(()=>{if(n)return f(),()=>h()},[n,f,h]),y.jsx(Ua.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:y.jsx($e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:Se(e.onMouseDown,b=>{n?c.onItemFocus(l):b.preventDefault()}),onFocus:Se(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Se(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){c.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const g=Ek(b,c.orientation,c.dir);if(g!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=p().filter(C=>C.focusable).map(C=>C.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const C=w.indexOf(b.currentTarget);w=c.loop?Sk(w,C+1):w.slice(C+1)}setTimeout(()=>Pp(w))}})})})});Rp.displayName=Op;var xk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ek(e,t,r){const n=wk(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return xk[n]}function Pp(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Sk(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Ck=Ap,_k=Rp;function $k(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var Mp=e=>{const{present:t,children:r}=e,n=Tk(t),o=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),a=Pe(n.ref,Ak(o));return typeof r=="function"||n.isPresent?v.cloneElement(o,{ref:a}):null};Mp.displayName="Presence";function Tk(e){const[t,r]=v.useState(),n=v.useRef({}),o=v.useRef(e),a=v.useRef("none"),i=e?"mounted":"unmounted",[s,l]=$k(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const c=Gn(n.current);a.current=s==="mounted"?c:"none"},[s]),mt(()=>{const c=n.current,u=o.current;if(u!==e){const f=a.current,h=Gn(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),mt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,p=h=>{const g=Gn(n.current).includes(h.animationName);if(h.target===t&&g&&(l("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},f=h=>{h.target===t&&(a.current=Gn(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(c=>{c&&(n.current=getComputedStyle(c)),r(c)},[])}}function Gn(e){return(e==null?void 0:e.animationName)||"none"}function Ak(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var us="Radio",[Ok,Np]=Cp(us),[Rk,Pk]=Ok(us),Dp=v.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:o=!1,required:a,disabled:i,value:s="on",onCheck:l,form:c,...u}=e,[p,f]=v.useState(null),h=Pe(t,m=>f(m)),b=v.useRef(!1),g=p?c||!!p.closest("form"):!0;return y.jsxs(Rk,{scope:r,checked:o,disabled:i,children:[y.jsx($e.button,{type:"button",role:"radio","aria-checked":o,"data-state":Ip(o),"data-disabled":i?"":void 0,disabled:i,value:s,...u,ref:h,onClick:Se(e.onClick,m=>{o||l==null||l(),g&&(b.current=m.isPropagationStopped(),b.current||m.stopPropagation())})}),g&&y.jsx(Mk,{control:p,bubbles:!b.current,name:n,value:s,checked:o,required:a,disabled:i,form:c,style:{transform:"translateX(-100%)"}})]})});Dp.displayName=us;var kp="RadioIndicator",jp=v.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...o}=e,a=Pk(kp,r);return y.jsx(Mp,{present:n||a.checked,children:y.jsx($e.span,{"data-state":Ip(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t})})});jp.displayName=kp;var Mk=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=v.useRef(null),i=Qu(r),s=ni(t);return v.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==r&&p){const f=new Event("click",{bubbles:n});p.call(l,r),l.dispatchEvent(f)}},[i,r,n]),y.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ip(e){return e?"checked":"unchecked"}var Nk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],fs="RadioGroup",[Dk,rj]=Cp(fs,[Tp,Np]),Fp=Tp(),Lp=Np(),[kk,jk]=Dk(fs),Bp=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:o,value:a,required:i=!1,disabled:s=!1,orientation:l,dir:c,loop:u=!0,onValueChange:p,...f}=e,h=Fp(r),b=_p(c),[g,m]=gn({prop:a,defaultProp:o,onChange:p});return y.jsx(kk,{scope:r,name:n,required:i,disabled:s,value:g,onValueChange:m,children:y.jsx(Ck,{asChild:!0,...h,orientation:l,dir:b,loop:u,children:y.jsx($e.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":s?"":void 0,dir:b,...f,ref:t})})})});Bp.displayName=fs;var Hp="RadioGroupItem",zp=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...o}=e,a=jk(Hp,r),i=a.disabled||n,s=Fp(r),l=Lp(r),c=v.useRef(null),u=Pe(t,c),p=a.value===o.value,f=v.useRef(!1);return v.useEffect(()=>{const h=g=>{Nk.includes(g.key)&&(f.current=!0)},b=()=>f.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",b)}},[]),y.jsx(_k,{asChild:!0,...s,focusable:!i,active:p,children:y.jsx(Dp,{disabled:i,required:a.required,checked:p,...l,...o,name:a.name,ref:u,onCheck:()=>a.onValueChange(o.value),onKeyDown:Se(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Se(o.onFocus,()=>{var h;f.current&&((h=c.current)==null||h.click())})})})});zp.displayName=Hp;var Ik="RadioGroupIndicator",Up=v.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,o=Lp(r);return y.jsx(jp,{...o,...n,ref:t})});Up.displayName=Ik;var Gp=Bp,Wp=zp,Fk=Up;const Vp=v.forwardRef(({className:e,...t},r)=>y.jsx(Gp,{className:Me("ve-grid ve-gap-2",e),...t,ref:r}));Vp.displayName=Gp.displayName;const Ga=v.forwardRef(({className:e,...t},r)=>y.jsx(Wp,{ref:r,className:Me("ve-aspect-square ve-h-4 ve-w-4 ve-rounded-full ve-border ve-border-[#dcdcdc] ve-ring-offset focus:ve-outline-none focus-visible:ve-ring-2 focus-visible:ve-ring-offset-2 disabled:ve-cursor-not-allowed disabled:ve-opacity-50",e),...t,children:y.jsx(Fk,{className:"ve-flex ve-items-center ve-justify-center",children:y.jsx(gh,{className:"ve-h-2.5 ve-w-2.5 ve-fill-current ve-text-current"})})}));Ga.displayName=Wp.displayName;var Lk="Label",Yp=v.forwardRef((e,t)=>y.jsx($e.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Yp.displayName=Lk;var Kp=Yp;const Bk=po("ve-text-sm ve-font-medium ve-leading-none peer-disabled:ve-cursor-not-allowed peer-disabled:ve-opacity-70"),Wa=v.forwardRef(({className:e,...t},r)=>y.jsx(Kp,{ref:r,className:Me(Bk(),e),...t}));Wa.displayName=Kp.displayName;const Hk=["type.string","type.phone"],zk=e=>{for(const t of Hk)if(e.includes(t))return!0},Uk=e=>({type:"custom",label:e.label,render:({field:t,value:r,onChange:n})=>{const o=uk(e.filter),a=i=>{n({field:(r==null?void 0:r.field)??"",constantValue:(r==null?void 0:r.constantValue)??"",constantValueEnabled:i})};return y.jsxs(y.Fragment,{children:[zk(e.filter.types)&&y.jsx(Gk,{constantValueEnabled:r==null?void 0:r.constantValueEnabled,toggleConstantValueEnabled:a}),r!=null&&r.constantValueEnabled?y.jsx(ut.FieldLabel,{label:"Constant Value",className:"entityField-constantValue",children:y.jsx(ut.AutoField,{onChange:i=>n({field:(r==null?void 0:r.field)??"",constantValue:i,constantValueEnabled:!0}),value:r==null?void 0:r.constantValue,field:{type:"text"}})}):y.jsx(ut.FieldLabel,{label:t.label||"Label is undefined",className:"ve-mt-2.5",children:y.jsx(ut.AutoField,{field:{type:"select",options:[{value:"",label:"Select a Content field"},...o.map(i=>({label:i.name,value:i.name}))]},onChange:i=>{n({field:i,constantValue:(r==null?void 0:r.constantValue)??"",constantValueEnabled:!1})},value:r==null?void 0:r.field})})]})}}),Gk=({constantValueEnabled:e,toggleConstantValueEnabled:t})=>y.jsx("div",{className:"ve-mb-2 ve-w-full",children:y.jsxs(Vp,{defaultValue:(e==null?void 0:e.toString())??"false",children:[y.jsxs("div",{className:"ve-flex ve-items-center ve-space-x-2",children:[y.jsx(Ga,{value:"false",id:"ve-use-entity-value",onClick:()=>t(!1)}),y.jsx(Wa,{htmlFor:"ve-use-entity-value",children:"Use Entity Value"})]}),y.jsxs("div",{className:"ve-flex ve-items-center ve-space-x-2",children:[y.jsx(Ga,{value:"true",id:"ve-use-constant-value",onClick:()=>t(!0)}),y.jsx(Wa,{htmlFor:"ve-use-constant-value",children:"Use Constant Value"})]})]})}),Wk=()=>{const[e,t]=d.useState();return Dt("getEntityDocument",Ne,(r,n)=>{t(n),r({status:"success",payload:{message:"getEntityDocument received"}})}),e},Va=JSON.stringify({root:{},content:[],zones:{}});function Vk(e,t){var s,l,c;if(!t)throw new Error("Unable to parse puck data, template name must be defined in config.");const{document:r}=e,n=r.visualConfigurations??[],o=r.pageLayouts??[],a=(s=r._site)==null?void 0:s.defaultLayouts;for(const u of n)if(u.pageSet===t){const p=JSON.parse(ha(u.data,t));return{...e,document:{...r,visualTemplate:p}}}for(const u of o)if(((l=u.visualConfiguration)==null?void 0:l.pageSet)===t){const p=JSON.parse(ha(u.visualConfiguration.data,t));return{...e,document:{...r,visualTemplate:p}}}if(a){for(const u of a)if(((c=u.visualConfiguration)==null?void 0:c.pageSet)===t){const p=JSON.parse(ha(u.visualConfiguration.data,t));return{...e,document:{...r,visualTemplate:p}}}}console.warn(`Unable to find puck data for pageSet: ${t}`);const i=JSON.parse(Va);return{...e,document:{...r,visualTemplate:i}}}function ha(e,t){if(!e||e.length<1)return console.warn(`Missing visual editor data for template: ${t}`),Va;try{JSON.parse(e)}catch{return console.warn(`Invalid visual editor data for template: ${t}`),Va}return e}const Yk=(e,t)=>{if(!(!t||typeof t!="object"||!("field"in t)||!("constantValue"in t))){if(t.constantValueEnabled)return t.constantValue;if(t.field!==""){try{const r=t.field.split(".");let n=!1,o=e;for(let a=0;a<r.length;a++)if((o==null?void 0:o[r[a]])!==void 0)o=o[r[a]];else{n=!0;break}if(!n)return o}catch(r){console.error("Error in resolveYextEntityField:",r)}console.warn(`The field ${t.field} was not found in the document.`)}}},qp=(e,t="")=>{const r={};for(const n in e){const o=e[n];"default"in o?r[n]=`var(--${t}-${n})`:"styles"in o&&(r[n]=qp(o.styles,`${t}-${n}`))}return r},Kk=e=>{const t={};for(const r in e){const n=e[r];t[r]=qp(n.styles,r)}return t},Xp=(e,t)=>{const r={...t};for(const n in e)if(n in e){const o=e[n],a=r[n];Fc(o)&&Fc(a)?r[n]=Xp(o,a):(o&&a&&console.warn(`Both theme.config.ts and tailwind.config.ts provided a value for ${n}. Using the value from theme.config.ts (${a})`),r[n]=a??o)}return r},Fc=e=>e!==null&&typeof e=="object",qk=(e,t)=>{const r=Kk(t);return Xp(e,r)};exports.ColorSelector=lp;exports.Editor=rk;exports.EntityField=Rb;exports.EntityFieldsProvider=ak;exports.YextEntityFieldSelector=Uk;exports.applyTheme=Db;exports.resolveVisualEditorData=Vk;exports.resolveYextEntityField=Yk;exports.themeResolver=qk;exports.useEntityFields=xp;exports.usePlatformBridgeDocument=Wk;exports.usePlatformBridgeEntityFields=nk;
|
package/dist/visual-editor.js
CHANGED
|
@@ -15564,11 +15564,16 @@ const pj = {
|
|
|
15564
15564
|
}), []);
|
|
15565
15565
|
const vt = !S || !E || !e || !h || !c || !a || E.isThemeMode && (!oe || !T || !Y);
|
|
15566
15566
|
We(() => {
|
|
15567
|
-
console.log("theme useEffect"), U && K && r && (we.logData("THEME_INITIAL_HISTORY", K), Ei(
|
|
15567
|
+
console.log("theme useEffect"), U && K && r && (E != null && E.isThemeMode) && (we.logData("THEME_INITIAL_HISTORY", K), Ei(
|
|
15568
15568
|
K.history[K.index],
|
|
15569
15569
|
r
|
|
15570
15570
|
));
|
|
15571
|
-
}, [
|
|
15571
|
+
}, [
|
|
15572
|
+
K,
|
|
15573
|
+
r,
|
|
15574
|
+
U,
|
|
15575
|
+
E == null ? void 0 : E.isThemeMode
|
|
15576
|
+
]);
|
|
15572
15577
|
const Vr = 100 * // @ts-expect-error adding bools is fine
|
|
15573
15578
|
(!!S + !!E + !!e + h + c + a + (E != null && E.isThemeMode ? oe + T + Y : 0)) / (E != null && E.isThemeMode ? 9 : 6);
|
|
15574
15579
|
return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
|