{"version":3,"file":"TallyBookingEmbed.BCYSs6wI.mjs","names":["useRef","useState","useEffect","_jsx","__esmMin","init_ssg_sandbox_shims","window","_e","de","init_jsx_runtime","c","init_npm_react_18_3_1","ce","addPropertyControls","init_framer_BWzg2IRg","ControlType","TallyBookingEmbed","props","formId","minHeight","formHeight","hideTitle","transparentBackground","category","sevaName","price","style","wrapRef","frameRef","liveHeight","setLiveHeight","width","setWidth","params","cat","name","cost","src","el","update","ro","onMessage","h","parts","m","d","height","init_TallyBookingEmbed"],"sources":["https:/framerusercontent.com/modules/aChvGee7aLLEBTGYcS1l/SkGFuTV6sH2ETY5350xR/TallyBookingEmbed.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Embeds the GB SRS Brundavan seva booking form (Tally) and pre-selects the seva\n * the devotee was viewing, using the form's hidden fields.\n * The frame is sized so the whole form fits and only the page scrolls (no inner scrollbar).\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TallyBookingEmbed(props){const{formId,minHeight,formHeight,hideTitle,transparentBackground,category,sevaName,price,style}=props;const wrapRef=useRef(null);const frameRef=useRef(null);const[liveHeight,setLiveHeight]=useState(null);const[width,setWidth]=useState(760);const params=[\"alignLeft=1\",\"hideTitle=\"+(hideTitle?1:0),\"transparentBackground=\"+(transparentBackground?1:0)];const cat=(category||\"\").trim();const name=(sevaName||\"\").trim();const cost=(price||\"\").trim();if(cat)params.push(\"seva_category=\"+encodeURIComponent(cat));if(name&&cost)params.push(\"seva_item=\"+encodeURIComponent(name+\" – \"+cost));const src=\"https://tally.so/embed/\"+formId+\"?\"+params.join(\"&\");// Track the width the form is drawn at: narrower screens wrap more, so the form is taller.\nuseEffect(()=>{const el=wrapRef.current;if(!el)return;const update=()=>setWidth(el.getBoundingClientRect().width||760);update();if(typeof ResizeObserver===\"undefined\")return;const ro=new ResizeObserver(update);ro.observe(el);return()=>ro.disconnect();},[]);// If Tally reports its real height, follow it (any common format).\nuseEffect(()=>{const onMessage=e=>{try{if(!frameRef.current||e.source!==frameRef.current.contentWindow)return;let h=0;if(typeof e.data===\"string\"){if(e.data.indexOf(\"[iFrameSizer]\")===0){const parts=e.data.slice(13).split(\":\");if(parts[0].indexOf(\"message\")===-1)h=Number(parts[1]);}else{const m=e.data.match(/\"height\"\\s*:\\s*\"?(\\d+(?:\\.\\d+)?)/i);if(m)h=Number(m[1]);}}else if(e.data&&typeof e.data===\"object\"){const d=e.data;h=Number(d.payload&&d.payload.height||d.height||0);}if(h>300)setLiveHeight(Math.ceil(h)+8);}catch(err){}};window.addEventListener(\"message\",onMessage);return()=>window.removeEventListener(\"message\",onMessage);},[]);// Fixed frame height, slightly taller than the form (about 2200px at every width), so nothing scrolls inside the frame.\nconst estimate=width>=480?2300:2350;const height=liveHeight||(formHeight&&formHeight>0?formHeight+(width<480?250:0):Math.max(minHeight,estimate));return /*#__PURE__*/_jsx(\"div\",{ref:wrapRef,style:{width:\"100%\",...style},children:/*#__PURE__*/_jsx(\"iframe\",{ref:frameRef,src:src,title:\"Book a seva\",width:\"100%\",height:height,style:{border:0,display:\"block\",width:\"100%\",height}},src)});}TallyBookingEmbed.defaultProps={formId:\"DqzzRj\",minHeight:900,formHeight:0,hideTitle:true,transparentBackground:true,category:\"\",sevaName:\"\",price:\"\"};addPropertyControls(TallyBookingEmbed,{formId:{type:ControlType.String,title:\"Tally form ID\",defaultValue:\"DqzzRj\"},formHeight:{type:ControlType.Number,title:\"Form height (0 = auto)\",defaultValue:0,min:0,max:6e3,step:50},minHeight:{type:ControlType.Number,title:\"Min height\",defaultValue:900,min:300,max:3e3,step:50},hideTitle:{type:ControlType.Boolean,title:\"Hide title\",defaultValue:true},transparentBackground:{type:ControlType.Boolean,title:\"Transparent bg\",defaultValue:true},category:{type:ControlType.String,title:\"Seva category\",defaultValue:\"\"},sevaName:{type:ControlType.String,title:\"Seva name\",defaultValue:\"\"},price:{type:ControlType.String,title:\"Price\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TallyBookingEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TallyBookingEmbed.map"],"mappings":"A,sMAMG,SAAwBgB,EAAkBC,EAAM,CAAC,GAAK,CAACC,SAAOC,YAAUC,aAAWC,YAAUC,wBAAsBC,WAASC,WAASC,QAAMC,SAAOT,EAAYU,EAAQ3B,EAAO,IAAI,EAAQ4B,EAAS5B,EAAO,IAAI,EAAO,CAAC6B,EAAWC,GAAe7B,EAAS,IAAI,EAAO,CAAC8B,EAAMC,GAAU/B,EAAS,GAAG,EAAQgC,EAAO,CAAC,cAAc,cAAcZ,KAAe,0BAA0BC,IAA0B,EAAQY,GAAKX,GAAU,GAAA,CAAI,KAAK,EAAQY,GAAMX,GAAU,GAAA,CAAI,KAAK,EAAQY,GAAMX,GAAO,GAAA,CAAI,KAAK,EAAKS,GAAID,EAAO,KAAK,iBAAiB,mBAAmBC,CAAG,CAAC,EAAKC,GAAMC,GAAKH,EAAO,KAAK,aAAa,mBAAmBE,EAAK,MAAMC,CAAI,CAAC,EAAE,IAAMC,EAAI,0BAA0BnB,EAAO,IAAIe,EAAO,KAAK,GAAG,EAC1rB/B,MAAc,CAAC,IAAMoC,EAAGX,EAAQ,QAAQ,GAAG,CAACW,EAAG,OAAO,IAAMC,MAAWP,EAASM,EAAG,sBAAsB,CAAC,CAAC,OAAO,GAAG,EAAW,GAATC,EAAO,EAAK,OAAO,eAAiB,IAAY,OAAO,IAAMC,EAAG,IAAI,eAAeD,CAAM,EAAiB,OAAfC,EAAG,QAAQF,CAAE,MAAYE,EAAG,WAAW,CAAE,EAAE,CAAC,CAAC,EAC/PtC,MAAc,CAAC,IAAMuC,EAAU,GA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