const t=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],e=(()=>new Set(t))();const s={};class n{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>function(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let i=0;in=!0,c=i.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(c.schedule(e),t()),e(a)}const c={schedule:(t,i=!1,a=!1)=>{const o=a&&n?e:s;return i&&r.add(t),o.add(t),t},cancel:t=>{s.delete(t),r.delete(t)},process:t=>{if(a=t,n)return void(i=!0);n=!0;const r=e;e=s,s=r,e.forEach(o),e.clear(),n=!1,i&&(i=!1,c.process(t))}};return c}(o),t),{}),{setup:d,read:h,resolveKeyframes:l,preUpdate:p,update:u,preRender:f,render:m,postRender:g}=c,v=()=>{const i=s.useManualTiming,o=i?a.timestamp:performance.now();n=!1,i||(a.delta=r?1e3/60:Math.max(Math.min(o-a.timestamp,40),1)),a.timestamp=o,a.isProcessing=!0,d.process(a),h.process(a),l.process(a),p.process(a),u.process(a),f.process(a),m.process(a),g.process(a),a.isProcessing=!1,n&&e&&(r=!1,t(v))};return{schedule:i.reduce((e,s)=>{const i=c[s];return e[s]=(e,s=!1,o=!1)=>(n||(n=!0,r=!0,a.isProcessing||t(v)),i.schedule(e,s,o)),e},{}),cancel:t=>{for(let e=0;et,!0);let d;function h(){d=void 0}const l={now:()=>(void 0===d&&l.set(c.isProcessing||s.useManualTiming?c.timestamp:performance.now()),d),set:t=>{d=t,queueMicrotask(h)}};class p{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=l.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=l.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new n);const s=this.events[t].add(e);return"change"===t?()=>{s(),a.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&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 this.current}getPrevious(){return this.prev}getVelocity(){const t=l.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return s=parseFloat(this.current)-parseFloat(this.prevFrameValue),(n=e)?s*(1e3/n):0;var s,n}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),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 u(t){return(e,s)=>{const n=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter(t=>null!=t)}(e),i=[];for(const e of n){const n=t(e,s);i.push(n)}return()=>{for(const t of i)t()}}}const f={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},m={...f,transform:t=>((t,e,s)=>s>e?e:s({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),w=y("deg"),b=y("%"),k=y("px"),A=(()=>({...b,parse:t=>b.parse(t)/100,transform:t=>b.transform(100*t)}))(),P={borderWidth:k,borderTopWidth:k,borderRightWidth:k,borderBottomWidth:k,borderLeftWidth:k,borderRadius:k,borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomRightRadius:k,borderBottomLeftRadius:k,width:k,maxWidth:k,height:k,maxHeight:k,top:k,right:k,bottom:k,left:k,inset:k,insetBlock:k,insetBlockStart:k,insetBlockEnd:k,insetInline:k,insetInlineStart:k,insetInlineEnd:k,padding:k,paddingTop:k,paddingRight:k,paddingBottom:k,paddingLeft:k,paddingBlock:k,paddingBlockStart:k,paddingBlockEnd:k,paddingInline:k,paddingInlineStart:k,paddingInlineEnd:k,margin:k,marginTop:k,marginRight:k,marginBottom:k,marginLeft:k,marginBlock:k,marginBlockStart:k,marginBlockEnd:k,marginInline:k,marginInlineStart:k,marginInlineEnd:k,fontSize:k,backgroundPositionX:k,backgroundPositionY:k,...{rotate:w,rotateX:w,rotateY:w,rotateZ:w,scale:g,scaleX:g,scaleY:g,scaleZ:g,skew:w,skewX:w,skewY:w,distance:k,translateX:k,translateY:k,translateZ:k,x:k,y:k,z:k,perspective:k,transformPerspective:k,opacity:m,originX:A,originY:A,originZ:k},zIndex:v,fillOpacity:m,strokeOpacity:m,numOctaves:v};class S{constructor(){this.latest={},this.values=new Map}set(t,e,s,n,i=!0){const r=this.values.get(t);r&&r.onRemove();const c=()=>{const n=e.get();this.latest[t]=i?((t,e)=>e&&"number"==typeof t?e.transform(t):t)(n,P[t]):n,s&&a.render(s)};c();const d=e.on("change",c);n&&e.addDependent(n);const h=()=>{d(),s&&o(s),this.values.delete(t),n&&e.removeDependent(n)};return this.values.set(t,{value:e,onRemove:h}),h}get(t){return this.values.get(t)?.value}}function E(t){const e=new WeakMap;return(s,n)=>{const i=e.get(s)??new S;e.set(s,i);const r=[];for(const e in n){const a=n[e],o=t(s,i,e,a);r.push(o)}return()=>{for(const t of r)t()}}}const B={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const R=new Set(["originX","originY","originZ"]),F=(s,n,i,r)=>{let a,o;return e.has(i)?(n.get("transform")||(function(t){return"object"==typeof(e=t)&&null!==e&&"offsetHeight"in t&&!("ownerSVGElement"in t);var e}(s)||n.get("transformBox")||F(s,n,"transformBox",new p("fill-box")),n.set("transform",new p("none"),()=>{s.style.transform=function(e){let s="",n=!0;for(let i=0;i{const t=n.latest.originX??"50%",e=n.latest.originY??"50%",i=n.latest.originZ??0;s.style.transformOrigin=`${t} ${e} ${i}`}),o=n.get("transformOrigin")):a=i.startsWith("--")?()=>{s.style.setProperty(i,n.latest[i])}:()=>{s.style[i]=n.latest[i]},n.set(i,r,a,o)},x=u(E(F));export{F as addStyleValue,x as styleEffect}; //# sourceMappingURL=size-rollup-style-effect.js.map