{"version":3,"file":"AZBCCourtwideEmbed.Tf-eofUI.mjs","names":["React.useRef","React.useState","React.useMemo","React.useCallback","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","_e","c","init_jsx_runtime","ce","de","addPropertyControls","init_framer_DcxuU94H","ControlType","AZBCCourtwideEmbed","props","MeasuredEmbed","view","iframeRef","ready","setReady","iframeHeight","setIframeHeight","VIEW_HEIGHTS","embedOrigin","embedView","embedUrl","requestHeight","onMessage","frameWindow","event","data","candidate","iframe","nextHeight","style","init_AZBCCourtwideEmbed"],"sources":["https:/framerusercontent.com/modules/quWS192tXXJC3KiwmOzL/BB6rBbqaqhGmDoUQuopo/AZBCCourtwideEmbed.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const VIEW_HEIGHTS={schedule:950,memberships:900,classes:1400,\"class-finder\":1e3,\"class-packs\":600,summary:650,hours:430,prices:240};/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function AZBCCourtwideEmbed(props){const{view=\"schedule\",style}=props;return /*#__PURE__*/_jsx(MeasuredEmbed,{view:view,style:style},view);}function MeasuredEmbed({view,style}){const iframeRef=React.useRef(null);const[ready,setReady]=React.useState(false);const[iframeHeight,setIframeHeight]=React.useState(VIEW_HEIGHTS[view]);const embedOrigin=\"https://app.courtwide.com\";const embedView=view===\"classes\"?\"training\":view;const embedUrl=React.useMemo(()=>`${embedOrigin}/book/azbc/embed?view=${embedView}&footer=hidden`,[embedOrigin,embedView]);const requestHeight=React.useCallback(()=>{iframeRef.current?.contentWindow?.postMessage({type:\"courtwide:request-height\"},embedOrigin);},[embedOrigin]);const onMessage=React.useCallback(event=>{const frameWindow=iframeRef.current?.contentWindow;if(!frameWindow)return;if(event.origin!==embedOrigin)return;if(event.source!==frameWindow)return;const data=event.data;if(!data||typeof data!==\"object\")return;const candidate=data;if(candidate.type===\"courtwide:website-ready\"){requestHeight();return;}if(candidate.type===\"courtwide:website-scroll\"){if(typeof candidate.top!==\"number\"||!Number.isFinite(candidate.top)||candidate.top<0||candidate.top>1e4)return;const iframe=iframeRef.current;if(!iframe)return;window.scrollTo({top:Math.max(0,window.scrollY+iframe.getBoundingClientRect().top+candidate.top-100),behavior:window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches?\"auto\":\"smooth\"});return;}if(candidate.type!==\"courtwide:website-height\")return;if(typeof candidate.height!==\"number\"||!Number.isFinite(candidate.height)){return;}const nextHeight=candidate.height;if(nextHeight<100||nextHeight>1e4)return;// Apply both growth and shrinkage immediately, without a deferred reset.\nsetIframeHeight(Math.ceil(nextHeight));},[requestHeight,embedOrigin]);React.useEffect(()=>{if(typeof window===\"undefined\")return;window.addEventListener(\"message\",onMessage);window.addEventListener(\"pageshow\",requestHeight);window.addEventListener(\"resize\",requestHeight);setReady(true);return()=>{window.removeEventListener(\"message\",onMessage);window.removeEventListener(\"pageshow\",requestHeight);window.removeEventListener(\"resize\",requestHeight);};},[onMessage,requestHeight]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:iframeHeight,minHeight:0,display:\"block\"},children:ready?/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,title:\"AZBC schedule and booking\",src:embedUrl,onLoad:requestHeight,scrolling:\"no\",referrerPolicy:\"no-referrer\",style:{width:\"100%\",height:iframeHeight,border:0,display:\"block\"}}):/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{height:iframeHeight}})});}addPropertyControls(AZBCCourtwideEmbed,{view:{type:ControlType.Enum,title:\"View\",options:[\"schedule\",\"summary\",\"hours\",\"prices\",\"memberships\",\"classes\",\"class-finder\",\"class-packs\"],optionTitles:[\"schedule\",\"summary\",\"hours\",\"prices\",\"memberships\",\"classes\",\"class-finder\",\"class-packs\"],defaultValue:\"schedule\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AZBCCourtwideEmbed\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AZBCCourtwideEmbed.map"],"mappings":"A,oNAGG,SAAwBkB,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAW,SAAOC,EAAM,MAAoB,gBAAKC,EAAc,CAAM,OAAW,OAAK,EAAEC,CAAI,CAAE,CAAC,SAASD,EAAc,CAAC,OAAK,SAAO,CAAC,IAAME,EAAUtB,EAAa,IAAI,EAAO,CAACuB,EAAMC,GAAUvB,EAAe,EAAK,EAAO,CAACwB,EAAaC,GAAiBzB,EAAe0B,EAAaN,EAAK,EAAQO,EAAY,4BAAkCC,EAAUR,IAAO,UAAU,WAAWA,EAAWS,EAAS5B,MAAkB,GAAG0B,EAAY,wBAAwBC,EAAU,gBAAgB,CAACD,EAAYC,CAAS,CAAC,EAAQE,EAAc5B,MAAsB,CAACmB,EAAU,SAAS,eAAe,YAAY,CAAC,KAAK,0BAA0B,EAAEM,CAAW,CAAE,EAAE,CAACA,CAAW,CAAC,EAAQI,EAAU7B,EAAkB,GAAO,CAAC,IAAM8B,EAAYX,EAAU,SAAS,cAA0E,GAAzD,CAACW,GAAsBC,EAAM,SAASN,GAAsBM,EAAM,SAASD,EAAY,OAAO,IAAME,EAAKD,EAAM,KAAK,GAAG,CAACC,GAAM,OAAOA,GAAO,SAAS,OAAO,IAAMC,EAAUD,EAAK,GAAGC,EAAU,OAAO,0BAA0B,CAACL,EAAc,EAAE,MAAO,CAAC,GAAGK,EAAU,OAAO,2BAA2B,CAAC,GAAG,OAAOA,EAAU,KAAM,UAAU,CAAC,OAAO,SAASA,EAAU,GAAG,GAAGA,EAAU,IAAI,GAAGA,EAAU,IAAI,IAAI,OAAO,IAAMC,EAAOf,EAAU,QAAQ,GAAG,CAACe,EAAO,OAAO5B,EAAO,SAAS,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