import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as d,j as y}from"./index-CMkL1IIy.js";import{c as Rc}from"./client-CiuGHKKk.js";import{r as bs}from"./index-CiOmdJeW.js";import{_ as Ec}from"./preload-helper-BXl3LOEh.js";import{SplatPreview as Lc}from"./SplatPreview-D3bCUQ8P.js";import{t as ri}from"./ImageToGaussianModel-Buc7WHZd.js";const Ss=d.createContext({});function Ke(e){const t=d.useRef(null);return t.current===null&&(t.current=e()),t.current}const Ic=typeof window<"u",_n=Ic?d.useLayoutEffect:d.useEffect,Kn=d.createContext(null);function xs(e,t){e.indexOf(t)===-1&&e.push(t)}function ye(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ht=(e,t,n)=>n>t?t:n{};const Zt={},la=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ca=e=>typeof e=="object"&&e!==null,ua=e=>/^0[^.\s]+$/u.test(e);function ha(e){let t;return()=>(t===void 0&&(t=e()),t)}const Et=e=>e,Xe=(...e)=>e.reduce((t,n)=>i=>n(t(i))),ve=(e,t,n)=>{const i=t-e;return i?(n-e)/i:1};class Cs{constructor(){this.subscriptions=[]}add(t){return xs(this.subscriptions,t),()=>ye(this.subscriptions,t)}notify(t,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,i);else for(let r=0;re*1e3,Rt=e=>e/1e3,fa=(e,t)=>t?e*(1e3/t):0,Vc=(e,t,n)=>{const i=t-e;return((n-e)%i+i)%i+e},da=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Oc=1e-7,Fc=12;function jc(e,t,n,i,s){let r,o,a=0;do o=t+(n-t)/2,r=da(o,i,s)-e,r>0?n=o:t=o;while(Math.abs(r)>Oc&&++ajc(r,0,1,e,n);return r=>r===0||r===1?r:da(s(r),t,i)}const pa=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ps=e=>t=>1-e(1-t),ma=Ye(.33,1.53,.69,.99),Ts=Ps(ma),ga=pa(Ts),ya=e=>e>=1?1:(e*=2)<1?.5*Ts(e):.5*(2-Math.pow(2,-10*(e-1))),ks=e=>1-Math.sin(Math.acos(e)),va=Ps(ks),ba=pa(ks),Uc=Ye(.42,0,1,1),Nc=Ye(0,0,.58,1),Sa=Ye(.42,0,.58,1),xa=e=>Array.isArray(e)&&typeof e[0]!="number";function wa(e,t){return xa(e)?e[Vc(0,e.length,t)]:e}const Ca=e=>Array.isArray(e)&&typeof e[0]=="number",Bc={linear:Et,easeIn:Uc,easeInOut:Sa,easeOut:Nc,circIn:ks,circInOut:ba,circOut:va,backIn:Ts,backInOut:ga,backOut:ma,anticipate:ya},Gc=e=>typeof e=="string",cr=e=>{if(Ca(e)){ws(e.length===4);const[t,n,i,s]=e;return Ye(t,n,i,s)}else if(Gc(e))return Bc[e];return e},nn=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Hc(e){let t=new Set,n=new Set,i=!1,s=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){r.has(c)&&(l.schedule(c),e()),c(o)}const l={schedule:(c,u=!1,h=!1)=>{const m=h&&i?t:n;return u&&r.add(c),m.add(c),c},cancel:c=>{n.delete(c),r.delete(c)},process:c=>{if(o=c,i){s=!0;return}i=!0;const u=t;t=n,n=u,t.forEach(a),t.clear(),i=!1,s&&(s=!1,l.process(c))}};return l}const Wc=40;function Pa(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=nn.reduce((S,x)=>(S[x]=Hc(r),S),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:f,render:m,postRender:p}=o,v=()=>{const S=Zt.useManualTiming,x=S?s.timestamp:performance.now();n=!1,S||(s.delta=i?1e3/60:Math.max(Math.min(x-s.timestamp,Wc),1)),s.timestamp=x,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),h.process(s),f.process(s),m.process(s),p.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(v))},g=()=>{n=!0,i=!0,s.isProcessing||e(v)};return{schedule:nn.reduce((S,x)=>{const w=o[x];return S[x]=(P,A=!1,k=!1)=>(n||g(),w.schedule(P,A,k)),S},{}),cancel:S=>{for(let x=0;x(bn===void 0&&St.set(dt.isProcessing||Zt.useManualTiming?dt.timestamp:performance.now()),bn),set:e=>{bn=e,queueMicrotask(zc)}},Ta=e=>t=>typeof t=="string"&&t.startsWith(e),ka=Ta("--"),$c=Ta("var(--"),As=e=>$c(e)?_c.test(e.split("/*")[0].trim()):!1,_c=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ur(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const xe={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ge={...xe,transform:e=>Ht(0,1,e)},sn={...xe,default:1},Oe=e=>Math.round(e*1e5)/1e5,Ms=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Kc(e){return e==null}const Xc=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ds=(e,t)=>n=>!!(typeof n=="string"&&Xc.test(n)&&n.startsWith(e)||t&&!Kc(n)&&Object.prototype.hasOwnProperty.call(n,t)),Aa=(e,t,n)=>i=>{if(typeof i!="string")return i;const[s,r,o,a]=i.match(Ms);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Yc=e=>Ht(0,255,e),ai={...xe,transform:e=>Math.round(Yc(e))},se={test:Ds("rgb","red"),parse:Aa("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+ai.transform(e)+", "+ai.transform(t)+", "+ai.transform(n)+", "+Oe(Ge.transform(i))+")"};function qc(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const Fi={test:Ds("#"),parse:qc,transform:se.transform},qe=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),$t=qe("deg"),Gt=qe("%"),L=qe("px"),Zc=qe("vh"),Jc=qe("vw"),hr={...Gt,parse:e=>Gt.parse(e)/100,transform:e=>Gt.transform(e*100)},fe={test:Ds("hsl","hue"),parse:Aa("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Gt.transform(Oe(t))+", "+Gt.transform(Oe(n))+", "+Oe(Ge.transform(i))+")"},st={test:e=>se.test(e)||Fi.test(e)||fe.test(e),parse:e=>se.test(e)?se.parse(e):fe.test(e)?fe.parse(e):Fi.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?se.transform(e):fe.transform(e),getAnimatableNone:e=>{const t=st.parse(e);return t.alpha=0,st.transform(t)}},Qc=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function tu(e){return isNaN(e)&&typeof e=="string"&&(e.match(Ms)?.length||0)+(e.match(Qc)?.length||0)>0}const Ma="number",Da="color",eu="var",nu="var(",fr="${}",iu=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function be(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const a=t.replace(iu,l=>(st.test(l)?(i.color.push(r),s.push(Da),n.push(st.parse(l))):l.startsWith(nu)?(i.var.push(r),s.push(eu),n.push(l)):(i.number.push(r),s.push(Ma),n.push(parseFloat(l))),++r,fr)).split(fr);return{values:n,split:a,indexes:i,types:s}}function su(e){return be(e).values}function Ra({split:e,types:t}){const n=e.length;return i=>{let s="";for(let r=0;rtypeof e=="number"?0:st.test(e)?st.getAnimatableNone(e):e,au=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:ou(e);function lu(e){const t=be(e);return Ra(t)(t.values.map((i,s)=>au(i,t.split[s])))}const Ft={test:tu,parse:su,createTransformer:ru,getAnimatableNone:lu};function li(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function cu({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let s=0,r=0,o=0;if(!t)s=r=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=li(l,a,e+1/3),r=li(l,a,e),o=li(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:i}}function In(e,t){return n=>n>0?t:e}const Z=(e,t,n)=>e+(t-e)*n,ci=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},uu=[Fi,se,fe],hu=e=>uu.find(t=>t.test(e));function dr(e){const t=hu(e);if(!t)return!1;let n=t.parse(e);return t===fe&&(n=cu(n)),n}const pr=(e,t)=>{const n=dr(e),i=dr(t);if(!n||!i)return In(e,t);const s={...n};return r=>(s.red=ci(n.red,i.red,r),s.green=ci(n.green,i.green,r),s.blue=ci(n.blue,i.blue,r),s.alpha=Z(n.alpha,i.alpha,r),se.transform(s))},ji=new Set(["none","hidden"]);function fu(e,t){return ji.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function du(e,t){return n=>Z(e,t,n)}function Rs(e){return typeof e=="number"?du:typeof e=="string"?As(e)?In:st.test(e)?pr:gu:Array.isArray(e)?Ea:typeof e=="object"?st.test(e)?pr:pu:In}function Ea(e,t){const n=[...e],i=n.length,s=e.map((r,o)=>Rs(r)(r,t[o]));return r=>{for(let o=0;o{for(const r in i)n[r]=i[r](s);return n}}function mu(e,t){const n=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Ft.createTransformer(t),i=be(e),s=be(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?ji.has(e)&&!s.values.length||ji.has(t)&&!i.values.length?fu(e,t):Xe(Ea(mu(i,s),s.values),n):In(e,t)};function La(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Z(e,t,n):Rs(e)(e,t)}const yu=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>J.update(t,n),stop:()=>_t(t),now:()=>dt.isProcessing?dt.timestamp:St.now()}},Ia=(e,t,n=10)=>{let i="";const s=Math.max(Math.round(t/n),2);for(let r=0;r=Vn?1/0:t}function Va(e,t=100,n){const i=n({...e,keyframes:[0,t]}),s=Math.min(Es(i),Vn);return{type:"keyframes",ease:r=>i.next(s*r).value/t,duration:Rt(s)}}const et={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Ui(e,t){return e*Math.sqrt(1-t*t)}const vu=12;function bu(e,t,n){let i=n;for(let s=1;s{const u=c*o,h=u*e,f=u-n,m=Ui(c,o),p=Math.exp(-h);return ui-f/m*p},r=c=>{const h=c*o*e,f=h*n+n,m=Math.pow(o,2)*Math.pow(c,2)*e,p=Math.exp(-h),v=Ui(Math.pow(c,2),o);return(-s(c)+ui>0?-1:1)*((f-m)*p)/v}):(s=c=>{const u=Math.exp(-c*e),h=(c-n)*e+1;return-ui+u*h},r=c=>{const u=Math.exp(-c*e),h=(n-c)*(e*e);return u*h});const a=5/e,l=bu(s,r,a);if(e=Tt(e),isNaN(l))return{stiffness:et.stiffness,damping:et.damping,duration:e};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:e}}}const xu=["duration","bounce"],wu=["stiffness","damping","mass"];function mr(e,t){return t.some(n=>e[n]!==void 0)}function Cu(e){let t={velocity:et.velocity,stiffness:et.stiffness,damping:et.damping,mass:et.mass,isResolvedFromDuration:!1,...e};if(!mr(e,wu)&&mr(e,xu))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,r=2*Ht(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:et.mass,stiffness:s,damping:r}}else{const n=Su({...e,velocity:0});t={...t,...n,mass:et.mass},t.isResolvedFromDuration=!0}return t}function He(e=et.visualDuration,t=et.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:c,mass:u,duration:h,velocity:f,isResolvedFromDuration:m}=Cu({...n,velocity:-Rt(n.velocity||0)}),p=f||0,v=c/(2*Math.sqrt(l*u)),g=o-r,b=Rt(Math.sqrt(l/u)),C=Math.abs(g)<5;i||(i=C?et.restSpeed.granular:et.restSpeed.default),s||(s=C?et.restDelta.granular:et.restDelta.default);let S,x,w,P,A,k;if(v<1)w=Ui(b,v),P=(p+v*b*g)/w,S=M=>{const V=Math.exp(-v*b*M);return o-V*(P*Math.sin(w*M)+g*Math.cos(w*M))},A=v*b*P+g*w,k=v*b*g-P*w,x=M=>Math.exp(-v*b*M)*(A*Math.sin(w*M)+k*Math.cos(w*M));else if(v===1){S=V=>o-Math.exp(-b*V)*(g+(p+b*g)*V);const M=p+b*g;x=V=>Math.exp(-b*V)*(b*M*V-p)}else{const M=b*Math.sqrt(v*v-1);S=$=>{const N=Math.exp(-v*b*$),E=Math.min(M*$,300);return o-N*((p+v*b*g)*Math.sinh(E)+M*g*Math.cosh(E))/M};const V=(p+v*b*g)/M,G=v*b*V-g*M,X=v*b*g-V*M;x=$=>{const N=Math.exp(-v*b*$),E=Math.min(M*$,300);return N*(G*Math.sinh(E)+X*Math.cosh(E))}}const D={calculatedDuration:m&&h||null,velocity:M=>Tt(x(M)),next:M=>{if(!m&&v<1){const G=Math.exp(-v*b*M),X=Math.sin(w*M),$=Math.cos(w*M),N=o-G*(P*X+g*$),E=Tt(G*(A*X+k*$));return a.done=Math.abs(E)<=i&&Math.abs(o-N)<=s,a.value=a.done?o:N,a}const V=S(M);if(m)a.done=M>=h;else{const G=Tt(x(M));a.done=Math.abs(G)<=i&&Math.abs(o-V)<=s}return a.value=a.done?o:V,a},toString:()=>{const M=Math.min(Es(D),Vn),V=Ia(G=>D.next(M*G).value,M,30);return M+"ms "+V},toTransition:()=>{}};return D}He.applyToOptions=e=>{const t=Va(e,100,He);return e.ease=t.ease,e.duration=Tt(t.duration),e.type="keyframes",e};const Pu=5;function Oa(e,t,n){const i=Math.max(t-Pu,0);return fa(n-e(i),t-i)}function Ni({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=e[0],f={done:!1,value:h},m=k=>a!==void 0&&kl,p=k=>a===void 0?l:l===void 0||Math.abs(a-k)-v*Math.exp(-k/i),S=k=>b+C(k),x=k=>{const D=C(k),M=S(k);f.done=Math.abs(D)<=c,f.value=f.done?b:M};let w,P;const A=k=>{m(f.value)&&(w=k,P=He({keyframes:[f.value,p(f.value)],velocity:Oa(S,k,f.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return A(0),{calculatedDuration:null,next:k=>{let D=!1;return!P&&w===void 0&&(D=!0,x(k),A(k)),w!==void 0&&k>=w?P.next(k-w):(!D&&x(k),f)}}}function Tu(e,t,n){const i=[],s=n||Zt.mix||La,r=e.length-1;for(let o=0;ot[0];if(r===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Tu(t,i,s),l=a.length,c=u=>{if(o&&u1)for(;hc(Ht(e[0],e[r-1],u)):c}function ja(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=ve(0,t,i);e.push(Z(n,1,s))}}function Ua(e){const t=[0];return ja(t,e.length-1),t}function ku(e,t){return e.map(n=>n*t)}function Au(e,t){return e.map(()=>t||Sa).splice(0,e.length-1)}function Fe({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const s=xa(i)?i.map(cr):cr(i),r={done:!1,value:t[0]},o=ku(n&&n.length===t.length?n:Ua(t),e),a=Fa(o,t,{ease:Array.isArray(s)?s:Au(t,s)});return{calculatedDuration:e,next:l=>(r.value=a(l),r.done=l>=e,r)}}const Mu=e=>e!==null;function Xn(e,{repeat:t,repeatType:n="loop"},i,s=1){const r=e.filter(Mu),a=s<0||t&&n!=="loop"&&t%2===1?0:r.length-1;return!a||i===void 0?r[a]:i}const Du={decay:Ni,inertia:Ni,tween:Fe,keyframes:Fe,spring:He};function Na(e){typeof e.type=="string"&&(e.type=Du[e.type])}class Ls{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Ru=e=>e/100;class On extends Ls{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==St.now()&&this.tick(St.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Na(t);const{type:n=Fe,repeat:i=0,repeatDelay:s=0,repeatType:r,velocity:o=0}=t;let{keyframes:a}=t;const l=n||Fe;l!==Fe&&typeof a[0]!="number"&&(this.mixKeyframes=Xe(Ru,La(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});r==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Es(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(i+1)-s,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:i,totalDuration:s,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:c=0,keyframes:u,repeat:h,repeatType:f,repeatDelay:m,type:p,onUpdate:v,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-c*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?b<0:b>s;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let S=this.currentTime,x=i;if(h){const k=Math.min(this.currentTime,s)/a;let D=Math.floor(k),M=k%1;!M&&k>=1&&(M=1),M===1&&D--,D=Math.min(D,h+1),D%2&&(f==="reverse"?(M=1-M,m&&(M-=m/a)):f==="mirror"&&(x=o)),S=Ht(0,1,M)*a}let w;C?(this.delayState.value=u[0],w=this.delayState):w=x.next(S),r&&!C&&(w.value=r(w.value));let{done:P}=w;!C&&l!==null&&(P=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return A&&p!==Ni&&(w.value=Xn(u,this.options,g,this.speed)),v&&v(w.value),A&&this.finish(),w}then(t,n){return this.finished.then(t,n)}get duration(){return Rt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Rt(t)}get time(){return Rt(this.currentTime)}set time(t){t=Tt(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return Oa(i=>this.generator.next(i).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(St.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Rt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=yu,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(St.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Eu(e){for(let t=1;te*180/Math.PI,Bi=e=>{const t=re(Math.atan2(e[1],e[0]));return Gi(t)},Lu={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Bi,rotateZ:Bi,skewX:e=>re(Math.atan(e[1])),skewY:e=>re(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Gi=e=>(e=e%360,e<0&&(e+=360),e),gr=Bi,yr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Iu={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:yr,scaleY:vr,scale:e=>(yr(e)+vr(e))/2,rotateX:e=>Gi(re(Math.atan2(e[6],e[5]))),rotateY:e=>Gi(re(Math.atan2(-e[2],e[0]))),rotateZ:gr,rotate:gr,skewX:e=>re(Math.atan(e[4])),skewY:e=>re(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Hi(e){return e.includes("scale")?1:0}function Wi(e,t){if(!e||e==="none")return Hi(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=Iu,s=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Lu,s=a}if(!s)return Hi(t);const r=i[t],o=s[1].split(",").map(Ou);return typeof r=="function"?r(o):o[r]}const Vu=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Wi(n,t)};function Ou(e){return parseFloat(e.trim())}const we=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ce=new Set([...we,"pathRotation"]),br=e=>e===xe||e===L,Fu=new Set(["x","y","z"]),ju=we.filter(e=>!Fu.has(e));function Uu(e){const t=[];return ju.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const qt={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:i})=>{const s=e.max-e.min;return i==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:i})=>{const s=e.max-e.min;return i==="border-box"?s:s-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Wi(t,"x"),y:(e,{transform:t})=>Wi(t,"y")};qt.translateX=qt.x;qt.translateY=qt.y;const ae=new Set;let zi=!1,$i=!1,_i=!1;function Ba(){if($i){const e=Array.from(ae).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const s=Uu(i);s.length&&(n.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([r,o])=>{i.getValue(r)?.set(o)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}$i=!1,zi=!1,ae.forEach(e=>e.complete(_i)),ae.clear()}function Ga(){ae.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&($i=!0)})}function Nu(){_i=!0,Ga(),Ba(),_i=!1}class Is{constructor(t,n,i,s,r,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=s,this.element=r,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ae.add(this),zi||(zi=!0,J.read(Ga),J.resolveKeyframes(Ba))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:s}=this;if(t[0]===null){const r=s?.get(),o=t[t.length-1];if(r!==void 0)t[0]=r;else if(i&&n){const a=i.readValue(n,o);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=o),s&&r===void 0&&s.set(t[0])}Eu(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ae.delete(this)}cancel(){this.state==="scheduled"&&(ae.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Bu=e=>e.startsWith("--");function Ha(e,t,n){Bu(t)?e.style.setProperty(t,n):e.style[t]=n}const Gu={};function Wa(e,t){const n=ha(e);return()=>Gu[t]??n()}const Hu=Wa(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),za=Wa(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ve=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,Sr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ve([0,.65,.55,1]),circOut:Ve([.55,0,1,.45]),backIn:Ve([.31,.01,.66,-.59]),backOut:Ve([.33,1.53,.69,.99])};function $a(e,t){if(e)return typeof e=="function"?za()?Ia(e,t):"ease-out":Ca(e)?Ve(e):Array.isArray(e)?e.map(n=>$a(n,t)||Sr.easeOut):Sr[e]}function Wu(e,t,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const h=$a(a,s);Array.isArray(h)&&(u.easing=h);const f={delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function Vs(e){return typeof e=="function"&&"applyToOptions"in e}function zu({type:e,...t}){return Vs(e)&&za()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class _a extends Ls{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:i,keyframes:s,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!r,this.allowFlatten=o,this.options=t,ws(typeof t.type!="string");const c=zu(t);this.animation=Wu(n,i,s,c,r),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const u=Xn(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),Ha(n,i,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Rt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Rt(t)}get time(){return Rt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Tt(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:i,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Hu()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),i&&(this.animation.rangeEnd=i),Et):s(this)}}const Ka={anticipate:ya,backInOut:ga,circInOut:ba};function $u(e){return e in Ka}function _u(e){typeof e.ease=="string"&&$u(e.ease)&&(e.ease=Ka[e.ease])}const hi=10;class Ku extends _a{constructor(t){_u(t),Na(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:i,onComplete:s,element:r,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new On({...o,autoplay:!1}),l=Math.max(hi,St.now()-this.startTime),c=Ht(0,hi,l-hi),u=a.sample(l).value,{name:h}=this.options;r&&h&&Ha(r,h,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const xr=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ft.test(e)||e==="0")&&!e.startsWith("url("));function Xu(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function th(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:s,damping:r,type:o,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return Qu()&&n&&(Xa.has(n)||Ju.has(n)&&Zu(a))&&(n!=="transform"||!u)&&!c&&!i&&s!=="mirror"&&r!==0&&o!=="inertia"}const eh=40;class nh extends Ls{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=St.now();const f={autoplay:t,delay:n,type:i,repeat:s,repeatDelay:r,repeatType:o,name:l,motionValue:c,element:u,...h},m=u?.KeyframeResolver||Is;this.keyframeResolver=new m(a,(p,v,g)=>this.onKeyframesResolved(p,v,f,!g),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,i,s){this.keyframeResolver=void 0;const{name:r,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=i;this.resolvedAt=St.now();let h=!0;Yu(t,r,o,a)||(h=!1,(Zt.instantAnimations||!l)&&u?.(Xn(t,i,n)),t[0]=t[t.length-1],Ki(i),i.repeat=0);const m={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>eh?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:t},p=h&&!c&&th(m),v=m.motionValue?.owner?.current;let g;if(p)try{g=new Ku({...m,element:v})}catch{g=new On(m)}else g=new On(m);g.finished.then(()=>{this.notifyFinished()}).catch(Et),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Nu()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class ih{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;ii.attachTimeline(t));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return wr(this.animations,"duration")}get iterationDuration(){return wr(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(n=>n[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function wr(e,t){let n=0;for(let i=0;in&&(n=s)}return n}class sh extends ih{then(t,n){return this.finished.finally(t).then(()=>{})}}function Ya(e,t,n,i=0,s=1){const r=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),o=e.size,a=(o-1)*i;return typeof n=="function"?n(r,o):s===1?r*i:a-r*i}const Cr=30,rh=e=>!isNaN(parseFloat(e)),je={current:void 0};class oh{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const s=St.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=St.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=rh(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Cs);const i=this.events[t].add(n);return t==="change"?()=>{i(),J.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return je.current&&je.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=St.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Cr)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Cr);return fa(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Jt(e,t){return new oh(e,t)}function qa(e,t){if(e?.inherit&&t){const{inherit:n,...i}=e;return{...t,...i}}return e}function Os(e,t){const n=e?.[t]??e?.default??e;return n!==e?qa(n,e):n}const ah={type:"spring",stiffness:500,damping:25,restSpeed:10},lh=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ch={type:"keyframes",duration:.8},uh={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},hh=(e,{keyframes:t})=>t.length>2?ch:Ce.has(e)?e.startsWith("scale")?lh(t[1]):ah:uh,fh=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function dh(e){for(const t in e)if(!fh.has(t))return!0;return!1}const Fs=(e,t,n,i={},s,r)=>o=>{const a=Os(i,e)||{},l=a.delay||i.delay||0;let{elapsed:c=0}=i;c=c-Tt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:r?void 0:s};dh(a)||Object.assign(u,hh(e,u)),u.duration&&(u.duration=Tt(u.duration)),u.repeatDelay&&(u.repeatDelay=Tt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Ki(u),u.delay===0&&(h=!0)),(Zt.instantAnimations||Zt.skipAnimations||s?.shouldSkipAnimations||a.skipAnimations)&&(h=!0,Ki(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!r&&t.get()!==void 0){const f=Xn(u.keyframes,a);if(f!==void 0){J.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new On(u):new nh(u)},ph=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mh(e){const t=ph.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${n??i}`,s]}function Za(e,t,n=1){const[i,s]=mh(e);if(!i)return;const r=window.getComputedStyle(t).getPropertyValue(i);if(r){const o=r.trim();return la(o)?parseFloat(o):o}return As(s)?Za(s,t,n+1):s}function Pr(e){const t=[{},{}];return e?.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function js(e,t,n,i){if(typeof t=="function"){const[s,r]=Pr(i);t=t(n!==void 0?n:e.custom,s,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,r]=Pr(i);t=t(n!==void 0?n:e.custom,s,r)}return t}function le(e,t,n){const i=e.getProps();return js(i,t,n!==void 0?n:i.custom,e)}const Ja=new Set(["width","height","top","left","right","bottom",...we]),Xi=e=>Array.isArray(e);function gh(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Jt(n))}function yh(e){return Xi(e)?e[e.length-1]||0:e}function vh(e,t){const n=le(e,t);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const o in r){const a=yh(r[o]);gh(e,o,a)}}const at=e=>!!(e&&e.getVelocity);function bh(e){return!!(at(e)&&e.add)}function Yi(e,t){const n=e.getValue("willChange");if(bh(n))return n.add(t);if(!n&&Zt.WillChange){const i=new Zt.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function Us(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Sh="framerAppearId",Qa="data-"+Us(Sh);function tl(e){return e.props[Qa]}function xh({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function Ns(e,t,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:r,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();r=r?qa(r,l):l;const c=r?.reduceMotion,u=r?.skipAnimations;i&&(r=i);const h=[],f=s&&e.animationState&&e.animationState.getState()[s],m=r?.path;m&&m.animateVisualElement(e,a,r,n,h);for(const p in a){const v=e.getValue(p,e.latestValues[p]??null),g=a[p];if(g===void 0||f&&xh(f,p))continue;const b={delay:n,...Os(r||{},p)};u&&(b.skipAnimations=!0);const C=v.get();if(C!==void 0&&!v.isAnimating()&&!Array.isArray(g)&&g===C&&!b.velocity){J.update(()=>v.set(g));continue}let S=!1;if(window.MotionHandoffAnimation){const P=tl(e);if(P){const A=window.MotionHandoffAnimation(P,p,J);A!==null&&(b.startTime=A,S=!0)}}Yi(e,p);const x=c??e.shouldReduceMotion;v.start(Fs(p,v,g,x&&Ja.has(p)?{type:!1}:b,e,S));const w=v.animation;w&&h.push(w)}if(o){const p=()=>J.update(()=>{o&&vh(e,o)});h.length?Promise.all(h).then(p):p()}return h}function qi(e,t,n={}){const i=le(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const r=i?()=>Promise.all(Ns(e,i,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:h}=s;return wh(e,t,l,c,u,h,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,c]=a==="beforeChildren"?[r,o]:[o,r];return l().then(()=>c())}else return Promise.all([r(),o(n.delay)])}function wh(e,t,n=0,i=0,s=0,r=1,o){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(qi(l,t,{...o,delay:n+(typeof i=="function"?0:i)+Ya(e.variantChildren,l,i,s,r)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function Ch(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const s=t.map(r=>qi(e,r,n));i=Promise.all(s)}else if(typeof t=="string")i=qi(e,t,n);else{const s=typeof t=="function"?le(e,t,n.custom):t;i=Promise.all(Ns(e,s,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const Ph={test:e=>e==="auto",parse:e=>e},el=e=>t=>t.test(e),nl=[xe,L,Gt,$t,Jc,Zc,Ph],Tr=e=>nl.find(el(e));function Th(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ua(e):!0}const kh=new Set(["brightness","contrast","saturate","opacity"]);function Ah(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(Ms)||[];if(!i)return e;const s=n.replace(i,"");let r=kh.has(t)?1:0;return i!==n&&(r*=100),t+"("+r+s+")"}const Mh=/\b([a-z-]*)\(.*?\)/gu,Zi={...Ft,getAnimatableNone:e=>{const t=e.match(Mh);return t?t.map(Ah).join(" "):e}},Ji={...Ft,getAnimatableNone:e=>{const t=Ft.parse(e);return Ft.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},kr={...xe,transform:Math.round},Dh={rotate:$t,pathRotation:$t,rotateX:$t,rotateY:$t,rotateZ:$t,scale:sn,scaleX:sn,scaleY:sn,scaleZ:sn,skew:$t,skewX:$t,skewY:$t,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,transformPerspective:L,opacity:Ge,originX:hr,originY:hr,originZ:L},Fn={borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,top:L,right:L,bottom:L,left:L,inset:L,insetBlock:L,insetBlockStart:L,insetBlockEnd:L,insetInline:L,insetInlineStart:L,insetInlineEnd:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,paddingBlock:L,paddingBlockStart:L,paddingBlockEnd:L,paddingInline:L,paddingInlineStart:L,paddingInlineEnd:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,marginBlock:L,marginBlockStart:L,marginBlockEnd:L,marginInline:L,marginInlineStart:L,marginInlineEnd:L,fontSize:L,backgroundPositionX:L,backgroundPositionY:L,...Dh,zIndex:kr,fillOpacity:Ge,strokeOpacity:Ge,numOctaves:kr},Rh={...Fn,color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,filter:Zi,WebkitFilter:Zi,mask:Ji,WebkitMask:Ji},il=e=>Rh[e],Eh=new Set([Zi,Ji]);function sl(e,t){let n=il(e);return Eh.has(n)||(n=Ft),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Lh=new Set(["auto","none","0"]);function Ih(e,t,n){let i=0,s;for(;i{t.getValue(a).set(l)}),this.resolveNoneKeyframes()}}const Bs=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Gs(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const s=n?.[e]??i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(i=>i!=null)}const Qi=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Sn(e){return ca(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Hs}=Pa(queueMicrotask,!1),Vt={x:!1,y:!1};function rl(){return Vt.x||Vt.y}function Oh(e){return e==="x"||e==="y"?Vt[e]?null:(Vt[e]=!0,()=>{Vt[e]=!1}):Vt.x||Vt.y?null:(Vt.x=Vt.y=!0,()=>{Vt.x=Vt.y=!1})}function ol(e,t){const n=Gs(e),i=new AbortController,s={passive:!0,...t,signal:i.signal};return[n,s,()=>i.abort()]}function Fh(e){return!(e.pointerType==="touch"||rl())}function jh(e,t,n={}){const[i,s,r]=ol(e,n);return i.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",p)},h=g=>{c&&(c(g),c=void 0),u()},f=g=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(g))},m=()=>{a=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},p=g=>{if(g.pointerType!=="touch"){if(a){l=!0;return}h(g)}},v=g=>{if(!Fh(g))return;l=!1;const b=t(o,g);typeof b=="function"&&(c=b,o.addEventListener("pointerleave",p,s))};o.addEventListener("pointerenter",v,s),o.addEventListener("pointerdown",m,s)}),r}const al=(e,t)=>t?e===t?!0:al(e,t.parentElement):!1,Ws=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Uh=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Nh(e){return Uh.has(e.tagName)||e.isContentEditable===!0}const Bh=new Set(["INPUT","SELECT","TEXTAREA"]);function Gh(e){return Bh.has(e.tagName)||e.isContentEditable===!0}const xn=new WeakSet;function Ar(e){return t=>{t.key==="Enter"&&e(t)}}function fi(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Hh=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=Ar(()=>{if(xn.has(n))return;fi(n,"down");const s=Ar(()=>{fi(n,"up")}),r=()=>fi(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function Mr(e){return Ws(e)&&!rl()}const Dr=new WeakSet;function Wh(e,t,n={}){const[i,s,r]=ol(e,n),o=a=>{const l=a.currentTarget;if(!Mr(a)||Dr.has(a))return;xn.add(l),n.stopPropagation&&Dr.add(a);const c=t(l,a),u={...s,capture:!0},h=(p,v)=>{window.removeEventListener("pointerup",f,u),window.removeEventListener("pointercancel",m,u),xn.has(l)&&xn.delete(l),Mr(p)&&typeof c=="function"&&c(p,{success:v})},f=p=>{h(p,l===window||l===document||n.useGlobalTarget||al(l,p.target))},m=p=>{h(p,!1)};window.addEventListener("pointerup",f,u),window.addEventListener("pointercancel",m,u)};return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),Sn(a)&&(a.addEventListener("focus",c=>Hh(c,s)),!Nh(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),r}function Yn(e){return ca(e)&&"ownerSVGElement"in e}const wn=new WeakMap;let Cn;const ll=(e,t,n)=>(i,s)=>s&&s[0]?s[0][e+"Size"]:Yn(i)&&"getBBox"in i?i.getBBox()[t]:i[n],zh=ll("inline","width","offsetWidth"),$h=ll("block","height","offsetHeight");function _h({target:e,borderBoxSize:t}){wn.get(e)?.forEach(n=>{n(e,{get width(){return zh(e,t)},get height(){return $h(e,t)}})})}function Kh(e){e.forEach(_h)}function Xh(){typeof ResizeObserver>"u"||(Cn=new ResizeObserver(Kh))}function Yh(e,t){Cn||Xh();const n=Gs(e);return n.forEach(i=>{let s=wn.get(i);s||(s=new Set,wn.set(i,s)),s.add(t),Cn?.observe(i)}),()=>{n.forEach(i=>{const s=wn.get(i);s?.delete(t),s?.size||Cn?.unobserve(i)})}}const Pn=new Set;let de;function qh(){de=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Pn.forEach(t=>t(e))},window.addEventListener("resize",de)}function Zh(e){return Pn.add(e),de||qh(),()=>{Pn.delete(e),!Pn.size&&typeof de=="function"&&(window.removeEventListener("resize",de),de=void 0)}}function Rr(e,t){return typeof e=="function"?Zh(e):Yh(e,t)}function cl(e){return Yn(e)&&e.tagName==="svg"}function Jh(...e){const t=!Array.isArray(e[0]),n=t?0:-1,i=e[0+n],s=e[1+n],r=e[2+n],o=e[3+n],a=Fa(s,r,o);return t?a(i):a}const Qh=[...nl,st,Ft],tf=e=>Qh.find(el(e)),Er=()=>({translate:0,scale:1,origin:0,originPoint:0}),pe=()=>({x:Er(),y:Er()}),Lr=()=>({min:0,max:0}),it=()=>({x:Lr(),y:Lr()}),We=new WeakMap;function qn(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ze(e){return typeof e=="string"||Array.isArray(e)}const zs=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$s=["initial",...zs];function Zn(e){return qn(e.animate)||$s.some(t=>ze(e[t]))}function ul(e){return!!(Zn(e)||e.variants)}function ef(e,t,n){for(const i in t){const s=t[i],r=n[i];if(at(s))e.addValue(i,s);else if(at(r))e.addValue(i,Jt(s,{owner:e}));else if(r!==s)if(e.hasValue(i)){const o=e.getValue(i);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(i);e.addValue(i,Jt(o!==void 0?o:s,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const ts={current:null},hl={current:!1},nf=typeof window<"u";function sf(){if(hl.current=!0,!!nf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ts.current=e.matches;e.addEventListener("change",t),t()}else ts.current=!1}const Ir=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let jn={};function fl(e){jn=e}function rf(){return jn}class dl{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:s,skipAnimations:r,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Is,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=St.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(hl.current||sf(),this.shouldReduceMotion=ts.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),_t(this.notifyUpdate),_t(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&Xa.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,h=new _a({element:this.current,name:t,keyframes:a,times:l,ease:c,duration:Tt(u)}),f=o(h);this.valueSubscriptions.set(t,()=>{f(),h.cancel()});return}const i=Ce.has(t);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&J.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;typeof window<"u"&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),r&&r()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in jn){const n=jn[t];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):it()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;in.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=Jt(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(la(i)||ua(i))?i=parseFloat(i):!tf(i)&&Ft.test(n)&&(i=sl(t,n)),this.setBaseTarget(t,at(i)?i.get():i)),at(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const r=js(this.props,n,this.presenceContext?.custom);r&&(i=r[t])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!at(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Cs),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Hs.render(this.render)}}class pl extends dl{constructor(){super(...arguments),this.KeyframeResolver=Vh}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const i=t.style;return i?i[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;at(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Qt{constructor(t){this.isMounted=!1,this.node=t}update(){}}function ml({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function of({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function af(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function di(e){return e===void 0||e===1}function es({scale:e,scaleX:t,scaleY:n}){return!di(e)||!di(t)||!di(n)}function ie(e){return es(e)||gl(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function gl(e){return Vr(e.x)||Vr(e.y)}function Vr(e){return e&&e!=="0%"}function Un(e,t,n){const i=e-n,s=t*i;return n+s}function Or(e,t,n,i,s){return s!==void 0&&(e=Un(e,s,i)),Un(e,n,i)+t}function ns(e,t=0,n=1,i,s){e.min=Or(e.min,t,n,i,s),e.max=Or(e.max,t,n,i,s)}function yl(e,{x:t,y:n}){ns(e.x,t.translate,t.scale,t.originPoint),ns(e.y,n.translate,n.scale,n.originPoint)}const Fr=.999999999999,jr=1.0000000000001;function lf(e,t,n,i=!1){const s=n.length;if(!s)return;t.x=t.y=1;let r,o;for(let a=0;aFr&&(t.x=1),t.yFr&&(t.y=1)}function Bt(e,t){e.min+=t,e.max+=t}function Ur(e,t,n,i,s=.5){const r=Z(e.min,e.max,s);ns(e,t,n,r,i)}function Nr(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Tn(e,t,n){const i=n??e;Ur(e.x,Nr(t.x,i.x),t.scaleX,t.scale,t.originX),Ur(e.y,Nr(t.y,i.y),t.scaleY,t.scale,t.originY)}function vl(e,t){return ml(af(e.getBoundingClientRect(),t))}function cf(e,t,n){const i=vl(e,n),{scroll:s}=t;return s&&(Bt(i.x,s.offset.x),Bt(i.y,s.offset.y)),i}const uf={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hf=we.length;function ff(e,t,n){let i="",s=!0;for(let o=0;o{if(!t.target)return e;if(typeof e=="string")if(L.test(e))e=parseFloat(e);else return e;const n=Br(e,t.target.x),i=Br(e,t.target.y);return`${n}% ${i}%`}},df={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=Ft.parse(e);if(s.length>5)return i;const r=Ft.createTransformer(e),o=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const c=Z(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),r(s)}},is={borderRadius:{...Ae,applyTo:[...Bs]},borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomLeftRadius:Ae,borderBottomRightRadius:Ae,boxShadow:df};function Sl(e,{layout:t,layoutId:n}){return Ce.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!is[e]||e==="opacity")}function Ks(e,t,n){const i=e.style,s=t?.style,r={};if(!i)return r;for(const o in i)(at(i[o])||s&&at(s[o])||Sl(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(r[o]=i[o]);return r}function pf(e){return window.getComputedStyle(e)}class xl extends pl{constructor(){super(...arguments),this.type="html",this.renderInstance=bl}readValueFromInstance(t,n){if(Ce.has(n))return this.projection?.isProjecting?Hi(n):Vu(t,n);{const i=pf(t),s=(ka(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return vl(t,n)}build(t,n,i){_s(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return Ks(t,n,i)}}function mf(e,t){return e in t}class gf extends dl{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,n){if(mf(n,t)){const i=t[n];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,n){delete n.output[t]}measureInstanceViewportBox(){return it()}build(t,n){Object.assign(t.output,n)}renderInstance(t,{output:n}){Object.assign(t,n)}sortInstanceNodePosition(){return 0}}const yf={offset:"stroke-dashoffset",array:"stroke-dasharray"},vf={offset:"strokeDashoffset",array:"strokeDasharray"};function bf(e,t,n=1,i=0,s=!0){e.pathLength=1;const r=s?yf:vf;e[r.offset]=`${-i}`,e[r.array]=`${t} ${n}`}const Sf=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function wl(e,{attrX:t,attrY:n,attrScale:i,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...a},l,c,u){if(_s(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:f}=e;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete h.transformBox);for(const m of Sf)h[m]!==void 0&&(f[m]=h[m],delete h[m]);t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),i!==void 0&&(h.scale=i),s!==void 0&&bf(h,s,r,o,!1)}const Cl=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Pl=e=>typeof e=="string"&&e.toLowerCase()==="svg";function xf(e,t,n,i){bl(e,t,void 0,i);for(const s in t.attrs)e.setAttribute(Cl.has(s)?s:Us(s),t.attrs[s])}function Tl(e,t,n){const i=Ks(e,t,n);for(const s in e)if(at(e[s])||at(t[s])){const r=we.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[r]=e[s]}return i}class kl extends pl{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=it}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ce.has(n)){const i=il(n);return i&&i.default||0}return n=Cl.has(n)?n:Us(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return Tl(t,n,i)}build(t,n,i){wl(t,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,n,i,s){xf(t,n,i,s)}mount(t){this.isSVGTag=Pl(t.tagName),super.mount(t)}}const wf=$s.length;function Al(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Al(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:i})=>Ch(e,n,i)))}function kf(e){let t=Tf(e),n=Gr(),i=!0,s=!1;const r=c=>(u,h)=>{const f=le(e,h,c==="exit"?e.presenceContext?.custom:void 0);if(f){const{transition:m,transitionEnd:p,...v}=f;u={...u,...v,...p}}return u};function o(c){t=c(e)}function a(c){const{props:u}=e,h=Al(e.parent)||{},f=[],m=new Set;let p={},v=1/0;for(let b=0;bv&&w,M=!1;const V=Array.isArray(x)?x:[x];let G=V.reduce(r(C),{});P===!1&&(G={});const{prevResolvedValues:X={}}=S,$={...X,...G},N=I=>{D=!0,m.has(I)&&(M=!0,m.delete(I)),S.needsAnimating[I]=!0;const _=e.getValue(I);_&&(_.liveStyle=!1)};for(const I in $){const _=G[I],q=X[I];if(p.hasOwnProperty(I))continue;let lt=!1;Xi(_)&&Xi(q)?lt=!Ml(_,q)||k:lt=_!==q,lt?_!=null?N(I):m.add(I):_!==void 0&&m.has(I)?N(I):S.protectedKeys[I]=!0}S.prevProp=x,S.prevResolvedValues=G,S.isActive&&(p={...p,...G}),(i||s)&&e.blockInitialAnimation&&(D=!1);const E=A&&k;D&&(!E||M)&&f.push(...V.map(I=>{const _={type:C};if(typeof I=="string"&&(i||s)&&!E&&e.manuallyAnimateOnMount&&e.parent){const{parent:q}=e,lt=le(q,I);if(q.enteringChildren&<){const{delayChildren:Mt}=lt.transition||{};_.delay=Ya(q.enteringChildren,e,Mt)}}return{animation:I,options:_}}))}if(m.size){const b={};if(typeof u.initial!="boolean"){const C=le(e,Array.isArray(u.initial)?u.initial[0]:u.initial);C&&C.transition&&(b.transition=C.transition)}m.forEach(C=>{const S=e.getBaseTarget(C),x=e.getValue(C);x&&(x.liveStyle=!0),b[C]=S??null}),f.push({animation:b})}let g=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,s=!1,g?t(f):Promise.resolve()}function l(c,u){if(n[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(f=>f.animationState?.setActive(c,u)),n[c].isActive=u;const h=a(c);for(const f in n)n[f].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Gr(),s=!0}}}function Af(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ml(t,e):!1}function ne(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Gr(){return{animate:ne(!0),whileInView:ne(),whileHover:ne(),whileTap:ne(),whileDrag:ne(),whileFocus:ne(),exit:ne()}}function ss(e,t){e.min=t.min,e.max=t.max}function It(e,t){ss(e.x,t.x),ss(e.y,t.y)}function Hr(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Dl=1e-4,Mf=1-Dl,Df=1+Dl,Rl=.01,Rf=0-Rl,Ef=0+Rl;function xt(e){return e.max-e.min}function Lf(e,t,n){return Math.abs(e-t)<=n}function Wr(e,t,n,i=.5){e.origin=i,e.originPoint=Z(t.min,t.max,e.origin),e.scale=xt(n)/xt(t),e.translate=Z(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Mf&&e.scale<=Df||isNaN(e.scale))&&(e.scale=1),(e.translate>=Rf&&e.translate<=Ef||isNaN(e.translate))&&(e.translate=0)}function Ue(e,t,n,i){Wr(e.x,t.x,n.x,i?i.originX:void 0),Wr(e.y,t.y,n.y,i?i.originY:void 0)}function zr(e,t,n,i=0){const s=i?Z(n.min,n.max,i):n.min;e.min=s+t.min,e.max=e.min+xt(t)}function If(e,t,n,i){zr(e.x,t.x,n.x,i?.x),zr(e.y,t.y,n.y,i?.y)}function $r(e,t,n,i=0){const s=i?Z(n.min,n.max,i):n.min;e.min=t.min-s,e.max=e.min+xt(t)}function Nn(e,t,n,i){$r(e.x,t.x,n.x,i?.x),$r(e.y,t.y,n.y,i?.y)}function _r(e,t,n,i,s){return e-=t,e=Un(e,1/n,i),s!==void 0&&(e=Un(e,1/s,i)),e}function Vf(e,t=0,n=1,i=.5,s,r=e,o=e){if(Gt.test(t)&&(t=parseFloat(t),t=Z(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=Z(r.min,r.max,i);e===r&&(a-=t),e.min=_r(e.min,t,n,a,s),e.max=_r(e.max,t,n,a,s)}function Kr(e,t,[n,i,s],r,o){Vf(e,t[n],t[i],t[s],t.scale,r,o)}const Of=["x","scaleX","originX"],Ff=["y","scaleY","originY"];function Xr(e,t,n,i){Kr(e.x,t,Of,n?n.x:void 0,i?i.x:void 0),Kr(e.y,t,Ff,n?n.y:void 0,i?i.y:void 0)}function Yr(e){return e.translate===0&&e.scale===1}function El(e){return Yr(e.x)&&Yr(e.y)}function qr(e,t){return e.min===t.min&&e.max===t.max}function jf(e,t){return qr(e.x,t.x)&&qr(e.y,t.y)}function Zr(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ll(e,t){return Zr(e.x,t.x)&&Zr(e.y,t.y)}function Jr(e){return xt(e.x)/xt(e.y)}function Qr(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Nt(e){return[e("x"),e("y")]}function Uf(e,t,n){let i="";const s=e.x.translate/t.x,r=e.y.translate/t.y,o=n?.z||0;if((s||r||o)&&(i=`translate3d(${s}px, ${r}px, ${o}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:h,rotateX:f,rotateY:m,skewX:p,skewY:v}=n;c&&(i=`perspective(${c}px) ${i}`),u&&(i+=`rotate(${u}deg) `),h&&(i+=`rotate(${h}deg) `),f&&(i+=`rotateX(${f}deg) `),m&&(i+=`rotateY(${m}deg) `),p&&(i+=`skewX(${p}deg) `),v&&(i+=`skewY(${v}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(i+=`scale(${a}, ${l})`),i||"none"}const Nf=Bs.length,to=e=>typeof e=="string"?parseFloat(e):e,eo=e=>typeof e=="number"||L.test(e);function Bf(e,t,n,i,s,r){s?(e.opacity=Z(0,n.opacity??1,Gf(i)),e.opacityExit=Z(t.opacity??1,0,Hf(i))):r&&(e.opacity=Z(t.opacity??1,n.opacity??1,i));for(let o=0;oit?1:n(ve(e,t,i))}function Vl(e,t,n){const i=at(e)?e:Jt(e);return i.start(Fs("",i,t,n)),i.animation}function $e(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}const Wf=(e,t)=>e.depth-t.depth;class zf{constructor(){this.children=[],this.isDirty=!1}add(t){xs(this.children,t),this.isDirty=!0}remove(t){ye(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Wf),this.isDirty=!1,this.children.forEach(t)}}function $f(e,t){const n=St.now(),i=({timestamp:s})=>{const r=s-n;r>=t&&(_t(i),e(r-t))};return J.setup(i,!0),()=>_t(i)}function kn(e){return at(e)?e.get():e}class _f{constructor(){this.members=[]}add(t){xs(this.members,t);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===t||i===this.lead||i===this.prevLead)continue;const s=i.instance;(!s||s.isConnected===!1)&&!i.snapshot&&(ye(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(ye(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const i=this.members[n];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=i.options,{layoutDependency:r}=t.options;(s===void 0||s!==r)&&(t.resumeFrom=i,n&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const An={hasAnimatedSinceResize:!0,hasEverUpdated:!1},pi=["","X","Y","Z"],Kf=1e3;let Xf=0;function mi(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function Ol(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=tl(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",J,!(s||r))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&Ol(i)}function Fl({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(o={},a=t?.()){this.id=Xf++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Zf),this.nodes.forEach(id),this.nodes.forEach(sd),this.nodes.forEach(Jf)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;J.read(()=>{h=window.innerWidth}),e(o,()=>{const m=window.innerWidth;m!==h&&(h=m,this.root.updateBlockedByResize=!0,u&&u(),u=$f(f,250),An.hasAnimatedSinceResize&&(An.hasAnimatedSinceResize=!1,this.nodes.forEach(ro)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||cd,{onLayoutAnimationStart:v,onLayoutAnimationComplete:g}=c.getProps(),b=!this.targetLayout||!Ll(this.targetLayout,m),C=!h&&f;if(this.options.layoutRoot||this.resumeFrom||C||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...Os(p,"layout"),onPlay:v,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,C,S.path)}else h||ro(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),_t(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rd),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ol(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xt(this.snapshot.measuredBox.x)&&!xt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const A=P/1e3,k=w?.(A);k?(f.x.translate=k.x,f.x.scale=Z(o.x.scale,1,A),f.x.origin=o.x.origin,f.x.originPoint=o.x.originPoint,f.y.translate=k.y,f.y.scale=Z(o.y.scale,1,A),f.y.origin=o.y.origin,f.y.originPoint=o.y.originPoint):(oo(f.x,o.x,A),oo(f.y,o.y,A)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Nn(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ad(this.relativeTarget,this.relativeTargetOrigin,m,A),x&&jf(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=it()),It(x,this.relativeTarget)),g&&(this.animationValues=h,Bf(h,u,this.latestValues,A,S,C)),k&&k.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=k.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(_t(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=J.update(()=>{An.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Jt(0)),this.motionValue.jump(0,!1),this.currentAnimation=Vl(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Kf),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&jl(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||it();const h=xt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const f=xt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}It(a,l),Tn(a,u),Ue(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new _f),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&mi("z",o,c,this.animationValues);for(let u=0;uo.currentAnimation?.stop()),this.root.nodes.forEach(io),this.root.sharedNodes.clear()}}}function Yf(e){e.updateLayout()}function qf(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=e.layout,{animationType:s}=e.options,r=t.source!==e.layout.source;if(s==="size")Nt(u=>{const h=r?t.measuredBox[u]:t.layoutBox[u],f=xt(h);h.min=n[u].min,h.max=h.min+f});else if(s==="x"||s==="y"){const u=s==="x"?"y":"x";ss(r?t.measuredBox[u]:t.layoutBox[u],n[u])}else jl(s,t.layoutBox,n)&&Nt(u=>{const h=r?t.measuredBox[u]:t.layoutBox[u],f=xt(n[u]);h.max=h.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+f)});const o=pe();Ue(o,n,t.layoutBox);const a=pe();r?Ue(a,e.applyTransform(i,!0),t.measuredBox):Ue(a,n,t.layoutBox);const l=!El(o);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:f}=u;if(h&&f){const m=e.options.layoutAnchor||void 0,p=it();Nn(p,t.layoutBox,h.layoutBox,m);const v=it();Nn(v,n,f.layoutBox,m),Ll(p,v)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=p,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function Zf(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Jf(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Qf(e){e.clearSnapshot()}function io(e){e.clearMeasurements()}function td(e){e.isLayoutDirty=!0,e.updateLayout()}function so(e){e.isLayoutDirty=!1}function ed(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function nd(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ro(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function id(e){e.resolveTargetDelta()}function sd(e){e.calcProjection()}function rd(e){e.resetSkewAndRotation()}function od(e){e.removeLeadSnapshot()}function oo(e,t,n){e.translate=Z(t.translate,0,n),e.scale=Z(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function ao(e,t,n,i){e.min=Z(t.min,n.min,i),e.max=Z(t.max,n.max,i)}function ad(e,t,n,i){ao(e.x,t.x,n.x,i),ao(e.y,t.y,n.y,i)}function ld(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const cd={duration:.45,ease:[.4,0,.1,1]},lo=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),co=lo("applewebkit/")&&!lo("chrome/")?Math.round:Et;function uo(e){e.min=co(e.min),e.max=co(e.max)}function ud(e){uo(e.x),uo(e.y)}function jl(e,t,n){return e==="position"||e==="preserve-aspect"&&!Lf(Jr(t),Jr(n),.2)}function hd(e){return e!==e.root&&e.scroll?.wasRoot}const fd=Fl({attachResizeListener:(e,t)=>$e(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),gi={current:void 0},Ul=Fl({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!gi.current){const e=new fd({});e.mount(window),e.setOptions({layoutScroll:!0}),gi.current=e}return gi.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Jn=d.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function ho(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dd(...e){return t=>{let n=!1;const i=e.map(s=>{const r=ho(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s{const{width:f,height:m,top:p,left:v,right:g,bottom:b,direction:C}=l.current;if(t||r===!1||!a.current||!f||!m)return;const S=C==="rtl",x=n==="left"?S?`right: ${g}`:`left: ${v}`:S?`left: ${v}`:`right: ${g}`,w=i==="bottom"?`bottom: ${b}`:`top: ${p}`;a.current.dataset.motionPopId=o;const P=document.createElement("style");c&&(P.nonce=c);const A=s??document.head;return A.appendChild(P),P.sheet&&P.sheet.insertRule(` [data-motion-pop-id="${o}"] { position: absolute !important; width: ${f}px !important; height: ${m}px !important; ${x}px !important; ${w}px !important; } `),()=>{a.current?.removeAttribute("data-motion-pop-id"),A.contains(P)&&A.removeChild(P)}},[t]),y.jsx(md,{isPresent:t,childRef:a,sizeRef:l,pop:r,children:r===!1?e:d.cloneElement(e,{ref:h})})}const yd=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:r,mode:o,anchorX:a,anchorY:l,root:c})=>{const u=Ke(vd),h=d.useId(),f=d.useRef(n),m=d.useRef(i);_n(()=>{f.current=n,m.current=i});let p=!0,v=d.useMemo(()=>(p=!1,{id:h,initial:t,isPresent:n,custom:s,onExitComplete:g=>{u.set(g,!0);for(const b of u.values())if(!b)return;i&&i()},register:g=>(u.set(g,!1),()=>{u.delete(g),!f.current&&!u.size&&m.current?.()})}),[n,u,i]);return r&&p&&(v={...v}),d.useMemo(()=>{u.forEach((g,b)=>u.set(b,!1))},[n]),d.useEffect(()=>{!n&&!u.size&&i&&i()},[n]),e=y.jsx(gd,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),y.jsx(Kn.Provider,{value:v,children:e})};function vd(){return new Map}function Nl(e=!0){const t=d.useContext(Kn);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=t,r=d.useId();d.useEffect(()=>{if(e)return s(r)},[e]);const o=d.useCallback(()=>e&&i&&i(r),[r,i,e]);return!n&&i?[!1,o]:[!0]}const rn=e=>e.key||"";function fo(e){const t=[];return d.Children.forEach(e,n=>{d.isValidElement(n)&&t.push(n)}),t}const Qn=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:r="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,h]=Nl(o),f=d.useMemo(()=>fo(e),[e]),m=o&&!u?[]:f.map(rn),p=d.useRef(!0),v=d.useRef(f),g=Ke(()=>new Map),b=d.useRef(new Set),[C,S]=d.useState(f),[x,w]=d.useState(f);_n(()=>{p.current=!1,v.current=f;for(let k=0;k{const D=rn(k),M=o&&!u?!1:f===x||m.includes(D),V=()=>{if(b.current.has(D))return;if(g.has(D))b.current.add(D),g.set(D,!0);else return;let G=!0;g.forEach(X=>{X||(G=!1)}),G&&(A?.(),w(v.current),o&&h?.(),i&&i())};return y.jsx(yd,{isPresent:M,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:r,root:c,onExitComplete:M?void 0:V,anchorX:a,anchorY:l,children:k},D)})})},Bl=d.createContext({strict:!1}),po={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let mo=!1;function bd(){if(mo)return;const e={};for(const t in po)e[t]={isEnabled:n=>po[t].some(i=>!!n[i])};fl(e),mo=!0}function Gl(){return bd(),rf()}function Sd(e){const t=Gl();for(const n in e)t[n]={...t[n],...e[n]};fl(t)}const xd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Bn(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||xd.has(e)}let Hl=e=>!Bn(e);function wd(e){typeof e=="function"&&(Hl=t=>t.startsWith("on")?!Bn(t):e(t))}try{wd(require("@emotion/is-prop-valid").default)}catch{}function Cd(e,t,n){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||at(e[s])||(Hl(s)||n===!0&&Bn(s)||!t&&!Bn(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}const ti=d.createContext({});function Pd(e,t){if(Zn(e)){const{initial:n,animate:i}=e;return{initial:n===!1||ze(n)?n:void 0,animate:ze(i)?i:void 0}}return e.inherit!==!1?t:{}}function Td(e){const{initial:t,animate:n}=Pd(e,d.useContext(ti));return d.useMemo(()=>({initial:t,animate:n}),[go(t),go(n)])}function go(e){return Array.isArray(e)?e.join(" "):e}const Xs=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Wl(e,t,n){for(const i in t)!at(t[i])&&!Sl(i,n)&&(e[i]=t[i])}function kd({transformTemplate:e},t){return d.useMemo(()=>{const n=Xs();return _s(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ad(e,t){const n=e.style||{},i={};return Wl(i,n,e),Object.assign(i,kd(e,t)),i}function Md(e,t){const n={},i=Ad(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const zl=()=>({...Xs(),attrs:{}});function Dd(e,t,n,i){const s=d.useMemo(()=>{const r=zl();return wl(r,t,Pl(i),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};Wl(r,e.style,e),s.style={...r,...s.style}}return s}const Rd=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ys(e){return typeof e!="string"||e.includes("-")?!1:!!(Rd.indexOf(e)>-1||/[A-Z]/u.test(e))}function Ed(e,t,n,{latestValues:i},s,r=!1,o){const l=(o??Ys(e)?Dd:Md)(t,i,s,e),c=Cd(t,typeof e=="string",r),u=e!==d.Fragment?{...c,...l,ref:n}:{},{children:h}=t,f=d.useMemo(()=>at(h)?h.get():h,[h]);return d.createElement(e,{...u,children:f})}function Ld({scrapeMotionValuesFromProps:e,createRenderState:t},n,i,s){return{latestValues:Id(n,i,s,e),renderState:t()}}function Id(e,t,n,i){const s={},r=i(e,{});for(const f in r)s[f]=kn(r[f]);let{initial:o,animate:a}=e;const l=Zn(e),c=ul(e);t&&c&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!qn(h)){const f=Array.isArray(h)?h:[h];for(let m=0;m(t,n)=>{const i=d.useContext(ti),s=d.useContext(Kn),r=()=>Ld(e,t,i,s);return n?r():Ke(r)},Vd=$l({scrapeMotionValuesFromProps:Ks,createRenderState:Xs}),Od=$l({scrapeMotionValuesFromProps:Tl,createRenderState:zl}),Fd=Symbol.for("motionComponentSymbol");function jd(e,t,n){const i=d.useRef(n);d.useInsertionEffect(()=>{i.current=n});const s=d.useRef(null);return d.useCallback(r=>{r&&e.onMount?.(r),t&&(r?t.mount(r):t.unmount());const o=i.current;if(typeof o=="function")if(r){const a=o(r);typeof a=="function"&&(s.current=a)}else s.current?(s.current(),s.current=null):o(r);else o&&(o.current=r)},[t])}const _l=d.createContext({});function he(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ud(e,t,n,i,s,r){const{visualElement:o}=d.useContext(ti),a=d.useContext(Bl),l=d.useContext(Kn),c=d.useContext(Jn),u=c.reducedMotion,h=c.skipAnimations,f=d.useRef(null),m=d.useRef(!1);i=i||a.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:r}),m.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,v=d.useContext(_l);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&Nd(f.current,n,s,v);const g=d.useRef(!1);d.useInsertionEffect(()=>{p&&g.current&&p.update(n,l)});const b=n[Qa],C=d.useRef(!!b&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return _n(()=>{m.current=!0,p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),C.current&&p.animationState&&p.animationState.animateChanges())}),d.useEffect(()=>{p&&(!C.current&&p.animationState&&p.animationState.animateChanges(),C.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),C.current=!1),p.enteringChildren=void 0)}),p}function Nd(e,t,n,i){const{layoutId:s,layout:r,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Kl(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!o||a&&he(a),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:i,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function Kl(e){if(e)return e.options.allowProjection!==!1?e.projection:Kl(e.parent)}function yi(e,{forwardMotionProps:t=!1,type:n}={},i,s){i&&Sd(i);const r=n?n==="svg":Ys(e),o=r?Od:Vd;function a(c,u){let h;const f={...d.useContext(Jn),...c,layoutId:Bd(c)},{isStatic:m}=f,p=Td(c),v=o(c,m);if(!m&&typeof window<"u"){Gd();const g=Hd(f);h=g.MeasureLayout,p.visualElement=Ud(e,v,f,s,g.ProjectionNode,r)}return y.jsxs(ti.Provider,{value:p,children:[h&&p.visualElement?y.jsx(h,{visualElement:p.visualElement,...f}):null,Ed(e,c,jd(v,p.visualElement,u),v,m,t,r)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=d.forwardRef(a);return l[Fd]=e,l}function Bd({layoutId:e}){const t=d.useContext(Ss).id;return t&&e!==void 0?t+"-"+e:e}function Gd(e,t){d.useContext(Bl).strict}function Hd(e){const t=Gl(),{drag:n,layout:i}=t;if(!n&&!i)return{};const s={...n,...i};return{MeasureLayout:n?.isEnabled(e)||i?.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Wd(e,t){if(typeof Proxy>"u")return yi;const n=new Map,i=(r,o)=>yi(r,o,e,t),s=(r,o)=>i(r,o);return new Proxy(s,{get:(r,o)=>o==="create"?i:(n.has(o)||n.set(o,yi(o,void 0,e,t)),n.get(o))})}const zd=(e,t)=>t.isSVG??Ys(e)?new kl(t):new xl(t,{allowProjection:e!==d.Fragment});class $d extends Qt{constructor(t){super(t),t.animationState||(t.animationState=kf(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qn(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let _d=0;class Kd extends Qt{constructor(){super(...arguments),this.id=_d++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;if(t&&i===!1){if(this.isExitComplete){const{initial:r,custom:o}=this.node.getProps();if(typeof r=="string"||typeof r=="object"&&r!==null&&!Array.isArray(r)){const a=le(this.node,r,o);if(a){const{transition:l,transitionEnd:c,...u}=a;for(const h in u)this.node.getValue(h)?.jump(u[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Xd={animation:{Feature:$d},exit:{Feature:Kd}};function Ze(e){return{point:{x:e.pageX,y:e.pageY}}}const Yd=e=>t=>Ws(t)&&e(t,Ze(t));function Ne(e,t,n,i){return $e(e,t,Yd(n),i)}const Xl=({current:e})=>e?e.ownerDocument.defaultView:null,yo=(e,t)=>Math.abs(e-t);function qd(e,t){const n=yo(e.x,t.x),i=yo(e.y,t.y);return Math.sqrt(n**2+i**2)}const vo=new Set(["auto","scroll"]);class Yl{constructor(t,n,{transformPagePoint:i,contextWindow:s=window,dragSnapToOrigin:r=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=on(this.lastRawMoveEventInfo,this.transformPagePoint));const p=vi(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,g=qd(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!g)return;const{point:b}=p,{timestamp:C}=dt;this.history.push({...b,timestamp:C});const{onStart:S,onMove:x}=this.handlers;v||(S&&S(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,p)},this.handlePointerMove=(p,v)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=v,this.lastMoveEventInfo=on(v,this.transformPagePoint),J.update(this.updatePoint,!0)},this.handlePointerUp=(p,v)=>{this.end();const{onEnd:g,onSessionEnd:b,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=vi(p.type==="pointercancel"?this.lastMoveEventInfo:on(v,this.transformPagePoint),this.history);this.startEvent&&g&&g(p,S),b&&b(p,S)},!Ws(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=s||window;const l=Ze(t),c=on(l,this.transformPagePoint),{point:u}=c,{timestamp:h}=dt;this.history=[{...u,timestamp:h}];const{onSessionStart:f}=n;f&&f(t,vi(c,this.history));const m={passive:!0,capture:!0};this.removeListeners=Xe(Ne(this.contextWindow,"pointermove",this.handlePointerMove,m),Ne(this.contextWindow,"pointerup",this.handlePointerUp,m),Ne(this.contextWindow,"pointercancel",this.handlePointerUp,m)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const i=getComputedStyle(n);(vo.has(i.overflowX)||vo.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const i=t===window,s=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},r={x:s.x-n.x,y:s.y-n.y};r.x===0&&r.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=r.x,this.lastMoveEventInfo.point.y+=r.y):this.history.length>0&&(this.history[0].x-=r.x,this.history[0].y-=r.y),this.scrollPositions.set(t,s),J.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),_t(this.updatePoint)}}function on(e,t){return t?{point:t(e.point)}:e}function bo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function vi({point:e},t){return{point:e,delta:bo(e,ql(t)),offset:bo(e,Zd(t)),velocity:Jd(t,.1)}}function Zd(e){return e[0]}function ql(e){return e[e.length-1]}function Jd(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const s=ql(e);for(;n>=0&&(i=e[n],!(s.timestamp-i.timestamp>Tt(t)));)n--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&s.timestamp-i.timestamp>Tt(t)*2&&(i=e[1]);const r=Rt(s.timestamp-i.timestamp);if(r===0)return{x:0,y:0};const o={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Qd(e,{min:t,max:n},i){return t!==void 0&&en&&(e=i?Z(n,e,i.max):Math.min(e,n)),e}function So(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function tp(e,{top:t,left:n,bottom:i,right:s}){return{x:So(e.x,n,s),y:So(e.y,t,i)}}function xo(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.mini?n=ve(t.min,t.max-i,e.min):i>s&&(n=ve(e.min,e.max-s,t.min)),Ht(0,1,n)}function ip(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const rs=.35;function sp(e=rs){return e===!1?e=0:e===!0&&(e=rs),{x:wo(e,"left","right"),y:wo(e,"top","bottom")}}function wo(e,t,n){return{min:Co(e,t),max:Co(e,n)}}function Co(e,t){return typeof e=="number"?e:e[t]||0}const rp=new WeakMap;class op{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=it(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const r=h=>{n&&this.snapToCursor(Ze(h).point),this.stopAnimation()},o=(h,f)=>{const{drag:m,dragPropagation:p,onDragStart:v}=this.getProps();if(m&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Oh(m),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Nt(b=>{let C=this.getAxisMotionValue(b).get()||0;if(Gt.test(C)){const{projection:S}=this.visualElement;if(S&&S.layout){const x=S.layout.layoutBox[b];x&&(C=xt(x)*(parseFloat(C)/100))}}this.originPoint[b]=C}),v&&J.update(()=>v(h,f),!1,!0),Yi(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:p,onDirectionLock:v,onDrag:g}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:b}=f;if(p&&this.currentDirection===null){this.currentDirection=lp(b),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",f.point,b),this.updateAxis("y",f.point,b),this.visualElement.render(),g&&J.update(()=>g(h,f),!1,!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new Yl(t,{onSessionStart:r,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:i,contextWindow:Xl(this.visualElement),element:this.visualElement.current})}stop(t,n){const i=t||this.latestPointerEvent,s=n||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!s||!i)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&J.postRender(()=>a(i,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,i){const{drag:s}=this.getProps();if(!i||!an(t,s,this.currentDirection))return;const r=this.getAxisMotionValue(t);let o=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(o=Qd(o,this.constraints[t],this.elastic[t])),r.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;t&&he(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=tp(i.layoutBox,t):this.constraints=!1,this.elastic=sp(n),s!==this.constraints&&!he(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&Nt(r=>{this.constraints!==!1&&this.getAxisMotionValue(r)&&(this.constraints[r]=ip(i.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!he(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const r=cf(i,s.root,this.visualElement.getTransformPagePoint());let o=ep(s.layout.layoutBox,r);if(n){const a=n(of(o));this.hasMutatedConstraints=!!a,a&&(o=ml(a))}return o}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Nt(u=>{if(!an(u,n,this.currentDirection))return;let h=l&&l[u]||{};(o===!0||o===u)&&(h={min:0,max:0});const f=s?200:1e6,m=s?40:1e7,p={type:"inertia",velocity:i?t[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...r,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return Yi(this.visualElement,t),i.start(Fs(t,i,0,n,this.visualElement,!1))}stopAnimation(){Nt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps()[n];return s||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){Nt(n=>{const{drag:i}=this.getProps();if(!an(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n],l=r.get()||0;r.set(t[n]-Z(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!he(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Nt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=np({min:l,max:l},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),Nt(o=>{if(!an(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Z(l,c,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;rp.set(this.visualElement,this);const t=this.visualElement.current,n=Ne(t,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps(),f=c.target,m=f!==t&&Gh(f);u&&h&&!m&&this.start(c)});let i;const s=()=>{const{dragConstraints:c}=this.getProps();he(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),i||(i=ap(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:r}=this.visualElement,o=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),J.read(s);const a=$e(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Nt(h=>{const f=this.getAxisMotionValue(h);f&&(this.originPoint[h]+=c[h].translate,f.set(f.get()+c[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),l&&l(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:o=rs,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Po(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function ap(e,t,n){const i=Rr(e,Po(n)),s=Rr(t,Po(n));return()=>{i(),s()}}function an(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function lp(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class cp extends Qt{constructor(t){super(t),this.removeGroupControls=Et,this.removeListeners=Et,this.controls=new op(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Et}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const bi=e=>(t,n)=>{e&&J.update(()=>e(t,n),!1,!0)};class up extends Qt{constructor(){super(...arguments),this.removePointerDownListener=Et}onPointerDown(t){this.session=new Yl(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Xl(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:bi(t),onStart:bi(n),onMove:bi(i),onEnd:(r,o)=>{delete this.session,s&&J.postRender(()=>s(r,o))}}}mount(){this.removePointerDownListener=Ne(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Si=!1;class hp extends d.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:r}=t;r&&(n.group&&n.group.add(r),i&&i.register&&s&&i.register(r),Si&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),An.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:s,isPresent:r}=this.props,{projection:o}=i;return o&&(o.isPresent=r,t.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),Si=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==r?o.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?o.promote():o.relegate()||J.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:i}=t;i&&(i.options.layoutAnchor=n,i.root.didUpdate(),Hs.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=t;Si=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Zl(e){const[t,n]=Nl(),i=d.useContext(Ss);return y.jsx(hp,{...e,layoutGroup:i,switchLayoutGroup:d.useContext(_l),isPresent:t,safeToRemove:n})}const fp={pan:{Feature:up},drag:{Feature:cp,ProjectionNode:Ul,MeasureLayout:Zl}};function To(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,r=i[s];r&&J.postRender(()=>r(t,Ze(t)))}class dp extends Qt{mount(){const{current:t}=this.node;t&&(this.unmount=jh(t,(n,i)=>(To(this.node,i,"Start"),s=>To(this.node,s,"End"))))}unmount(){}}class pp extends Qt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xe($e(this.node.current,"focus",()=>this.onFocus()),$e(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ko(e,t,n){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),r=i[s];r&&J.postRender(()=>r(t,Ze(t)))}class mp extends Qt{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=Wh(t,(s,r)=>(ko(this.node,r,"Start"),(o,{success:a})=>ko(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const os=new WeakMap,xi=new WeakMap,gp=e=>{const t=os.get(e.target);t&&t(e)},yp=e=>{e.forEach(gp)};function vp({root:e,...t}){const n=e||document;xi.has(n)||xi.set(n,{});const i=xi.get(n),s=JSON.stringify(t);return i[s]||(i[s]=new IntersectionObserver(yp,{root:e,...t})),i[s]}function bp(e,t,n){const i=vp(t);return os.set(e,n),i.observe(e),()=>{os.delete(e),i.unobserve(e)}}const Sp={some:0,all:1};class xp extends Qt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:r}=t,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:Sp[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,r&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),f=c?u:h;f&&f(l)};this.stopObserver=bp(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(wp(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function wp({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Cp={inView:{Feature:xp},tap:{Feature:mp},focus:{Feature:pp},hover:{Feature:dp}},Pp={layout:{ProjectionNode:Ul,MeasureLayout:Zl}},Tp={...Xd,...Cp,...fp,...Pp},kp=Wd(Tp,zd);function as(e){const t=Ke(()=>Jt(e)),{isStatic:n}=d.useContext(Jn);if(n){const[,i]=d.useState(e);d.useEffect(()=>t.on("change",i),[])}return t}function Jl(e,t){const n=as(t()),i=()=>n.set(t());return i(),_n(()=>{const s=()=>J.preRender(i,!1,!0),r=e.map(o=>o.on("change",s));return()=>{r.forEach(o=>o()),_t(i)}}),n}function Ap(e){je.current=[],e();const t=Jl(je.current,e);return je.current=void 0,t}function ln(e,t,n,i){if(typeof e=="function")return Ap(e);const r=typeof t=="function"?t:Jh(t,n,i),o=Array.isArray(e)?Ao(e,r):Ao([e],([l])=>r(l)),a=Array.isArray(e)?void 0:e.accelerate;return a&&!a.isTransformed&&typeof t!="function"&&Array.isArray(n)&&i?.clamp!==!1&&(o.accelerate={...a,times:t,keyframes:n,isTransformed:!0}),o}function Ao(e,t){const n=Ke(()=>[]);return Jl(e,()=>{n.length=0;const i=e.length;for(let s=0;ss!=null):[e]}function Mp(e,t,n){return e*(t+1)+n*t}function Mo(e,t,n,i){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?n:t.startsWith("<")?Math.max(0,n+parseFloat(t.slice(1))):i.get(t)??e}function Dp(e,t,n){for(let i=0;it&&s.at{const D=Fp(x),{delay:M=0,times:V=Ua(D),type:G=t.type||"keyframes",repeat:X,repeatType:$,repeatDelay:N=0,...E}=w;let{ease:j=t.ease||"easeOut",duration:I}=w;const _=typeof M=="function"?M(A,k):M,q=D.length,lt=Vs(G)?G:s?.[G||"keyframes"];if(q<=2&<){let mt=100;if(q===2&&Np(D)){const B=D[1]-D[0];mt=Math.abs(B)}const U={...t,...E};I!==void 0&&(U.duration=Tt(I));const O=Va(U,mt,lt);j=O.ease,I=O.duration}I??(I=r);const Mt=h+_;V.length===1&&V[0]===0&&(V[1]=1);const ut=V.length-D.length;if(ut>0&&ja(V,ut),D.length===1&&D.unshift(null),X&&X0?N/I:0;I=Mp(I,X,N);const U=[...D],O=[...V];j=Array.isArray(j)?[...j]:[j];const B=[...j],K=$==="reverse"||$==="mirror";let Y=U,ht=B;K&&(Y=[...U].reverse(),$==="reverse"&&(ht=[...B].reverse().map(nt=>typeof nt=="function"?Ps(nt):nt)));for(let nt=0;nt0&&(D.push(D[D.length-1]),V.push(At),j.push("linear")),D.push(...Lt);for(let ot=0;ot{for(const v in m){const g=m[v];g.sort(Lp);const b=[],C=[],S=[];for(let A=0;Atypeof e=="number",Np=e=>e.every(Up);function Bp(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Yn(e)&&!cl(e)?new kl(t):new xl(t);n.mount(e),We.set(e,n)}function Gp(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new gf(t);n.mount(e),We.set(e,n)}function Hp(e,t){return at(e)||typeof e=="number"||typeof e=="string"&&!qs(t)}function tc(e,t,n,i){const s=[];if(Hp(e,t))s.push(Vl(e,qs(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return s;const r=Ql(e,t,i),o=r.length;for(let a=0;a{if(Array.isArray(o)&&typeof o[0]=="function"){const a=o[0],l=Jt(0);return l.on("change",a),o.length===1?[l,[0,1]]:o.length===2?[l,[0,1],o[1]]:[l,o[1],o[2]]}return o});return Op(s,t,n,{spring:He}).forEach(({keyframes:o,transition:a},l)=>{i.push(...tc(l,o,a))}),i}function zp(e){return Array.isArray(e)&&e.some(Array.isArray)}function $p(e={}){const{scope:t,reduceMotion:n,skipAnimations:i}=e;function s(r,o,a){let l=[],c;const u={};if(n!==void 0&&(u.reduceMotion=n),i!==void 0&&(u.skipAnimations=i),zp(r)){const{onComplete:f,...m}=o||{};typeof f=="function"&&(c=f),l=Wp(r,{...u,...m},t)}else{const{onComplete:f,...m}=a||{};typeof f=="function"&&(c=f),l=tc(r,o,{...u,...m},t)}const h=new sh(l);return c&&h.finished.then(c),t&&(t.animations.push(h),h.finished.then(()=>{ye(t.animations,h)})),h}return s}const Eo=$p(),Pt=kp;var _p=Object.freeze({});function Lo(e,t){return ec(e,t,"")}function Kp(e,t){const n={};return typeof t=="object"&&t!==null&&nc(e,t,"",n),n}function ec(e,t,n){const i={};for(const[s,r]of Object.entries(e)){if(s==="_collapsed")continue;const o=n?`${n}.${s}`:s;if(Array.isArray(r)&&r.length<=4&&typeof r[0]=="number")i[s]=t[o]??r[0];else if(typeof r=="number"||typeof r=="boolean"||typeof r=="string")i[s]=t[o]??r;else if(ic(r)||sc(r))i[s]=t[o]??r;else if(Zs(r))i[s]=t[o]??r;else if(rc(r)){const a=r.default??Yp(r.options);i[s]=t[o]??a}else oc(r)?i[s]=t[o]??r.default??"#000000":ac(r)?i[s]=t[o]??r.default??"":typeof r=="object"&&r!==null&&(i[s]=ec(r,t,o))}return i}function nc(e,t,n,i){for(const[s,r]of Object.entries(e)){if(s==="_collapsed"||!(s in t))continue;const o=t[s];if(o===void 0)continue;const a=n?`${n}.${s}`:s;if(!Zs(r)){if(Xp(r)){i[a]=o;continue}typeof r=="object"&&r!==null&&typeof o=="object"&&o!==null&&!Array.isArray(o)&&nc(r,o,a,i)}}}function Xp(e){return Array.isArray(e)&&e.length<=4&&typeof e[0]=="number"||typeof e=="number"||typeof e=="boolean"||typeof e=="string"||ic(e)||sc(e)||Zs(e)||rc(e)||oc(e)||ac(e)}function Pe(e,t){return typeof e=="object"&&e!==null&&"type"in e&&e.type===t}function ic(e){return Pe(e,"spring")}function sc(e){return Pe(e,"easing")}function Zs(e){return Pe(e,"action")}function rc(e){return Pe(e,"select")&&"options"in e&&Array.isArray(e.options)}function oc(e){return Pe(e,"color")}function ac(e){return Pe(e,"text")}function Yp(e){const t=e[0];return t===void 0?"":typeof t=="string"?t:t.value}var qp=class{constructor(){this.panels=new Map,this.listeners=new Map,this.globalListeners=new Set,this.snapshots=new Map,this.actionListeners=new Map,this.presets=new Map,this.activePreset=new Map,this.baseValues=new Map,this.defaultValues=new Map,this.registrationCounts=new Map,this.retainedPanels=new Set,this.persistConfigs=new Map}registerPanel(e,t,n,i,s={}){this.configurePanelRetention(e,s),this.registrationCounts.set(e,(this.registrationCounts.get(e)??0)+1);const r=this.parseConfig(n,"",i),o=this.mapControlsByPath(r),a=this.flattenValues(n,"");this.initTransitionModes(n,"",a);const l=this.loadPersistedPanel(e),c=this.panels.get(e)?.values??this.snapshots.get(e)??l?.values??{},u=this.reconcileValues(a,c,o),h=this.baseValues.get(e)??l?.baseValues??l?.values??{},f=this.reconcileValues(a,h,o);this.panels.set(e,{id:e,name:t,controls:r,values:u,shortcuts:i??{}}),this.snapshots.set(e,{...u}),this.baseValues.set(e,f),this.defaultValues.set(e,{...a});const m=this.presets.get(e)??l?.presets;m&&this.presets.set(e,this.reconcilePresets(m,a,o)),!this.activePreset.has(e)&&l?.activePresetId!==void 0&&this.activePreset.set(e,l.activePresetId),this.persistPanel(e),this.notify(e),this.notifyGlobal()}updatePanel(e,t,n,i,s={}){this.configurePanelRetention(e,s);const r=this.panels.get(e);if(!r){this.registerPanel(e,t,n,i,s);return}const o=this.parseConfig(n,"",i),a=this.mapControlsByPath(o),l=this.flattenValues(n,"");this.initTransitionModes(n,"",l);const c=this.reconcileValues(l,r.values,a),u={id:e,name:t,controls:o,values:c,shortcuts:i??r.shortcuts};this.panels.set(e,u),this.snapshots.set(e,{...c});const h=this.baseValues.get(e)??{},f=this.reconcileValues(l,h,a);for(const[m,p]of Object.entries(c))m.endsWith(".__mode")&&(f[m]=p);this.baseValues.set(e,f),this.defaultValues.set(e,{...l}),this.presets.set(e,this.reconcilePresets(this.presets.get(e)??[],l,a)),this.persistPanel(e),this.notify(e),this.notifyGlobal()}unregisterPanel(e){const t=(this.registrationCounts.get(e)??1)-1;if(t>0){this.registrationCounts.set(e,t);return}this.registrationCounts.delete(e),this.panels.delete(e),this.listeners.delete(e),this.actionListeners.delete(e),this.retainedPanels.has(e)||(this.snapshots.delete(e),this.baseValues.delete(e),this.defaultValues.delete(e),this.presets.delete(e),this.activePreset.delete(e),this.persistConfigs.delete(e)),this.notifyGlobal()}updateValue(e,t,n){this.updateValues(e,{[t]:n})}updateValues(e,t){const n=this.panels.get(e);if(!n)return;const i={};for(const[r,o]of Object.entries(t))!Object.prototype.hasOwnProperty.call(n.values,r)||this.findControlByPath(n.controls,r)?.type==="action"||(n.values[r]=o,i[r]=o);if(Object.keys(i).length===0)return;const s=this.activePreset.get(e);if(s){const o=(this.presets.get(e)??[]).find(a=>a.id===s);if(o)for(const[a,l]of Object.entries(i))o.values[a]=l}else{const r=this.baseValues.get(e);if(r)for(const[o,a]of Object.entries(i))r[o]=a}this.snapshots.set(e,{...n.values}),this.persistPanel(e),this.notify(e)}resetValues(e){const t=this.panels.get(e),n=this.defaultValues.get(e);!t||!n||(t.values={...n},this.snapshots.set(e,{...t.values}),this.baseValues.set(e,{...n}),this.activePreset.set(e,null),this.persistPanel(e),this.notify(e))}updateSpringMode(e,t,n){this.updateTransitionMode(e,t,n)}getSpringMode(e,t){const n=this.getTransitionMode(e,t);return n==="easing"?"simple":n}updateTransitionMode(e,t,n){const i=this.panels.get(e);i&&(i.values[`${t}.__mode`]=n,this.snapshots.set(e,{...i.values}),this.persistPanel(e),this.notify(e))}getTransitionMode(e,t){const n=this.panels.get(e);return n&&n.values[`${t}.__mode`]||"simple"}getValue(e,t){return this.panels.get(e)?.values[t]}getValues(e){return this.snapshots.get(e)??_p}getPanels(){return Array.from(this.panels.values())}getPanel(e){return this.panels.get(e)}subscribe(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>{this.listeners.get(e)?.delete(t)}}subscribeGlobal(e){return this.globalListeners.add(e),()=>this.globalListeners.delete(e)}subscribeActions(e,t){return this.actionListeners.has(e)||this.actionListeners.set(e,new Set),this.actionListeners.get(e).add(t),()=>{this.actionListeners.get(e)?.delete(t)}}triggerAction(e,t){this.actionListeners.get(e)?.forEach(n=>n(t))}savePreset(e,t){const n=this.panels.get(e);if(!n)throw new Error(`Panel ${e} not found`);const i=`preset-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,s={id:i,name:t,values:{...n.values}},r=this.presets.get(e)??[];return this.presets.set(e,[...r,s]),this.activePreset.set(e,i),this.snapshots.set(e,{...n.values}),this.persistPanel(e),this.notify(e),i}loadPreset(e,t){const n=this.panels.get(e);if(!n)return;const s=(this.presets.get(e)??[]).find(r=>r.id===t);s&&(n.values={...s.values},this.snapshots.set(e,{...n.values}),this.activePreset.set(e,t),this.persistPanel(e),this.notify(e))}deletePreset(e,t){const n=this.presets.get(e)??[];this.presets.set(e,n.filter(s=>s.id!==t)),this.activePreset.get(e)===t&&this.activePreset.set(e,null);const i=this.panels.get(e);i&&this.snapshots.set(e,{...i.values}),this.persistPanel(e),this.notify(e)}getPresets(e){return this.presets.get(e)??[]}getActivePresetId(e){return this.activePreset.get(e)??null}clearActivePreset(e){const t=this.panels.get(e),n=this.baseValues.get(e);t&&n&&(t.values={...n},this.snapshots.set(e,{...t.values})),this.activePreset.set(e,null),this.persistPanel(e),this.notify(e)}resolveShortcutTarget(e,t){for(const n of this.panels.values())for(const[i,s]of Object.entries(n.shortcuts)){if(!s.key||s.key.toLowerCase()!==e.toLowerCase()||(s.modifier??void 0)!==t)continue;const o=this.findControlByPath(n.controls,i);if(o)return{panelId:n.id,path:i,control:o}}return null}resolveScrollOnlyTargets(){const e=[];for(const t of this.panels.values())for(const[n,i]of Object.entries(t.shortcuts)){if((i.interaction??"scroll")!=="scroll-only")continue;const s=this.findControlByPath(t.controls,n);s&&e.push({panelId:t.id,path:n,control:s,shortcut:i})}return e}configurePanelRetention(e,t){t.retainOnUnmount&&this.retainedPanels.add(e);const n=this.normalizePersistConfig(e,t.persist);n&&(this.persistConfigs.set(e,n),this.retainedPanels.add(e))}reconcileValues(e,t,n){const i={};for(const[s,r]of Object.entries(e)){if(s.endsWith(".__mode")){const o=s.slice(0,-7),a=n.get(o);i[s]=a?.type==="transition"&&t[s]!==void 0?t[s]:r;continue}i[s]=this.normalizePreservedValue(t[s],r,n.get(s))}return i}reconcilePresets(e,t,n){return e.map(i=>({...i,values:this.reconcileValues(t,i.values,n)}))}normalizePersistConfig(e,t){if(!t)return null;const n=typeof t=="object"?t:{};return{key:n.key??`dialkit:${e}`,storage:n.storage??"localStorage",presets:n.presets??!0}}loadPersistedPanel(e){const t=this.persistConfigs.get(e);if(!t)return null;const n=this.getStorage(t.storage);if(!n)return null;try{const i=n.getItem(t.key);if(!i)return null;const s=JSON.parse(i);return s?.version!==1||typeof s!="object"?null:s}catch{return null}}persistPanel(e){const t=this.persistConfigs.get(e);if(!t)return;const n=this.getStorage(t.storage);if(!n)return;const i=this.snapshots.get(e)??this.panels.get(e)?.values;if(!i)return;const s={version:1,values:i,baseValues:this.baseValues.get(e)??i,activePresetId:this.activePreset.get(e)??null};t.presets&&(s.presets=this.presets.get(e)??[]);try{n.setItem(t.key,JSON.stringify(s))}catch{}}getStorage(e){if(typeof globalThis>"u"||!("window"in globalThis))return null;try{return e==="sessionStorage"?globalThis.window?.sessionStorage??null:globalThis.window?.localStorage??null}catch{return null}}findControlByPath(e,t){for(const n of e){if(n.path===t)return n;if(n.type==="folder"&&n.children){const i=this.findControlByPath(n.children,t);if(i)return i}}return null}notify(e){this.listeners.get(e)?.forEach(t=>t())}notifyGlobal(){this.globalListeners.forEach(e=>e())}initTransitionModes(e,t,n){for(const[i,s]of Object.entries(e)){if(i==="_collapsed")continue;const r=t?`${t}.${i}`:i;if(this.isEasingConfig(s))n[`${r}.__mode`]="easing";else if(this.isSpringConfig(s)){const o=s.stiffness!==void 0||s.damping!==void 0||s.mass!==void 0,a=s.visualDuration!==void 0||s.bounce!==void 0;n[`${r}.__mode`]=o&&!a?"advanced":"simple"}else typeof s=="object"&&s!==null&&!Array.isArray(s)&&!this.isActionConfig(s)&&!this.isSelectConfig(s)&&!this.isColorConfig(s)&&!this.isTextConfig(s)&&this.initTransitionModes(s,r,n)}}parseConfig(e,t,n){const i=[];for(const[s,r]of Object.entries(e)){if(s==="_collapsed")continue;const o=t?`${t}.${s}`:s,a=this.formatLabel(s),l=n?.[o];if(Array.isArray(r)&&r.length<=4&&typeof r[0]=="number")i.push({type:"slider",path:o,label:a,min:r[1],max:r[2],step:r[3]??this.inferStep(r[1],r[2]),shortcut:l});else if(typeof r=="number"){const{min:c,max:u,step:h}=this.inferRange(r);i.push({type:"slider",path:o,label:a,min:c,max:u,step:h,shortcut:l})}else if(typeof r=="boolean")i.push({type:"toggle",path:o,label:a,shortcut:l});else if(this.isSpringConfig(r)||this.isEasingConfig(r))i.push({type:"transition",path:o,label:a});else if(this.isActionConfig(r))i.push({type:"action",path:o,label:r.label||a});else if(this.isSelectConfig(r))i.push({type:"select",path:o,label:a,options:r.options});else if(this.isColorConfig(r))i.push({type:"color",path:o,label:a});else if(this.isTextConfig(r))i.push({type:"text",path:o,label:a,placeholder:r.placeholder});else if(typeof r=="string")this.isHexColor(r)?i.push({type:"color",path:o,label:a}):i.push({type:"text",path:o,label:a});else if(typeof r=="object"&&r!==null){const c=r,u="_collapsed"in c?!c._collapsed:!0;i.push({type:"folder",path:o,label:a,defaultOpen:u,children:this.parseConfig(c,o,n)})}}return i}flattenValues(e,t){const n={};for(const[i,s]of Object.entries(e)){if(i==="_collapsed")continue;const r=t?`${t}.${i}`:i;if(Array.isArray(s)&&s.length<=4&&typeof s[0]=="number")n[r]=s[0];else if(typeof s=="number"||typeof s=="boolean"||typeof s=="string")n[r]=s;else if(this.isSpringConfig(s)||this.isEasingConfig(s))n[r]=s;else if(this.isActionConfig(s))n[r]=s;else if(this.isSelectConfig(s)){const o=s.options[0],a=typeof o=="string"?o:o.value;n[r]=s.default??a}else this.isColorConfig(s)?n[r]=s.default??"#000000":this.isTextConfig(s)?n[r]=s.default??"":typeof s=="object"&&s!==null&&Object.assign(n,this.flattenValues(s,r))}return n}isSpringConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="spring"}isEasingConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="easing"}isActionConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="action"}isSelectConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="select"&&"options"in e&&Array.isArray(e.options)}isColorConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="color"}isTextConfig(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="text"}isHexColor(e){return/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)}formatLabel(e){return e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()).trim()}inferRange(e){return e>=0&&e<=1?{min:0,max:1,step:.01}:e>=0&&e<=10?{min:0,max:e*3||10,step:.1}:e>=0&&e<=100?{min:0,max:e*3||100,step:1}:e>=0?{min:0,max:e*3||1e3,step:10}:{min:e*3,max:-e*3,step:1}}inferStep(e,t){const n=t-e;return n<=1?.01:n<=10?.1:n<=100?1:10}normalizePreservedValue(e,t,n){if(e===void 0||!n)return t;switch(n.type){case"slider":{if(typeof e!="number"||typeof t!="number")return t;const i=n.min??Number.NEGATIVE_INFINITY,s=n.max??Number.POSITIVE_INFINITY,r=Math.min(s,Math.max(i,e));return typeof n.step!="number"||n.step<=0?r:this.roundToStep(r,i,s,n.step)}case"toggle":return typeof e=="boolean"?e:t;case"select":{if(typeof e!="string")return t;const i=n.options??[];return new Set(i.map(r=>typeof r=="string"?r:r.value)).has(e)?e:t}case"color":case"text":return typeof e=="string"?e:t;case"transition":return this.isSpringConfig(t)?this.isSpringConfig(e)?e:t:this.isEasingConfig(t)&&this.isEasingConfig(e)?e:t;case"action":return t;default:return t}}roundToStep(e,t,n,i){const s=t+Math.round((e-t)/i)*i,r=Math.min(n,Math.max(t,s)),o=this.stepPrecision(i);return Number(r.toFixed(o))}stepPrecision(e){const t=String(e),n=t.indexOf(".");return n===-1?0:t.length-n-1}mapControlsByPath(e){const t=new Map,n=i=>{for(const s of i){if(s.type==="folder"&&s.children){n(s.children);continue}t.set(s.path,s)}};return n(e),t}},H=new qp;function Zp(e,t,n){const i=d.useId(),s=n?.id!==void 0,r=n?.id??`${e}-${i}`,o=d.useRef(t),a=JSON.stringify(t);o.current=t;const l=d.useRef(n?.onAction);l.current=n?.onAction;const c=d.useRef(n?.shortcuts);c.current=n?.shortcuts;const u=d.useRef(n?.persist);u.current=n?.persist;const h=JSON.stringify(n?.shortcuts),f=JSON.stringify(n?.persist);d.useEffect(()=>(H.registerPanel(r,e,o.current,c.current,{retainOnUnmount:s,persist:u.current}),()=>H.unregisterPanel(r)),[s,r,e]);const m=d.useRef(!1);d.useEffect(()=>{if(!m.current){m.current=!0;return}H.updatePanel(r,e,o.current,c.current,{retainOnUnmount:s,persist:u.current})},[s,r,e,a,h,f]),d.useEffect(()=>H.subscribeActions(r,P=>{l.current?.(P)}),[r]);const p=d.useCallback(P=>H.subscribe(r,P),[r]),v=d.useCallback(()=>H.getValues(r),[r]),g=d.useSyncExternalStore(p,v,v),b=d.useMemo(()=>Lo(o.current,g),[g,a]),C=d.useCallback((P,A)=>{H.updateValue(r,P,A)},[r]),S=d.useCallback(P=>{H.updateValues(r,Kp(o.current,P))},[r]),x=d.useCallback(()=>{H.resetValues(r)},[r]),w=d.useCallback(()=>Lo(o.current,H.getValues(r)),[r]);return d.useMemo(()=>({values:b,setValue:C,setValues:S,resetValues:x,getValues:w}),[w,x,C,S,b])}var Js="M6 9.5L12 15.5L18 9.5",Jp="M5 12.75L10 19L19 5",wi={board:"M8 6C8 4.34315 9.34315 3 11 3H13C14.6569 3 16 4.34315 16 6V7H8V6Z",sparkle:"M19.2405 16.1852L18.5436 14.3733C18.4571 14.1484 18.241 14 18 14C17.759 14 17.5429 14.1484 17.4564 14.3733L16.7595 16.1852C16.658 16.4493 16.4493 16.658 16.1852 16.7595L14.3733 17.4564C14.1484 17.5429 14 17.759 14 18C14 18.241 14.1484 18.4571 14.3733 18.5436L16.1852 19.2405C16.4493 19.342 16.658 19.5507 16.7595 19.8148L17.4564 21.6267C17.5429 21.8516 17.759 22 18 22C18.241 22 18.4571 21.8516 18.5436 21.6267L19.2405 19.8148C19.342 19.5507 19.5507 19.342 19.8148 19.2405L21.6267 18.5436C21.8516 18.4571 22 18.241 22 18C22 17.759 21.8516 17.5429 21.6267 17.4564L19.8148 16.7595C19.5507 16.658 19.342 16.4493 19.2405 16.1852Z",body:"M16 5H17C18.6569 5 20 6.34315 20 8V11M8 5H7C5.34315 5 4 6.34315 4 8V18C4 19.6569 5.34315 21 7 21H12"},Qp=["M4 6H20","M4 12H10","M15 15L21 15","M18 12V18","M4 18H10"],tm=["M5 6.5L5.80734 18.2064C5.91582 19.7794 7.22348 21 8.80023 21H15.1998C16.7765 21 18.0842 19.7794 18.1927 18.2064L19 6.5","M10 11V16","M14 11V16","M3.5 6H20.5","M8.07092 5.74621C8.42348 3.89745 10.0485 2.5 12 2.5C13.9515 2.5 15.5765 3.89745 15.9291 5.74621"],Io={path:"M6.84766 11.75C6.78583 11.9899 6.75 12.2408 6.75 12.5C6.75 12.7592 6.78583 13.0101 6.84766 13.25H2C1.58579 13.25 1.25 12.9142 1.25 12.5C1.25 12.0858 1.58579 11.75 2 11.75H6.84766ZM14 11.75C14.4142 11.75 14.75 12.0858 14.75 12.5C14.75 12.9142 14.4142 13.25 14 13.25H12.6523C12.7142 13.0101 12.75 12.7592 12.75 12.5C12.75 12.2408 12.7142 11.9899 12.6523 11.75H14ZM3.09766 7.25C3.03583 7.48994 3 7.74075 3 8C3 8.25925 3.03583 8.51006 3.09766 8.75H2C1.58579 8.75 1.25 8.41421 1.25 8C1.25 7.58579 1.58579 7.25 2 7.25H3.09766ZM14 7.25C14.4142 7.25 14.75 7.58579 14.75 8C14.75 8.41421 14.4142 8.75 14 8.75H8.90234C8.96417 8.51006 9 8.25925 9 8C9 7.74075 8.96417 7.48994 8.90234 7.25H14ZM7.59766 2.75C7.53583 2.98994 7.5 3.24075 7.5 3.5C7.5 3.75925 7.53583 4.01006 7.59766 4.25H2C1.58579 4.25 1.25 3.91421 1.25 3.5C1.25 3.08579 1.58579 2.75 2 2.75H7.59766ZM14 2.75C14.4142 2.75 14.75 3.08579 14.75 3.5C14.75 3.91421 14.4142 4.25 14 4.25H13.4023C13.4642 4.01006 13.5 3.75925 13.5 3.5C13.5 3.24075 13.4642 2.98994 13.4023 2.75H14Z",circles:[{cx:"6",cy:"8",r:"0.998596"},{cx:"10.4999",cy:"3.5",r:"0.998657"},{cx:"9.75015",cy:"12.5",r:"0.997986"}]};function me({title:e,children:t,defaultOpen:n=!0,isRoot:i=!1,inline:s=!1,onOpenChange:r,toolbar:o,panelHeightOffset:a=10}){const[l,c]=d.useState(n),[u,h]=d.useState(!n),f=d.useRef(null),[m,p]=d.useState(void 0),[v,g]=d.useState(typeof window<"u"?window.innerHeight:800);d.useEffect(()=>{if(!i)return;const S=()=>g(window.innerHeight);return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[i]),d.useEffect(()=>{const S=f.current;if(!S)return;const x=new ResizeObserver(()=>{if(l){const w=S.offsetHeight;p(P=>P===w?P:w)}});return x.observe(S),()=>x.disconnect()},[l]);const b=()=>{if(s&&i)return;const S=!l;c(S),h(!S),r?.(S)},C=y.jsxs("div",{ref:i?f:void 0,className:`dialkit-folder ${i?"dialkit-folder-root":""}`,"data-open":String(l),children:[y.jsxs("div",{className:`dialkit-folder-header ${i?"dialkit-panel-header":""}`,onClick:b,children:[y.jsxs("div",{className:"dialkit-folder-header-top",children:[i?l&&y.jsx("div",{className:"dialkit-folder-title-row",children:y.jsx("span",{className:"dialkit-folder-title dialkit-folder-title-root",children:e})}):y.jsx("div",{className:"dialkit-folder-title-row",children:y.jsx("span",{className:"dialkit-folder-title",children:e})}),i&&!s&&y.jsxs("svg",{className:"dialkit-panel-icon",viewBox:"0 0 16 16",fill:"none",children:[y.jsx("path",{opacity:"0.5",d:Io.path,fill:"currentColor"}),Io.circles.map((S,x)=>y.jsx("circle",{cx:S.cx,cy:S.cy,r:S.r,fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"},x))]}),!i&&y.jsx(Pt.svg,{className:"dialkit-folder-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",initial:!1,animate:{rotate:l?0:180},transition:{type:"spring",visualDuration:.35,bounce:.15},children:y.jsx("path",{d:Js})})]}),i&&o&&l&&y.jsx("div",{className:"dialkit-panel-toolbar",onClick:S=>S.stopPropagation(),children:o})]}),y.jsx(Qn,{initial:!1,children:l&&y.jsx(Pt.div,{className:"dialkit-folder-content",initial:i?void 0:{height:0,opacity:0},animate:i?void 0:{height:"auto",opacity:1},exit:i?void 0:{height:0,opacity:0},transition:i?void 0:{type:"spring",visualDuration:.35,bounce:.1},style:i?void 0:{clipPath:"inset(0 -20px)"},children:y.jsx("div",{className:"dialkit-folder-inner",children:t})})})]});if(i){if(s)return y.jsx("div",{className:"dialkit-panel-inner dialkit-panel-inline",children:C});const S=l?{width:280,height:m!==void 0?Math.min(m+a,v-32):"auto",borderRadius:14,boxShadow:"var(--dial-shadow)",cursor:void 0,overflowY:"auto"}:{width:42,height:42,borderRadius:"50%",boxSizing:"border-box",boxShadow:"var(--dial-shadow-collapsed)",overflow:"hidden",cursor:"pointer"};return y.jsx(Pt.div,{className:"dialkit-panel-inner",style:S,onClick:l?void 0:b,"data-collapsed":u,whileTap:l?void 0:{scale:.9},transition:{type:"spring",visualDuration:.15,bounce:.3},children:C})}return C}function ls(e){const t=e.toString(),n=t.indexOf(".");return n===-1?0:t.length-n-1}function Mn(e,t){const n=Math.round(e/t)*t;return parseFloat(n.toFixed(ls(t)))}function Me(e,t){const n=e.min??0,s=(e.max??1)-n,r=t.mode??"normal";return r==="fine"?s*.01:r==="coarse"?s*.1:e.step??1}function De(e,t,n,i,s){const r=H.getValue(e,t),o=n.min??0,a=n.max??1,l=Math.max(o,Math.min(a,r+s*i));H.updateValue(e,t,Mn(l,i))}function em(e,t,n){const i=(e-t)/(n-t),s=Math.round(i*10)/10;return Math.abs(i-s)<=.03125?t+s*(n-t):e}function cn(){const e=document.activeElement;if(!e)return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"}function Ci(e){if(e.altKey)return"alt";if(e.shiftKey)return"shift";if(e.metaKey)return"meta"}function lc(e,t){for(const n of e){if(n.path===t)return n;if(n.type==="folder"&&n.children){const i=lc(n.children,t);if(i)return i}}return null}var un=4;function nm(e){switch(e){case"drag":return"Drag";case"move":return"Move";case"scroll-only":return"Scroll";default:return"Scroll"}}function im(e){const t=e.interaction??"scroll",n=nm(t);return e.key?`${cc(e.modifier)}${e.key.toUpperCase()}+${n}`:n}function sm(e){return e.key?`${cc(e.modifier)}${e.key.toUpperCase()}`:"Press"}function cc(e){return e==="alt"?"⌥":e==="shift"?"⇧":e==="meta"?"⌘":""}var uc=d.createContext({activePanelId:null,activePath:null});function rm({children:e}){const[t,n]=d.useState({activePanelId:null,activePath:null}),i=d.useRef(new Set),s=d.useRef(!1),r=d.useRef(null),o=d.useRef(0),a=d.useCallback(l=>{for(const c of i.current){const u=H.getPanels();for(const h of u)for(const[f,m]of Object.entries(h.shortcuts)){if(!m.key||m.key.toLowerCase()!==c||(m.interaction??"scroll")!==l)continue;const p=lc(h.controls,f);if(p&&p.type==="slider")return{panelId:h.id,path:f,control:p,shortcut:m}}}return null},[]);return d.useEffect(()=>{const l=v=>{if(cn())return;const g=v.key.toLowerCase();if((g==="arrowleft"||g==="arrowright"||g==="arrowup"||g==="arrowdown")&&i.current.size>0){const x=a("scroll")||a("drag")||a("move");if(x&&x.control.type==="slider"){v.preventDefault();const w=g==="arrowright"||g==="arrowup"?1:-1,P=Me(x.control,x.shortcut);De(x.panelId,x.path,x.control,P,w);return}}const b=i.current.has(g);i.current.add(g);const C=Ci(v),S=H.resolveShortcutTarget(g,C);if(S&&(n({activePanelId:S.panelId,activePath:S.path}),!b&&S.control.type==="toggle")){const x=H.getValue(S.panelId,S.path);H.updateValue(S.panelId,S.path,!x)}b||(r.current=null,o.current=0)},c=v=>{const g=v.key.toLowerCase();if(i.current.delete(g),s.current=!1,r.current=null,o.current=0,i.current.size===0)n({activePanelId:null,activePath:null});else{let b=!1;for(const C of i.current){const S=Ci(v),x=H.resolveShortcutTarget(C,S);if(x){n({activePanelId:x.panelId,activePath:x.path}),b=!0;break}}b||n({activePanelId:null,activePath:null})}},u=v=>{if(cn())return;const g=Ci(v);if(i.current.size>0)for(const C of i.current){const S=H.resolveShortcutTarget(C,g);if(!S)continue;const{panelId:x,path:w,control:P}=S;if((P.shortcut?.interaction??"scroll")!=="scroll"||P.type!=="slider")continue;v.preventDefault();const k=Me(P,P.shortcut),D=v.deltaY>0?-1:1;De(x,w,P,k,D);return}const b=H.resolveScrollOnlyTargets();for(const{panelId:C,path:S,control:x,shortcut:w}of b){if(x.type!=="slider")continue;v.preventDefault();const P=Me(x,w),A=v.deltaY>0?-1:1;De(C,S,x,P,A);return}},h=v=>{if(cn()||i.current.size===0)return;a("drag")&&(s.current=!0,r.current=v.clientX,o.current=0,v.preventDefault())},f=()=>{s.current=!1,r.current=null,o.current=0},m=v=>{if(cn()||i.current.size===0)return;if(s.current){const b=a("drag");if(b&&r.current!==null){const C=v.clientX-r.current;r.current=v.clientX,o.current+=C;const S=Me(b.control,b.shortcut),x=Math.trunc(o.current/un);x!==0&&(o.current-=x*un,De(b.panelId,b.path,b.control,S,x))}return}const g=a("move");if(g){if(r.current===null){r.current=v.clientX;return}const b=v.clientX-r.current;r.current=v.clientX,o.current+=b;const C=Me(g.control,g.shortcut),S=Math.trunc(o.current/un);S!==0&&(o.current-=S*un,De(g.panelId,g.path,g.control,C,S))}},p=()=>{i.current.clear(),s.current=!1,r.current=null,o.current=0,n({activePanelId:null,activePath:null})};return window.addEventListener("keydown",l),window.addEventListener("keyup",c),window.addEventListener("wheel",u,{passive:!1}),window.addEventListener("mousedown",h),window.addEventListener("mouseup",f),window.addEventListener("mousemove",m),window.addEventListener("blur",p),()=>{window.removeEventListener("keydown",l),window.removeEventListener("keyup",c),window.removeEventListener("wheel",u),window.removeEventListener("mousedown",h),window.removeEventListener("mouseup",f),window.removeEventListener("mousemove",m),window.removeEventListener("blur",p)}},[a]),y.jsx(uc.Provider,{value:t,children:e})}var om=3,am=32,lm=200,cm=8;function gt({label:e,value:t,onChange:n,min:i=0,max:s=1,step:r=.01,unit:o,shortcut:a,shortcutActive:l}){const c=d.useRef(null),u=d.useRef(null),h=d.useRef(null),f=d.useRef(null),m=d.useRef(null),[p,v]=d.useState(!1),[g,b]=d.useState(!1),[C,S]=d.useState(!1),[x,w]=d.useState(!1),[P,A]=d.useState(!1),[k,D]=d.useState(!1),[M,V]=d.useState(""),G=d.useRef(null),X=d.useRef(null),$=d.useRef(!0),N=d.useRef(null),E=d.useRef(null),j=d.useRef(1),I=(t-i)/(s-i)*100,_=p||C,q=as(I),lt=ln(q,T=>`${T}%`),Mt=ln(q,T=>`max(5px, calc(${T}% - 9px))`),ut=as(0),jt=ln(ut,T=>`calc(100% + ${Math.abs(T)}px)`),mt=ln(ut,T=>T<0?T:0);d.useEffect(()=>{!p&&!N.current&&q.jump(I)},[I,p,q]);const U=d.useCallback(T=>{const W=E.current;if(!W)return t;const vt=(T-W.left)/j.current,z=c.current?c.current.offsetWidth:W.width,Xt=Math.max(0,Math.min(1,vt/z)),te=i+Xt*(s-i);return Math.max(i,Math.min(s,te))},[i,s,t]),O=d.useCallback(T=>(T-i)/(s-i)*100,[i,s]),B=d.useCallback((T,W)=>{const Q=E.current;if(!Q)return 0;const vt=W<0?Q.left-T:T-Q.right,z=Math.max(0,vt-am);return W*cm*Math.sqrt(Math.min(z/lm,1))},[]),K=d.useCallback(T=>{if(!k&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),X.current={x:T.clientX,y:T.clientY},$.current=!0,v(!0),c.current)){E.current=c.current.getBoundingClientRect();const W=c.current.offsetWidth;j.current=E.current.width/W}},[k]),Y=d.useCallback(T=>{if(!p||!X.current)return;const W=T.clientX-X.current.x,Q=T.clientY-X.current.y,vt=Math.sqrt(W*W+Q*Q);if($.current&&vt>om&&($.current=!1,b(!0)),!$.current){const z=E.current;z&&(T.clientXz.right?ut.jump(B(T.clientX,1)):ut.jump(0));const Xt=U(T.clientX),te=O(Xt);N.current&&(N.current.stop(),N.current=null),q.jump(te),n(Mn(Xt,r))}},[p,U,O,n,q,ut,B]),ht=d.useCallback(T=>{if(p){if($.current){const W=U(T.clientX),vt=(s-i)/r<=10?Math.max(i,Math.min(s,i+Math.round((W-i)/r)*r)):em(W,i,s),z=O(vt);N.current&&N.current.stop(),N.current=Eo(q,z,{type:"spring",stiffness:300,damping:25,mass:.8,onComplete:()=>{N.current=null}}),n(Mn(vt,r))}ut.get()!==0&&Eo(ut,0,{type:"spring",visualDuration:.35,bounce:.15}),v(!1),b(!1),X.current=null}},[p,U,O,n,i,s,q,ut]);d.useEffect(()=>(x&&!k&&!P?G.current=setTimeout(()=>{A(!0)},800):!x&&!k&&(G.current&&(clearTimeout(G.current),G.current=null),A(!1)),()=>{G.current&&clearTimeout(G.current)}),[x,k,P]),d.useEffect(()=>{k&&h.current&&(h.current.focus(),h.current.select())},[k]);const nt=T=>{V(T.target.value)},ft=()=>{const T=parseFloat(M);if(!isNaN(T)){const W=Math.max(i,Math.min(s,T));n(Mn(W,r))}D(!1),w(!1),A(!1)},Lt=T=>{P&&(T.stopPropagation(),T.preventDefault(),D(!0),V(t.toFixed(ls(r))))},tt=T=>{T.key==="Enter"?ft():T.key==="Escape"&&(D(!1),w(!1))},At=()=>{ft()},ot=t.toFixed(ls(r)),Dt=8,Ut=10,Wt=10;let Je=30,Qe=78;const Kt=c.current?.offsetWidth;Kt&&Kt>0&&(f.current&&(Je=(Ut+f.current.offsetWidth+Dt)/Kt*100),m.current&&(Qe=(Kt-Wt-m.current.offsetWidth-Dt)/Kt*100));const ke=IQe,tn=_?ke?.1:g?.9:.5:0,en=(s-i)/r,R=en<=10?Array.from({length:en-1},(T,W)=>{const Q=(W+1)*r/(s-i)*100;return y.jsx("div",{className:"dialkit-slider-hashmark",style:{left:`${Q}%`}},W)}):Array.from({length:9},(T,W)=>{const Q=(W+1)*10;return y.jsx("div",{className:"dialkit-slider-hashmark",style:{left:`${Q}%`}},W)});return y.jsx("div",{ref:c,className:"dialkit-slider-wrapper",children:y.jsxs(Pt.div,{ref:u,className:`dialkit-slider ${_?"dialkit-slider-active":""}`,onPointerDown:K,onPointerMove:Y,onPointerUp:ht,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{width:jt,x:mt},children:[y.jsx("div",{className:"dialkit-slider-hashmarks",children:R}),y.jsx(Pt.div,{className:"dialkit-slider-fill",style:{width:lt}}),y.jsx(Pt.div,{className:"dialkit-slider-handle",style:{left:Mt,y:"-50%"},animate:{opacity:tn,scaleX:_?1:.25,scaleY:_&&ke?.75:1},transition:{scaleX:{type:"spring",visualDuration:.25,bounce:.15},scaleY:{type:"spring",visualDuration:.2,bounce:.1},opacity:{duration:.15}}}),y.jsxs("span",{ref:f,className:"dialkit-slider-label",children:[e,a&&y.jsx("span",{className:`dialkit-shortcut-pill${l?" dialkit-shortcut-pill-active":""}`,children:im(a)})]}),k?y.jsx("input",{ref:h,type:"text",className:"dialkit-slider-input",value:M,onChange:nt,onKeyDown:tt,onBlur:At,onClick:T=>T.stopPropagation(),onMouseDown:T=>T.stopPropagation()}):y.jsx("span",{ref:m,className:`dialkit-slider-value ${P?"dialkit-slider-value-editable":""}`,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:Lt,onMouseDown:T=>P&&T.stopPropagation(),style:{cursor:P?"text":"default"},children:ot})]})})}function Qs({options:e,value:t,onChange:n}){const i=d.useRef(null),s=d.useRef(!1),[r,o]=d.useState(null),a=d.useCallback(()=>{const c=i.current;if(!c)return;const u=c.querySelector('[data-active="true"]');u&&o({left:u.offsetLeft,width:u.offsetWidth})},[]);d.useLayoutEffect(()=>{a()},[t,e.length,a]);const l=s.current;return s.current=!0,y.jsxs("div",{className:"dialkit-segmented",ref:i,children:[r&&y.jsx("div",{className:"dialkit-segmented-pill",style:{left:r.left,width:r.width,transition:l?"left 0.2s cubic-bezier(0.25, 1, 0.5, 1), width 0.2s cubic-bezier(0.25, 1, 0.5, 1)":"none"}}),e.map(c=>{const u=t===c.value;return y.jsx("button",{onClick:()=>n(c.value),className:"dialkit-segmented-button","data-active":String(u),children:c.label},c.value)})]})}function um({label:e,checked:t,onChange:n,shortcut:i,shortcutActive:s}){return y.jsxs("div",{className:"dialkit-labeled-control",children:[y.jsxs("span",{className:"dialkit-labeled-control-label",children:[e,i&&y.jsx("span",{className:`dialkit-shortcut-pill${s?" dialkit-shortcut-pill-active":""}`,children:sm(i)})]}),y.jsx(Qs,{options:[{value:"off",label:"Off"},{value:"on",label:"On"}],value:t?"on":"off",onChange:r=>n(r==="on")})]})}function hm(e,t,n,i){const s=[],o=i/100;let a=0,l=0;const c=1;for(let u=0;u<=100;u++){const h=u*o;s.push([h,a]);const f=-e*(a-c),m=-t*l,p=(f+m)/n;l+=p*o,a+=l*o}return s}function hc({spring:e,isSimpleMode:t}){let s,r,o;if(t){const v=e.visualDuration??.3,g=e.bounce??.2;o=1,s=2*Math.PI/v,s=Math.pow(s,2),r=2*(1-g)*Math.sqrt(s*o)}else s=e.stiffness??400,r=e.damping??17,o=e.mass??1;const a=2,l=hm(s,r,o,a),c=l.map(([,v])=>v),u=Math.min(...c),f=Math.max(...c)-u,m=l.map(([v,g],b)=>{const C=v/a*256,x=140-((g-u)/(f||1)*140*.6+140*.2);return`${b===0?"M":"L"} ${C} ${x}`}).join(" "),p=[];for(let v=1;v<4;v++){const g=64*v,b=140/4*v;p.push(y.jsx("line",{x1:g,y1:0,x2:g,y2:140,stroke:"rgba(255, 255, 255, 0.08)",strokeWidth:"1"},`v-${v}`),y.jsx("line",{x1:0,y1:b,x2:256,y2:b,stroke:"rgba(255, 255, 255, 0.08)",strokeWidth:"1"},`h-${v}`))}return y.jsxs("svg",{viewBox:"0 0 256 140",className:"dialkit-spring-viz",children:[p,y.jsx("line",{x1:0,y1:140/2,x2:256,y2:140/2,stroke:"rgba(255, 255, 255, 0.15)",strokeWidth:"1",strokeDasharray:"4,4"}),y.jsx("path",{d:m,fill:"none",stroke:"rgba(255, 255, 255, 0.6)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fm({panelId:e,path:t,label:n,spring:i,onChange:s}){const r=d.useCallback(f=>H.subscribe(e,f),[e]),o=d.useCallback(()=>H.getSpringMode(e,t),[e,t]),a=d.useSyncExternalStore(r,o,o),l=a==="simple",c=d.useRef({simple:i.visualDuration!==void 0?i:{type:"spring",visualDuration:.3,bounce:.2},advanced:i.stiffness!==void 0?i:{type:"spring",stiffness:200,damping:25,mass:1}});l?c.current.simple=i:c.current.advanced=i;const u=f=>{H.updateSpringMode(e,t,f),s(f==="simple"?c.current.simple:c.current.advanced)},h=(f,m)=>{if(l){const{stiffness:p,damping:v,mass:g,...b}=i;s({...b,[f]:m})}else{const{visualDuration:p,bounce:v,...g}=i;s({...g,[f]:m})}};return y.jsx(me,{title:n,defaultOpen:!0,children:y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[y.jsx(hc,{spring:i,isSimpleMode:l}),y.jsxs("div",{className:"dialkit-labeled-control",children:[y.jsx("span",{className:"dialkit-labeled-control-label",children:"Type"}),y.jsx(Qs,{options:[{value:"simple",label:"Time"},{value:"advanced",label:"Physics"}],value:a,onChange:u})]}),l?y.jsxs(y.Fragment,{children:[y.jsx(gt,{label:"Duration",value:i.visualDuration??.3,onChange:f=>h("visualDuration",f),min:.1,max:1,step:.05,unit:"s"}),y.jsx(gt,{label:"Bounce",value:i.bounce??.2,onChange:f=>h("bounce",f),min:0,max:1,step:.05})]}):y.jsxs(y.Fragment,{children:[y.jsx(gt,{label:"Stiffness",value:i.stiffness??400,onChange:f=>h("stiffness",f),min:1,max:1e3,step:10}),y.jsx(gt,{label:"Damping",value:i.damping??17,onChange:f=>h("damping",f),min:1,max:100,step:1}),y.jsx(gt,{label:"Mass",value:i.mass??1,onChange:f=>h("mass",f),min:.1,max:10,step:.1})]})]})})}function dm({easing:e}){const t=e.ease,n=200,i=10,r=(n-i*2)/2,o=(f,m)=>({x:i+(f+.5)*r,y:i+(1.5-m)*r}),a=o(0,0),l=o(1,1),c=o(t[0],t[1]),u=o(t[2],t[3]),h=`M ${a.x} ${a.y} C ${c.x} ${c.y}, ${u.x} ${u.y}, ${l.x} ${l.y}`;return y.jsxs("svg",{viewBox:`0 0 ${n} ${n}`,preserveAspectRatio:"xMidYMid slice",className:"dialkit-spring-viz dialkit-easing-viz",children:[y.jsx("line",{x1:a.x,y1:a.y,x2:l.x,y2:l.y,stroke:"rgba(255, 255, 255, 0.15)",strokeWidth:"1",strokeDasharray:"4,4"}),y.jsx("path",{d:h,fill:"none",stroke:"rgba(255, 255, 255, 0.6)",strokeWidth:"2",strokeLinecap:"round"})]})}function pm({panelId:e,path:t,label:n,value:i,onChange:s}){const r=d.useCallback(g=>H.subscribe(e,g),[e]),o=d.useCallback(()=>H.getTransitionMode(e,t),[e,t]),a=d.useSyncExternalStore(r,o,o),l=a==="easing",c=a==="simple",u=d.useRef({easing:i.type==="easing"?i:{type:"easing",duration:.3,ease:[1,-.4,.5,1]},simple:i.type==="spring"&&i.visualDuration!==void 0?i:{type:"spring",visualDuration:.3,bounce:.2},advanced:i.type==="spring"&&i.stiffness!==void 0?i:{type:"spring",stiffness:200,damping:25,mass:1}});l&&i.type==="easing"?u.current.easing=i:c&&i.type==="spring"?u.current.simple=i:a==="advanced"&&i.type==="spring"&&(u.current.advanced=i);const h=i.type==="spring"?i:u.current.simple,f=i.type==="easing"?i:u.current.easing,m=g=>{H.updateTransitionMode(e,t,g),s(g==="easing"?u.current.easing:g==="simple"?u.current.simple:u.current.advanced)},p=(g,b)=>{if(c){const{stiffness:C,damping:S,mass:x,...w}=h;s({...w,[g]:b})}else{const{visualDuration:C,bounce:S,...x}=h;s({...x,[g]:b})}},v=(g,b)=>{const C=[...f.ease];C[g]=b,s({...f,ease:C})};return y.jsx(me,{title:n,defaultOpen:!0,children:y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l?y.jsx(dm,{easing:f}):y.jsx(hc,{spring:h,isSimpleMode:c}),y.jsxs("div",{className:"dialkit-labeled-control",children:[y.jsx("span",{className:"dialkit-labeled-control-label",children:"Type"}),y.jsx(Qs,{options:[{value:"easing",label:"Easing"},{value:"simple",label:"Time"},{value:"advanced",label:"Physics"}],value:a,onChange:m})]}),l?y.jsxs(y.Fragment,{children:[y.jsx(gt,{label:"x1",value:f.ease[0],onChange:g=>v(0,g),min:0,max:1,step:.01}),y.jsx(gt,{label:"y1",value:f.ease[1],onChange:g=>v(1,g),min:-1,max:2,step:.01}),y.jsx(gt,{label:"x2",value:f.ease[2],onChange:g=>v(2,g),min:0,max:1,step:.01}),y.jsx(gt,{label:"y2",value:f.ease[3],onChange:g=>v(3,g),min:-1,max:2,step:.01}),y.jsx(gt,{label:"Duration",value:f.duration,onChange:g=>s({...f,duration:g}),min:.1,max:2,step:.05,unit:"s"}),y.jsx(gm,{ease:f.ease,onChange:g=>s({...f,ease:g})})]}):c?y.jsxs(y.Fragment,{children:[y.jsx(gt,{label:"Duration",value:h.visualDuration??.3,onChange:g=>p("visualDuration",g),min:.1,max:1,step:.05,unit:"s"}),y.jsx(gt,{label:"Bounce",value:h.bounce??.2,onChange:g=>p("bounce",g),min:0,max:1,step:.05})]}):y.jsxs(y.Fragment,{children:[y.jsx(gt,{label:"Stiffness",value:h.stiffness??400,onChange:g=>p("stiffness",g),min:1,max:1e3,step:10}),y.jsx(gt,{label:"Damping",value:h.damping??17,onChange:g=>p("damping",g),min:1,max:100,step:1}),y.jsx(gt,{label:"Mass",value:h.mass??1,onChange:g=>p("mass",g),min:.1,max:10,step:.1})]})]})})}function Vo(e){return e.map(t=>parseFloat(t.toFixed(2))).join(", ")}function mm(e){const t=e.split(",").map(n=>parseFloat(n.trim()));return t.length===4&&t.every(n=>!isNaN(n))?t:null}function gm({ease:e,onChange:t}){const[n,i]=d.useState(!1),[s,r]=d.useState(""),o=()=>{r(Vo(e)),i(!0)},a=()=>{const c=mm(s);c&&t(c),i(!1)},l=c=>{c.key==="Enter"&&c.target.blur()};return y.jsxs("div",{className:"dialkit-labeled-control",children:[y.jsx("span",{className:"dialkit-labeled-control-label",children:"Ease"}),y.jsx("input",{type:"text",className:"dialkit-text-input",value:n?s:Vo(e),onChange:c=>r(c.target.value),onFocus:o,onBlur:a,onKeyDown:l,spellCheck:!1})]})}function ym({label:e,value:t,onChange:n,placeholder:i}){return y.jsxs("div",{className:"dialkit-text-control",children:[y.jsx("label",{className:"dialkit-text-label",children:e}),y.jsx("input",{type:"text",className:"dialkit-text-input",value:t,onChange:s=>n(s.target.value),placeholder:i})]})}function vm(e,t,n={}){const{dropdownHeight:i=0,gap:s=4,allowAbove:r=!0}=n,o=e.getBoundingClientRect(),a=t.getBoundingClientRect(),l=window.innerHeight-o.bottom-s,c=r&&ll;return{top:c?o.top-a.top-i-s:o.bottom-a.top+s,left:o.left-a.left,width:o.width,above:c}}function bm(e){return e?.closest(".dialkit-root")??null}function Sm(e){return e.replace(/\b\w/g,t=>t.toUpperCase())}function xm(e){return e.map(t=>typeof t=="string"?{value:t,label:Sm(t)}:t)}function wm({label:e,value:t,options:n,onChange:i}){const[s,r]=d.useState(!1),o=d.useRef(null),a=d.useRef(null),[l,c]=d.useState(null),[u,h]=d.useState(null),f=xm(n),m=f.find(v=>v.value===t),p=d.useCallback(()=>{const v=o.current;if(!v||!l)return;const g=8+f.length*36;h(vm(v,l,{dropdownHeight:g}))},[f.length,l]);return d.useEffect(()=>{c(bm(o.current)??document.body)},[]),d.useEffect(()=>{s&&p()},[s,p]),d.useEffect(()=>{if(!s)return;const v=g=>{const b=g.target;o.current&&!o.current.contains(b)&&a.current&&!a.current.contains(b)&&r(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),y.jsxs("div",{className:"dialkit-select-row",children:[y.jsxs("button",{ref:o,className:"dialkit-select-trigger",onClick:()=>r(!s),"data-open":String(s),children:[y.jsx("span",{className:"dialkit-select-label",children:e}),y.jsxs("div",{className:"dialkit-select-right",children:[y.jsx("span",{className:"dialkit-select-value",children:m?.label??t}),y.jsx(Pt.svg,{className:"dialkit-select-chevron",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",animate:{rotate:s?180:0},transition:{type:"spring",visualDuration:.2,bounce:.15},children:y.jsx("path",{d:Js})})]})]}),l&&bs.createPortal(y.jsx(Qn,{children:s&&u&&y.jsx(Pt.div,{ref:a,className:"dialkit-select-dropdown",initial:{opacity:0,y:u.above?8:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:u.above?8:-8,scale:.95},transition:{type:"spring",visualDuration:.15,bounce:0},style:{position:"absolute",left:u.left,top:u.top,width:u.width,transformOrigin:u.above?"bottom":"top"},children:f.map(v=>y.jsx("button",{className:"dialkit-select-option","data-selected":String(v.value===t),onClick:()=>{i(v.value),r(!1)},children:v.label},v.value))})}),l)]})}var Cm=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;function Pm({label:e,value:t,onChange:n}){const[i,s]=d.useState(!1),[r,o]=d.useState(t),a=d.useRef(null);d.useEffect(()=>{i||o(t)},[t,i]);function l(){s(!1),Cm.test(r)?n(r):o(t)}function c(u){u.key==="Enter"?l():u.key==="Escape"&&(s(!1),o(t))}return y.jsxs("div",{className:"dialkit-color-control",children:[y.jsx("span",{className:"dialkit-color-label",children:e}),y.jsxs("div",{className:"dialkit-color-inputs",children:[i?y.jsx("input",{type:"text",className:"dialkit-color-hex-input",value:r,onChange:u=>o(u.target.value),onBlur:l,onKeyDown:c,autoFocus:!0}):y.jsx("span",{className:"dialkit-color-hex",onClick:()=>s(!0),children:(t??"").toUpperCase()}),y.jsx("button",{className:"dialkit-color-swatch",style:{backgroundColor:t},onClick:()=>a.current?.click(),title:"Pick color"}),y.jsx("input",{ref:a,type:"color",className:"dialkit-color-picker-native",value:t.length===4?Tm(t):t.slice(0,7),onChange:u=>n(u.target.value)})]})]})}function Tm(e){return e.length!==4?e:`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}function km({panelId:e,presets:t,activePresetId:n,onAdd:i}){const[s,r]=d.useState(!1),o=d.useRef(null),a=d.useRef(null),[l,c]=d.useState({top:0,left:0,width:0}),u=t.length>0,h=t.find(b=>b.id===n),f=d.useCallback(()=>{if(!u)return;const b=o.current?.getBoundingClientRect();b&&c({top:b.bottom+4,left:b.left,width:b.width}),r(!0)},[u]),m=d.useCallback(()=>r(!1),[]),p=d.useCallback(()=>{s?m():f()},[s,f,m]);d.useEffect(()=>{if(!s)return;const b=C=>{const S=C.target;o.current?.contains(S)||a.current?.contains(S)||m()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s,m]);const v=b=>{b?H.loadPreset(e,b):H.clearActivePreset(e),m()},g=(b,C)=>{b.stopPropagation(),H.deletePreset(e,C)};return y.jsxs("div",{className:"dialkit-preset-manager",children:[y.jsxs("button",{ref:o,className:"dialkit-preset-trigger",onClick:p,"data-open":String(s),"data-has-preset":String(!!h),"data-disabled":String(!u),children:[y.jsx("span",{className:"dialkit-preset-label",children:h?h.name:"Version 1"}),y.jsx(Pt.svg,{className:"dialkit-select-chevron",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",animate:{rotate:s?180:0,opacity:u?.6:.25},transition:{type:"spring",visualDuration:.2,bounce:.15},children:y.jsx("path",{d:Js})})]}),bs.createPortal(y.jsx(Qn,{children:s&&y.jsxs(Pt.div,{ref:a,className:"dialkit-root dialkit-preset-dropdown",style:{position:"fixed",top:l.top,left:l.left,minWidth:l.width},initial:{opacity:0,y:4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,scale:.97,pointerEvents:"none"},transition:{type:"spring",visualDuration:.15,bounce:0},children:[y.jsx("div",{className:"dialkit-preset-item","data-active":String(!n),onClick:()=>v(null),children:y.jsx("span",{className:"dialkit-preset-name",children:"Version 1"})}),t.map(b=>y.jsxs("div",{className:"dialkit-preset-item","data-active":String(b.id===n),onClick:()=>v(b.id),children:[y.jsx("span",{className:"dialkit-preset-name",children:b.name}),y.jsx("button",{className:"dialkit-preset-delete",onClick:C=>g(C,b.id),title:"Delete preset",children:y.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:tm.map((C,S)=>y.jsx("path",{d:C},S))})})]},b.id))]})}),document.body)]})}function Oo({panel:e,defaultOpen:t=!0,inline:n=!1,onOpenChange:i,variant:s="root"}){const[r,o]=d.useState(!1),[a,l]=d.useState(t),c=d.useContext(uc);Object.keys(e.shortcuts).length>0;const u=d.useCallback(w=>H.subscribe(e.id,w),[e.id]),h=d.useCallback(()=>H.getValues(e.id),[e.id]),f=d.useSyncExternalStore(u,h,h),m=H.getPresets(e.id),p=H.getActivePresetId(e.id),v=()=>{const w=m.length+2;H.savePreset(e.id,`Version ${w}`)},g=()=>{const w=JSON.stringify(f,null,2),P=`Update the useDialKit configuration for "${e.name}" with these values: \`\`\`json ${w} \`\`\` Apply these values as the new defaults in the useDialKit call.`;navigator.clipboard.writeText(P),o(!0),setTimeout(()=>o(!1),1500)},b=d.useCallback(w=>{l(w),i?.(w)},[i]),C=w=>{const P=f[w.path];switch(w.type){case"slider":return y.jsx(gt,{label:w.label,value:P,onChange:A=>H.updateValue(e.id,w.path,A),min:w.min,max:w.max,step:w.step,shortcut:w.shortcut,shortcutActive:c.activePanelId===e.id&&c.activePath===w.path},w.path);case"toggle":return y.jsx(um,{label:w.label,checked:P,onChange:A=>H.updateValue(e.id,w.path,A),shortcut:w.shortcut,shortcutActive:c.activePanelId===e.id&&c.activePath===w.path},w.path);case"spring":return y.jsx(fm,{panelId:e.id,path:w.path,label:w.label,spring:P,onChange:A=>H.updateValue(e.id,w.path,A)},w.path);case"transition":return y.jsx(pm,{panelId:e.id,path:w.path,label:w.label,value:P,onChange:A=>H.updateValue(e.id,w.path,A)},w.path);case"folder":return y.jsx(me,{title:w.label,defaultOpen:w.defaultOpen??!0,children:w.children?.map(C)},w.path);case"text":return y.jsx(ym,{label:w.label,value:P,onChange:A=>H.updateValue(e.id,w.path,A),placeholder:w.placeholder},w.path);case"select":return y.jsx(wm,{label:w.label,value:P,options:w.options??[],onChange:A=>H.updateValue(e.id,w.path,A)},w.path);case"color":return y.jsx(Pm,{label:w.label,value:P,onChange:A=>H.updateValue(e.id,w.path,A)},w.path);case"action":return y.jsx("button",{className:"dialkit-button",onClick:()=>H.triggerAction(e.id,w.path),children:w.label},w.path);default:return null}},S=()=>e.controls.map(C),x=y.jsxs(y.Fragment,{children:[y.jsx(Pt.button,{className:"dialkit-toolbar-add",onClick:v,title:"Add preset",whileTap:{scale:.9},transition:{type:"spring",visualDuration:.15,bounce:.3},children:y.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:Qp.map((w,P)=>y.jsx("path",{d:w},P))})}),y.jsx(km,{panelId:e.id,presets:m,activePresetId:p,onAdd:v}),y.jsx(Pt.button,{className:"dialkit-toolbar-add",onClick:g,title:"Copy parameters",whileTap:{scale:.9},transition:{type:"spring",visualDuration:.15,bounce:.3},children:y.jsx("span",{style:{position:"relative",width:16,height:16},children:y.jsx(Qn,{initial:!1,mode:"wait",children:r?y.jsx(Pt.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",inset:0,width:16,height:16,color:"var(--dial-text-label)"},initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.08},children:y.jsx("path",{d:Jp})},"check"):y.jsxs(Pt.svg,{viewBox:"0 0 24 24",fill:"none",style:{position:"absolute",inset:0,width:16,height:16,color:"var(--dial-text-label)"},initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.08},children:[y.jsx("path",{d:wi.board,stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),y.jsx("path",{d:wi.sparkle,fill:"currentColor"}),y.jsx("path",{d:wi.body,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]},"clipboard")})})})]});return s==="section"?y.jsxs(me,{title:e.name,defaultOpen:t,onOpenChange:b,children:[y.jsx("div",{className:"dialkit-panel-section-toolbar",onClick:w=>w.stopPropagation(),children:x}),S()]}):y.jsx("div",{className:"dialkit-panel-wrapper",children:y.jsx(me,{title:e.name,defaultOpen:t,isRoot:!0,inline:n,onOpenChange:b,toolbar:x,children:S()})})}var Am=8,Mm=42,Dm=[".dialkit-panel-icon",".dialkit-panel-toolbar","button","input","select","textarea","a",'[role="button"]','[contenteditable="true"]'].join(",");function Rm(e,t){if(!(e instanceof Element)||!t)return null;const n=e.closest(".dialkit-panel-inner");if(!n||!t.contains(n))return null;if(n.getAttribute("data-collapsed")==="true")return n;const i=e.closest(".dialkit-panel-header");return!i||!n.contains(i)||e.closest(Dm)?null:i}function Em(e,t,n){const i=n.getBoundingClientRect();return{pointerX:e,pointerY:t,elX:i.left,elY:i.top}}function Lm(e,t,n){return{x:e.elX+t-e.pointerX,y:e.elY+n-e.pointerY}}function Im(e,t,n){const i=t-e.pointerX,s=n-e.pointerY;return Math.hypot(i,s)>=Am}function Vm(e,t,n=typeof window<"u"?window.innerWidth:void 0){return t&&n?t.x+Mm/2{n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()};e.addEventListener("click",t,{capture:!0,once:!0}),window.setTimeout(()=>{e.removeEventListener("click",t,!0)},0)}var Fm=typeof process<"u"?!1:!(typeof import.meta<"u");function jm({position:e="top-right",defaultOpen:t=!0,mode:n="popover",theme:i="system",productionEnabled:s=Fm,onOpenChange:r}){if(!s)return null;const[o,a]=d.useState([]),[l,c]=d.useState(!1),u=n==="inline",h=d.useRef(null),[f,m]=d.useState(null),[p,v]=d.useState(e),g=d.useRef(null),b=d.useRef(!1),C=d.useRef(null),S=d.useRef(!1),x=d.useRef(null),w=d.useRef(new Map),P=d.useRef(null);d.useEffect(()=>(c(!0),a(H.getPanels()),H.subscribeGlobal(()=>{a(H.getPanels())})),[]),d.useEffect(()=>{const E=u||t,j=new Map;for(const I of o)j.set(I.id,w.current.get(I.id)??E);w.current=j,P.current=Array.from(j.values()).some(Boolean)},[t,u,o]),d.useEffect(()=>{if(!h.current||u)return;const E=new MutationObserver(()=>{const j=h.current?.querySelectorAll(".dialkit-panel-inner");if(!j||j.length===0)return;const I=Array.from(j).every(q=>q.getAttribute("data-collapsed")==="true"),_=f;if(I)_?g.current=_:g.current&&m(g.current);else{if(_){g.current=_;const q=_.x+21,lt=window.innerWidth/2;v(qE.disconnect()},[u,f,e]);const A=d.useCallback(E=>{const j=h.current,I=Rm(E.target,j);!j||!I||(x.current=I,C.current=Em(E.clientX,E.clientY,j),S.current=!1,b.current=!0,I.setPointerCapture(E.pointerId))},[]),k=d.useCallback(E=>{!b.current||!C.current||!S.current&&!Im(C.current,E.clientX,E.clientY)||(S.current=!0,m(Lm(C.current,E.clientX,E.clientY)))},[]),D=d.useCallback(E=>{if(!b.current)return;b.current=!1,C.current=null;const j=x.current;j?.hasPointerCapture(E.pointerId)&&j.releasePointerCapture(E.pointerId),S.current&&(E.stopPropagation(),j&&Om(j)),x.current=null},[]),M=d.useCallback((E,j)=>{w.current.set(E,j);const I=u||t,_=o.some(q=>w.current.get(q.id)??I);P.current!==_&&(P.current=_,r?.(_))},[t,u,r,o]),V=d.useCallback(E=>{P.current!==E&&(P.current=E,r?.(E))},[r]);if(!l||typeof window>"u"||o.length===0)return null;const G=f?{top:f.y,left:f.x,right:"auto",bottom:"auto"}:void 0,X=Vm(p,f),$=o.length>1,N=y.jsx(rm,{children:y.jsx("div",{className:"dialkit-root","data-mode":n,"data-theme":i,children:y.jsx("div",{ref:h,className:"dialkit-panel","data-position":u||f?void 0:p,"data-origin-x":u?void 0:X,"data-mode":n,"data-multiple":$?"true":void 0,style:G,onPointerDown:u?void 0:A,onPointerMove:u?void 0:k,onPointerUp:u?void 0:D,onPointerCancel:u?void 0:D,children:$?y.jsx("div",{className:"dialkit-panel-wrapper",children:y.jsx(me,{title:"DialKit",defaultOpen:u||t,isRoot:!0,inline:u,onOpenChange:V,panelHeightOffset:2,children:o.map(E=>y.jsx(Oo,{panel:E,defaultOpen:!0,variant:"section"},E.id))})}):o.map(E=>y.jsx(Oo,{panel:E,defaultOpen:u||t,inline:u,onOpenChange:j=>M(E.id,j)},E.id))})})});return u?N:bs.createPortal(N,document.body)}const Pi=[0,-1,0],Fo=.005,Um=.0015,Nm=.5,Bm=.05,Gm=Math.PI-.05;function Hm({plyUrl:e,generationKey:t,initialCameraPosition:n,initialCameraTarget:i,initialCameraUp:s,bgColor:r,fov:o,autoRotate:a,splatPosition:l,splatRotation:c,splatFlip:u,onCameraChange:h,children:f}){const m=d.useRef(null),p=d.useRef(null),v=d.useRef(null),g=d.useRef(null),[b,C]=d.useState("Waiting for a generated splat…"),S=d.useRef(h);S.current=h;const x=d.useRef(o);x.current=o;const w=d.useRef(a);w.current=a;const P=d.useRef(r);P.current=r;const A=d.useRef(l),k=d.useRef(c),D=d.useRef(u);A.current=l,k.current=c,D.current=u;const M=d.useRef(null),V=d.useRef([0,0,0]),G=d.useRef([0,0,3]),X=d.useRef([...Pi]),$=d.useRef(!0);return d.useEffect(()=>{let N=!1,E=null,j=null,I=0;const _=[],q=async()=>{const U=m.current;if(!e||!U){C("Waiting for a generated splat…");return}C("Loading splat preview…");let O,B;try{const[K,Y]=await Promise.all([Ec(()=>import("./index-BIhgVP9E.js"),[]),fetch(e)]);O=K,p.current=K,B=new Uint8Array(await Y.arrayBuffer())}catch(K){N||C(`Preview failed: ${No(K)}`);return}if(!(N||!m.current))try{E=O.createViewer("aholo-preview",U,{antialiasing:!0,alpha:!0}),v.current=E;const K=await O.SplatLoader.parseSplatData(O.SplatLoader.SplatFileType.PLY,B,O.SplatLoader.SplatPackType.Compressed);if(N)return;const Y=zm(K);if(j=await O.SplatUtils.createSplat(K),N){j.freeGPU();return}g.current=j;const ht=new O.PerspectiveCamera(x.current,Uo(U),.05,5e3);M.current=ht,ut(Y,{position:n,target:i,up:s,fov:x.current}),jo(j,{position:A.current,rotation:k.current,flip:D.current}),E.getScene().add(j),E.setCamera(ht);const[nt,ft,Lt]=fc(P.current);O.setViewerConfig(E,{pipeline:{Background:{background:{active:O.BackgroundMode.BasicBackground,basic:{color:new O.Color(nt,ft,Lt)}},ground:{enabled:!1}},Splatting:{enabled:!0},TAA:{enabled:!0}}});let tt=performance.now();const At=Ut=>{const Wt=Math.min((Ut-tt)/1e3,.1);tt=Ut,w.current&&(G.current=Ti(G.current,ue(X.current),Nm*Wt),$.current=!0),$.current&&(Mt(ht),lt(),$.current=!1),E?.render(),I=requestAnimationFrame(At)};I=requestAnimationFrame(At);const ot=()=>{const Ut=m.current;!Ut||!E||(E.resize(),ht.aspect=Uo(Ut),ht.updateProjectionMatrix(),$.current=!0)},Dt=new ResizeObserver(ot);Dt.observe(U),_.push(()=>Dt.disconnect()),jt(U,_),C("Preview ready. Drag to orbit, scroll to zoom.")}catch(K){N||C(`Preview failed: ${No(K)}`)}},lt=()=>{const U=S.current;if(!U)return;const O=V.current,B=G.current;U({position:[O[0]+B[0],O[1]+B[1],O[2]+B[2]],target:[...O],up:[...X.current]})},Mt=U=>{const O=p.current;if(!O)return;const B=V.current,K=G.current,Y=X.current;U.up.set(Y[0],Y[1],Y[2]),U.position.set(B[0]+K[0],B[1]+K[1],B[2]+K[2]),U.lookAt(new O.Vector3(B[0],B[1],B[2]))},ut=(U,O)=>{if(O.position){const B=O.target??[0,0,0];V.current=[...B],G.current=[O.position[0]-B[0],O.position[1]-B[1],O.position[2]-B[2]],X.current=O.up?[...O.up]:[...Pi]}else{V.current=[...U.center],X.current=[...Pi];const B=Math.max(U.radius/Math.tan(O.fov*Math.PI/360),.1)*1.4,K=ue([.35,-.35,-1]);G.current=[K[0]*B,K[1]*B,K[2]*B]}$.current=!0},jt=(U,O)=>{let B=!1,K=0,Y=0;const ht=tt=>{B=!0,K=tt.clientX,Y=tt.clientY,U.setPointerCapture(tt.pointerId)},nt=tt=>{if(!B)return;const At=tt.clientX-K,ot=tt.clientY-Y;K=tt.clientX,Y=tt.clientY,mt(At,ot)},ft=tt=>{if(B){B=!1;try{U.releasePointerCapture(tt.pointerId)}catch{}}},Lt=tt=>{tt.preventDefault();const At=Math.exp(tt.deltaY*Um),ot=G.current,Dt=tr(ot),Wt=Math.min(Math.max(Dt*At,Xm(Dt)),Dt*100)/(Dt||1);G.current=[ot[0]*Wt,ot[1]*Wt,ot[2]*Wt],$.current=!0};U.addEventListener("pointerdown",ht),U.addEventListener("pointermove",nt),U.addEventListener("pointerup",ft),U.addEventListener("pointercancel",ft),U.addEventListener("wheel",Lt,{passive:!1}),O.push(()=>{U.removeEventListener("pointerdown",ht),U.removeEventListener("pointermove",nt),U.removeEventListener("pointerup",ft),U.removeEventListener("pointercancel",ft),U.removeEventListener("wheel",Lt)})},mt=(U,O)=>{const B=ue(X.current);let K=G.current;K=Ti(K,B,-U*Fo);const Y=ue([-K[0],-K[1],-K[2]]),ht=ue(_m(Y,B)),nt=Ti(K,ht,O*Fo),ft=Math.acos(Km($m(ue(nt),B),-1,1));G.current=ft>Bm&&ft{N=!0,cancelAnimationFrame(I);for(const U of _)U();if(M.current=null,v.current=null,g.current=null,p.current=null,j){try{E?.getScene().remove(j)}catch{}j.freeGPU()}E?.destroy()}},[e,t]),d.useEffect(()=>{const N=M.current;N&&(N.fov=o,N.updateProjectionMatrix(),$.current=!0)},[o]),d.useEffect(()=>{const N=v.current,E=p.current;!N||!E||Wm(E,N,r)},[r]),d.useEffect(()=>{const N=g.current;N&&(jo(N,{position:l,rotation:c,flip:u}),$.current=!0)},[l,c,u]),y.jsxs("section",{className:"panel preview-panel",children:[y.jsxs("div",{className:"preview-toolbar",children:[y.jsx("span",{className:"preview-title",children:"Gaussian Splat Preview · Aholo"}),y.jsx("span",{className:"preview-status",children:b})]}),y.jsxs("div",{className:"splat-canvas-shell",children:[y.jsx("div",{ref:m,className:"splat-canvas-host"}),e?null:y.jsx("div",{className:"splat-empty",children:"Generate a splat to preview it here."})]}),f]})}function Wm(e,t,n){const[i,s,r]=fc(n);e.setViewerConfig(t,{pipeline:{Background:{background:{active:e.BackgroundMode.BasicBackground,basic:{color:new e.Color(i,s,r)}},ground:{enabled:!1}}}})}function jo(e,t){e.position.set(t.position[0],t.position[1],t.position[2]),e.rotation.set(t.rotation[0]*Math.PI/180,t.rotation[1]*Math.PI/180,t.rotation[2]*Math.PI/180,"XYZ"),e.scale.set(t.flip[0]?-1:1,t.flip[1]?-1:1,t.flip[2]?-1:1)}function zm(e){const t=e.counts;if(!t)return{center:[0,0,0],radius:1};const n=new Float32Array(t*3);e.fillCenters(n);let i=1/0,s=1/0,r=1/0,o=-1/0,a=-1/0,l=-1/0;for(let h=0;ho&&(o=f),m>a&&(a=m),p>l&&(l=p)}if(!Number.isFinite(i))return{center:[0,0,0],radius:1};const c=[(i+o)/2,(s+a)/2,(r+l)/2],u=Math.max(.5*tr([o-i,a-s,l-r]),.05);return{center:c,radius:u}}function Uo(e){const t=e.getBoundingClientRect();return t.height>0?t.width/t.height:1}function fc(e){const t=e.replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.padEnd(6,"0"),i=parseInt(n.slice(0,6),16);return Number.isNaN(i)?[0,0,0]:[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}function No(e){return e instanceof Error?e.message:String(e)}function tr(e){return Math.hypot(e[0],e[1],e[2])}function ue(e){const t=tr(e)||1;return[e[0]/t,e[1]/t,e[2]/t]}function $m(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _m(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Km(e,t,n){return Math.min(Math.max(e,t),n)}function Xm(e){return Math.max(e*.02,.02)}function Ti(e,t,n){const i=Math.cos(n),s=Math.sin(n),[r,o,a]=t,l=r*e[0]+o*e[1]+a*e[2],c=[o*e[2]-a*e[1],a*e[0]-r*e[2],r*e[1]-o*e[0]];return[e[0]*i+c[0]*s+r*l*(1-i),e[1]*i+c[1]*s+o*l*(1-i),e[2]*i+c[2]*s+a*l*(1-i)]}var ei=typeof self<"u"?self:global;const _e=typeof navigator<"u",Ym=_e&&typeof HTMLImageElement>"u",Gn=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),er=ei.Buffer,hn=ei.BigInt,nr=!!er,qm=e=>e;function Hn(e,t=qm){if(Gn)try{return typeof require=="function"?Promise.resolve(t(require(e))):import(e).then(t)}catch{console.warn(`Couldn't load ${e}`)}}let ir=ei.fetch;const Zm=e=>ir=e;if(!ei.fetch){const e=Hn("http",(i=>i)),t=Hn("https",(i=>i)),n=(i,{headers:s}={})=>new Promise((async(r,o)=>{let{port:a,hostname:l,pathname:c,protocol:u,search:h}=new URL(i);const f={method:"GET",hostname:l,path:encodeURI(c)+h,headers:s};a!==""&&(f.port=Number(a));const m=(u==="https:"?await t:await e).request(f,(p=>{if(p.statusCode===301||p.statusCode===302){let v=new URL(p.headers.location,i).toString();return n(v,{headers:s}).then(r).catch(o)}r({status:p.statusCode,arrayBuffer:()=>new Promise((v=>{let g=[];p.on("data",(b=>g.push(b))),p.on("end",(()=>v(Buffer.concat(g))))}))})}));m.on("error",o),m.end()}));Zm(n)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Wn=e=>dc(e)?void 0:e,Jm=e=>e!==void 0;function dc(e){return e===void 0||(e instanceof Map?e.size===0:Object.values(e).filter(Jm).length===0)}function rt(e){let t=new Error(e);throw delete t.stack,t}function oe(e){return(e=(function(t){for(;t.endsWith("\0");)t=t.slice(0,-1);return t})(e).trim())===""?void 0:e}function cs(e){let t=(function(n){let i=0;return n.ifd0.enabled&&(i+=1024),n.exif.enabled&&(i+=2048),n.makerNote&&(i+=2048),n.userComment&&(i+=1024),n.gps.enabled&&(i+=512),n.interop.enabled&&(i+=100),n.ifd1.enabled&&(i+=1024),i+2048})(e);return e.jfif.enabled&&(t+=50),e.xmp.enabled&&(t+=2e4),e.iptc.enabled&&(t+=14e3),e.icc.enabled&&(t+=6e3),t}const us=e=>String.fromCharCode.apply(null,e),Bo=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;function pc(e){return Bo?Bo.decode(e):nr?Buffer.from(e).toString("utf8"):decodeURIComponent(escape(us(e)))}class Ct{static from(t,n){return t instanceof this&&t.le===n?t:new Ct(t,void 0,void 0,n)}constructor(t,n=0,i,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(t)&&(t=new Uint8Array(t)),t===0)this.byteOffset=0,this.byteLength=0;else if(t instanceof ArrayBuffer){i===void 0&&(i=t.byteLength-n);let r=new DataView(t,n,i);this._swapDataView(r)}else if(t instanceof Uint8Array||t instanceof DataView||t instanceof Ct){i===void 0&&(i=t.byteLength-n),(n+=t.byteOffset)+i>t.byteOffset+t.byteLength&&rt("Creating view outside of available memory in ArrayBuffer");let r=new DataView(t.buffer,n,i);this._swapDataView(r)}else if(typeof t=="number"){let r=new DataView(new ArrayBuffer(t));this._swapDataView(r)}else rt("Invalid input argument for BufferView: "+t)}_swapArrayBuffer(t){this._swapDataView(new DataView(t))}_swapBuffer(t){this._swapDataView(new DataView(t.buffer,t.byteOffset,t.byteLength))}_swapDataView(t){this.dataView=t,this.buffer=t.buffer,this.byteOffset=t.byteOffset,this.byteLength=t.byteLength}_lengthToEnd(t){return this.byteLength-t}set(t,n,i=Ct){return t instanceof DataView||t instanceof Ct?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array||rt("BufferView.set(): Invalid data argument."),this.toUint8().set(t,n),new i(this,n,t.byteLength)}subarray(t,n){return n=n||this._lengthToEnd(t),new Ct(this,t,n)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(t,n){return new Uint8Array(this.buffer,this.byteOffset+t,n)}getString(t=0,n=this.byteLength){return pc(this.getUint8Array(t,n))}getLatin1String(t=0,n=this.byteLength){let i=this.getUint8Array(t,n);return us(i)}getUnicodeString(t=0,n=this.byteLength){const i=[];for(let s=0;s1e4?ds(e,t,"base64"):Gn&&e.includes("://")?fs(e,t,"url",ps):Gn?ds(e,t,"fs"):_e?fs(e,t,"url",ps):void rt("Invalid input argument");var n}async function fs(e,t,n,i){return Te.has(n)?ds(e,t,n):i?(async function(s,r){let o=await r(s);return new Ct(o)})(e,i):void rt(`Parser ${n} is not loaded`)}async function ds(e,t,n){let i=new(Te.get(n))(e,t);return await i.read(),i}const ps=e=>ir(e).then((t=>t.arrayBuffer())),ms=e=>new Promise(((t,n)=>{let i=new FileReader;i.onloadend=()=>t(i.result||new ArrayBuffer),i.onerror=n,i.readAsArrayBuffer(e)}));class tg extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}}function pt(e,t,n){let i=new tg;for(let[s,r]of n)i.set(s,r);if(Array.isArray(t))for(let s of t)e.set(s,i);else e.set(t,i);return i}function gs(e,t,n){let i,s=e.get(t);for(i of n)s.set(i[0],i[1])}const kt=new Map,ce=new Map,Dn=new Map,fn=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],mc=["jfif","xmp","icc","iptc","ihdr"],ys=["tiff",...mc],ct=["ifd0","ifd1","exif","gps","interop"],dn=[...ys,...ct],pn=["makerNote","userComment"],gc=["translateKeys","translateValues","reviveValues","multiSegment"],mn=[...gc,"sanitize","mergeOutput","silentErrors"];class yc{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}}class Re extends yc{get needed(){return this.enabled||this.deps.size>0}constructor(t,n,i,s){if(super(),F(this,"enabled",!1),F(this,"skip",new Set),F(this,"pick",new Set),F(this,"deps",new Set),F(this,"translateKeys",!1),F(this,"translateValues",!1),F(this,"reviveValues",!1),this.key=t,this.enabled=n,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=ct.includes(t),this.canBeFiltered&&(this.dict=kt.get(t)),i!==void 0)if(Array.isArray(i))this.parse=this.enabled=!0,this.canBeFiltered&&i.length>0&&this.translateTagSet(i,this.pick);else if(typeof i=="object"){if(this.enabled=!0,this.parse=i.parse!==!1,this.canBeFiltered){let{pick:r,skip:o}=i;r&&r.length>0&&this.translateTagSet(r,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(i)}else i===!0||i===!1?this.parse=this.enabled=i:rt(`Invalid options argument: ${i}`)}applyInheritables(t){let n,i;for(n of gc)i=t[n],i!==void 0&&(this[n]=i)}translateTagSet(t,n){if(this.dict){let i,s,{tagKeys:r,tagValues:o}=this.dict;for(i of t)typeof i=="string"?(s=o.indexOf(i),s===-1&&(s=r.indexOf(Number(i))),s!==-1&&n.add(Number(r[s]))):n.add(i)}else for(let i of t)n.add(i)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,zn(this.pick,this.deps)):this.enabled&&this.pick.size>0&&zn(this.pick,this.deps)}}var bt={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},Ho=new Map;class rr extends yc{static useCached(t){let n=Ho.get(t);return n!==void 0||(n=new this(t),Ho.set(t,n)),n}constructor(t){super(),t===!0?this.setupFromTrue():t===void 0?this.setupFromUndefined():Array.isArray(t)?this.setupFromArray(t):typeof t=="object"?this.setupFromObject(t):rt(`Invalid options argument ${t}`),this.firstChunkSize===void 0&&(this.firstChunkSize=_e?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let t;for(t of fn)this[t]=bt[t];for(t of mn)this[t]=bt[t];for(t of pn)this[t]=bt[t];for(t of dn)this[t]=new Re(t,bt[t],void 0,this)}setupFromTrue(){let t;for(t of fn)this[t]=bt[t];for(t of mn)this[t]=bt[t];for(t of pn)this[t]=!0;for(t of dn)this[t]=new Re(t,!0,void 0,this)}setupFromArray(t){let n;for(n of fn)this[n]=bt[n];for(n of mn)this[n]=bt[n];for(n of pn)this[n]=bt[n];for(n of dn)this[n]=new Re(n,!1,void 0,this);this.setupGlobalFilters(t,void 0,ct)}setupFromObject(t){let n;for(n of(ct.ifd0=ct.ifd0||ct.image,ct.ifd1=ct.ifd1||ct.thumbnail,Object.assign(this,t),fn))this[n]=ki(t[n],bt[n]);for(n of mn)this[n]=ki(t[n],bt[n]);for(n of pn)this[n]=ki(t[n],bt[n]);for(n of ys)this[n]=new Re(n,bt[n],t[n],this);for(n of ct)this[n]=new Re(n,bt[n],t[n],this.tiff);this.setupGlobalFilters(t.pick,t.skip,ct,dn),t.tiff===!0?this.batchEnableWithBool(ct,!0):t.tiff===!1?this.batchEnableWithUserValue(ct,t):Array.isArray(t.tiff)?this.setupGlobalFilters(t.tiff,void 0,ct):typeof t.tiff=="object"&&this.setupGlobalFilters(t.tiff.pick,t.tiff.skip,ct)}batchEnableWithBool(t,n){for(let i of t)this[i].enabled=n}batchEnableWithUserValue(t,n){for(let i of t){let s=n[i];this[i].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(t,n,i,s=i){if(t&&t.length){for(let o of s)this[o].enabled=!1;let r=Wo(t,i);for(let[o,a]of r)zn(this[o].pick,a),this[o].enabled=!0}else if(n&&n.length){let r=Wo(n,i);for(let[o,a]of r)zn(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:t,exif:n,xmp:i,iptc:s,icc:r}=this;this.makerNote?n.deps.add(37500):n.skip.add(37500),this.userComment?n.deps.add(37510):n.skip.add(37510),i.enabled||t.skip.add(700),s.enabled||t.skip.add(33723),r.enabled||t.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:t,exif:n,gps:i,interop:s}=this;s.needed&&(n.deps.add(40965),t.deps.add(40965)),n.needed&&t.deps.add(34665),i.needed&&t.deps.add(34853),this.tiff.enabled=ct.some((r=>this[r].enabled===!0))||this.makerNote||this.userComment;for(let r of ct)this[r].finalizeFilters()}get onlyTiff(){return!mc.map((t=>this[t].enabled)).some((t=>t===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let t of ys)this[t].enabled&&!yt.has(t)&&hs("segment parser",t)}}function Wo(e,t){let n,i,s,r,o=[];for(s of t){for(r of(n=kt.get(s),i=[],n))(e.includes(r[0])||e.includes(r[1]))&&i.push(r[0]);i.length&&o.push([s,i])}return o}function ki(e,t){return e!==void 0?e:t!==void 0?t:void 0}function zn(e,t){for(let n of t)e.add(n)}F(rr,"default",bt);class eg{constructor(t){F(this,"parsers",{}),F(this,"output",{}),F(this,"errors",[]),F(this,"pushToErrors",(n=>this.errors.push(n))),this.options=rr.useCached(t)}async read(t){this.file=await Qm(t,this.options)}setup(){if(this.fileParser)return;let{file:t}=this,n=t.getUint16(0);for(let[i,s]of Se)if(s.canHandle(t,n))return this.fileParser=new s(this.options,this.file,this.parsers),t[i]=!0;this.file.close&&this.file.close(),rt("Unknown file format")}async parse(){let{output:t,errors:n}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),n.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&n.length>0&&(t.errors=n),Wn(t)}async executeParsers(){let{output:t}=this;await this.fileParser.parse();let n=Object.values(this.parsers).map((async i=>{let s=await i.parse();i.assignToOutput(t,s)}));this.options.silentErrors&&(n=n.map((i=>i.catch(this.pushToErrors)))),await Promise.all(n)}async extractThumbnail(){this.setup();let{options:t,file:n}=this,i=yt.get("tiff",t);var s;if(n.tiff?s={start:0,type:"tiff"}:n.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let r=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new i(r,t,n),a=await o.extractThumbnail();return n.close&&n.close(),a}}async function ng(e,t){let n=new eg(t);return await n.read(e),n.parse()}class ni{constructor(t,n,i){F(this,"errors",[]),F(this,"ensureSegmentChunk",(async s=>{let r=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(r,o))s.chunk=this.file.subarray(r,o);else try{s.chunk=await this.file.readChunk(r,o)}catch(a){rt(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>r+o?s.chunk=this.file.subarray(r,o):s.size===void 0?s.chunk=this.file.subarray(r):rt("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(t),this.options=t,this.file=n,this.parsers=i}injectSegment(t,n){this.options[t].enabled&&this.createParser(t,n)}createParser(t,n){let i=new(yt.get(t))(n,this.options,this.file);return this.parsers[t]=i}createParsers(t){for(let n of t){let{type:i,chunk:s}=n,r=this.options[i];if(r&&r.enabled){let o=this.parsers[i];o&&o.append||o||this.createParser(i,s)}}}async readSegments(t){let n=t.map(this.ensureSegmentChunk);await Promise.all(n)}}class Ot{static findPosition(t,n){let i=t.getUint16(n+2)+2,s=typeof this.headerLength=="function"?this.headerLength(t,n,i):this.headerLength,r=n+s,o=i-s;return{offset:n,length:i,headerLength:s,start:r,size:o,end:r+o}}static parse(t,n={}){return new this(t,new rr({[this.type]:n}),t).parse()}normalizeInput(t){return t instanceof Ct?t:new Ct(t)}constructor(t,n={},i){F(this,"errors",[]),F(this,"raw",new Map),F(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(t),this.file=i,this.type=this.constructor.type,this.globalOptions=this.options=n,this.localOptions=n[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(t,n){let i=Dn.get(n),s=ce.get(n),r=kt.get(n),o=this.options[n],a=o.reviveValues&&!!i,l=o.translateValues&&!!s,c=o.translateKeys&&!!r,u={};for(let[h,f]of t)a&&i.has(h)?f=i.get(h)(f):l&&s.has(h)&&(f=this.translateValue(f,s.get(h))),c&&r.has(h)&&(h=r.get(h)||h),u[h]=f;return u}translateValue(t,n){return n[t]||n.DEFAULT||t}assignToOutput(t,n){this.assignObjectToOutput(t,this.constructor.type,n)}assignObjectToOutput(t,n,i){if(this.globalOptions.mergeOutput)return Object.assign(t,i);t[n]?Object.assign(t[n],i):t[n]=i}}F(Ot,"headerLength",4),F(Ot,"type",void 0),F(Ot,"multiSegment",!1),F(Ot,"canHandle",(()=>!1));function ig(e){return e===192||e===194||e===196||e===219||e===221||e===218||e===254}function sg(e){return e>=224&&e<=239}function rg(e,t,n){for(let[i,s]of yt)if(s.canHandle(e,t,n))return i}class zo extends ni{constructor(...t){super(...t),F(this,"appSegments",[]),F(this,"jpegSegments",[]),F(this,"unknownSegments",[])}static canHandle(t,n){return n===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(t){t===!0?(this.findAll=!0,this.wanted=new Set(yt.keyList())):(t=t===void 0?yt.keyList().filter((n=>this.options[n].enabled)):t.filter((n=>this.options[n].enabled&&yt.has(n))),this.findAll=!1,this.remaining=new Set(t),this.wanted=new Set(t)),this.unfinishedMultiSegment=!1}async findAppSegments(t=0,n){this.setupSegmentFinderArgs(n);let{file:i,findAll:s,wanted:r,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(r).some((a=>{let l=yt.get(a),c=this.options[a];return l.multiSegment&&c.multiSegment})),s&&await this.file.readWhole()),t=this.findAppSegmentsInRange(t,i.byteLength),!this.options.onlyTiff&&i.chunked){let a=!1;for(;o.size>0&&!a&&(i.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=i,c=this.appSegments.some((u=>!this.file.available(u.offset||u.start,u.length||u.size)));if(a=t>l&&!c?!await i.readNextChunk(t):!await i.readNextChunk(l),(t=this.findAppSegmentsInRange(t,i.byteLength))===void 0)return}}}findAppSegmentsInRange(t,n){n-=2;let i,s,r,o,a,l,{file:c,findAll:u,wanted:h,remaining:f,options:m}=this;for(;tn.multiSegment)))return;let t=(function(n,i){let s,r,o,a=new Map;for(let l=0;l{let s=yt.get(n,this.options);return s.handleMultiSegments?{type:n,chunk:s.handleMultiSegments(i)}:i[0]}))}getSegment(t){return this.appSegments.find((n=>n.type===t))}async getOrFindSegment(t){let n=this.getSegment(t);return n===void 0&&(await this.findAppSegments(0,[t]),n=this.getSegment(t)),n}}F(zo,"type","jpeg"),Se.set("jpeg",zo);const og=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class ag extends Ot{parseHeader(){var t=this.chunk.getUint16();t===18761?this.le=!0:t===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(t,n,i=new Map){let{pick:s,skip:r}=this.options[n];s=new Set(s);let o=s.size>0,a=r.size===0,l=this.chunk.getUint16(t);t+=2;for(let c=0;c13)&&rt(`Invalid TIFF value type. block: ${i.toUpperCase()}, tag: ${n.toString(16)}, type: ${r}, offset ${t}`),t>s.byteLength&&rt(`Invalid TIFF value offset. block: ${i.toUpperCase()}, tag: ${n.toString(16)}, type: ${r}, offset ${t} is outside of chunk size ${s.byteLength}`),r===1)return s.getUint8Array(t,o);if(r===2)return oe(s.getString(t,o));if(r===7)return s.getUint8Array(t,o);if(o===1)return this.parseTagValue(r,t);{let l=new((function(u){switch(u){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(r))(o),c=a;for(let u=0;ut.byteLength&&rt(`IFD0 offset points to outside of file. this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${t.byteLength}`),t.tiff&&await t.ensureChunk(this.ifd0Offset,cs(this.options));let n=this.parseBlock(this.ifd0Offset,"ifd0");return n.size!==0?(this.exifOffset=n.get(34665),this.interopOffset=n.get(40965),this.gpsOffset=n.get(34853),this.xmp=n.get(700),this.iptc=n.get(33723),this.icc=n.get(34675),this.options.sanitize&&(n.delete(34665),n.delete(40965),n.delete(34853),n.delete(700),n.delete(33723),n.delete(34675)),n):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,cs(this.options));let t=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=t.get(40965)),this.makerNote=t.get(37500),this.userComment=t.get(37510),this.options.sanitize&&(t.delete(40965),t.delete(37500),t.delete(37510)),this.unpack(t,41728),this.unpack(t,41729),t}unpack(t,n){let i=t.get(n);i&&i.length===1&&t.set(n,i[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let t=this.parseBlock(this.gpsOffset,"gps");return t&&t.has(2)&&t.has(4)&&(t.set("latitude",$o(...t.get(2),t.get(1))),t.set("longitude",$o(...t.get(4),t.get(3)))),t}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(t=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||t))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let t=this.ifd1.get(513),n=this.ifd1.get(514);return this.chunk.getUint8Array(t,n)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let t,n,i,s={};for(n of ct)if(t=this[n],!dc(t))if(i=this.canTranslate?this.translateBlock(t,n):Object.fromEntries(t),this.options.mergeOutput){if(n==="ifd1")continue;Object.assign(s,i)}else s[n]=i;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(t,n){if(this.globalOptions.mergeOutput)Object.assign(t,n);else for(let[i,s]of Object.entries(n))this.assignObjectToOutput(t,i,s)}}function $o(e,t,n,i){var s=e+t/60+n/3600;return i!=="S"&&i!=="W"||(s*=-1),s}F(Ai,"type","tiff"),F(Ai,"headerLength",10),yt.set("tiff",Ai);const or={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},or,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},or,{tiff:!1,ifd1:!0,mergeOutput:!1});Object.assign({},or,{firstChunkSize:4e4,ifd0:[274]});if(typeof navigator=="object"){let e=navigator.userAgent;if(e.includes("iPad")||e.includes("iPhone")){let t=e.match(/OS (\d+)_(\d+)/);if(t){let[,n,i]=t}}else if(e.includes("OS X 10")){let[,t]=e.match(/OS X 10[_.](\d+)/)}if(e.includes("Chrome/")){let[,t]=e.match(/Chrome\/(\d+)/)}else if(e.includes("Firefox/")){let[,t]=e.match(/Firefox\/(\d+)/)}}class lg extends Ct{constructor(...t){super(...t),F(this,"ranges",new cg),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(t,n,i){if(t===0&&this.byteLength===0&&i){let s=new DataView(i.buffer||i,i.byteOffset,i.byteLength);this._swapDataView(s)}else{let s=t+n;if(s>this.byteLength){let{dataView:r}=this._extend(s);this._swapDataView(r)}}}_extend(t){let n;n=nr?er.allocUnsafe(t):new Uint8Array(t);let i=new DataView(n.buffer,n.byteOffset,n.byteLength);return n.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:n,dataView:i}}subarray(t,n,i=!1){return n=n||this._lengthToEnd(t),i&&this._tryExtend(t,n),this.ranges.add(t,n),super.subarray(t,n)}set(t,n,i=!1){i&&this._tryExtend(n,t.byteLength,t);let s=super.set(t,n);return this.ranges.add(n,s.byteLength),s}async ensureChunk(t,n){this.chunked&&(this.ranges.available(t,n)||await this.readChunk(t,n))}available(t,n){return this.ranges.available(t,n)}}class cg{constructor(){F(this,"list",[])}get length(){return this.list.length}add(t,n,i=0){let s=t+n,r=this.list.filter((o=>_o(t,o.offset,s)||_o(t,o.end,s)));if(r.length>0){t=Math.min(t,...r.map((a=>a.offset))),s=Math.max(s,...r.map((a=>a.end))),n=s-t;let o=r.shift();o.offset=t,o.length=n,o.end=s,this.list=this.list.filter((a=>!r.includes(a)))}else this.list.push({offset:t,length:n,end:s})}available(t,n){let i=t+n;return this.list.some((s=>s.offset<=t&&i<=s.end))}}function _o(e,t,n){return e<=t&&t<=n}class ii extends lg{constructor(t,n){super(0),F(this,"chunksRead",0),this.input=t,this.options=n}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(t=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let n=this.options.chunkSize,i=await this.readChunk(t,n);return!!i&&i.byteLength===n}async readChunk(t,n){if(this.chunksRead++,(n=this.safeWrapAddress(t,n))!==0)return this._readChunk(t,n)}safeWrapAddress(t,n){return this.size!==void 0&&t+n>this.size?Math.max(0,this.size-t):n}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksReadi.kind===n))}parseBoxHead(t){let n=this.file.getUint32(t),i=this.file.getString(t+4,4),s=t+8;return n===1&&(n=this.file.getUint64(t+8),s+=8),{offset:t,length:n,kind:i,start:s}}parseBoxFullHead(t){if(t.version!==void 0)return;let n=this.file.getUint32(t.start);t.version=n>>24,t.start+=4}}class vc extends ug{static canHandle(t,n){if(n!==0)return!1;let i=t.getUint16(2);if(i>50)return!1;let s=16,r=[];for(;s=2&&(s=n.version===3?4:2,r=this.file.getString(i+s+2,4),r==="Exif"))return this.file.getUintBytes(i,s);o+=n.length}}get8bits(t){let n=this.file.getUint8(t);return[n>>4,15&n]}findExtentInIloc(t,n){this.parseBoxFullHead(t);let i=t.start,[s,r]=this.get8bits(i++),[o,a]=this.get8bits(i++),l=t.version===2?4:2,c=t.version===1||t.version===2?2:0,u=a+s+r,h=t.version===2?4:2,f=this.file.getUintBytes(i,h);for(i+=h;f--;){let m=this.file.getUintBytes(i,l);i+=l+c+2+o;let p=this.file.getUint16(i);if(i+=2,m===n)return p>1&&console.warn(`ILOC box has more than one extent but we're only processing one Please create an issue at https://github.com/MikeKovarik/exifr with this file`),[this.file.getUintBytes(i+a,s),this.file.getUintBytes(i+a+s,r)];i+=p*u}}}class bc extends vc{}F(bc,"type","heic");class Ko extends vc{}F(Ko,"type","avif"),Se.set("heic",bc),Se.set("avif",Ko),pt(kt,["ifd0","ifd1"],[[256,"ImageWidth"],[257,"ImageHeight"],[258,"BitsPerSample"],[259,"Compression"],[262,"PhotometricInterpretation"],[270,"ImageDescription"],[271,"Make"],[272,"Model"],[273,"StripOffsets"],[274,"Orientation"],[277,"SamplesPerPixel"],[278,"RowsPerStrip"],[279,"StripByteCounts"],[282,"XResolution"],[283,"YResolution"],[284,"PlanarConfiguration"],[296,"ResolutionUnit"],[301,"TransferFunction"],[305,"Software"],[306,"ModifyDate"],[315,"Artist"],[316,"HostComputer"],[317,"Predictor"],[318,"WhitePoint"],[319,"PrimaryChromaticities"],[513,"ThumbnailOffset"],[514,"ThumbnailLength"],[529,"YCbCrCoefficients"],[530,"YCbCrSubSampling"],[531,"YCbCrPositioning"],[532,"ReferenceBlackWhite"],[700,"ApplicationNotes"],[33432,"Copyright"],[33723,"IPTC"],[34665,"ExifIFD"],[34675,"ICC"],[34853,"GpsIFD"],[330,"SubIFD"],[40965,"InteropIFD"],[40091,"XPTitle"],[40092,"XPComment"],[40093,"XPAuthor"],[40094,"XPKeywords"],[40095,"XPSubject"]]),pt(kt,"exif",[[33434,"ExposureTime"],[33437,"FNumber"],[34850,"ExposureProgram"],[34852,"SpectralSensitivity"],[34855,"ISO"],[34858,"TimeZoneOffset"],[34859,"SelfTimerMode"],[34864,"SensitivityType"],[34865,"StandardOutputSensitivity"],[34866,"RecommendedExposureIndex"],[34867,"ISOSpeed"],[34868,"ISOSpeedLatitudeyyy"],[34869,"ISOSpeedLatitudezzz"],[36864,"ExifVersion"],[36867,"DateTimeOriginal"],[36868,"CreateDate"],[36873,"GooglePlusUploadCode"],[36880,"OffsetTime"],[36881,"OffsetTimeOriginal"],[36882,"OffsetTimeDigitized"],[37121,"ComponentsConfiguration"],[37122,"CompressedBitsPerPixel"],[37377,"ShutterSpeedValue"],[37378,"ApertureValue"],[37379,"BrightnessValue"],[37380,"ExposureCompensation"],[37381,"MaxApertureValue"],[37382,"SubjectDistance"],[37383,"MeteringMode"],[37384,"LightSource"],[37385,"Flash"],[37386,"FocalLength"],[37393,"ImageNumber"],[37394,"SecurityClassification"],[37395,"ImageHistory"],[37396,"SubjectArea"],[37500,"MakerNote"],[37510,"UserComment"],[37520,"SubSecTime"],[37521,"SubSecTimeOriginal"],[37522,"SubSecTimeDigitized"],[37888,"AmbientTemperature"],[37889,"Humidity"],[37890,"Pressure"],[37891,"WaterDepth"],[37892,"Acceleration"],[37893,"CameraElevationAngle"],[40960,"FlashpixVersion"],[40961,"ColorSpace"],[40962,"ExifImageWidth"],[40963,"ExifImageHeight"],[40964,"RelatedSoundFile"],[41483,"FlashEnergy"],[41486,"FocalPlaneXResolution"],[41487,"FocalPlaneYResolution"],[41488,"FocalPlaneResolutionUnit"],[41492,"SubjectLocation"],[41493,"ExposureIndex"],[41495,"SensingMethod"],[41728,"FileSource"],[41729,"SceneType"],[41730,"CFAPattern"],[41985,"CustomRendered"],[41986,"ExposureMode"],[41987,"WhiteBalance"],[41988,"DigitalZoomRatio"],[41989,"FocalLengthIn35mmFormat"],[41990,"SceneCaptureType"],[41991,"GainControl"],[41992,"Contrast"],[41993,"Saturation"],[41994,"Sharpness"],[41996,"SubjectDistanceRange"],[42016,"ImageUniqueID"],[42032,"OwnerName"],[42033,"SerialNumber"],[42034,"LensInfo"],[42035,"LensMake"],[42036,"LensModel"],[42037,"LensSerialNumber"],[42080,"CompositeImage"],[42081,"CompositeImageCount"],[42082,"CompositeImageExposureTimes"],[42240,"Gamma"],[59932,"Padding"],[59933,"OffsetSchema"],[65e3,"OwnerName"],[65001,"SerialNumber"],[65002,"Lens"],[65100,"RawFile"],[65101,"Converter"],[65102,"WhiteBalance"],[65105,"Exposure"],[65106,"Shadows"],[65107,"Brightness"],[65108,"Contrast"],[65109,"Saturation"],[65110,"Sharpness"],[65111,"Smoothness"],[65112,"MoireFilter"],[40965,"InteropIFD"]]),pt(kt,"gps",[[0,"GPSVersionID"],[1,"GPSLatitudeRef"],[2,"GPSLatitude"],[3,"GPSLongitudeRef"],[4,"GPSLongitude"],[5,"GPSAltitudeRef"],[6,"GPSAltitude"],[7,"GPSTimeStamp"],[8,"GPSSatellites"],[9,"GPSStatus"],[10,"GPSMeasureMode"],[11,"GPSDOP"],[12,"GPSSpeedRef"],[13,"GPSSpeed"],[14,"GPSTrackRef"],[15,"GPSTrack"],[16,"GPSImgDirectionRef"],[17,"GPSImgDirection"],[18,"GPSMapDatum"],[19,"GPSDestLatitudeRef"],[20,"GPSDestLatitude"],[21,"GPSDestLongitudeRef"],[22,"GPSDestLongitude"],[23,"GPSDestBearingRef"],[24,"GPSDestBearing"],[25,"GPSDestDistanceRef"],[26,"GPSDestDistance"],[27,"GPSProcessingMethod"],[28,"GPSAreaInformation"],[29,"GPSDateStamp"],[30,"GPSDifferential"],[31,"GPSHPositioningError"]]),pt(ce,["ifd0","ifd1"],[[274,{1:"Horizontal (normal)",2:"Mirror horizontal",3:"Rotate 180",4:"Mirror vertical",5:"Mirror horizontal and rotate 270 CW",6:"Rotate 90 CW",7:"Mirror horizontal and rotate 90 CW",8:"Rotate 270 CW"}],[296,{1:"None",2:"inches",3:"cm"}]]);let Be=pt(ce,"exif",[[34850,{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"}],[37121,{0:"-",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}],[37383,{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"}],[37384,{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"}],[37385,{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"}],[41495,{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"}],[41728,{1:"Film Scanner",2:"Reflection Print Scanner",3:"Digital Camera"}],[41729,{1:"Directly photographed"}],[41985,{0:"Normal",1:"Custom",2:"HDR (no original saved)",3:"HDR (original saved)",4:"Original (for HDR)",6:"Panorama",7:"Portrait HDR",8:"Portrait"}],[41986,{0:"Auto",1:"Manual",2:"Auto bracket"}],[41987,{0:"Auto",1:"Manual"}],[41990,{0:"Standard",1:"Landscape",2:"Portrait",3:"Night",4:"Other"}],[41991,{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"}],[41996,{0:"Unknown",1:"Macro",2:"Close",3:"Distant"}],[42080,{0:"Unknown",1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"}]]);const Xo={1:"No absolute unit of measurement",2:"Inch",3:"Centimeter"};Be.set(37392,Xo),Be.set(41488,Xo);const Mi={0:"Normal",1:"Low",2:"High"};function Yo(e){return typeof e=="object"&&e.length!==void 0?e[0]:e}function qo(e){let t=Array.from(e).slice(1);return t[1]>15&&(t=t.map((n=>String.fromCharCode(n)))),t[2]!=="0"&&t[2]!==0||t.pop(),t.join(".")}function Di(e){if(typeof e=="string"){var[t,n,i,s,r,o]=e.trim().split(/[-: ]/g).map(Number),a=new Date(t,n-1,i);return Number.isNaN(s)||Number.isNaN(r)||Number.isNaN(o)||(a.setHours(s),a.setMinutes(r),a.setSeconds(o)),Number.isNaN(+a)?e:a}}function Ee(e){if(typeof e=="string")return e;let t=[];if(e[1]===0&&e[e.length-1]===0)for(let n=0;nArray.from(e).join(".")],[7,e=>Array.from(e).join(":")]]);class Ri extends Ot{static canHandle(t,n){return t.getUint8(n+1)===225&&t.getUint32(n+4)===1752462448&&t.getString(n+4,20)==="http://ns.adobe.com/"}static headerLength(t,n){return t.getString(n+4,34)==="http://ns.adobe.com/xmp/extension/"?79:33}static findPosition(t,n){let i=super.findPosition(t,n);return i.multiSegment=i.extended=i.headerLength===79,i.multiSegment?(i.chunkCount=t.getUint8(n+72),i.chunkNumber=t.getUint8(n+76),t.getUint8(n+77)!==0&&i.chunkNumber++):(i.chunkCount=1/0,i.chunkNumber=-1),i}static handleMultiSegments(t){return t.map((n=>n.chunk.getString())).join("")}normalizeInput(t){return typeof t=="string"?t:Ct.from(t).getString()}parse(t=this.chunk){if(!this.localOptions.parse)return t;t=(function(r){let o={},a={};for(let l of Cc)o[l]=[],a[l]=0;return r.replace(pg,((l,c,u)=>{if(c==="<"){let h=++a[u];return o[u].push(h),`${l}#${h}`}return`${l}#${o[u].pop()}`}))})(t);let n=ge.findAll(t,"rdf","Description");n.length===0&&n.push(new ge("rdf","Description",void 0,t));let i,s={};for(let r of n)for(let o of r.properties)i=dg(o.ns,s),Sc(o,i);return(function(r){let o;for(let a in r)o=r[a]=Wn(r[a]),o===void 0&&delete r[a];return Wn(r)})(s)}assignToOutput(t,n){if(this.localOptions.parse)for(let[i,s]of Object.entries(n))switch(i){case"tiff":this.assignObjectToOutput(t,"ifd0",s);break;case"exif":this.assignObjectToOutput(t,"exif",s);break;case"xmlns":break;default:this.assignObjectToOutput(t,i,s)}else t.xmp=n}}F(Ri,"type","xmp"),F(Ri,"multiSegment",!0),yt.set("xmp",Ri);class $n{static findAll(t){return xc(t,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map($n.unpackMatch)}static unpackMatch(t){let n=t[1],i=t[2],s=t[3].slice(1,-1);return s=wc(s),new $n(n,i,s)}constructor(t,n,i){this.ns=t,this.name=n,this.value=i}serialize(){return this.value}}class ge{static findAll(t,n,i){if(n!==void 0||i!==void 0){n=n||"[\\w\\d-]+",i=i||"[\\w\\d-]+";var s=new RegExp(`<(${n}):(${i})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`,"gm")}else s=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return xc(t,s).map(ge.unpackMatch)}static unpackMatch(t){let n=t[1],i=t[2],s=t[4],r=t[8];return new ge(n,i,s,r)}constructor(t,n,i,s){this.ns=t,this.name=n,this.attrString=i,this.innerXml=s,this.attrs=$n.findAll(i),this.children=ge.findAll(s),this.value=this.children.length===0?wc(s):void 0,this.properties=[...this.attrs,...this.children]}get isPrimitive(){return this.value!==void 0&&this.attrs.length===0&&this.children.length===0}get isListContainer(){return this.children.length===1&&this.children[0].isList}get isList(){let{ns:t,name:n}=this;return t==="rdf"&&(n==="Seq"||n==="Bag"||n==="Alt")}get isListItem(){return this.ns==="rdf"&&this.name==="li"}serialize(){if(this.properties.length===0&&this.value===void 0)return;if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return fg(this.children.map(hg));if(this.isListItem&&this.children.length===1&&this.attrs.length===0)return this.children[0].serialize();let t={};for(let n of this.properties)Sc(n,t);return this.value!==void 0&&(t.value=this.value),Wn(t)}}function Sc(e,t){let n=e.serialize();n!==void 0&&(t[e.name]=n)}var hg=e=>e.serialize(),fg=e=>e.length===1?e[0]:e,dg=(e,t)=>t[e]?t[e]:t[e]={};function xc(e,t){let n,i=[];if(!e)return i;for(;(n=t.exec(e))!==null;)i.push(n);return i}function wc(e){if((function(i){return i==null||i==="null"||i==="undefined"||i===""||i.trim()===""})(e))return;let t=Number(e);if(!Number.isNaN(t))return t;let n=e.toLowerCase();return n==="true"||n!=="false"&&e.trim()}const Cc=["rdf:li","rdf:Seq","rdf:Bag","rdf:Alt","rdf:Description"],pg=new RegExp(`(<|\\/)(${Cc.join("|")})`,"g");let Jo=Hn("fs",(e=>e.promises));Te.set("fs",class extends ii{async readWhole(){this.chunked=!1,this.fs=await Jo;let e=await this.fs.readFile(this.input);this._swapBuffer(e)}async readChunked(){this.chunked=!0,this.fs=await Jo,await this.open(),await this.readChunk(0,this.options.firstChunkSize)}async open(){this.fh===void 0&&(this.fh=await this.fs.open(this.input,"r"),this.size=(await this.fh.stat(this.input)).size)}async _readChunk(e,t){this.fh===void 0&&await this.open(),e+t>this.size&&(t=this.size-e);var n=this.subarray(e,t,!0);return await this.fh.read(n.dataView,0,t,e),n}async close(){if(this.fh){let e=this.fh;this.fh=void 0,await e.close()}}});Te.set("base64",class extends ii{constructor(...e){super(...e),this.input=this.input.replace(/^data:([^;]+);base64,/gim,""),this.size=this.input.length/4*3,this.input.endsWith("==")?this.size-=2:this.input.endsWith("=")&&(this.size-=1)}async _readChunk(e,t){let n,i,s=this.input;e===void 0?(e=0,n=0,i=0):(n=4*Math.floor(e/3),i=e-n/4*3),t===void 0&&(t=this.size);let r=e+t,o=n+4*Math.ceil(r/3);s=s.slice(n,o);let a=Math.min(t,this.size-e);if(nr){let l=er.from(s,"base64").slice(i,i+a);return this.set(l,e,!0)}{let l=this.subarray(e,a,!0),c=atob(s),u=l.toUint8();for(let h=0;hthis.errors.push(n))),F(this,"metaChunks",[]),F(this,"unknownChunks",[])}static canHandle(t,n){return n===35152&&t.getUint32(0)===2303741511&&t.getUint32(4)===218765834}async parse(){let{file:t}=this;await this.findPngChunksInRange(8,t.byteLength),await this.readSegments(this.metaChunks),this.findIhdr(),this.parseTextChunks(),await this.findExif().catch(this.catchError),await this.findXmp().catch(this.catchError),await this.findIcc().catch(this.catchError)}async findPngChunksInRange(t,n){let{file:i}=this;for(;tn.type==="text"));for(let n of t){let[i,s]=this.file.getString(n.start,n.size).split("\0");this.injectKeyValToIhdr(i,s)}}injectKeyValToIhdr(t,n){let i=this.parsers.ihdr;i&&i.raw.set(t,n)}findIhdr(){let t=this.metaChunks.find((n=>n.type==="ihdr"));t&&this.options.ihdr.enabled!==!1&&this.createParser("ihdr",t.chunk)}async findExif(){let t=this.metaChunks.find((n=>n.type==="exif"));t&&this.injectSegment("tiff",t.chunk)}async findXmp(){let t=this.metaChunks.filter((n=>n.type==="itxt"));for(let n of t)n.chunk.getString(0,17)==="XML:com.adobe.xmp"&&this.injectSegment("xmp",n.chunk)}async findIcc(){let t=this.metaChunks.find((a=>a.type==="iccp"));if(!t)return;let{chunk:n}=t,i=n.getUint8Array(0,81),s=0;for(;s<80&&i[s]!==0;)s++;let r=s+2,o=n.getString(0,s);if(this.injectKeyValToIhdr("ProfileName",o),Gn){let a=await mg,l=n.getUint8Array(r);l=a.inflateSync(l),this.injectSegment("icc",l)}}}F(ta,"type","png"),Se.set("png",ta),pt(kt,"interop",[[1,"InteropIndex"],[2,"InteropVersion"],[4096,"RelatedImageFileFormat"],[4097,"RelatedImageWidth"],[4098,"RelatedImageHeight"]]),gs(kt,"ifd0",[[11,"ProcessingSoftware"],[254,"SubfileType"],[255,"OldSubfileType"],[263,"Thresholding"],[264,"CellWidth"],[265,"CellLength"],[266,"FillOrder"],[269,"DocumentName"],[280,"MinSampleValue"],[281,"MaxSampleValue"],[285,"PageName"],[286,"XPosition"],[287,"YPosition"],[290,"GrayResponseUnit"],[297,"PageNumber"],[321,"HalftoneHints"],[322,"TileWidth"],[323,"TileLength"],[332,"InkSet"],[337,"TargetPrinter"],[18246,"Rating"],[18249,"RatingPercent"],[33550,"PixelScale"],[34264,"ModelTransform"],[34377,"PhotoshopSettings"],[50706,"DNGVersion"],[50707,"DNGBackwardVersion"],[50708,"UniqueCameraModel"],[50709,"LocalizedCameraModel"],[50736,"DNGLensInfo"],[50739,"ShadowScale"],[50740,"DNGPrivateData"],[33920,"IntergraphMatrix"],[33922,"ModelTiePoint"],[34118,"SEMInfo"],[34735,"GeoTiffDirectory"],[34736,"GeoTiffDoubleParams"],[34737,"GeoTiffAsciiParams"],[50341,"PrintIM"],[50721,"ColorMatrix1"],[50722,"ColorMatrix2"],[50723,"CameraCalibration1"],[50724,"CameraCalibration2"],[50725,"ReductionMatrix1"],[50726,"ReductionMatrix2"],[50727,"AnalogBalance"],[50728,"AsShotNeutral"],[50729,"AsShotWhiteXY"],[50730,"BaselineExposure"],[50731,"BaselineNoise"],[50732,"BaselineSharpness"],[50734,"LinearResponseLimit"],[50735,"CameraSerialNumber"],[50741,"MakerNoteSafety"],[50778,"CalibrationIlluminant1"],[50779,"CalibrationIlluminant2"],[50781,"RawDataUniqueID"],[50827,"OriginalRawFileName"],[50828,"OriginalRawFileData"],[50831,"AsShotICCProfile"],[50832,"AsShotPreProfileMatrix"],[50833,"CurrentICCProfile"],[50834,"CurrentPreProfileMatrix"],[50879,"ColorimetricReference"],[50885,"SRawType"],[50898,"PanasonicTitle"],[50899,"PanasonicTitle2"],[50931,"CameraCalibrationSig"],[50932,"ProfileCalibrationSig"],[50933,"ProfileIFD"],[50934,"AsShotProfileName"],[50936,"ProfileName"],[50937,"ProfileHueSatMapDims"],[50938,"ProfileHueSatMapData1"],[50939,"ProfileHueSatMapData2"],[50940,"ProfileToneCurve"],[50941,"ProfileEmbedPolicy"],[50942,"ProfileCopyright"],[50964,"ForwardMatrix1"],[50965,"ForwardMatrix2"],[50966,"PreviewApplicationName"],[50967,"PreviewApplicationVersion"],[50968,"PreviewSettingsName"],[50969,"PreviewSettingsDigest"],[50970,"PreviewColorSpace"],[50971,"PreviewDateTime"],[50972,"RawImageDigest"],[50973,"OriginalRawFileDigest"],[50981,"ProfileLookTableDims"],[50982,"ProfileLookTableData"],[51043,"TimeCodes"],[51044,"FrameRate"],[51058,"TStop"],[51081,"ReelName"],[51089,"OriginalDefaultFinalSize"],[51090,"OriginalBestQualitySize"],[51091,"OriginalDefaultCropSize"],[51105,"CameraLabel"],[51107,"ProfileHueSatMapEncoding"],[51108,"ProfileLookTableEncoding"],[51109,"BaselineExposureOffset"],[51110,"DefaultBlackRender"],[51111,"NewRawImageDigest"],[51112,"RawToPreviewGain"]]);let ea=[[273,"StripOffsets"],[279,"StripByteCounts"],[288,"FreeOffsets"],[289,"FreeByteCounts"],[291,"GrayResponseCurve"],[292,"T4Options"],[293,"T6Options"],[300,"ColorResponseUnit"],[320,"ColorMap"],[324,"TileOffsets"],[325,"TileByteCounts"],[326,"BadFaxLines"],[327,"CleanFaxData"],[328,"ConsecutiveBadFaxLines"],[330,"SubIFD"],[333,"InkNames"],[334,"NumberofInks"],[336,"DotRange"],[338,"ExtraSamples"],[339,"SampleFormat"],[340,"SMinSampleValue"],[341,"SMaxSampleValue"],[342,"TransferRange"],[343,"ClipPath"],[344,"XClipPathUnits"],[345,"YClipPathUnits"],[346,"Indexed"],[347,"JPEGTables"],[351,"OPIProxy"],[400,"GlobalParametersIFD"],[401,"ProfileType"],[402,"FaxProfile"],[403,"CodingMethods"],[404,"VersionYear"],[405,"ModeNumber"],[433,"Decode"],[434,"DefaultImageColor"],[435,"T82Options"],[437,"JPEGTables"],[512,"JPEGProc"],[515,"JPEGRestartInterval"],[517,"JPEGLosslessPredictors"],[518,"JPEGPointTransforms"],[519,"JPEGQTables"],[520,"JPEGDCTables"],[521,"JPEGACTables"],[559,"StripRowCounts"],[999,"USPTOMiscellaneous"],[18247,"XP_DIP_XML"],[18248,"StitchInfo"],[28672,"SonyRawFileType"],[28688,"SonyToneCurve"],[28721,"VignettingCorrection"],[28722,"VignettingCorrParams"],[28724,"ChromaticAberrationCorrection"],[28725,"ChromaticAberrationCorrParams"],[28726,"DistortionCorrection"],[28727,"DistortionCorrParams"],[29895,"SonyCropTopLeft"],[29896,"SonyCropSize"],[32781,"ImageID"],[32931,"WangTag1"],[32932,"WangAnnotation"],[32933,"WangTag3"],[32934,"WangTag4"],[32953,"ImageReferencePoints"],[32954,"RegionXformTackPoint"],[32955,"WarpQuadrilateral"],[32956,"AffineTransformMat"],[32995,"Matteing"],[32996,"DataType"],[32997,"ImageDepth"],[32998,"TileDepth"],[33300,"ImageFullWidth"],[33301,"ImageFullHeight"],[33302,"TextureFormat"],[33303,"WrapModes"],[33304,"FovCot"],[33305,"MatrixWorldToScreen"],[33306,"MatrixWorldToCamera"],[33405,"Model2"],[33421,"CFARepeatPatternDim"],[33422,"CFAPattern2"],[33423,"BatteryLevel"],[33424,"KodakIFD"],[33445,"MDFileTag"],[33446,"MDScalePixel"],[33447,"MDColorTable"],[33448,"MDLabName"],[33449,"MDSampleInfo"],[33450,"MDPrepDate"],[33451,"MDPrepTime"],[33452,"MDFileUnits"],[33589,"AdventScale"],[33590,"AdventRevision"],[33628,"UIC1Tag"],[33629,"UIC2Tag"],[33630,"UIC3Tag"],[33631,"UIC4Tag"],[33918,"IntergraphPacketData"],[33919,"IntergraphFlagRegisters"],[33921,"INGRReserved"],[34016,"Site"],[34017,"ColorSequence"],[34018,"IT8Header"],[34019,"RasterPadding"],[34020,"BitsPerRunLength"],[34021,"BitsPerExtendedRunLength"],[34022,"ColorTable"],[34023,"ImageColorIndicator"],[34024,"BackgroundColorIndicator"],[34025,"ImageColorValue"],[34026,"BackgroundColorValue"],[34027,"PixelIntensityRange"],[34028,"TransparencyIndicator"],[34029,"ColorCharacterization"],[34030,"HCUsage"],[34031,"TrapIndicator"],[34032,"CMYKEquivalent"],[34152,"AFCP_IPTC"],[34232,"PixelMagicJBIGOptions"],[34263,"JPLCartoIFD"],[34306,"WB_GRGBLevels"],[34310,"LeafData"],[34687,"TIFF_FXExtensions"],[34688,"MultiProfiles"],[34689,"SharedData"],[34690,"T88Options"],[34732,"ImageLayer"],[34750,"JBIGOptions"],[34856,"Opto-ElectricConvFactor"],[34857,"Interlace"],[34908,"FaxRecvParams"],[34909,"FaxSubAddress"],[34910,"FaxRecvTime"],[34929,"FedexEDR"],[34954,"LeafSubIFD"],[37387,"FlashEnergy"],[37388,"SpatialFrequencyResponse"],[37389,"Noise"],[37390,"FocalPlaneXResolution"],[37391,"FocalPlaneYResolution"],[37392,"FocalPlaneResolutionUnit"],[37397,"ExposureIndex"],[37398,"TIFF-EPStandardID"],[37399,"SensingMethod"],[37434,"CIP3DataFile"],[37435,"CIP3Sheet"],[37436,"CIP3Side"],[37439,"StoNits"],[37679,"MSDocumentText"],[37680,"MSPropertySetStorage"],[37681,"MSDocumentTextPosition"],[37724,"ImageSourceData"],[40965,"InteropIFD"],[40976,"SamsungRawPointersOffset"],[40977,"SamsungRawPointersLength"],[41217,"SamsungRawByteOrder"],[41218,"SamsungRawUnknown"],[41484,"SpatialFrequencyResponse"],[41485,"Noise"],[41489,"ImageNumber"],[41490,"SecurityClassification"],[41491,"ImageHistory"],[41494,"TIFF-EPStandardID"],[41995,"DeviceSettingDescription"],[42112,"GDALMetadata"],[42113,"GDALNoData"],[44992,"ExpandSoftware"],[44993,"ExpandLens"],[44994,"ExpandFilm"],[44995,"ExpandFilterLens"],[44996,"ExpandScanner"],[44997,"ExpandFlashLamp"],[46275,"HasselbladRawImage"],[48129,"PixelFormat"],[48130,"Transformation"],[48131,"Uncompressed"],[48132,"ImageType"],[48256,"ImageWidth"],[48257,"ImageHeight"],[48258,"WidthResolution"],[48259,"HeightResolution"],[48320,"ImageOffset"],[48321,"ImageByteCount"],[48322,"AlphaOffset"],[48323,"AlphaByteCount"],[48324,"ImageDataDiscard"],[48325,"AlphaDataDiscard"],[50215,"OceScanjobDesc"],[50216,"OceApplicationSelector"],[50217,"OceIDNumber"],[50218,"OceImageLogic"],[50255,"Annotations"],[50459,"HasselbladExif"],[50547,"OriginalFileName"],[50560,"USPTOOriginalContentType"],[50656,"CR2CFAPattern"],[50710,"CFAPlaneColor"],[50711,"CFALayout"],[50712,"LinearizationTable"],[50713,"BlackLevelRepeatDim"],[50714,"BlackLevel"],[50715,"BlackLevelDeltaH"],[50716,"BlackLevelDeltaV"],[50717,"WhiteLevel"],[50718,"DefaultScale"],[50719,"DefaultCropOrigin"],[50720,"DefaultCropSize"],[50733,"BayerGreenSplit"],[50737,"ChromaBlurRadius"],[50738,"AntiAliasStrength"],[50752,"RawImageSegmentation"],[50780,"BestQualityScale"],[50784,"AliasLayerMetadata"],[50829,"ActiveArea"],[50830,"MaskedAreas"],[50935,"NoiseReductionApplied"],[50974,"SubTileBlockSize"],[50975,"RowInterleaveFactor"],[51008,"OpcodeList1"],[51009,"OpcodeList2"],[51022,"OpcodeList3"],[51041,"NoiseProfile"],[51114,"CacheVersion"],[51125,"DefaultUserCrop"],[51157,"NikonNEFInfo"],[65024,"KdcIFD"]];gs(kt,"ifd0",ea),gs(kt,"exif",ea),pt(ce,"gps",[[23,{M:"Magnetic North",T:"True North"}],[25,{K:"Kilometers",M:"Miles",N:"Nautical Miles"}]]);class Ei extends Ot{static canHandle(t,n){return t.getUint8(n+1)===224&&t.getUint32(n+4)===1246120262&&t.getUint8(n+8)===0}parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint16(0)],[2,this.chunk.getUint8(2)],[3,this.chunk.getUint16(3)],[5,this.chunk.getUint16(5)],[7,this.chunk.getUint8(7)],[8,this.chunk.getUint8(8)]])}}F(Ei,"type","jfif"),F(Ei,"headerLength",9),yt.set("jfif",Ei),pt(kt,"jfif",[[0,"JFIFVersion"],[2,"ResolutionUnit"],[3,"XResolution"],[5,"YResolution"],[7,"ThumbnailWidth"],[8,"ThumbnailHeight"]]);class na extends Ot{parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint32(0)],[4,this.chunk.getUint32(4)],[8,this.chunk.getUint8(8)],[9,this.chunk.getUint8(9)],[10,this.chunk.getUint8(10)],[11,this.chunk.getUint8(11)],[12,this.chunk.getUint8(12)],...Array.from(this.raw)])}}F(na,"type","ihdr"),yt.set("ihdr",na),pt(kt,"ihdr",[[0,"ImageWidth"],[4,"ImageHeight"],[8,"BitDepth"],[9,"ColorType"],[10,"Compression"],[11,"Filter"],[12,"Interlace"]]),pt(ce,"ihdr",[[9,{0:"Grayscale",2:"RGB",3:"Palette",4:"Grayscale with Alpha",6:"RGB with Alpha",DEFAULT:"Unknown"}],[10,{0:"Deflate/Inflate",DEFAULT:"Unknown"}],[11,{0:"Adaptive",DEFAULT:"Unknown"}],[12,{0:"Noninterlaced",1:"Adam7 Interlace",DEFAULT:"Unknown"}]]);class Rn extends Ot{static canHandle(t,n){return t.getUint8(n+1)===226&&t.getUint32(n+4)===1229144927}static findPosition(t,n){let i=super.findPosition(t,n);return i.chunkNumber=t.getUint8(n+16),i.chunkCount=t.getUint8(n+17),i.multiSegment=i.chunkCount>1,i}static handleMultiSegments(t){return(function(n){let i=(function(s){let r=s[0].constructor,o=0;for(let c of s)o+=c.length;let a=new r(o),l=0;for(let c of s)a.set(c,l),l+=c.length;return a})(n.map((s=>s.chunk.toUint8())));return new Ct(i)})(t)}parse(){return this.raw=new Map,this.parseHeader(),this.parseTags(),this.translate(),this.output}parseHeader(){let{raw:t}=this;this.chunk.byteLength<84&&rt("ICC header is too short");for(let[n,i]of Object.entries(yg)){n=parseInt(n,10);let s=i(this.chunk,n);s!=="\0\0\0\0"&&t.set(n,s)}}parseTags(){let t,n,i,s,r,{raw:o}=this,a=this.chunk.getUint32(128),l=132,c=this.chunk.byteLength;for(;a--;){if(t=this.chunk.getString(l,4),n=this.chunk.getUint32(l+4),i=this.chunk.getUint32(l+8),s=this.chunk.getString(n,4),n+i>c)return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");r=this.parseTag(s,n,i),r!==void 0&&r!=="\0\0\0\0"&&o.set(t,r),l+=12}}parseTag(t,n,i){switch(t){case"desc":return this.parseDesc(n);case"mluc":return this.parseMluc(n);case"text":return this.parseText(n,i);case"sig ":return this.parseSig(n)}if(!(n+i>this.chunk.byteLength))return this.chunk.getUint8Array(n,i)}parseDesc(t){let n=this.chunk.getUint32(t+8)-1;return oe(this.chunk.getString(t+12,n))}parseText(t,n){return oe(this.chunk.getString(t+8,n-8))}parseSig(t){return oe(this.chunk.getString(t+8,4))}parseMluc(t){let{chunk:n}=this,i=n.getUint32(t+8),s=n.getUint32(t+12),r=t+16,o=[];for(let a=0;a>4,e.getUint8(t+1)%16].map((n=>n.toString(10))).join(".")},12:zt,16:zt,20:zt,24:function(e,t){const n=e.getUint16(t),i=e.getUint16(t+2)-1,s=e.getUint16(t+4),r=e.getUint16(t+6),o=e.getUint16(t+8),a=e.getUint16(t+10);return new Date(Date.UTC(n,i,s,r,o,a))},36:zt,40:zt,48:zt,52:zt,64:(e,t)=>e.getUint32(t),80:zt};function zt(e,t){return oe(e.getString(t,4))}yt.set("icc",Rn),pt(kt,"icc",[[4,"ProfileCMMType"],[8,"ProfileVersion"],[12,"ProfileClass"],[16,"ColorSpaceData"],[20,"ProfileConnectionSpace"],[24,"ProfileDateTime"],[36,"ProfileFileSignature"],[40,"PrimaryPlatform"],[44,"CMMFlags"],[48,"DeviceManufacturer"],[52,"DeviceModel"],[56,"DeviceAttributes"],[64,"RenderingIntent"],[68,"ConnectionSpaceIlluminant"],[80,"ProfileCreator"],[84,"ProfileID"],["Header","ProfileHeader"],["MS00","WCSProfiles"],["bTRC","BlueTRC"],["bXYZ","BlueMatrixColumn"],["bfd","UCRBG"],["bkpt","MediaBlackPoint"],["calt","CalibrationDateTime"],["chad","ChromaticAdaptation"],["chrm","Chromaticity"],["ciis","ColorimetricIntentImageState"],["clot","ColorantTableOut"],["clro","ColorantOrder"],["clrt","ColorantTable"],["cprt","ProfileCopyright"],["crdi","CRDInfo"],["desc","ProfileDescription"],["devs","DeviceSettings"],["dmdd","DeviceModelDesc"],["dmnd","DeviceMfgDesc"],["dscm","ProfileDescriptionML"],["fpce","FocalPlaneColorimetryEstimates"],["gTRC","GreenTRC"],["gXYZ","GreenMatrixColumn"],["gamt","Gamut"],["kTRC","GrayTRC"],["lumi","Luminance"],["meas","Measurement"],["meta","Metadata"],["mmod","MakeAndModel"],["ncl2","NamedColor2"],["ncol","NamedColor"],["ndin","NativeDisplayInfo"],["pre0","Preview0"],["pre1","Preview1"],["pre2","Preview2"],["ps2i","PS2RenderingIntent"],["ps2s","PostScript2CSA"],["psd0","PostScript2CRD0"],["psd1","PostScript2CRD1"],["psd2","PostScript2CRD2"],["psd3","PostScript2CRD3"],["pseq","ProfileSequenceDesc"],["psid","ProfileSequenceIdentifier"],["psvm","PS2CRDVMSize"],["rTRC","RedTRC"],["rXYZ","RedMatrixColumn"],["resp","OutputResponse"],["rhoc","ReflectionHardcopyOrigColorimetry"],["rig0","PerceptualRenderingIntentGamut"],["rig2","SaturationRenderingIntentGamut"],["rpoc","ReflectionPrintOutputColorimetry"],["sape","SceneAppearanceEstimates"],["scoe","SceneColorimetryEstimates"],["scrd","ScreeningDesc"],["scrn","Screening"],["targ","CharTarget"],["tech","Technology"],["vcgt","VideoCardGamma"],["view","ViewingConditions"],["vued","ViewingCondDesc"],["wtpt","MediaWhitePoint"]]);const gn={"4d2p":"Erdt Systems",AAMA:"Aamazing Technologies",ACER:"Acer",ACLT:"Acolyte Color Research",ACTI:"Actix Sytems",ADAR:"Adara Technology",ADBE:"Adobe",ADI:"ADI Systems",AGFA:"Agfa Graphics",ALMD:"Alps Electric",ALPS:"Alps Electric",ALWN:"Alwan Color Expertise",AMTI:"Amiable Technologies",AOC:"AOC International",APAG:"Apago",APPL:"Apple Computer",AST:"AST","AT&T":"AT&T",BAEL:"BARBIERI electronic",BRCO:"Barco NV",BRKP:"Breakpoint",BROT:"Brother",BULL:"Bull",BUS:"Bus Computer Systems","C-IT":"C-Itoh",CAMR:"Intel",CANO:"Canon",CARR:"Carroll Touch",CASI:"Casio",CBUS:"Colorbus PL",CEL:"Crossfield",CELx:"Crossfield",CGS:"CGS Publishing Technologies International",CHM:"Rochester Robotics",CIGL:"Colour Imaging Group, London",CITI:"Citizen",CL00:"Candela",CLIQ:"Color IQ",CMCO:"Chromaco",CMiX:"CHROMiX",COLO:"Colorgraphic Communications",COMP:"Compaq",COMp:"Compeq/Focus Technology",CONR:"Conrac Display Products",CORD:"Cordata Technologies",CPQ:"Compaq",CPRO:"ColorPro",CRN:"Cornerstone",CTX:"CTX International",CVIS:"ColorVision",CWC:"Fujitsu Laboratories",DARI:"Darius Technology",DATA:"Dataproducts",DCP:"Dry Creek Photo",DCRC:"Digital Contents Resource Center, Chung-Ang University",DELL:"Dell Computer",DIC:"Dainippon Ink and Chemicals",DICO:"Diconix",DIGI:"Digital","DL&C":"Digital Light & Color",DPLG:"Doppelganger",DS:"Dainippon Screen",DSOL:"DOOSOL",DUPN:"DuPont",EPSO:"Epson",ESKO:"Esko-Graphics",ETRI:"Electronics and Telecommunications Research Institute",EVER:"Everex Systems",EXAC:"ExactCODE",Eizo:"Eizo",FALC:"Falco Data Products",FF:"Fuji Photo Film",FFEI:"FujiFilm Electronic Imaging",FNRD:"Fnord Software",FORA:"Fora",FORE:"Forefront Technology",FP:"Fujitsu",FPA:"WayTech Development",FUJI:"Fujitsu",FX:"Fuji Xerox",GCC:"GCC Technologies",GGSL:"Global Graphics Software",GMB:"Gretagmacbeth",GMG:"GMG",GOLD:"GoldStar Technology",GOOG:"Google",GPRT:"Giantprint",GTMB:"Gretagmacbeth",GVC:"WayTech Development",GW2K:"Sony",HCI:"HCI",HDM:"Heidelberger Druckmaschinen",HERM:"Hermes",HITA:"Hitachi America",HP:"Hewlett-Packard",HTC:"Hitachi",HiTi:"HiTi Digital",IBM:"IBM",IDNT:"Scitex",IEC:"Hewlett-Packard",IIYA:"Iiyama North America",IKEG:"Ikegami Electronics",IMAG:"Image Systems",IMI:"Ingram Micro",INTC:"Intel",INTL:"N/A (INTL)",INTR:"Intra Electronics",IOCO:"Iocomm International Technology",IPS:"InfoPrint Solutions Company",IRIS:"Scitex",ISL:"Ichikawa Soft Laboratory",ITNL:"N/A (ITNL)",IVM:"IVM",IWAT:"Iwatsu Electric",Idnt:"Scitex",Inca:"Inca Digital Printers",Iris:"Scitex",JPEG:"Joint Photographic Experts Group",JSFT:"Jetsoft Development",JVC:"JVC Information Products",KART:"Scitex",KFC:"KFC Computek Components",KLH:"KLH Computers",KMHD:"Konica Minolta",KNCA:"Konica",KODA:"Kodak",KYOC:"Kyocera",Kart:"Scitex",LCAG:"Leica",LCCD:"Leeds Colour",LDAK:"Left Dakota",LEAD:"Leading Technology",LEXM:"Lexmark International",LINK:"Link Computer",LINO:"Linotronic",LITE:"Lite-On",Leaf:"Leaf",Lino:"Linotronic",MAGC:"Mag Computronic",MAGI:"MAG Innovision",MANN:"Mannesmann",MICN:"Micron Technology",MICR:"Microtek",MICV:"Microvitec",MINO:"Minolta",MITS:"Mitsubishi Electronics America",MITs:"Mitsuba",MNLT:"Minolta",MODG:"Modgraph",MONI:"Monitronix",MONS:"Monaco Systems",MORS:"Morse Technology",MOTI:"Motive Systems",MSFT:"Microsoft",MUTO:"MUTOH INDUSTRIES",Mits:"Mitsubishi Electric",NANA:"NANAO",NEC:"NEC",NEXP:"NexPress Solutions",NISS:"Nissei Sangyo America",NKON:"Nikon",NONE:"none",OCE:"Oce Technologies",OCEC:"OceColor",OKI:"Oki",OKID:"Okidata",OKIP:"Okidata",OLIV:"Olivetti",OLYM:"Olympus",ONYX:"Onyx Graphics",OPTI:"Optiquest",PACK:"Packard Bell",PANA:"Matsushita Electric Industrial",PANT:"Pantone",PBN:"Packard Bell",PFU:"PFU",PHIL:"Philips Consumer Electronics",PNTX:"HOYA",POne:"Phase One A/S",PREM:"Premier Computer Innovations",PRIN:"Princeton Graphic Systems",PRIP:"Princeton Publishing Labs",QLUX:"Hong Kong",QMS:"QMS",QPCD:"QPcard AB",QUAD:"QuadLaser",QUME:"Qume",RADI:"Radius",RDDx:"Integrated Color Solutions",RDG:"Roland DG",REDM:"REDMS Group",RELI:"Relisys",RGMS:"Rolf Gierling Multitools",RICO:"Ricoh",RNLD:"Edmund Ronald",ROYA:"Royal",RPC:"Ricoh Printing Systems",RTL:"Royal Information Electronics",SAMP:"Sampo",SAMS:"Samsung",SANT:"Jaime Santana Pomares",SCIT:"Scitex",SCRN:"Dainippon Screen",SDP:"Scitex",SEC:"Samsung",SEIK:"Seiko Instruments",SEIk:"Seikosha",SGUY:"ScanGuy.com",SHAR:"Sharp Laboratories",SICC:"International Color Consortium",SONY:"Sony",SPCL:"SpectraCal",STAR:"Star",STC:"Sampo Technology",Scit:"Scitex",Sdp:"Scitex",Sony:"Sony",TALO:"Talon Technology",TAND:"Tandy",TATU:"Tatung",TAXA:"TAXAN America",TDS:"Tokyo Denshi Sekei",TECO:"TECO Information Systems",TEGR:"Tegra",TEKT:"Tektronix",TI:"Texas Instruments",TMKR:"TypeMaker",TOSB:"Toshiba",TOSH:"Toshiba",TOTK:"TOTOKU ELECTRIC",TRIU:"Triumph",TSBT:"Toshiba",TTX:"TTX Computer Products",TVM:"TVM Professional Monitor",TW:"TW Casper",ULSX:"Ulead Systems",UNIS:"Unisys",UTZF:"Utz Fehlau & Sohn",VARI:"Varityper",VIEW:"Viewsonic",VISL:"Visual communication",VIVO:"Vivo Mobile Communication",WANG:"Wang",WLBR:"Wilbur Imaging",WTG2:"Ware To Go",WYSE:"WYSE Technology",XERX:"Xerox",XRIT:"X-Rite",ZRAN:"Zoran",Zebr:"Zebra Technologies",appl:"Apple Computer",bICC:"basICColor",berg:"bergdesign",ceyd:"Integrated Color Solutions",clsp:"MacDermid ColorSpan",ds:"Dainippon Screen",dupn:"DuPont",ffei:"FujiFilm Electronic Imaging",flux:"FluxData",iris:"Scitex",kart:"Scitex",lcms:"Little CMS",lino:"Linotronic",none:"none",ob4d:"Erdt Systems",obic:"Medigraph",quby:"Qubyx Sarl",scit:"Scitex",scrn:"Dainippon Screen",sdp:"Scitex",siwi:"SIWI GRAFIKA",yxym:"YxyMaster"},ia={scnr:"Scanner",mntr:"Monitor",prtr:"Printer",link:"Device Link",abst:"Abstract",spac:"Color Space Conversion Profile",nmcl:"Named Color",cenc:"ColorEncodingSpace profile",mid:"MultiplexIdentification profile",mlnk:"MultiplexLink profile",mvis:"MultiplexVisualization profile",nkpf:"Nikon Input Device Profile (NON-STANDARD!)"};pt(ce,"icc",[[4,gn],[12,ia],[40,Object.assign({},gn,ia)],[48,gn],[80,gn],[64,{0:"Perceptual",1:"Relative Colorimetric",2:"Saturation",3:"Absolute Colorimetric"}],["tech",{amd:"Active Matrix Display",crt:"Cathode Ray Tube Display",kpcd:"Photo CD",pmd:"Passive Matrix Display",dcam:"Digital Camera",dcpj:"Digital Cinema Projector",dmpc:"Digital Motion Picture Camera",dsub:"Dye Sublimation Printer",epho:"Electrophotographic Printer",esta:"Electrostatic Printer",flex:"Flexography",fprn:"Film Writer",fscn:"Film Scanner",grav:"Gravure",ijet:"Ink Jet Printer",imgs:"Photo Image Setter",mpfr:"Motion Picture Film Recorder",mpfs:"Motion Picture Film Scanner",offs:"Offset Lithography",pjtv:"Projection Television",rpho:"Photographic Paper Printer",rscn:"Reflective Scanner",silk:"Silkscreen",twax:"Thermal Wax Printer",vidc:"Video Camera",vidm:"Video Monitor"}]]);class yn extends Ot{static canHandle(t,n,i){return t.getUint8(n+1)===237&&t.getString(n+4,9)==="Photoshop"&&this.containsIptc8bim(t,n,i)!==void 0}static headerLength(t,n,i){let s,r=this.containsIptc8bim(t,n,i);if(r!==void 0)return s=t.getUint8(n+r+7),s%2!=0&&(s+=1),s===0&&(s=4),r+8+s}static containsIptc8bim(t,n,i){for(let s=0;s0){const t=Number(e);if(Number.isFinite(t))return t}if(e&&typeof e=="object"){const t=e,n=typeof t.numerator=="number"?t.numerator:void 0,i=typeof t.denominator=="number"?t.denominator:void 0;if(n!==void 0&&i!==void 0&&Number.isFinite(n)&&Number.isFinite(i)&&i!==0)return n/i}}async function Sg(e,t,n){let i;try{i=await ng(e,["FocalLengthIn35mmFilm","FocalLenIn35mmFilm","FocalLength"])}catch{i=void 0}const s=Li(i?.FocalLengthIn35mmFilm)??Li(i?.FocalLenIn35mmFilm),r=Li(i?.FocalLength);if(s!==void 0&&s>=1)return{focalPx:En(t,n,s),focalMmUsed:s,source:"exif-35mm",exif35mm:s,exifFocalMm:r};if(r!==void 0&&r>0){const o=r<10?r*8.4:r;return{focalPx:En(t,n,o),focalMmUsed:o,source:"exif-mm-approx",exifFocalMm:r}}return{focalPx:En(t,n,vs),focalMmUsed:vs,source:"default-30mm"}}const xg=`