import{j as r}from"./query-vendor-CZu0EHPe.js";import{r as te}from"./react-vendor-0bvDbF03.js";import{b6 as le,b7 as ce,b8 as ue,b9 as de,ba as se,bb as me,bc as fe,bd as ge,be as pe,bf as he,bg as ye,bh as xe,bi as be,bj as we,bk as ve,bl as je,bm as B,bn as Se,bo as Ee,bp as Ne,bq as Ae,b0 as Oe,br as q,m as ae,b1 as z,bs as J}from"./index-DmqBj0U5.js";import{u as Te}from"./use-mobile-BN2Z-RJr.js";import{u as Ve}from"./i18n-vendor-Cl4-lKeC.js";import"./supabase-vendor-CNV44oIa.js";import"./helmet-vendor-NlTFkN97.js";const ke=(e,t,s)=>{const a=t-e;return((s-e)%a+a)%a+e};function ne(e,t){return le(e)?e[ke(0,e.length,t)]:e}function C(e){return typeof e=="object"&&!Array.isArray(e)}function re(e,t,s,a){return typeof e=="string"&&C(t)?ce(e,s,a):e instanceof NodeList?Array.from(e):Array.isArray(e)?e:[e]}function Fe(e,t,s){return e*(t+1)}function Q(e,t,s,a){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?s:a.get(t)??e}function Me(e,t,s){for(let a=0;a<e.length;a++){const i=e[a];i.at>t&&i.at<s&&(de(e,i),a--)}}function De(e,t,s,a,i,o){Me(e,i,o);for(let n=0;n<t.length;n++)e.push({value:t[n],at:ue(i,o,a[n]),easing:ne(s,n)})}function Re(e,t){for(let s=0;s<e.length;s++)e[s]=e[s]/(t+1)}function _e(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const Ie="easeInOut";function ze(e,{defaultTransition:t={},...s}={},a,i){const o=t.duration||.3,n=new Map,p=new Map,E={},N=new Map;let V=0,l=0,k=0;for(let A=0;A<e.length;A++){const m=e[A];if(typeof m=="string"){N.set(m,l);continue}else if(!Array.isArray(m)){N.set(m.name,Q(l,m.at,V,N));continue}let[x,h,f={}]=m;f.at!==void 0&&(l=Q(l,f.at,V,N));let c=0;const y=(u,b,g,w=0,v=0)=>{const d=Be(u),{delay:K=0,times:j=me(d),type:L="keyframes",repeat:R,repeatType:ot,repeatDelay:it=0,...ie}=b;let{ease:O=t.ease||"easeOut",duration:S}=b;const G=typeof K=="function"?K(w,v):K,H=d.length,P=he(L)?L:i?.[L];if(H<=2&&P){let F=100;if(H===2&&Ce(d)){const M=d[1]-d[0];F=Math.abs(M)}const _={...ie};S!==void 0&&(_.duration=ye(S));const I=fe(_,F,P);O=I.ease,S=I.duration}S??(S=o);const W=l+G;j.length===1&&j[0]===0&&(j[1]=1);const Z=j.length-d.length;if(Z>0&&ge(j,Z),d.length===1&&d.unshift(null),R){S=Fe(S,R);const F=[...d],_=[...j];O=Array.isArray(O)?[...O]:[O];const I=[...O];for(let M=0;M<R;M++){d.push(...F);for(let D=0;D<F.length;D++)j.push(_[D]+(M+1)),O.push(D===0?"linear":ne(I,D-1))}Re(j,R)}const $=W+S;De(g,d,O,j,W,$),c=Math.max(G+S,c),k=Math.max($,k)};if(se(x)){const u=U(x,p);y(h,f,X("default",u))}else{const u=re(x,h,a,E),b=u.length;for(let g=0;g<b;g++){h=h,f=f;const w=u[g],v=U(w,p);for(const d in h)y(h[d],Ke(f,d),X(d,v),g,b)}}V=l,l+=c}return p.forEach((A,m)=>{for(const x in A){const h=A[x];h.sort(_e);const f=[],c=[],y=[];for(let b=0;b<h.length;b++){const{at:g,value:w,easing:v}=h[b];f.push(w),c.push(pe(0,k,g)),y.push(v||"easeOut")}c[0]!==0&&(c.unshift(0),f.unshift(f[0]),y.unshift(Ie)),c[c.length-1]!==1&&(c.push(1),f.push(null)),n.has(m)||n.set(m,{keyframes:{},transition:{}});const u=n.get(m);u.keyframes[x]=f,u.transition[x]={...t,duration:k,ease:y,times:c,...s}}}),n}function U(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function X(e,t){return t[e]||(t[e]=[]),t[e]}function Be(e){return Array.isArray(e)?e:[e]}function Ke(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const Le=e=>typeof e=="number",Ce=e=>e.every(Le);function Ge(e,t){return e in t}class He extends xe{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,s){if(Ge(s,t)){const a=t[s];if(typeof a=="string"||typeof a=="number")return a}}getBaseTargetFromProps(){}removeValueFromRenderState(t,s){delete s.output[t]}measureInstanceViewportBox(){return be()}build(t,s){Object.assign(t.output,s)}renderInstance(t,{output:s}){Object.assign(t,s)}sortInstanceNodePosition(){return 0}}function Pe(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},s=we(e)?new ve(t):new je(t);s.mount(e),B.set(e,s)}function We(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},s=new He(t);s.mount(e),B.set(e,s)}function Ze(e,t){return se(e)||typeof e=="number"||typeof e=="string"&&!C(t)}function oe(e,t,s,a){const i=[];if(Ze(e,t))i.push(Se(e,C(t)&&t.default||t,s&&(s.default||s)));else{const o=re(e,t,a),n=o.length;for(let p=0;p<n;p++){const E=o[p],N=E instanceof Element?Pe:We;B.has(E)||N(E);const V=B.get(E),l={...s};"delay"in l&&typeof l.delay=="function"&&(l.delay=l.delay(p,n)),i.push(...Ee(V,{...t,transition:l},{}))}}return i}function $e(e,t,s){const a=[];return ze(e,t,s,{spring:Ne}).forEach(({keyframes:o,transition:n},p)=>{a.push(...oe(p,o,n))}),a}function qe(e){return Array.isArray(e)&&e.some(Array.isArray)}function Je(e){function t(s,a,i){let o=[];return qe(s)?o=$e(s,a,e):o=oe(s,a,i,e),new Ae(o)}return t}const T=Je(),Qe="https://cdn.storysparkle.org/landing_assets/magical-world-ancient-ruins.webp",Ue="https://cdn.storysparkle.org/landing_assets/magical-world-deep-blue-sea.webp",Xe="https://cdn.storysparkle.org/landing_assets/magical-world-deep-forest.webp",Ye="https://cdn.storysparkle.org/landing_assets/magical-world-floating-island.webp",et="https://cdn.storysparkle.org/landing_assets/magical-world-frozen-tundra.webp",tt="https://cdn.storysparkle.org/landing_assets/magical-world-high-tech-city.webp",st="https://cdn.storysparkle.org/landing_assets/magical-world-land-of-deserts.webp",at="https://cdn.storysparkle.org/landing_assets/magical-world-magical-kingdom.webp",nt="https://cdn.storysparkle.org/landing_assets/magical-world-mysterious-planet.webp",rt="https://cdn.storysparkle.org/landing_assets/polaroid-photo-frame.webp",Y=[{img:Qe,x:-280,y:-240,rotate:-32,stagger:0,huddle:38},{img:Xe,x:-60,y:-300,rotate:5,stagger:.04,huddle:-42},{img:nt,x:160,y:-250,rotate:18,stagger:.02,huddle:35},{img:Ye,x:-300,y:-30,rotate:-22,stagger:.06,huddle:-38},{img:et,x:-100,y:-70,rotate:-6,stagger:.01,huddle:44},{img:at,x:120,y:-50,rotate:14,stagger:.08,huddle:-33},{img:tt,x:-260,y:150,rotate:28,stagger:.03,huddle:40},{img:Ue,x:-20,y:140,rotate:10,stagger:.05,huddle:-45},{img:st,x:180,y:160,rotate:-22,stagger:.07,huddle:36}],ee=({img:e,cfg:t,scrollYProgress:s,isMobile:a})=>{const[i,o]=te.useState(0),n=typeof window<"u"&&a&&window.innerWidth>=768,p=a?n?.62:.24:1,E=a?n?260:100:180,N=a?n?325:125:220,V=a?n?33:13:17,l=a?n?21:8:14,k=a?n?218:84:152,A=a?n?213:82:150,m=.15+t.stagger,x=.55+t.stagger,h=z(s,[m,x],[0,t.x*p]),f=z(s,[m,x],[0,t.y*p]),c=z(s,[m,x],[t.huddle,t.rotate]),y=J(0),u=J(1),b=z([c,y],([g,w])=>g+w);return r.jsxs(ae.div,{className:"absolute cursor-pointer",style:{width:E,height:N,zIndex:i,x:h,y:f,rotate:b,scale:u},onHoverStart:()=>{o(50);const g=c.get(),v=t.rotate*.3-g;T(y,v,{duration:.3,ease:"easeOut"}),T(u,1.08,{duration:.3,ease:"easeOut"})},onHoverEnd:()=>{T(y,0,{duration:.3,ease:"easeOut"}),T(u,1,{duration:.3,ease:"easeOut"}),setTimeout(()=>o(0),300)},onTouchStart:()=>{o(50);const g=c.get(),v=t.rotate*.3-g;T(y,v,{duration:.3,ease:"easeOut"}),T(u,1.08,{duration:.3,ease:"easeOut"})},onTouchEnd:()=>{T(y,0,{duration:.3,ease:"easeOut"}),T(u,1,{duration:.3,ease:"easeOut"}),setTimeout(()=>o(0),300)},children:[r.jsx("img",{src:e,alt:"Story maker polaroid photo",role:"presentation",className:"absolute object-cover rounded-sm pointer-events-none",style:{top:V,left:l,width:k,height:A}}),r.jsx("img",{src:rt,alt:"Polaroid frame",role:"presentation",className:"absolute inset-0 w-full h-full pointer-events-none",draggable:!1})]})},pt=({flickerWritingImageSrc:e})=>{const t=te.useRef(null),s=Te(),{t:a}=Ve("landing"),{scrollYProgress:i}=Oe({target:t,offset:["start start","end end"]});return r.jsx(r.Fragment,{children:r.jsx("section",{ref:t,className:`relative ${s?"h-[250vh]":"h-[200vh]"}`,style:{background:"#FFE4E6"},children:r.jsx("div",{className:"sticky top-14 h-[calc(100vh-3.5rem)] flex flex-col overflow-hidden relative z-10",style:{background:"#FFE4E6"},children:s?r.jsxs("div",{className:"flex flex-col items-center px-4 pt-2 h-full ipad-portrait:!gap-2",children:[r.jsxs("h2",{className:"section-header text-[22px] ipad-portrait:!text-[28px] mb-1 leading-tight text-center",children:[a("storyMaker.heading"),r.jsx("br",{}),a("storyMaker.headingLine2")]}),r.jsx("h3",{className:"section-subtext text-sm ipad-portrait:!text-base mb-1 text-center max-w-xs ipad-portrait:!max-w-[480px] mx-auto",children:a("storyMaker.subtext")}),r.jsx("div",{className:"flex flex-col items-center gap-1 relative z-20",children:e&&r.jsx("img",{src:e,alt:"Flicker writing a story",className:"w-32 ipad-portrait:!w-56 rounded-lg"})}),r.jsx("div",{className:"relative flex-1 ipad-portrait:!flex-none ipad-portrait:!h-[55vh] w-full flex items-center justify-center",children:r.jsx("div",{className:"relative",style:{width:1,height:1,transform:"translate(0px, -120px)"},children:Y.map((o,n)=>r.jsx(ee,{img:o.img,cfg:o,scrollYProgress:i,isMobile:s},n))})}),r.jsx("div",{className:"flex flex-col items-center pb-4 -mt-16 ipad-portrait:!mt-4 relative z-20",children:r.jsx(q,{})})]}):r.jsxs("div",{className:"container mx-auto px-6 grid grid-cols-2 gap-12 items-center h-full",children:[r.jsx("div",{className:"relative flex items-center justify-center",style:{minHeight:600},children:r.jsx("div",{className:"relative",style:{width:1,height:1},children:Y.map((o,n)=>r.jsx(ee,{img:o.img,cfg:o,scrollYProgress:i,isMobile:s},n))})}),r.jsxs(ae.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"text-center flex flex-col items-center",children:[r.jsxs("h2",{className:"section-header mb-6 leading-tight",children:[a("storyMaker.heading"),r.jsx("br",{}),a("storyMaker.headingLine2")]}),r.jsx("h3",{className:"section-subtext mb-8 max-w-md",children:a("storyMaker.subtext")}),e&&r.jsx("img",{src:e,alt:"Flicker writing a story",className:"w-48 md:w-56 mb-8 rounded-lg"}),r.jsx(q,{})]})]})})})})};export{pt as default};
//# sourceMappingURL=StoryMakerSection-C7R_velo.js.map