1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="08178979-fc54-407a-837c-ae9f439c5836",e._sentryDebugIdIdentifier="sentry-dbid-08178979-fc54-407a-837c-ae9f439c5836")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8427],{58427:(e,r,t)=>{t.r(r),t.d(r,{UnicornScene:()=>d,default:()=>c});var n=t(66774),o=t(36822),i={width:"100%",height:"100%",scale:1,production:!0,dpi:1.5,fps:60,altText:"Scene",className:"",lazyLoad:!0,showPlaceholderOnError:!0,showPlaceholderWhileLoading:!0},l=[15,24,30,60,120],u={container:{position:"relative",width:"var(--unicorn-width)",height:"var(--unicorn-height)"},errorWrapper:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},errorBox:{textAlign:"center",padding:"1rem",borderRadius:"0.5rem",backgroundColor:"rgb(254 242 242)",color:"rgb(239 68 68)"},errorTitle:{fontWeight:"600",marginBottom:"0.25rem"},errorMessage:{fontSize:"0.875rem",marginTop:"0.25rem"}};function d({projectId:e,jsonFilePath:r,sdkUrl:t="https://cdn.jsdelivr.net/gh/hiunicornstudio/[email protected]/dist/unicornStudio.umd.js",width:d=i.width,height:c=i.height,scale:s=i.scale,dpi:a=i.dpi,fps:f=i.fps,altText:h=i.altText,ariaLabel:p,className:g=i.className,lazyLoad:m=i.lazyLoad,production:y=i.production,placeholder:v,placeholderClassName:w,showPlaceholderOnError:b=i.showPlaceholderOnError,showPlaceholderWhileLoading:E=i.showPlaceholderWhileLoading,onLoad:S,onError:x}){let $=(0,n.useRef)(null),[k,L]=(0,n.useState)(!1),[j,I]=(0,n.useState)(!0),{isLoaded:C,error:N}=function(e){let[r,t]=(0,n.useState)(!1),[o,i]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{t(!0)},[]),u=(0,n.useCallback)(()=>{i(Error("Failed to load UnicornStudio script"))},[]);return(0,n.useEffect)(()=>{let r=document.querySelector(`script[src="${e}"]`);if(r)return"true"===r.getAttribute("data-loaded")?void t(!0):(r.addEventListener("load",l),r.addEventListener("error",u),()=>{r.removeEventListener("load",l),r.removeEventListener("error",u)});let n=document.createElement("script");return n.src=e,n.async=!0,n.addEventListener("load",()=>{n.setAttribute("data-loaded","true"),l()}),n.addEventListener("error",u),document.head.appendChild(n),()=>{n.parentNode&&(n.removeEventListener("load",l),n.removeEventListener("error",u))}},[e,l,u]),{isLoaded:r,error:o,handleScriptLoad:l,handleScriptError:u}}(t),{error:T}=function({elementRef:e,projectId:r,jsonFilePath:t,production:o,scale:i,dpi:u,fps:d,lazyLoad:c,altText:s,ariaLabel:a,isScriptLoaded:f,onLoad:h,onError:p}){let g=(0,n.useRef)(null),[m,y]=(0,n.useState)(null),v=(0,n.useRef)(!1),w=(0,n.useRef)(""),b=(0,n.useRef)(!1),E=(0,n.useMemo)(()=>(function(e,r){return e>=.25&&e<=1?l.includes(r)?null:`Invalid fps: ${r}. FPS must be one of: 15, 24, 30, 60, 120`:`Invalid scale: ${e}. Scale must be between 0.25 and 1.0`})(i,d),[i,d]),S=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(E!==S.current)if(S.current=E,E){let e=Error(E);y(e),null==p||p(e)}else y(null)},[E,p]);let x=(0,n.useCallback)(()=>{var e;(null==(e=g.current)?void 0:e.destroy)&&(g.current.destroy(),g.current=null),b.current=!1},[]),$=(0,n.useCallback)(async()=>{var n;if(!e.current||!f||E)return;if(b.current)return void console.log("Already initializing, skipping...");let l=`${r||""}-${t||""}-${i}-${u}-${d}-${o?"prod":"dev"}`;if(w.current===l&&g.current)return void console.log("Scene already initialized with this configuration, skipping...");w.current=l,v.current=!0,b.current=!0;try{let l;if(x(),!(null==(n=window.UnicornStudio)?void 0:n.addScene))throw Error("UnicornStudio.addScene not found");let f={elementId:e.current.id||`unicorn-${Math.random().toString(36).slice(2,11)}`,scale:i,dpi:u,fps:d,lazyLoad:c,altText:s,ariaLabel:a,production:o};if(e.current.id||(e.current.id=f.elementId),t)f.filePath=t;else if(r)f.projectId=r;else throw Error("No project ID or JSON file path provided");let p=new Promise((e,r)=>{l=setTimeout(()=>r(Error("Scene initialization timeout")),15e3)}),m=()=>{l&&clearTimeout(l)};try{let e=await Promise.race([window.UnicornStudio.addScene(f),p]);if(m(),e)g.current=e,v.current=!1,y(null),b.current=!1,null==h||h();else throw b.current=!1,Error("Failed to initialize scene")}catch(e){throw m(),e}}catch(t){let e=(t instanceof Error?t:Error("Unknown error")).message;e.includes("404")||e.includes("Failed to fetch")?e="Resource not found":e.includes("Network")||e.includes("network")?e="Network error occurred":e.includes("timeout")&&(e="Loading timeout");let r=Error(e);y(r),b.current=!1,null==p||p(r)}},[e,f,t,r,o,i,u,d,c,s,a,x,h,p,E]);return(0,n.useEffect)(()=>{f&&$()},[f,$]),(0,n.useEffect)(()=>x,[x]),(0,n.useEffect)(()=>{let e=`${r||""}-${t||""}-${i}-${u}-${d}-${o?"prod":"dev"}`;w.current!==e&&(v.current=!1,y(null),b.current=!1,w.current="")},[r,t,i,u,d,o]),{error:m}}({elementRef:$,projectId:e,jsonFilePath:r,production:y,scale:s,dpi:a,fps:f,lazyLoad:m,altText:h,ariaLabel:p||h,isScriptLoaded:C,onLoad:()=>{L(!0),null==S||S()},onError:x}),P=N||T;(0,n.useEffect)(()=>{I(function(){if("undefined"==typeof window)return!0;try{let e=document.createElement("canvas");return!!(e.getContext("webgl")||e.getContext("experimental-webgl"))}catch(e){return!1}}())},[]);let R=(v||w)&&(!j||E&&!k||b&&P),_="number"==typeof d?d:0,z="number"==typeof c?c:0,U="number"==typeof d&&"number"==typeof c,D={"--unicorn-width":"number"==typeof d?`${d}px`:d,"--unicorn-height":"number"==typeof c?`${c}px`:c};return(0,o.jsxs)("div",{ref:$,style:{...u.container,...D},className:g,children:[R&&(v||w)&&(0,o.jsx)("div",{style:{position:"absolute",inset:0},children:"string"==typeof v?(0,o.jsx)("img",{src:v,alt:h,style:{width:U?`${_}px`:"100%",height:U?`${z}px`:"100%",objectFit:"cover"}}):v||(w?(0,o.jsx)("div",{className:w,style:{width:"100%",height:"100%"},"aria-label":h}):null)}),P&&!R&&(0,o.jsx)("div",{style:u.errorWrapper,children:(0,o.jsxs)("div",{style:u.errorBox,children:[(0,o.jsx)("p",{style:u.errorTitle,children:"Error loading scene"}),(0,o.jsx)("p",{style:u.errorMessage,children:P.message})]})})]})}var c=d}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.