{"version":3,"file":"CodeweaversVRM.BRd9GUe4.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/tRv6EYkqQU5RmKFBcrHW/65TqOhGnlhRkQamSQ26Y/CodeweaversVRM.js"],"sourcesContent":["// CodeweaversVRM.tsx - Application form component that loads Codeweavers broker finance plugin\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Codeweavers VRM Application Form\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CodeweaversVRM(props){const{apiKey,channelKey,maxWidth,minHeight,borderRadius,background}=props;const containerRef=React.useRef(null);const[error,setError]=React.useState(null);React.useEffect(()=>{let cancelled=false;const scriptId=\"codeweavers-platform-script\";async function ensureScript(){if(window.__cwScriptLoaded)return;if(!window.__cwLoading){window.__cwLoading=new Promise((resolve,reject)=>{try{let s=document.getElementById(scriptId);if(!s){s=document.createElement(\"script\");s.id=scriptId;s.async=true;s.src=`https://plugins.codeweavers.net/scripts/v1/platform/broker-finance?ApiKey=${encodeURIComponent(apiKey)}`;s.onload=()=>{window.__cwScriptLoaded=true;resolve();};s.onerror=()=>reject(new Error(\"Failed to load Codeweavers script\"));document.body.appendChild(s);}else{window.__cwScriptLoaded=true;resolve();}}catch(e){reject(e);}});}await window.__cwLoading;}async function init(){try{await ensureScript();const start=Date.now();while(!window.codeweavers?.main){if(Date.now()-start>8e3)throw new Error(\"Codeweavers not initialising\");await new Promise(r=>setTimeout(r,50));}if(cancelled)return;window.codeweavers.main({pluginContentDivId:\"cw-plugin-container\",channel:{key:channelKey||\"Retailer\"}});}catch(e){if(!cancelled)setError(e?.message||\"Initialisation error\");}}if(typeof window!==\"undefined\"){init();}return()=>{cancelled=true;};},[apiKey,channelKey]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,width:\"100%\",height:\"100%\",background,display:\"flex\",justifyContent:\"center\",alignItems:\"flex-start\",padding:\"20px\",boxSizing:\"border-box\",position:\"relative\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{maxWidth,width:\"100%\",minHeight,borderRadius,backgroundColor:\"white\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"div\",{id:\"cw-plugin-container\",style:{minHeight}}),error&&/*#__PURE__*/_jsxs(\"div\",{style:{color:\"red\",padding:20,fontSize:14,backgroundColor:\"#ffebee\",border:\"1px solid #ffcdd2\",borderRadius:8,margin:10},children:[\"Codeweavers error: \",error]})]})});}addPropertyControls(CodeweaversVRM,{apiKey:{type:ControlType.String,title:\"API Key\",defaultValue:\"EyfkOLLS6wEK8Ix1n6\"},channelKey:{type:ControlType.String,title:\"Channel Key\",defaultValue:\"Retailer\"},maxWidth:{type:ControlType.Number,title:\"Max Width\",defaultValue:900,min:320,max:2e3,unit:\"px\"},minHeight:{type:ControlType.Number,title:\"Min Height\",defaultValue:640,min:300,max:2e3,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:48,unit:\"px\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CodeweaversVRM\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CodeweaversVRM.map"],"mappings":"6MAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,SAAO,aAAW,WAAS,YAAU,eAAa,cAAY,EAAY,EAAaA,EAAa,KAAK,CAAM,CAAC,EAAM,GAAUC,EAAe,KAAK,CAAkrC,OAAjrC,MAAoB,CAAC,IAAI,EAAU,GAAY,EAAS,8BAA8B,eAAe,GAAc,CAAI,EAAO,mBAAwB,AAAwB,EAAO,cAAY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