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