const t=new WeakMap,e=t=>t.startsWith("--"),s=t=>180*t/Math.PI,n=t=>{const e=s(Math.atan2(t[1],t[0]));return i(e)},r={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:n,rotateZ:n,skewX:t=>s(Math.atan(t[1])),skewY:t=>s(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},i=t=>((t%=360)<0&&(t+=360),t),a=t=>Math.hypot(t[0],t[1]),o=t=>Math.hypot(t[4],t[5]),c={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:a,scaleY:o,scaleZ:t=>Math.hypot(t[8],t[9],t[10]),scale:t=>(a(t)+o(t))/2,rotateX:t=>i(s(Math.atan2(t[6],t[5]))),rotateY:t=>i(s(Math.atan2(-t[2],t[0]))),rotateZ:n,rotate:n,skewX:t=>s(Math.atan(t[4])),skewY:t=>s(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function h(t){return t.includes("scale")?1:0}const d=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return function(t,e){if(!t||"none"===t)return h(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(s)n=c,i=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=r,i=e}if(!i)return h(e);const a=n[e],o=i[1].split(",").map(u);return"function"==typeof a?a(o):o[a]}(s,e)};function u(t){return parseFloat(t.trim())}const l=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],p=(()=>new Set([...l,"pathRotation"]))();const f={},g=t=>"object"==typeof t&&null!==t;class m{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>this.remove(t)}remove(t){!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 r=0;rn=!0,a=y.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,r=!1;const i=new Set;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){i.has(e)&&(s.add(e),t()),e(a)}const c={schedule:(t,r=!1,a=!1)=>{const o=a&&n?e:s;return r&&i.add(t),o.add(t),t},cancel:t=>{s.delete(t),i.delete(t)},process:t=>{if(a=t,n)return void(r=!0);n=!0;const i=e;e=s,s=i,e.forEach(o),e.clear(),n=!1,r&&(r=!1,c.process(t))}};return c}(i),t),{}),{setup:o,read:c,resolveKeyframes:h,preUpdate:d,update:u,preRender:l,render:p,postRender:g}=a,m=()=>{const i=f.useManualTiming,a=i?s.timestamp:performance.now();n=!1,i||(s.delta=r?1e3/60:Math.max(Math.min(a-s.timestamp,40),1)),s.timestamp=a,s.isProcessing=!0,o.process(s),c.process(s),h.process(s),d.process(s),u.process(s),l.process(s),p.process(s),g.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(m))};return{schedule:y.reduce((e,i)=>{const o=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,s.isProcessing||t(m)),o.schedule(e,i,a)),e},{}),cancel:t=>{for(let e=0;et,!0,w);let S;function P(){S=void 0}const M={now:()=>(void 0===S&&M.set(w.isProcessing||f.useManualTiming?w.timestamp:performance.now()),S),set:t=>{S=t,queueMicrotask(P)}};class A{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=M.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.notifyChange(),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=M.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){var s;return"change"===t?this.onChangeSubscribe(e):((s=this.events)[t]||(s[t]=new m)).add(e)}onChangeSubscribe(t){const{events:e}=this;return e.change||this.changeSubscriber?(e.change||(e.change=new m,e.change.add(this.changeSubscriber),this.changeSubscriber=void 0),e.change.add(t)):this.changeSubscriber=t,()=>{this.changeSubscriber===t?this.changeSubscriber=void 0:e.change?.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){k.read(()=>{this.changeSubscriber||this.events.change?.getSize()||this.stop()})}clearListeners(){this.changeSubscriber=void 0;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.notifyChange()}notifyChange(){const{current:t,changeSubscriber:e}=this;e?e(t):this.events.change?.notify(t)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){const t=this.animation?.liveValue?.();return void 0===t?this.current:t}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=M.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;let s,n=!1;s=t(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===s&&this.clearAnimation(),e()}),n||(this.animation=s),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}const R={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},V={...R,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}`}),E=Y("deg"),C=Y("%"),B=Y("px"),F=(()=>({...C,parse:t=>C.parse(t)/100,transform:t=>C.transform(100*t)}))(),Z={rotate:E,pathRotation:E,rotateX:E,rotateY:E,rotateZ:E,scale:x,scaleX:x,scaleY:x,scaleZ:x,skew:E,skewX:E,skewY:E,distance:B,translateX:B,translateY:B,translateZ:B,x:B,y:B,z:B,perspective:B,transformPerspective:B,opacity:V,originX:F,originY:F,originZ:B},I={borderWidth:B,borderTopWidth:B,borderRightWidth:B,borderBottomWidth:B,borderLeftWidth:B,borderRadius:B,borderTopLeftRadius:B,borderTopRightRadius:B,borderBottomRightRadius:B,borderBottomLeftRadius:B,width:B,maxWidth:B,height:B,maxHeight:B,top:B,right:B,bottom:B,left:B,inset:B,insetBlock:B,insetBlockStart:B,insetBlockEnd:B,insetInline:B,insetInlineStart:B,insetInlineEnd:B,padding:B,paddingTop:B,paddingRight:B,paddingBottom:B,paddingLeft:B,paddingBlock:B,paddingBlockStart:B,paddingBlockEnd:B,paddingInline:B,paddingInlineStart:B,paddingInlineEnd:B,margin:B,marginTop:B,marginRight:B,marginBottom:B,marginLeft:B,marginBlock:B,marginBlockStart:B,marginBlockEnd:B,marginInline:B,marginInlineStart:B,marginInlineEnd:B,fontSize:B,backgroundPositionX:B,backgroundPositionY:B,...Z,zIndex:X,fillOpacity:V,strokeOpacity:V,numOctaves:X},O=(t,e)=>e&&"number"==typeof t?e.transform(t):t;function T(t){const{test:e,read:s,get:n,flush:r,state:i}=t;return Object.assign((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),r=[];for(const e of n){const n=t(e,s);r.push(n)}return()=>{for(const t of r)t()}},{test:e,read:s,get:n,flush:r,state:i})}class W{constructor(t=k.render){this.step=t,this.values=new Map,this.pending=[],this.numPending=0,this.flush=()=>{const{pending:t,numPending:e}=this;this.numPending=0;for(let s=0;ss&&this.schedule(s);void 0!==e.get()&&r();const i=e.on("change",r),a=()=>{i(),s&&!n&&this.cancel(s),this.values.get(t)?.onRemove===a&&this.values.delete(t)};return this.values.set(t,{value:e,render:n?void 0:s,onRemove:a}),a}get(t){return this.values.get(t)?.value}release(){const t=new Map;return this.values.forEach((e,s)=>{t.set(s,e.value),e.onRemove()}),this.transformKeys=this.transformValues=void 0,t}schedule(t){const{pending:e,numPending:s}=this;for(let n=0;n{const i=n.get(s)??new W(e);n.set(s,i);const a=[];for(const e in r){const n=r[e],o=t(s,i,e,n);a.push(o)}return()=>{for(const t of a)t()}},s,{get:(t,e)=>n.get(t)?.get(e),flush:t=>n.get(t)?.flush(),state:t=>n.get(t)})}const U={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},L={};const $=new Set(["originX","originY","originZ"]),K=(t,e)=>O(t.get(e)?.get(),I[e]),N=(s,n,r,i)=>{let a,o;if(p.has(r)){if("pathRotation"!==r){const t=n.transformKeys??(n.transformKeys=[]);(n.transformValues??(n.transformValues={}))[r]=i,t.includes(r)||(t.push(r),t.sort((t,e)=>l.indexOf(t)-l.indexOf(e)))}n.get("transform")||(v(s)||n.get("transformBox")||N(s,n,"transformBox",new A("fill-box")),n.set("transform",new A("none"),()=>{t.get(s)?.check(),s.style.transform=function(t){let e="";const{transformKeys:s=[],transformValues:n={}}=t;for(let t=0;t{const t=K(n,"originX")??"50%",e=K(n,"originY")??"50%",r=K(n,"originZ")??0;s.style.transformOrigin=`${t} ${e} ${r}`}),o=n.get("transformOrigin")):a=e(r)?()=>{s.style.setProperty(r,i.getCurrent())}:()=>{s.style[r]=O(i.getCurrent(),I[r])};return n.set(r,i,a,o)},j=(t,s)=>{if(p.has(s))return d(t,s);const n=getComputedStyle(t),r=e(s)?n.getPropertyValue(s):n[s];return"string"==typeof r&&r.trim()||0},q=z(N,{test:t=>{return v(t)||g(e=t)&&"ownerSVGElement"in e;var e},read:j}),D=T(q);export{N as addStyleValue,$ as originProps,j as readStyleValue,D as styleEffect,q as styleSubjectEffect}; //# sourceMappingURL=size-rollup-style-effect.js.map