@petit-kit/scoped 0.0.8-beta.2 → 0.0.8-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <br />
9
9
  <br />
10
10
 
11
- # Scoped - 0.0.8-beta.2
11
+ # Scoped - 0.0.8-beta.22
12
12
 
13
13
  ### A lightweight, framework-agnostic library for building web components with reactive state, bindings, lifecycle hooks, template-based rendering and plugins.
14
14
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function t({from:t=0,to:e=1,mass:n=1,stiffness:s=120,damping:i=14,velocity:o=0,tolerance:d=.001,resumeOnTarget:p=!0}={}){function m(){return h(v)}function w(t){if(M)return m();if(r(v)&&r(S)&&r(b)){let e=!0;for(let o=0;o<v.length;o+=1){const r=v[o]-S[o],c=(-s*r-i*b[o])/n;b[o]+=c*t,v[o]+=b[o]*t;const h=v[o]-S[o];(Math.abs(b[o])>=d||Math.abs(h)>=d)&&(e=!1)}if(e){for(let t=0;t<v.length;t+=1)v[t]=S[t],b[t]=0;M=!0}return y.value=v,y.velocity=b,h(v)}if(c(v)&&c(S)&&c(b)){const e=y.objectKeys??Object.keys(v);let o=!0;for(const r of e){const e=v[r]-S[r],c=(-s*e-i*b[r])/n;b[r]+=c*t,v[r]+=b[r]*t;const h=v[r]-S[r];(Math.abs(b[r])>=d||Math.abs(h)>=d)&&(o=!1)}if(o){for(const t of e)v[t]=S[t],b[t]=0;M=!0}return y.value=v,y.velocity=b,h(v)}const e=S;let o=b;o+=(-s*(v-e)-i*o)/n*t,v+=o*t,b=o,y.value=v,y.velocity=b;const f=v-e;return Math.abs(o)<d&&Math.abs(f)<d&&(v=e,b=0,y.value=v,y.velocity=b,M=!0),v}const y=a({from:t,to:e,velocity:o,label:"Spring"}),g=y.normalizeInput;let v=y.value,b=y.velocity??o,S=y.target,j=null,M=!1;const x=new Set;return{setTarget:function(t){const e=g(t),n=!f(e,S);if(S=e,y.target=e,v=y.value,p&&M&&n){M=!1,j=null;for(const t of x)t(S)}},setValue:function(t,e={}){const{resetVelocity:n=!0,resetTime:s=!0,setTarget:i=!1,markDone:o=!1}=e;v=g(t),y.value=v,i&&(S=h(v),y.target=S);const r=M||!f(v,S);if(n&&(b=null!=y.arrayLength?l(0,y.arrayLength):null!=y.objectKeys?u(0,y.objectKeys):0,y.velocity=b),s&&(j=null),o&&(M=!0),r&&!o){M=!1,j=null;for(const t of x)t(S)}},getValue:m,isDone:function(){return M},onResume:function(t){return x.add(t),()=>{x.delete(t)}},step:w,next:function(t=performance.now()){if(null==j)return j=t,m();const e=(t-j)/1e3;j=t;const n=1/30;let s=e,i=m();for(;s>0&&!M;){const t=Math.min(s,n);i=w(t),s-=t}return i}}}function e(t,e){return t?`${t}:${e}`:e}function n(t,e){if(!e||"object"!=typeof e||null==e.type)return null!=t?t:e;const{type:n,default:s}=e;if(null==t)return s;try{switch(n){case String:return String(t);case Number:{const e=Number(t);return Number.isNaN(e)?s:e}case Boolean:return""===t||"true"===t||"false"!==t&&"0"!==t&&null!=t;case Object:case Array:try{return"string"==typeof t?JSON.parse(t):t}catch{return n===Array?Array.isArray(s)?s:[]:s}default:return t}}catch{return s}}function s(t,e,n,s){if(!s||"object"!=typeof s||!s.reflect)return;let i=null;const o=s.type;if(o!==Boolean){if(o===Object||o===Array)try{i=null==n?null:JSON.stringify(n)}catch{i=null}else i=null==n?null:String(n);null==i?t.removeAttribute(e):t.setAttribute(e,i)}else n?t.setAttribute(e,""):t.removeAttribute(e)}const i=()=>({name:"timer",extend:t=>{const e=new Set,n=new Set,s=new Set,i={setTimeout:(t,n,...s)=>{let i;return i=setTimeout((...n)=>{e.delete(i),t(...n)},n,...s),e.add(i),i},setInterval:(t,e,...s)=>{const i=setInterval(t,e,...s);return n.add(i),i},raf:(t,e)=>{let n=0,i=!0,o=0;const r="number"==typeof e&&e>0?1e3/e:0,c=e=>{if(s.delete(n),i){if(r){if(e-o>=r){const n=o?e-o:r;o=e,t(e,n)}}else{const n=o?e-o:0;o=e,t(e,n)}n=requestAnimationFrame(c),s.add(n)}};return n=requestAnimationFrame(c),s.add(n),()=>{i&&(i=!1,s.delete(n),cancelAnimationFrame(n))}}};return t.onDestroy(()=>{for(const t of e)clearTimeout(t);e.clear();for(const t of n)clearInterval(t);n.clear();for(const t of s)cancelAnimationFrame(t);s.clear()}),{timer:i}}}),o=()=>({name:"mouse",extend:t=>{const e=new Map,n=(t,n)=>{if("undefined"==typeof window)return()=>{};const s=t=>{const e=t;n(e.clientX,e.clientY,e)};window.addEventListener(t,s);let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(s),()=>{window.removeEventListener(t,s),i?.delete(s)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const[t,n]of e){for(const e of n)window.removeEventListener(t,e);n.clear()}e.clear()}}),{onMouseMove:t=>n("mousemove",t),onMouseDown:t=>n("mousedown",t),onMouseUp:t=>n("mouseup",t),onMouseWheel:t=>(t=>{if("undefined"==typeof window)return()=>{};const n=e=>{const n=e;t(n.clientX,n.clientY,n.deltaY,n)};window.addEventListener("wheel",n);let s=e.get("wheel");return s||(s=new Set,e.set("wheel",s)),s.add(n),()=>{window.removeEventListener("wheel",n),s?.delete(n)}})(t)}}}),r=t=>Array.isArray(t),c=t=>null!=t&&"object"==typeof t&&!Array.isArray(t),h=t=>r(t)?t.slice():c(t)?{...t}:t,f=(t,e)=>{if(r(t)&&r(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!Object.is(t[n],e[n]))return!1;return!0}if(c(t)&&c(e)){const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n){if(!(s in e))return!1;if(!Object.is(t[s],e[s]))return!1}return!0}return!(r(t)||r(e)||c(t)||c(e))&&Object.is(t,e)},l=(t,e)=>Array.from({length:e},()=>t),u=(t,e)=>e.reduce((e,n)=>(e[n]=t,e),{}),a=({from:t,to:e,velocity:n,label:s})=>{const i={value:t,target:e,velocity:n,arrayLength:null,objectKeys:null,normalizeInput:t=>t},o=t=>{if(null==i.arrayLength){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);i.arrayLength=t,r(i.value)||(i.value=l(i.value,t)),r(i.target)||(i.target=l(i.target,t)),void 0===i.velocity||r(i.velocity)||(i.velocity=l(i.velocity,t))}},h=t=>{if(null==i.objectKeys){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);i.objectKeys=t,c(i.value)||(i.value=u(i.value,t)),c(i.target)||(i.target=u(i.target,t)),void 0===i.velocity||c(i.velocity)||(i.velocity=u(i.velocity,t))}},f=t=>{if(r(t)){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);if(null==i.arrayLength&&o(t.length),t.length!==i.arrayLength)throw new Error(`${s} value length mismatch (expected ${i.arrayLength}, got ${t.length}).`);return t.slice()}if(c(t)){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);const e=Object.keys(t);if(null==i.objectKeys&&h(e),i.objectKeys&&e.length!==i.objectKeys.length)throw new Error(`${s} value keys mismatch (expected ${i.objectKeys.length}, got ${e.length}).`);if(i.objectKeys)for(const e of i.objectKeys)if(!(e in t))throw new Error(`${s} value keys mismatch (missing key "${e}").`);return{...t}}return null!=i.arrayLength?l(t,i.arrayLength):null!=i.objectKeys?u(t,i.objectKeys):t};i.normalizeInput=f;const a=r(t)||r(e)||void 0!==n&&r(n),d=c(t)||c(e)||void 0!==n&&c(n);if(a&&d)throw new Error(`${s} value shape mismatch (array vs object).`);if(a){const s=r(t)?t.length:r(e)?e.length:n.length;o(s),i.value=f(t),i.target=f(e),void 0!==i.velocity&&(i.velocity=f(i.velocity))}else if(d){const s=c(t)?Object.keys(t):c(e)?Object.keys(e):Object.keys(n);h(s),i.value=f(t),i.target=f(e),void 0!==i.velocity&&(i.velocity=f(i.velocity))}return i};let d={x:-1,y:-1};const p={stiffness:300,damping:30,mass:1},m="0.0.8-beta.2",w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=t=>null==t||""===t?"":String(t).replace(/[&<>"']/g,t=>w[t]),g=/\{([A-Za-z_$][\w$]*)\}/g;exports.SCOPE_VERSION=m,exports.define=function(t,e={},i){const{props:o={},shadow:r=!1,styles:c,plugins:h}=e,f=h??[],l=()=>{};class u extends HTMLElement{constructor(){super(),this.version=m,this.t={};for(const t of Object.keys(o)){const e=o[t];this.t[t]=e&&"object"==typeof e&&("type"in e||"default"in e)?e:{type:void 0,default:e,reflect:!1}}this.props={},this.state={},this.actions={},this.refs={},this.emit=this.emit.bind(this),this.listen=this.listen.bind(this),this.setState=this.setState.bind(this),this.updateState=this.updateState.bind(this),this.setProps=this.setProps.bind(this),this.scheduleUpdate=this.scheduleUpdate.bind(this),this.update=this.update.bind(this),this.forceRender=this.forceRender.bind(this),this.destroy=this.destroy.bind(this),this.$=this.$.bind(this),this.i=null,this.o=null,this.h=!1,this.l=!1,this.u=r,this.p=r?this.attachShadow({mode:"open"}):this,this.m=null,this.S=[],this.j=[],this.M=[],this.O=[],this._=[],this.A=[],this.T=[],this.k=[],this.L=null,this.C="mount",this.F=void 0,this.I=new Map,this.R=!1,this.V=!1,this.q={},this.D=t,this.H=!1,this.N=new Set,this.U=!1,this.B=new Map,this.W=0,this.J=!1}P(t){const e=this.u?this.p.host:this;let n=t.parentElement;for(;n;){if(n===e)return!1;if(n.tagName.includes("-"))return!0;n=n.parentElement}return!1}static get observedAttributes(){return Object.keys(o)}attributeChangedCallback(t,e,s){if(e===s)return;const i=this.t[t],o=this.q[t],r=n(s,i);if(this.props[t]=r,this.R&&o!==r)for(const e of this.k)try{e(t,o,r)}catch(t){l(String(t?.message||t))}this.q[t]=r,this.N.has(t)?this.N.delete(t):this.i&&this.isConnected?this.U?this.H=!0:(this.C="props",this.F=[t],this.update(!0)):this.H=!0}connectedCallback(){for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=n(this.getAttribute(t),this.t[t]);this.props[t]=e,this.q[t]=e}r||this.m||(this.m=this.K());let t=null;try{if(i){const e={props:this.props,state:this.state,actions:this.actions,refs:this.refs,emit:this.emit,listen:this.listen,updateState:this.updateState.bind(this),$:this.$,host:this,onMount:t=>this.M.push(t),onDestroy:t=>this.O.push(t),onUpdate:t=>this._.push(t),onBeforeUpdate:t=>this.A.push(t),onFirstUpdate:t=>this.T.push(t),onPropsChanged:t=>this.k.push(t),shouldRender:t=>{this.L=t},link:(t,e)=>{const n=e||t;this.state[n]=this.props[t],this.k.push((e,s,i)=>{e===t&&(Object.is(this.state[n],i)||(this.state[n]=i))});const i={fn:()=>{const e=this.state[n];if(Object.is(this.props[t],e))return;this.props[t]=e,this.q[t]=e;const i=this.t[t],o=i?{...i,reflect:!0}:i,r=this.getAttribute(t);this.N.add(t),s(this,t,e,o),r===this.getAttribute(t)&&this.N.delete(t)},deps:()=>[this.state[n]]};this.S.push(i)},computed:(t,e)=>{let n;if(void 0!==e)try{const t="function"==typeof e?e():e;Array.isArray(t)&&(n=t)}catch(t){String(t?.message||t)}const s={getter:t,deps:e,value:void 0!==e?t(n):t()};this.j.push(s);const i=()=>s.value;return i.Z=s,this.G(i),i},effect:(t,e)=>{const n={fn:t,deps:e};return this.S.push(n),()=>this.X(n)},delegate:(t,e,n)=>(this.Y(t,e,n),()=>this.tt(t,e,n)),escapeHtml:y};for(const t of f)if(t)try{const n=t.extend(e,this);n&&"object"==typeof n&&Object.assign(e,n)}catch(t){l(String(t?.message||t))}t=i(e)}}catch(t){throw String(t?.message||t),t}this.i="function"!=typeof t?()=>"":t,this.U=!0,this.C="mount",this.F=void 0,this.update(!0),this.U=!1,this.H&&(this.H=!1,this.C="props",this.F=void 0,this.update(!0))}disconnectedCallback(){this.destroy()}remove(){super.remove()}$(t){const e=this.p.querySelectorAll(t);return 0===e.length?null:1===e.length?e[0]:Array.from(e)}destroy(){for(const t of this.O)try{t()}catch(t){l(String(t?.message||t))}for(const t of this.S)if(t.cleanup){try{t.cleanup()}catch(t){l(String(t?.message||t))}t.cleanup=void 0}for(const[,t]of this.I)try{this.p.removeEventListener(t.eventType,t.listener)}catch{}this.I.clear(),this.R=!1}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}listen(t,e,n,s){const i=n;t.addEventListener(e,i,s);const o=()=>{try{t.removeEventListener(e,i,s)}catch{}};return this.O.push(o),o}setState(t){const e=[],n=t,s=this.state;for(const t in n){if(!Object.prototype.hasOwnProperty.call(n,t))continue;const i=n[t];Object.is(s[t],i)||(s[t]=i,e.push(t))}if(0!==e.length)if(this.U||!this.R)this.C="state",this.F=e,this.update(!0);else{if(!this.i||!this.isConnected)return;if(this.h)return;this.h=!0;const t=[...e];requestAnimationFrame(()=>{this.h=!1,this.i&&this.isConnected&&(this.C="state",this.F=t,this.update(!0))})}}updateState(t){Object.assign(this.state,t),this.i&&this.isConnected&&this.et()}setProps(t){const e=Object.keys(t);if(0===e.length)return;const n=[];for(const i of e){const e=t[i],o=this.q[i];this.props[i]=e,this.R&&o!==e&&n.push(i);const r=this.t[i];r&&r.reflect&&s(this,i,e,r),this.R&&o===e||(this.q[i]=e)}if(this.R&&n.length>0)for(const e of n){const n=this.q[e],s=t[e];for(const t of this.k)try{t(e,n,s)}catch(t){l(String(t?.message||t))}}this.i&&this.isConnected?(this.C="props",this.F=n,this.update(!0)):this.H=!0}scheduleUpdate(){this.i&&this.isConnected&&this.et()}et(){this.l||this.h||(this.l=!0,("function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t))(()=>{this.l=!1,this.i&&this.isConnected&&(this.h||this.update(!1))}))}update(t){if(this.i){if(t&&this.R)for(const t of this.A)try{t()}catch(t){l(String(t?.message||t))}if(t){const t={reason:this.C,changedKeys:this.F};if(null===this.L||this.L(t)){this.nt();let t="";try{t=this.i()}catch(e){String(e?.message||e),t=""}if("string"!=typeof t&&(t=null==t?"":String(t)),t=((t,e)=>{const n={...this.props,...e};return t.replace(g,(t,e)=>{const s=n[e];return null==s?"":String(s)})})(t,this.state),!this.u){const e=`data-scope-owner="${this.D}"`;t=t.replace(/<slot(?![^>]*data-scope-owner)(\s|>)/g,`<slot ${e}$1`)}this.J=!1;const e=null!==this.o&&Object.is(this.o,t);let n=!1;e&&this.R||(this.p.innerHTML=t,this.o=t,n=!0),this.U?("function"==typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,0))(()=>{if(this.i&&this.isConnected){if(n&&!r&&this.projectSlots(),n&&this.st(),!this.R){this.R=!0;for(const t of this.M)try{t()}catch(t){l(String(t?.message||t))}}this.it(),this.ot()}}):(n&&!r&&this.projectSlots(),n&&this.st(),this.it(),this.ot())}else this.it(),this.R&&this.ot()}else this.J&&this.nt(),this.it(),this.R&&this.ot()}}forceRender(){this.o=null,this.i&&this.isConnected?this.U?this.H=!0:(this.C="force",this.F=void 0,this.update(!0)):this.H=!0}ot(){if(!this.V){this.V=!0;for(const t of this.T)try{t()}catch(t){l(String(t?.message||t))}}for(const t of this._)try{t()}catch(t){l(String(t?.message||t))}this.rt()}rt(){const t=(this.u?this.p:this).querySelectorAll("*"),e=Object.prototype.hasOwnProperty,n=this.state,s=this.props;this.actions;for(let i=0;i<t.length;i++){const o=t[i];if(this.P(o))continue;if(0===o.attributes.length)continue;const r=o.attributes;for(let t=r.length-1;t>=0;t--){const i=r[t];if(!i.name.startsWith("bind:"))continue;const c=i.name.slice(5),h=i.value,f=h?h.trim():"";let l,u=!1;if(f){const t=this.B.get(f);if(t){t.Z&&(this.J=!0);try{l=t()}catch{}u=!0}}if(!u){const t=f||c,i=e.call(n,t),o=!i&&e.call(s,t);i?l=n[t]:o&&(l=s[t])}if("text"===c){const t=null==l?"":String(l);o.textContent!==t&&(o.textContent=t)}else if("html"===c){const t=null==l?"":String(l);o.innerHTML!==t&&(o.innerHTML=t)}else if(c in o){if(!Object.is(o[c],l))try{o[c]=l}catch{}if("value"===c)try{null==l?o.removeAttribute("value"):o.setAttribute("value",String(l))}catch{}}else if(null!=l)try{o.setAttribute(c,String(l))}catch{}const a=`__scopeBind_${c}`,d=o[a];if(d){const t=d.ct;t&&o.removeEventListener(t,d),delete o[a]}}}}ht(t,e){if(!t||!e||t.length!==e.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!0;return!1}nt(){for(const t of this.j){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){try{t.value=void 0!==t.deps?t.getter(e):t.getter()}catch(t){l(String(t?.message||t))}e&&(t.prevDeps=e.slice())}}}it(){for(const t of this.S){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){if(t.cleanup){try{t.cleanup()}catch{}t.cleanup=void 0}try{const n=void 0!==t.deps?t.fn(e):t.fn();"function"==typeof n&&(t.cleanup=n)}catch{}e&&(t.prevDeps=e.slice())}}}X(t){const e=this.S.indexOf(t);if(-1!==e){if(t.cleanup)try{t.cleanup()}catch{}this.S.splice(e,1)}}G(t){const e=t.ft;if(e&&"string"==typeof e)return this.B.set(e,t),e;const n=`__scope_bind_${++this.W}__`;this.B.set(n,t);try{t.ft=n,t.toString=()=>n}catch{}return n}st(){const t=(this.u?this.p:this).querySelectorAll("*"),e=this.refs;for(const t in e)e.hasOwnProperty(t)&&delete e[t];for(let n=0;n<t.length;n++){const s=t[n];if(this.P(s))continue;const i=s.getAttribute("ref");if(i&&(e[i]?Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]:e[i]=s),s.attributes.length>0){const t=s.attributes;for(let e=t.length-1;e>=0;e--){const n=t[e];if(!n.name.startsWith("on:"))continue;const i=n.name.slice(3),o=n.value,r=`__tinyHandler_${i}`,c=s[r];c&&s.removeEventListener(i,c),s.removeAttribute(n.name);const h=this.actions[o];if(h&&"function"==typeof h){const t=t=>{h.call(this.actions,t)};s[r]=t,s.addEventListener(i,t)}}}}}K(){const t=new Map,e=this.childNodes,n=[];for(let t=0;t<e.length;t++)n.push(e[t]);for(let e=0;e<n.length;e++){const s=n[e];let i="";1===s.nodeType&&s.getAttribute&&(i=s.getAttribute("slot")||""),t.has(i)||t.set(i,[]),t.get(i).push(s)}for(let t=0;t<n.length;t++){const e=n[t];e.parentNode&&e.parentNode.removeChild(e)}return t}projectSlots(){const t=this.m||new Map,e=(this.u?this.p:this).querySelectorAll(`slot[data-scope-owner="${this.D}"]`);if(0!==e.length)for(let n=0;n<e.length;n++){const s=e[n],i=s.getAttribute("name")||"",o=t.get(i)||[];if(o.length){const t=document.createDocumentFragment();for(let e=0;e<o.length;e++){const n=o[e];let s;if(1===n.nodeType&&n.tagName.includes("-")&&n.m instanceof Map){const t=n,e=document.createElement(t.tagName.toLowerCase());for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n];e.setAttribute(s.name,s.value)}for(const n of t.m.values())for(let t=0;t<n.length;t++)e.appendChild(n[t].cloneNode(!0));s=e}else s=n.cloneNode(!0);t.appendChild(s)}s.replaceWith(t)}else{const t=s.childNodes,e=[];for(let n=0;n<t.length;n++)e.push(t[n]);if(e.length>0){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++)t.appendChild(e[n]);s.replaceWith(t)}}}}Y(t,e,n){const s=`${t}::${e}`;let i=this.I.get(s);if(!i){const n=t=>{const n=t.target&&t.target.closest?t.target.closest(e):null;if(n)for(const e of i.handlers)try{e(t,n)}catch{}};i={eventType:t,selector:e,listener:n,handlers:new Set},this.I.set(s,i),this.p.addEventListener(t,n)}i.handlers.add(n)}tt(t,e,n){const s=`${t}::${e}`,i=this.I.get(s);if(i&&(i.handlers.delete(n),0===i.handlers.size)){try{this.p.removeEventListener(t,i.listener)}catch{}this.I.delete(s)}}}if(!customElements.get(t)){if(c&&"undefined"!=typeof document){const e=`scope-${t}-styles`;if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=c,document.head.appendChild(t)}}try{customElements.define(t,u)}catch(t){String(t?.message||t)}}return u},exports.devicePlugin=()=>({name:"device",extend:t=>{const e=new Map;return t.onDestroy(()=>{for(const[t,n]of e)t.removeEventListener("change",n);e.clear()}),{onMediaQuery:(t,n,s={})=>{if("undefined"==typeof window||"undefined"==typeof matchMedia)return()=>{};const{immediate:i=!0}=s,o=matchMedia(t),r=t=>{n(t.matches,t)};return o.addEventListener("change",r),e.set(o,r),i&&n(o.matches,null),()=>{o.removeEventListener("change",r),e.delete(o)}}}}}),exports.happy=()=>{console.info("The website is using @petit-kit/scoped v"+m,"\nhttps://github.com/petit-kit/scoped")},exports.inViewPlugin=()=>({name:"inview",extend:(t,e)=>{const n=new Set,s=(t,e,s={})=>{if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return()=>{};const{immediate:i=!0,...o}=s;let r=!i;const c=new IntersectionObserver(n=>{for(const s of n)s.target===t&&(r?r=!1:e(s.isIntersecting,s))},o);return c.observe(t),n.add(c),()=>{c.unobserve(t),c.disconnect(),n.delete(c)}};return t.onDestroy(()=>{for(const t of n)t.disconnect();n.clear()}),{onInView:(t,n)=>s(e,t,n),observeInView:(t,e,n)=>s(t,e,n)}}}),exports.lenisPlugin=t=>({name:"lenis",extend:e=>{const n=new Set;return e.onDestroy(()=>{for(const{lenis:t,handler:e}of n)"function"==typeof t.off&&t.off("scroll",e);n.clear()}),{onLenisScroll:e=>{const s=t();if(!s)return()=>{};const i=t=>{e(t)};s.on("scroll",i);const o={lenis:s,handler:i};return n.add(o),()=>{n.has(o)&&(n.delete(o),"function"==typeof s.off&&s.off("scroll",i))}}}}}),exports.lerpPlugin=()=>({name:"lerp",extend:t=>{const{timer:e}=i().extend(t,t.host),n=new Set;return t.onDestroy(()=>{for(const t of n)t();n.clear()}),{createLerp:t=>function({from:t=0,to:e=1,lerp:n=.1,tolerance:s=.001,resumeOnTarget:i=!0}={}){function o(){return h(p)}function l(t){if(y)return o();const e=(t=>t<0?0:t>1?1:t)(n);if(0===e)return o();if(1===e)return p=h(m),u.value=p,y=!0,o();const i=t>0?1-Math.pow(1-e,60*t):0;if(r(p)&&r(m)){let t=!0;for(let e=0;e<p.length;e+=1)p[e]+=(m[e]-p[e])*i,Math.abs(m[e]-p[e])>=s&&(t=!1);if(t){for(let t=0;t<p.length;t+=1)p[t]=m[t];y=!0}return u.value=p,h(p)}if(c(p)&&c(m)){const t=u.objectKeys??Object.keys(p);let e=!0;for(const n of t)p[n]+=(m[n]-p[n])*i,Math.abs(m[n]-p[n])>=s&&(e=!1);if(e){for(const e of t)p[e]=m[e];y=!0}return u.value=p,h(p)}const f=m;return p+=(f-p)*i,u.value=p,Math.abs(f-p)<s&&(p=f,u.value=p,y=!0),p}const u=a({from:t,to:e,label:"Lerp"}),d=u.normalizeInput;let p=u.value,m=u.target,w=null,y=!1;const g=new Set;return{setTarget:function(t){const e=d(t),n=!f(e,m);if(m=e,u.target=e,p=u.value,i&&y&&n){y=!1,w=null;for(const t of g)t(m)}},setValue:function(t,e={}){const{resetTime:n=!0,setTarget:s=!1,markDone:i=!1}=e;p=d(t),u.value=p,s&&(m=h(p),u.target=m);const o=y||!f(p,m);if(n&&(w=null),i&&(y=!0),o&&!i){y=!1,w=null;for(const t of g)t(m)}},getValue:o,isDone:function(){return y},onResume:function(t){return g.add(t),()=>{g.delete(t)}},step:l,next:function(t=performance.now()){if(null==w)return w=t,o();const e=(t-w)/1e3;w=t;const n=1/30;let s=e,i=o();for(;s>0&&!y;){const t=Math.min(s,n);i=l(t),s-=t}return i}}}(t),runLerp:(t,s,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&s(t.getValue(),t);const l=()=>{f||(f=e.raf(e=>{if(h)return;const n=t.next(e);s(n,t),c&&t.isDone()&&u()},o))},u=()=>{f&&(f(),f=null)};l();const a=t.onResume(()=>{!h&&c&&(r&&s(t.getValue(),t),l())}),d=()=>{h||(h=!0,a(),u(),n.delete(d))};return n.add(d),d}}}}),exports.localStoragePlugin=(t={})=>({name:"localstorage",extend:n=>{const{prefix:s="",json:i=!0}=t,o="undefined"==typeof window?null:window.localStorage;return{storage:{get:t=>{if(o)try{const n=o.getItem(e(s,t));if(null===n)return;return i?JSON.parse(n):n}catch{return}},set:(t,n)=>{if(o)try{const r=i?JSON.stringify(n):String(n);o.setItem(e(s,t),r)}catch{}},remove:t=>{o&&o.removeItem(e(s,t))},clear:()=>{if(!o)return;if(!s)return;const t=[];for(let e=0;e<o.length;e++){const n=o.key(e);null!=n&&n.startsWith(s+":")&&t.push(n)}for(const e of t)o.removeItem(e)}}}}}),exports.morphPlugin=(t,e={})=>({name:"morph",extend:(n,s)=>{const{ignoreActiveValue:i=!0,callbacks:o}=e,r=t(),c=s,h=c.p,f=c.u?ShadowRoot.prototype:HTMLElement.prototype,l=Object.getOwnPropertyDescriptor(f,"innerHTML"),u=t=>{r.morph(h,t,{morphStyle:"innerHTML",ignoreActiveValue:i,callbacks:o})};let a=!0;return Object.defineProperty(h,"innerHTML",{set(t){a?(l.set.call(this,t),a=!1):u(t)},get(){return l.get.call(this)},configurable:!0}),n.onDestroy(()=>{delete h.innerHTML}),{morph:u}}}),exports.mousePlugin=o,exports.pointerPlugin=()=>({name:"pointer",extend:e=>{const{onMouseMove:n}=o().extend(e,e.host),{timer:s}=i().extend(e,e.host);d.x=window.innerWidth/2,d.y=window.innerHeight/2;const r={x:t({from:d.x,to:d.x,...p}),y:t({from:d.y,to:d.y,...p})};return n((t,e)=>{r.x.setTarget(t),r.y.setTarget(e)}),{onPointerMove:t=>{let e=d.x,n=d.y;s.raf(s=>{const i=r.x.next(s),o=r.y.next(s);var c,h;e===i&&n===o||(t({x:i,y:o,v:(c={x:i,y:o},h={x:e,y:n},{x:c.x-h.x,y:c.y-h.y,magnitude:Math.sqrt((c.x-h.x)*(c.x-h.x)+(c.y-h.y)*(c.y-h.y))}).magnitude}),e=i,n=o)})},onMouseMove:n}}}),exports.springPlugin=()=>({name:"spring",extend:e=>{const{timer:n}=i().extend(e,e.host),s=new Set;return e.onDestroy(()=>{for(const t of s)t();s.clear()}),{createSpring:e=>t(e),runSpring:(t,e,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&e(t.getValue(),t);const l=()=>{f||(f=n.raf(n=>{if(h)return;const s=t.next(n);e(s,t),c&&t.isDone()&&u()},o))},u=()=>{f&&(f(),f=null)};l();const a=t.onResume(()=>{!h&&c&&(r&&e(t.getValue(),t),l())}),d=()=>{h||(h=!0,a(),u(),s.delete(d))};return s.add(d),d}}}}),exports.timerPlugin=i,exports.windowPlugin=()=>({name:"window",extend:t=>{const e=new Set,n=new Set,s=new Set,i=(t,n={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=n,i=e=>{t(window.innerWidth,window.innerHeight,e)};return window.addEventListener("resize",i),e.add(i),s&&i(new UIEvent("resize")),()=>{window.removeEventListener("resize",i),e.delete(i)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const t of e)window.removeEventListener("resize",t);e.clear();for(const t of s)t.disconnect();s.clear();for(const t of n)window.removeEventListener("scroll",t);n.clear()}}),{onViewportResize:i,onWindowResize:(t,e={})=>{if("undefined"==typeof window)return()=>{};if("undefined"==typeof ResizeObserver)return i((e,n,s)=>t(e,n,s),e);const{immediate:n=!0}=e,o=document.documentElement,r=new ResizeObserver(e=>{const n=e[0];if(!n)return;const{width:s,height:i}=n.contentRect;t(s,i,n)});if(r.observe(o),s.add(r),n){const e=o.getBoundingClientRect();t(e.width,e.height,new UIEvent("resize"))}return()=>{r.disconnect(),s.delete(r)}},onWindowScroll:(t,e={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=e,i=e=>{t(window.scrollX,window.scrollY,e)};return window.addEventListener("scroll",i,{passive:!0}),n.add(i),s&&i(new Event("scroll")),()=>{window.removeEventListener("scroll",i),n.delete(i)}}}}});
1
+ "use strict";function t({from:t=0,to:e=1,mass:n=1,stiffness:s=120,damping:i=14,velocity:o=0,tolerance:r=.001,resumeOnTarget:p=!0}={}){function m(){return f(v)}function w(t){if(M)return m();if(c(v)&&c(S)&&c(b)){let e=!0;for(let o=0;o<v.length;o+=1){const c=v[o]-S[o],h=(-s*c-i*b[o])/n;b[o]+=h*t,v[o]+=b[o]*t;const f=v[o]-S[o];(Math.abs(b[o])>=r||Math.abs(f)>=r)&&(e=!1)}if(e){for(let t=0;t<v.length;t+=1)v[t]=S[t],b[t]=0;M=!0}return y.value=v,y.velocity=b,f(v)}if(h(v)&&h(S)&&h(b)){const e=y.objectKeys??Object.keys(v);let o=!0;for(const c of e){const e=v[c]-S[c],h=(-s*e-i*b[c])/n;b[c]+=h*t,v[c]+=b[c]*t;const f=v[c]-S[c];(Math.abs(b[c])>=r||Math.abs(f)>=r)&&(o=!1)}if(o){for(const t of e)v[t]=S[t],b[t]=0;M=!0}return y.value=v,y.velocity=b,f(v)}const e=S;let o=b;o+=(-s*(v-e)-i*o)/n*t,v+=o*t,b=o,y.value=v,y.velocity=b;const u=v-e;return Math.abs(o)<r&&Math.abs(u)<r&&(v=e,b=0,y.value=v,y.velocity=b,M=!0),v}const y=d({from:t,to:e,velocity:o,label:"Spring"}),g=y.normalizeInput;let v=y.value,b=y.velocity??o,S=y.target,j=null,M=!1;const x=new Set;return{setTarget:function(t){const e=g(t),n=!u(e,S);if(S=e,y.target=e,v=y.value,p&&M&&n){M=!1,j=null;for(const t of x)t(S)}},setValue:function(t,e={}){const{resetVelocity:n=!0,resetTime:s=!0,setTarget:i=!1,markDone:o=!1}=e;v=g(t),y.value=v,i&&(S=f(v),y.target=S);const r=M||!u(v,S);if(n&&(b=null!=y.arrayLength?l(0,y.arrayLength):null!=y.objectKeys?a(0,y.objectKeys):0,y.velocity=b),s&&(j=null),o&&(M=!0),r&&!o){M=!1,j=null;for(const t of x)t(S)}},getValue:m,isDone:function(){return M},onResume:function(t){return x.add(t),()=>{x.delete(t)}},step:w,next:function(t=performance.now()){if(null==j)return j=t,m();const e=(t-j)/1e3;j=t;const n=1/30;let s=e,i=m();for(;s>0&&!M;){const t=Math.min(s,n);i=w(t),s-=t}return i}}}function e(t,e){return t?`${t}:${e}`:e}function n(t,e){if(!e||"object"!=typeof e||null==e.type)return null!=t?t:e;const{type:n,default:s}=e;if(null==t)return s;try{switch(n){case String:return String(t);case Number:{const e=Number(t);return Number.isNaN(e)?s:e}case Boolean:return""===t||"true"===t||"false"!==t&&"0"!==t&&null!=t;case Object:case Array:try{return"string"==typeof t?JSON.parse(t):t}catch{return n===Array?Array.isArray(s)?s:[]:s}default:return t}}catch{return s}}function s(t){if(!t)return;const e=t.default;return"function"==typeof e?e():e}function i(t,e,n,s){if(!s||"object"!=typeof s||!s.reflect)return;let i=null;const o=s.type;if(o!==Boolean){if(o===Object||o===Array)try{i=null==n?null:JSON.stringify(n)}catch{i=null}else i=null==n?null:String(n);null==i?t.removeAttribute(e):t.setAttribute(e,i)}else n?t.setAttribute(e,""):t.removeAttribute(e)}const o=()=>({name:"timer",extend:t=>{const e=new Set,n=new Set,s=new Set,i={setTimeout:(t,n,...s)=>{let i;return i=setTimeout((...n)=>{e.delete(i),t(...n)},n,...s),e.add(i),i},setInterval:(t,e,...s)=>{const i=setInterval(t,e,...s);return n.add(i),i},raf:(t,e)=>{let n=0,i=!0,o=0;const r="number"==typeof e&&e>0?1e3/e:0,c=e=>{if(s.delete(n),i){if(r){if(e-o>=r){const n=o?e-o:r;o=e,t(e,n)}}else{const n=o?e-o:0;o=e,t(e,n)}n=requestAnimationFrame(c),s.add(n)}};return n=requestAnimationFrame(c),s.add(n),()=>{i&&(i=!1,s.delete(n),cancelAnimationFrame(n))}}};return t.onDestroy(()=>{for(const t of e)clearTimeout(t);e.clear();for(const t of n)clearInterval(t);n.clear();for(const t of s)cancelAnimationFrame(t);s.clear()}),{timer:i}}}),r=()=>({name:"mouse",extend:t=>{const e=new Map,n=(t,n)=>{if("undefined"==typeof window)return()=>{};const s=t=>{const e=t;n(e.clientX,e.clientY,e)};window.addEventListener(t,s);let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(s),()=>{window.removeEventListener(t,s),i?.delete(s)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const[t,n]of e){for(const e of n)window.removeEventListener(t,e);n.clear()}e.clear()}}),{onMouseMove:t=>n("mousemove",t),onMouseDown:t=>n("mousedown",t),onMouseUp:t=>n("mouseup",t),onMouseWheel:t=>(t=>{if("undefined"==typeof window)return()=>{};const n=e=>{const n=e;t(n.clientX,n.clientY,n.deltaY,n)};window.addEventListener("wheel",n);let s=e.get("wheel");return s||(s=new Set,e.set("wheel",s)),s.add(n),()=>{window.removeEventListener("wheel",n),s?.delete(n)}})(t)}}}),c=t=>Array.isArray(t),h=t=>null!=t&&"object"==typeof t&&!Array.isArray(t),f=t=>c(t)?t.slice():h(t)?{...t}:t,u=(t,e)=>{if(c(t)&&c(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!Object.is(t[n],e[n]))return!1;return!0}if(h(t)&&h(e)){const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n){if(!(s in e))return!1;if(!Object.is(t[s],e[s]))return!1}return!0}return!(c(t)||c(e)||h(t)||h(e))&&Object.is(t,e)},l=(t,e)=>Array.from({length:e},()=>t),a=(t,e)=>e.reduce((e,n)=>(e[n]=t,e),{}),d=({from:t,to:e,velocity:n,label:s})=>{const i={value:t,target:e,velocity:n,arrayLength:null,objectKeys:null,normalizeInput:t=>t},o=t=>{if(null==i.arrayLength){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);i.arrayLength=t,c(i.value)||(i.value=l(i.value,t)),c(i.target)||(i.target=l(i.target,t)),void 0===i.velocity||c(i.velocity)||(i.velocity=l(i.velocity,t))}},r=t=>{if(null==i.objectKeys){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);i.objectKeys=t,h(i.value)||(i.value=a(i.value,t)),h(i.target)||(i.target=a(i.target,t)),void 0===i.velocity||h(i.velocity)||(i.velocity=a(i.velocity,t))}},f=t=>{if(c(t)){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);if(null==i.arrayLength&&o(t.length),t.length!==i.arrayLength)throw new Error(`${s} value length mismatch (expected ${i.arrayLength}, got ${t.length}).`);return t.slice()}if(h(t)){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);const e=Object.keys(t);if(null==i.objectKeys&&r(e),i.objectKeys&&e.length!==i.objectKeys.length)throw new Error(`${s} value keys mismatch (expected ${i.objectKeys.length}, got ${e.length}).`);if(i.objectKeys)for(const e of i.objectKeys)if(!(e in t))throw new Error(`${s} value keys mismatch (missing key "${e}").`);return{...t}}return null!=i.arrayLength?l(t,i.arrayLength):null!=i.objectKeys?a(t,i.objectKeys):t};i.normalizeInput=f;const u=c(t)||c(e)||void 0!==n&&c(n),d=h(t)||h(e)||void 0!==n&&h(n);if(u&&d)throw new Error(`${s} value shape mismatch (array vs object).`);if(u){const s=c(t)?t.length:c(e)?e.length:n.length;o(s),i.value=f(t),i.target=f(e),void 0!==i.velocity&&(i.velocity=f(i.velocity))}else if(d){const s=h(t)?Object.keys(t):h(e)?Object.keys(e):Object.keys(n);r(s),i.value=f(t),i.target=f(e),void 0!==i.velocity&&(i.velocity=f(i.velocity))}return i};let p={x:-1,y:-1};const m={stiffness:300,damping:30,mass:1},w="0.0.8-beta.22",y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=t=>null==t||""===t?"":String(t).replace(/[&<>"']/g,t=>y[t]),v=new Set(["checked","disabled","readonly","required","selected","autofocus","multiple","hidden"]),b=/bind:([a-zA-Z_$][\w$]*)="([^"]*)"/g;exports.SCOPE_VERSION=w,exports.define=function(t,e={},o){const{props:r={},shadow:c=!1,styles:h,plugins:f}=e,u=f??[],l=()=>{};class a extends HTMLElement{constructor(){super(),this.version=w,this.t={};for(const t of Object.keys(r)){const e=r[t];this.t[t]=e&&"object"==typeof e&&("type"in e||"default"in e)?e:{type:void 0,default:e,reflect:!1}}this.props={},this.state={},this.actions={},this.refs={},this.emit=this.emit.bind(this),this.listen=this.listen.bind(this),this.setState=this.setState.bind(this),this.updateState=this.updateState.bind(this),this.setProps=this.setProps.bind(this),this.scheduleUpdate=this.scheduleUpdate.bind(this),this.update=this.update.bind(this),this.forceRender=this.forceRender.bind(this),this.destroy=this.destroy.bind(this),this.$=this.$.bind(this),this.i=null,this.o=null,this.h=!1,this.u=!1,this.l=c,this.p=c?this.attachShadow({mode:"open"}):this,this.m=null,this.S=[],this.j=[],this.M=[],this.O=[],this._=[],this.A=[],this.T=[],this.k=[],this.L=null,this.C="mount",this.F=void 0,this.I=new Map,this.R=!1,this.V=!1,this.q={},this.D=t,this.H=!1,this.N=new Set,this.U=!1,this.B=new Map,this.W=0,this.J=!1}P(t){const e=this.l?this.p.host:this;let n=t.parentElement;for(;n;){if(n===e)return!1;if(n.tagName.includes("-"))return!0;n=n.parentElement}return!1}static get observedAttributes(){return Object.keys(r)}attributeChangedCallback(t,e,s){if(e===s)return;const i=this.t[t],o=this.q[t],r=n(s,i);if(this.props[t]=r,this.R&&o!==r)for(const e of this.k)try{e(t,o,r)}catch(t){l(String(t?.message||t))}this.q[t]=r,this.N.has(t)?this.N.delete(t):this.i&&this.isConnected?this.U?this.H=!0:(this.C="props",this.F=[t],this.update(!0)):this.H=!0}connectedCallback(){for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=n(this.getAttribute(t),this.t[t]);this.props[t]=e,this.q[t]=e}c||this.m||(this.m=this.K());let t=null;try{if(o){const e={props:this.props,state:this.state,actions:this.actions,refs:this.refs,emit:this.emit,listen:this.listen,updateState:this.updateState.bind(this),$:this.$,host:this,onMount:t=>this.M.push(t),onDestroy:t=>this.O.push(t),onUpdate:t=>this._.push(t),onBeforeUpdate:t=>this.A.push(t),onFirstUpdate:t=>this.T.push(t),onPropsChanged:t=>this.k.push(t),shouldRender:t=>{this.L=t},link:(t,e)=>{const n=e||t;this.state[n]=this.props[t],this.k.push((e,s,i)=>{e===t&&(Object.is(this.state[n],i)||(this.state[n]=i))});const s={fn:()=>{const e=this.state[n];if(Object.is(this.props[t],e))return;this.props[t]=e,this.q[t]=e;const s=this.t[t],o=s?{...s,reflect:!0}:s,r=this.getAttribute(t);this.N.add(t),i(this,t,e,o),r===this.getAttribute(t)&&this.N.delete(t)},deps:()=>[this.state[n]]};this.S.push(s)},computed:(t,e)=>{let n;if(void 0!==e)try{const t="function"==typeof e?e():e;Array.isArray(t)&&(n=t)}catch(t){String(t?.message||t)}const s={getter:t,deps:e,value:void 0!==e?t(n):t()};this.j.push(s);const i=()=>s.value;return i.Z=s,this.G(i),i},effect:(t,e)=>{const n={fn:t,deps:e};return this.S.push(n),()=>this.X(n)},delegate:(t,e,n)=>(this.Y(t,e,n),()=>this.tt(t,e,n)),escapeHtml:g};for(const t of u)if(t)try{const n=t.extend(e,this);n&&"object"==typeof n&&Object.assign(e,n)}catch(t){l(String(t?.message||t))}t=o(e)}}catch(t){throw String(t?.message||t),t}this.i="function"!=typeof t?()=>"":t,this.U=!0,this.C="mount",this.F=void 0,this.update(!0),this.U=!1,this.H&&(this.H=!1,this.C="props",this.F=void 0,this.update(!0))}disconnectedCallback(){this.destroy()}remove(){super.remove()}$(t){const e=this.p.querySelectorAll(t);return 0===e.length?null:1===e.length?e[0]:Array.from(e)}destroy(){for(const t of this.O)try{t()}catch(t){l(String(t?.message||t))}for(const t of this.S)if(t.cleanup){try{t.cleanup()}catch(t){l(String(t?.message||t))}t.cleanup=void 0}for(const[,t]of this.I)try{this.p.removeEventListener(t.eventType,t.listener)}catch{}this.I.clear(),this.R=!1}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}listen(t,e,n,s){const i=n;t.addEventListener(e,i,s);const o=()=>{try{t.removeEventListener(e,i,s)}catch{}};return this.O.push(o),o}setState(t){const e=[],n=t,s=this.state;for(const t in n){if(!Object.prototype.hasOwnProperty.call(n,t))continue;const i=n[t];Object.is(s[t],i)||(s[t]=i,e.push(t))}if(0!==e.length)if(this.U||!this.R)this.C="state",this.F=e,this.update(!0);else{if(!this.i||!this.isConnected)return;if(this.h)return;this.h=!0;const t=[...e];requestAnimationFrame(()=>{this.h=!1,this.i&&this.isConnected&&(this.C="state",this.F=t,this.update(!0))})}}updateState(t){Object.assign(this.state,t),this.i&&this.isConnected&&this.et()}setProps(t){const e=Object.keys(t);if(0===e.length)return;const n=[],s={};for(const o of e){const e=t[o],r=this.q[o];this.props[o]=e,this.R&&r!==e&&(n.push(o),s[o]=r);const c=this.t[o];c&&c.reflect&&i(this,o,e,c),this.R&&r===e||(this.q[o]=e)}if(this.R&&n.length>0)for(const e of n){const n=s[e],i=t[e];for(const t of this.k)try{t(e,n,i)}catch(t){l(String(t?.message||t))}}this.i&&this.isConnected?(this.C="props",this.F=n,this.update(!0)):this.H=!0}scheduleUpdate(){this.i&&this.isConnected&&this.et()}et(){this.u||this.h||(this.u=!0,("function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t))(()=>{this.u=!1,this.i&&this.isConnected&&(this.h||this.update(!1))}))}update(t){if(this.i){if(t&&this.R)for(const t of this.A)try{t()}catch(t){l(String(t?.message||t))}if(t){const t={reason:this.C,changedKeys:this.F};if(null===this.L||this.L(t)){this.nt();let t="";try{t=this.i()}catch(e){String(e?.message||e),t=""}if("string"!=typeof t&&(t=null==t?"":String(t)),t=((t,e,n)=>{const s=Object.prototype.hasOwnProperty;return t.replace(b,(t,i,o)=>{if("text"===i||"html"===i)return t;const r=o.trim();if(!r)return t;const c=s.call(e,r),h=s.call(n,r);if(!c&&!h)return t;const f=c?e[r]:n[r];return v.has(i)?f?`${i}="" ${t}`:t:null==f?t:`${i}="${g(String(f))}" ${t}`})})(t,this.state,this.props),!this.l){const e=`data-scope-owner="${this.D}"`;t=t.replace(/<slot(?![^>]*data-scope-owner)(\s|>)/g,`<slot ${e}$1`)}this.J=!1;const e=null!==this.o&&Object.is(this.o,t);let n=!1;e&&this.R||(this.p.innerHTML=t,this.o=t,n=!0),this.U?("function"==typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,0))(()=>{if(this.i&&this.isConnected){if(n&&!c&&this.projectSlots(),n&&this.st(),!this.R){this.R=!0;for(const t of this.M)try{t()}catch(t){l(String(t?.message||t))}for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=this.t[t],n=this.props[t],i=s(e);if(n!==i)for(const e of this.k)try{e(t,i,n)}catch(t){l(String(t?.message||t))}}}this.it(),this.ot()}}):(n&&!c&&this.projectSlots(),n&&this.st(),this.it(),this.ot())}else this.it(),this.R&&this.ot()}else this.J&&this.nt(),this.it(),this.R&&this.ot()}}forceRender(){this.o=null,this.i&&this.isConnected?this.U?this.H=!0:(this.C="force",this.F=void 0,this.update(!0)):this.H=!0}ot(){if(!this.V){this.V=!0;for(const t of this.T)try{t()}catch(t){l(String(t?.message||t))}}for(const t of this._)try{t()}catch(t){l(String(t?.message||t))}this.rt()}rt(){const t=(this.l?this.p:this).querySelectorAll("*"),e=Object.prototype.hasOwnProperty,n=this.state,s=this.props;this.actions;for(let i=0;i<t.length;i++){const o=t[i];if(this.P(o))continue;if(0===o.attributes.length)continue;const r=o.attributes;for(let t=r.length-1;t>=0;t--){const i=r[t];if(!i.name.startsWith("bind:"))continue;const c=i.name.slice(5),h=i.value,f=h?h.trim():"";let u,l=!1;if(f){const t=this.B.get(f);if(t){t.Z&&(this.J=!0);try{u=t()}catch{}l=!0}}if(!l){const t=f||c,i=e.call(n,t),o=!i&&e.call(s,t);i?u=n[t]:o&&(u=s[t])}if("text"===c){const t=null==u?"":String(u);o.textContent!==t&&(o.textContent=t)}else if("html"===c){const t=null==u?"":String(u);o.innerHTML!==t&&(o.innerHTML=t)}else if(c in o){if(!Object.is(o[c],u))try{o[c]=u}catch{}if("value"===c)try{null==u?o.removeAttribute("value"):o.setAttribute("value",String(u))}catch{}}else if(null!=u)try{o.setAttribute(c,String(u))}catch{}const a=`__scopeBind_${c}`,d=o[a];if(d){const t=d.ct;t&&o.removeEventListener(t,d),delete o[a]}}}}ht(t,e){if(!t||!e||t.length!==e.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!0;return!1}nt(){for(const t of this.j){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){try{t.value=void 0!==t.deps?t.getter(e):t.getter()}catch(t){l(String(t?.message||t))}e&&(t.prevDeps=e.slice())}}}it(){for(const t of this.S){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){if(t.cleanup){try{t.cleanup()}catch{}t.cleanup=void 0}try{const n=void 0!==t.deps?t.fn(e):t.fn();"function"==typeof n&&(t.cleanup=n)}catch{}e&&(t.prevDeps=e.slice())}}}X(t){const e=this.S.indexOf(t);if(-1!==e){if(t.cleanup)try{t.cleanup()}catch{}this.S.splice(e,1)}}G(t){const e=t.ft;if(e&&"string"==typeof e)return this.B.set(e,t),e;const n=`__scope_bind_${++this.W}__`;this.B.set(n,t);try{t.ft=n,t.toString=()=>n}catch{}return n}st(){const t=(this.l?this.p:this).querySelectorAll("*"),e=this.refs;for(const t in e)e.hasOwnProperty(t)&&delete e[t];for(let n=0;n<t.length;n++){const s=t[n];if(this.P(s))continue;const i=s.getAttribute("ref");if(i&&(e[i]?Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]:e[i]=s),s.attributes.length>0){const t=s.attributes;for(let e=t.length-1;e>=0;e--){const n=t[e];if(!n.name.startsWith("on:"))continue;const i=n.name.slice(3),o=n.value,r=`__tinyHandler_${i}`,c=s[r];c&&s.removeEventListener(i,c),s.removeAttribute(n.name);const h=this.actions[o];if(h&&"function"==typeof h){const t=t=>{h.call(this.actions,t)};s[r]=t,s.addEventListener(i,t)}}}}}K(){const t=new Map,e=this.childNodes,n=[];for(let t=0;t<e.length;t++)n.push(e[t]);for(let e=0;e<n.length;e++){const s=n[e];let i="";1===s.nodeType&&s.getAttribute&&(i=s.getAttribute("slot")||""),t.has(i)||t.set(i,[]),t.get(i).push(s)}for(let t=0;t<n.length;t++){const e=n[t];e.parentNode&&e.parentNode.removeChild(e)}return t}projectSlots(){const t=this.m||new Map,e=(this.l?this.p:this).querySelectorAll(`slot[data-scope-owner="${this.D}"]`);if(0!==e.length)for(let n=0;n<e.length;n++){const s=e[n],i=s.getAttribute("name")||"",o=t.get(i)||[];if(o.length){const t=document.createDocumentFragment();for(let e=0;e<o.length;e++){const n=o[e];let s;if(1===n.nodeType&&n.tagName.includes("-")&&n.m instanceof Map){const t=n,e=document.createElement(t.tagName.toLowerCase());for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n];e.setAttribute(s.name,s.value)}for(const n of t.m.values())for(let t=0;t<n.length;t++)e.appendChild(n[t].cloneNode(!0));s=e}else s=n.cloneNode(!0);t.appendChild(s)}s.replaceWith(t)}else{const t=s.childNodes,e=[];for(let n=0;n<t.length;n++)e.push(t[n]);if(e.length>0){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++)t.appendChild(e[n]);s.replaceWith(t)}}}}Y(t,e,n){const s=`${t}::${e}`;let i=this.I.get(s);if(!i){const n=t=>{const n=t.target&&t.target.closest?t.target.closest(e):null;if(n)for(const e of i.handlers)try{e(t,n)}catch{}};i={eventType:t,selector:e,listener:n,handlers:new Set},this.I.set(s,i),this.p.addEventListener(t,n)}i.handlers.add(n)}tt(t,e,n){const s=`${t}::${e}`,i=this.I.get(s);if(i&&(i.handlers.delete(n),0===i.handlers.size)){try{this.p.removeEventListener(t,i.listener)}catch{}this.I.delete(s)}}}if(!customElements.get(t)){if(h&&"undefined"!=typeof document){const e=`scope-${t}-styles`;if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=h,document.head.appendChild(t)}}try{customElements.define(t,a)}catch(t){String(t?.message||t)}}return a},exports.devicePlugin=()=>({name:"device",extend:t=>{const e=new Map;return t.onDestroy(()=>{for(const[t,n]of e)t.removeEventListener("change",n);e.clear()}),{onMediaQuery:(t,n,s={})=>{if("undefined"==typeof window||"undefined"==typeof matchMedia)return()=>{};const{immediate:i=!0}=s,o=matchMedia(t),r=t=>{n(t.matches,t)};return o.addEventListener("change",r),e.set(o,r),i&&n(o.matches,null),()=>{o.removeEventListener("change",r),e.delete(o)}}}}}),exports.happy=()=>{console.info("The website is using @petit-kit/scoped v"+w,"\nhttps://github.com/petit-kit/scoped")},exports.inViewPlugin=()=>({name:"inview",extend:(t,e)=>{const n=new Set,s=(t,e,s={})=>{if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return()=>{};const{immediate:i=!0,...o}=s;let r=!i;const c=new IntersectionObserver(n=>{for(const s of n)s.target===t&&(r?r=!1:e(s.isIntersecting,s))},o);return c.observe(t),n.add(c),()=>{c.unobserve(t),c.disconnect(),n.delete(c)}};return t.onDestroy(()=>{for(const t of n)t.disconnect();n.clear()}),{onInView:(t,n)=>s(e,t,n),observeInView:(t,e,n)=>s(t,e,n)}}}),exports.lenisPlugin=t=>({name:"lenis",extend:e=>{const n=new Set;return e.onDestroy(()=>{for(const{lenis:t,handler:e}of n)"function"==typeof t.off&&t.off("scroll",e);n.clear()}),{onLenisScroll:e=>{const s=t();if(!s)return()=>{};const i=t=>{e(t)};s.on("scroll",i);const o={lenis:s,handler:i};return n.add(o),()=>{n.has(o)&&(n.delete(o),"function"==typeof s.off&&s.off("scroll",i))}}}}}),exports.lerpPlugin=()=>({name:"lerp",extend:t=>{const{timer:e}=o().extend(t,t.host),n=new Set;return t.onDestroy(()=>{for(const t of n)t();n.clear()}),{createLerp:t=>function({from:t=0,to:e=1,lerp:n=.1,tolerance:s=.001,resumeOnTarget:i=!0}={}){function o(){return f(p)}function r(t){if(y)return o();const e=(t=>t<0?0:t>1?1:t)(n);if(0===e)return o();if(1===e)return p=f(m),l.value=p,y=!0,o();const i=t>0?1-Math.pow(1-e,60*t):0;if(c(p)&&c(m)){let t=!0;for(let e=0;e<p.length;e+=1)p[e]+=(m[e]-p[e])*i,Math.abs(m[e]-p[e])>=s&&(t=!1);if(t){for(let t=0;t<p.length;t+=1)p[t]=m[t];y=!0}return l.value=p,f(p)}if(h(p)&&h(m)){const t=l.objectKeys??Object.keys(p);let e=!0;for(const n of t)p[n]+=(m[n]-p[n])*i,Math.abs(m[n]-p[n])>=s&&(e=!1);if(e){for(const e of t)p[e]=m[e];y=!0}return l.value=p,f(p)}const r=m;return p+=(r-p)*i,l.value=p,Math.abs(r-p)<s&&(p=r,l.value=p,y=!0),p}const l=d({from:t,to:e,label:"Lerp"}),a=l.normalizeInput;let p=l.value,m=l.target,w=null,y=!1;const g=new Set;return{setTarget:function(t){const e=a(t),n=!u(e,m);if(m=e,l.target=e,p=l.value,i&&y&&n){y=!1,w=null;for(const t of g)t(m)}},setValue:function(t,e={}){const{resetTime:n=!0,setTarget:s=!1,markDone:i=!1}=e;p=a(t),l.value=p,s&&(m=f(p),l.target=m);const o=y||!u(p,m);if(n&&(w=null),i&&(y=!0),o&&!i){y=!1,w=null;for(const t of g)t(m)}},getValue:o,isDone:function(){return y},onResume:function(t){return g.add(t),()=>{g.delete(t)}},step:r,next:function(t=performance.now()){if(null==w)return w=t,o();const e=(t-w)/1e3;w=t;const n=1/30;let s=e,i=o();for(;s>0&&!y;){const t=Math.min(s,n);i=r(t),s-=t}return i}}}(t),runLerp:(t,s,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&s(t.getValue(),t);const u=()=>{f||(f=e.raf(e=>{if(h)return;const n=t.next(e);s(n,t),c&&t.isDone()&&l()},o))},l=()=>{f&&(f(),f=null)};u();const a=t.onResume(()=>{!h&&c&&(r&&s(t.getValue(),t),u())}),d=()=>{h||(h=!0,a(),l(),n.delete(d))};return n.add(d),d}}}}),exports.localStoragePlugin=(t={})=>({name:"localstorage",extend:n=>{const{prefix:s="",json:i=!0}=t,o="undefined"==typeof window?null:window.localStorage;return{storage:{get:t=>{if(o)try{const n=o.getItem(e(s,t));if(null===n)return;return i?JSON.parse(n):n}catch{return}},set:(t,n)=>{if(o)try{const r=i?JSON.stringify(n):String(n);o.setItem(e(s,t),r)}catch{}},remove:t=>{o&&o.removeItem(e(s,t))},clear:()=>{if(!o)return;if(!s)return;const t=[];for(let e=0;e<o.length;e++){const n=o.key(e);null!=n&&n.startsWith(s+":")&&t.push(n)}for(const e of t)o.removeItem(e)}}}}}),exports.morphPlugin=(t,e={})=>({name:"morph",extend:(n,s)=>{const{ignoreActiveValue:i=!0,callbacks:o}=e,r=t(),c=s,h=c.p,f=c.l?ShadowRoot.prototype:HTMLElement.prototype,u=Object.getOwnPropertyDescriptor(f,"innerHTML"),l=t=>{r.morph(h,t,{morphStyle:"innerHTML",ignoreActiveValue:i,callbacks:o})};let a=!0;return Object.defineProperty(h,"innerHTML",{set(t){a?(u.set.call(this,t),a=!1):l(t)},get(){return u.get.call(this)},configurable:!0}),n.onDestroy(()=>{delete h.innerHTML}),{morph:l}}}),exports.mousePlugin=r,exports.pointerPlugin=()=>({name:"pointer",extend:e=>{const{onMouseMove:n}=r().extend(e,e.host),{timer:s}=o().extend(e,e.host);p.x=window.innerWidth/2,p.y=window.innerHeight/2;const i={x:t({from:p.x,to:p.x,...m}),y:t({from:p.y,to:p.y,...m})};return n((t,e)=>{i.x.setTarget(t),i.y.setTarget(e)}),{onPointerMove:t=>{let e=p.x,n=p.y;s.raf(s=>{const o=i.x.next(s),r=i.y.next(s);var c,h;e===o&&n===r||(t({x:o,y:r,v:(c={x:o,y:r},h={x:e,y:n},{x:c.x-h.x,y:c.y-h.y,magnitude:Math.sqrt((c.x-h.x)*(c.x-h.x)+(c.y-h.y)*(c.y-h.y))}).magnitude}),e=o,n=r)})},onMouseMove:n}}}),exports.springPlugin=()=>({name:"spring",extend:e=>{const{timer:n}=o().extend(e,e.host),s=new Set;return e.onDestroy(()=>{for(const t of s)t();s.clear()}),{createSpring:e=>t(e),runSpring:(t,e,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&e(t.getValue(),t);const u=()=>{f||(f=n.raf(n=>{if(h)return;const s=t.next(n);e(s,t),c&&t.isDone()&&l()},o))},l=()=>{f&&(f(),f=null)};u();const a=t.onResume(()=>{!h&&c&&(r&&e(t.getValue(),t),u())}),d=()=>{h||(h=!0,a(),l(),s.delete(d))};return s.add(d),d}}}}),exports.timerPlugin=o,exports.windowPlugin=()=>({name:"window",extend:t=>{const e=new Set,n=new Set,s=new Set,i=(t,n={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=n,i=e=>{t(window.innerWidth,window.innerHeight,e)};return window.addEventListener("resize",i),e.add(i),s&&i(new UIEvent("resize")),()=>{window.removeEventListener("resize",i),e.delete(i)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const t of e)window.removeEventListener("resize",t);e.clear();for(const t of s)t.disconnect();s.clear();for(const t of n)window.removeEventListener("scroll",t);n.clear()}}),{onViewportResize:i,onWindowResize:(t,e={})=>{if("undefined"==typeof window)return()=>{};if("undefined"==typeof ResizeObserver)return i((e,n,s)=>t(e,n,s),e);const{immediate:n=!0}=e,o=document.documentElement,r=new ResizeObserver(e=>{const n=e[0];if(!n)return;const{width:s,height:i}=n.contentRect;t(s,i,n)});if(r.observe(o),s.add(r),n){const e=o.getBoundingClientRect();t(e.width,e.height,new UIEvent("resize"))}return()=>{r.disconnect(),s.delete(r)}},onWindowScroll:(t,e={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=e,i=e=>{t(window.scrollX,window.scrollY,e)};return window.addEventListener("scroll",i,{passive:!0}),n.add(i),s&&i(new Event("scroll")),()=>{window.removeEventListener("scroll",i),n.delete(i)}}}}});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAG1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH;;;;GAIG;AACH,QAAA,MAAM,aAAa,QAAU,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,KAAK,YAKjB,CAAC;AAmDF;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACrC;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI;IAClE,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,CACN,OAAO,EAAE,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACjD,IAAI,EAAE,aAAa,KAChB,GAAG,CAAC;CACV,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB,CAC/B,OAAO,SAAS,SAAS,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,eAAe,CAAC,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AmsDpB;AAED,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- function t({from:t=0,to:e=1,mass:n=1,stiffness:s=120,damping:i=14,velocity:o=0,tolerance:r=.001,resumeOnTarget:c=!0}={}){function h(){return m(v)}function f(t){if(M)return h();if(a(v)&&a(S)&&a(b)){let e=!0;for(let o=0;o<v.length;o+=1){const c=v[o]-S[o],h=(-s*c-i*b[o])/n;b[o]+=h*t,v[o]+=b[o]*t;const f=v[o]-S[o];(Math.abs(b[o])>=r||Math.abs(f)>=r)&&(e=!1)}if(e){for(let t=0;t<v.length;t+=1)v[t]=S[t],b[t]=0;M=!0}return l.value=v,l.velocity=b,m(v)}if(d(v)&&d(S)&&d(b)){const e=l.objectKeys??Object.keys(v);let o=!0;for(const c of e){const e=v[c]-S[c],h=(-s*e-i*b[c])/n;b[c]+=h*t,v[c]+=b[c]*t;const f=v[c]-S[c];(Math.abs(b[c])>=r||Math.abs(f)>=r)&&(o=!1)}if(o){for(const t of e)v[t]=S[t],b[t]=0;M=!0}return l.value=v,l.velocity=b,m(v)}const e=S;let o=b;o+=(-s*(v-e)-i*o)/n*t,v+=o*t,b=o,l.value=v,l.velocity=b;const c=v-e;return Math.abs(o)<r&&Math.abs(c)<r&&(v=e,b=0,l.value=v,l.velocity=b,M=!0),v}const l=g({from:t,to:e,velocity:o,label:"Spring"}),u=l.normalizeInput;let v=l.value,b=l.velocity??o,S=l.target,j=null,M=!1;const O=new Set;return{setTarget:function(t){const e=u(t),n=!p(e,S);if(S=e,l.target=e,v=l.value,c&&M&&n){M=!1,j=null;for(const t of O)t(S)}},setValue:function(t,e={}){const{resetVelocity:n=!0,resetTime:s=!0,setTarget:i=!1,markDone:o=!1}=e;v=u(t),l.value=v,i&&(S=m(v),l.target=S);const r=M||!p(v,S);if(n&&(b=null!=l.arrayLength?w(0,l.arrayLength):null!=l.objectKeys?y(0,l.objectKeys):0,l.velocity=b),s&&(j=null),o&&(M=!0),r&&!o){M=!1,j=null;for(const t of O)t(S)}},getValue:h,isDone:function(){return M},onResume:function(t){return O.add(t),()=>{O.delete(t)}},step:f,next:function(t=performance.now()){if(null==j)return j=t,h();const e=(t-j)/1e3;j=t;const n=1/30;let s=e,i=h();for(;s>0&&!M;){const t=Math.min(s,n);i=f(t),s-=t}return i}}}function e(t,e){return t?`${t}:${e}`:e}function n(t,e){if(!e||"object"!=typeof e||null==e.type)return null!=t?t:e;const{type:n,default:s}=e;if(null==t)return s;try{switch(n){case String:return String(t);case Number:{const e=Number(t);return Number.isNaN(e)?s:e}case Boolean:return""===t||"true"===t||"false"!==t&&"0"!==t&&null!=t;case Object:case Array:try{return"string"==typeof t?JSON.parse(t):t}catch{return n===Array?Array.isArray(s)?s:[]:s}default:return t}}catch{return s}}function s(t,e,n,s){if(!s||"object"!=typeof s||!s.reflect)return;let i=null;const o=s.type;if(o!==Boolean){if(o===Object||o===Array)try{i=null==n?null:JSON.stringify(n)}catch{i=null}else i=null==n?null:String(n);null==i?t.removeAttribute(e):t.setAttribute(e,i)}else n?t.setAttribute(e,""):t.removeAttribute(e)}function i(t,e={},i){const{props:o={},shadow:r=!1,styles:c,plugins:h}=e,f=h??[],l=()=>{};class u extends HTMLElement{constructor(){super(),this.version=$,this.t={};for(const t of Object.keys(o)){const e=o[t];this.t[t]=e&&"object"==typeof e&&("type"in e||"default"in e)?e:{type:void 0,default:e,reflect:!1}}this.props={},this.state={},this.actions={},this.refs={},this.emit=this.emit.bind(this),this.listen=this.listen.bind(this),this.setState=this.setState.bind(this),this.updateState=this.updateState.bind(this),this.setProps=this.setProps.bind(this),this.scheduleUpdate=this.scheduleUpdate.bind(this),this.update=this.update.bind(this),this.forceRender=this.forceRender.bind(this),this.destroy=this.destroy.bind(this),this.$=this.$.bind(this),this.i=null,this.o=null,this.h=!1,this.l=!1,this.u=r,this.m=r?this.attachShadow({mode:"open"}):this,this.p=null,this.S=[],this.j=[],this.M=[],this.O=[],this._=[],this.A=[],this.T=[],this.k=[],this.L=null,this.C="mount",this.F=void 0,this.I=new Map,this.R=!1,this.V=!1,this.q={},this.D=t,this.H=!1,this.N=new Set,this.U=!1,this.B=new Map,this.W=0,this.J=!1}P(t){const e=this.u?this.m.host:this;let n=t.parentElement;for(;n;){if(n===e)return!1;if(n.tagName.includes("-"))return!0;n=n.parentElement}return!1}static get observedAttributes(){return Object.keys(o)}attributeChangedCallback(t,e,s){if(e===s)return;const i=this.t[t],o=this.q[t],r=n(s,i);if(this.props[t]=r,this.R&&o!==r)for(const e of this.k)try{e(t,o,r)}catch(t){l(String(t?.message||t))}this.q[t]=r,this.N.has(t)?this.N.delete(t):this.i&&this.isConnected?this.U?this.H=!0:(this.C="props",this.F=[t],this.update(!0)):this.H=!0}connectedCallback(){for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=n(this.getAttribute(t),this.t[t]);this.props[t]=e,this.q[t]=e}r||this.p||(this.p=this.K());let t=null;try{if(i){const e={props:this.props,state:this.state,actions:this.actions,refs:this.refs,emit:this.emit,listen:this.listen,updateState:this.updateState.bind(this),$:this.$,host:this,onMount:t=>this.M.push(t),onDestroy:t=>this.O.push(t),onUpdate:t=>this._.push(t),onBeforeUpdate:t=>this.A.push(t),onFirstUpdate:t=>this.T.push(t),onPropsChanged:t=>this.k.push(t),shouldRender:t=>{this.L=t},link:(t,e)=>{const n=e||t;this.state[n]=this.props[t],this.k.push((e,s,i)=>{e===t&&(Object.is(this.state[n],i)||(this.state[n]=i))});const i={fn:()=>{const e=this.state[n];if(Object.is(this.props[t],e))return;this.props[t]=e,this.q[t]=e;const i=this.t[t],o=i?{...i,reflect:!0}:i,r=this.getAttribute(t);this.N.add(t),s(this,t,e,o),r===this.getAttribute(t)&&this.N.delete(t)},deps:()=>[this.state[n]]};this.S.push(i)},computed:(t,e)=>{let n;if(void 0!==e)try{const t="function"==typeof e?e():e;Array.isArray(t)&&(n=t)}catch(t){String(t?.message||t)}const s={getter:t,deps:e,value:void 0!==e?t(n):t()};this.j.push(s);const i=()=>s.value;return i.Z=s,this.G(i),i},effect:(t,e)=>{const n={fn:t,deps:e};return this.S.push(n),()=>this.X(n)},delegate:(t,e,n)=>(this.Y(t,e,n),()=>this.tt(t,e,n)),escapeHtml:A};for(const t of f)if(t)try{const n=t.extend(e,this);n&&"object"==typeof n&&Object.assign(e,n)}catch(t){l(String(t?.message||t))}t=i(e)}}catch(t){throw String(t?.message||t),t}this.i="function"!=typeof t?()=>"":t,this.U=!0,this.C="mount",this.F=void 0,this.update(!0),this.U=!1,this.H&&(this.H=!1,this.C="props",this.F=void 0,this.update(!0))}disconnectedCallback(){this.destroy()}remove(){super.remove()}$(t){const e=this.m.querySelectorAll(t);return 0===e.length?null:1===e.length?e[0]:Array.from(e)}destroy(){for(const t of this.O)try{t()}catch(t){l(String(t?.message||t))}for(const t of this.S)if(t.cleanup){try{t.cleanup()}catch(t){l(String(t?.message||t))}t.cleanup=void 0}for(const[,t]of this.I)try{this.m.removeEventListener(t.eventType,t.listener)}catch{}this.I.clear(),this.R=!1}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}listen(t,e,n,s){const i=n;t.addEventListener(e,i,s);const o=()=>{try{t.removeEventListener(e,i,s)}catch{}};return this.O.push(o),o}setState(t){const e=[],n=t,s=this.state;for(const t in n){if(!Object.prototype.hasOwnProperty.call(n,t))continue;const i=n[t];Object.is(s[t],i)||(s[t]=i,e.push(t))}if(0!==e.length)if(this.U||!this.R)this.C="state",this.F=e,this.update(!0);else{if(!this.i||!this.isConnected)return;if(this.h)return;this.h=!0;const t=[...e];requestAnimationFrame(()=>{this.h=!1,this.i&&this.isConnected&&(this.C="state",this.F=t,this.update(!0))})}}updateState(t){Object.assign(this.state,t),this.i&&this.isConnected&&this.et()}setProps(t){const e=Object.keys(t);if(0===e.length)return;const n=[];for(const i of e){const e=t[i],o=this.q[i];this.props[i]=e,this.R&&o!==e&&n.push(i);const r=this.t[i];r&&r.reflect&&s(this,i,e,r),this.R&&o===e||(this.q[i]=e)}if(this.R&&n.length>0)for(const e of n){const n=this.q[e],s=t[e];for(const t of this.k)try{t(e,n,s)}catch(t){l(String(t?.message||t))}}this.i&&this.isConnected?(this.C="props",this.F=n,this.update(!0)):this.H=!0}scheduleUpdate(){this.i&&this.isConnected&&this.et()}et(){this.l||this.h||(this.l=!0,("function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t))(()=>{this.l=!1,this.i&&this.isConnected&&(this.h||this.update(!1))}))}update(t){if(this.i){if(t&&this.R)for(const t of this.A)try{t()}catch(t){l(String(t?.message||t))}if(t){const t={reason:this.C,changedKeys:this.F};if(null===this.L||this.L(t)){this.nt();let t="";try{t=this.i()}catch(e){String(e?.message||e),t=""}if("string"!=typeof t&&(t=null==t?"":String(t)),t=((t,e)=>{const n={...this.props,...e};return t.replace(E,(t,e)=>{const s=n[e];return null==s?"":String(s)})})(t,this.state),!this.u){const e=`data-scope-owner="${this.D}"`;t=t.replace(/<slot(?![^>]*data-scope-owner)(\s|>)/g,`<slot ${e}$1`)}this.J=!1;const e=null!==this.o&&Object.is(this.o,t);let n=!1;e&&this.R||(this.m.innerHTML=t,this.o=t,n=!0),this.U?("function"==typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,0))(()=>{if(this.i&&this.isConnected){if(n&&!r&&this.projectSlots(),n&&this.st(),!this.R){this.R=!0;for(const t of this.M)try{t()}catch(t){l(String(t?.message||t))}}this.it(),this.ot()}}):(n&&!r&&this.projectSlots(),n&&this.st(),this.it(),this.ot())}else this.it(),this.R&&this.ot()}else this.J&&this.nt(),this.it(),this.R&&this.ot()}}forceRender(){this.o=null,this.i&&this.isConnected?this.U?this.H=!0:(this.C="force",this.F=void 0,this.update(!0)):this.H=!0}ot(){if(!this.V){this.V=!0;for(const t of this.T)try{t()}catch(t){l(String(t?.message||t))}}for(const t of this._)try{t()}catch(t){l(String(t?.message||t))}this.rt()}rt(){const t=(this.u?this.m:this).querySelectorAll("*"),e=Object.prototype.hasOwnProperty,n=this.state,s=this.props;this.actions;for(let i=0;i<t.length;i++){const o=t[i];if(this.P(o))continue;if(0===o.attributes.length)continue;const r=o.attributes;for(let t=r.length-1;t>=0;t--){const i=r[t];if(!i.name.startsWith(T))continue;const c=i.name.slice(5),h=i.value,f=h?h.trim():"";let l,u=!1;if(f){const t=this.B.get(f);if(t){t.Z&&(this.J=!0);try{l=t()}catch{}u=!0}}if(!u){const t=f||c,i=e.call(n,t),o=!i&&e.call(s,t);i?l=n[t]:o&&(l=s[t])}if("text"===c){const t=null==l?"":String(l);o.textContent!==t&&(o.textContent=t)}else if("html"===c){const t=null==l?"":String(l);o.innerHTML!==t&&(o.innerHTML=t)}else if(c in o){if(!Object.is(o[c],l))try{o[c]=l}catch{}if("value"===c)try{null==l?o.removeAttribute("value"):o.setAttribute("value",String(l))}catch{}}else if(null!=l)try{o.setAttribute(c,String(l))}catch{}const a=`__scopeBind_${c}`,d=o[a];if(d){const t=d.ct;t&&o.removeEventListener(t,d),delete o[a]}}}}ht(t,e){if(!t||!e||t.length!==e.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!0;return!1}nt(){for(const t of this.j){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){try{t.value=void 0!==t.deps?t.getter(e):t.getter()}catch(t){l(String(t?.message||t))}e&&(t.prevDeps=e.slice())}}}it(){for(const t of this.S){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){if(t.cleanup){try{t.cleanup()}catch{}t.cleanup=void 0}try{const n=void 0!==t.deps?t.fn(e):t.fn();"function"==typeof n&&(t.cleanup=n)}catch{}e&&(t.prevDeps=e.slice())}}}X(t){const e=this.S.indexOf(t);if(-1!==e){if(t.cleanup)try{t.cleanup()}catch{}this.S.splice(e,1)}}G(t){const e=t.ft;if(e&&"string"==typeof e)return this.B.set(e,t),e;const n=`__scope_bind_${++this.W}__`;this.B.set(n,t);try{t.ft=n,t.toString=()=>n}catch{}return n}st(){const t=(this.u?this.m:this).querySelectorAll("*"),e=this.refs;for(const t in e)e.hasOwnProperty(t)&&delete e[t];for(let n=0;n<t.length;n++){const s=t[n];if(this.P(s))continue;const i=s.getAttribute("ref");if(i&&(e[i]?Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]:e[i]=s),s.attributes.length>0){const t=s.attributes;for(let e=t.length-1;e>=0;e--){const n=t[e];if(!n.name.startsWith("on:"))continue;const i=n.name.slice(3),o=n.value,r=`__tinyHandler_${i}`,c=s[r];c&&s.removeEventListener(i,c),s.removeAttribute(n.name);const h=this.actions[o];if(h&&"function"==typeof h){const t=t=>{h.call(this.actions,t)};s[r]=t,s.addEventListener(i,t)}}}}}K(){const t=new Map,e=this.childNodes,n=[];for(let t=0;t<e.length;t++)n.push(e[t]);for(let e=0;e<n.length;e++){const s=n[e];let i="";1===s.nodeType&&s.getAttribute&&(i=s.getAttribute("slot")||""),t.has(i)||t.set(i,[]),t.get(i).push(s)}for(let t=0;t<n.length;t++){const e=n[t];e.parentNode&&e.parentNode.removeChild(e)}return t}projectSlots(){const t=this.p||new Map,e=(this.u?this.m:this).querySelectorAll(`slot[data-scope-owner="${this.D}"]`);if(0!==e.length)for(let n=0;n<e.length;n++){const s=e[n],i=s.getAttribute("name")||"",o=t.get(i)||[];if(o.length){const t=document.createDocumentFragment();for(let e=0;e<o.length;e++){const n=o[e];let s;if(1===n.nodeType&&n.tagName.includes("-")&&n.p instanceof Map){const t=n,e=document.createElement(t.tagName.toLowerCase());for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n];e.setAttribute(s.name,s.value)}for(const n of t.p.values())for(let t=0;t<n.length;t++)e.appendChild(n[t].cloneNode(!0));s=e}else s=n.cloneNode(!0);t.appendChild(s)}s.replaceWith(t)}else{const t=s.childNodes,e=[];for(let n=0;n<t.length;n++)e.push(t[n]);if(e.length>0){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++)t.appendChild(e[n]);s.replaceWith(t)}}}}Y(t,e,n){const s=`${t}::${e}`;let i=this.I.get(s);if(!i){const n=t=>{const n=t.target&&t.target.closest?t.target.closest(e):null;if(n)for(const e of i.handlers)try{e(t,n)}catch{}};i={eventType:t,selector:e,listener:n,handlers:new Set},this.I.set(s,i),this.m.addEventListener(t,n)}i.handlers.add(n)}tt(t,e,n){const s=`${t}::${e}`,i=this.I.get(s);if(i&&(i.handlers.delete(n),0===i.handlers.size)){try{this.m.removeEventListener(t,i.listener)}catch{}this.I.delete(s)}}}if(!customElements.get(t)){if(c&&"undefined"!=typeof document){const e=`scope-${t}-styles`;if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=c,document.head.appendChild(t)}}try{customElements.define(t,u)}catch(t){String(t?.message||t)}}return u}const o=()=>({name:"device",extend:t=>{const e=new Map;return t.onDestroy(()=>{for(const[t,n]of e)t.removeEventListener("change",n);e.clear()}),{onMediaQuery:(t,n,s={})=>{if("undefined"==typeof window||"undefined"==typeof matchMedia)return()=>{};const{immediate:i=!0}=s,o=matchMedia(t),r=t=>{n(t.matches,t)};return o.addEventListener("change",r),e.set(o,r),i&&n(o.matches,null),()=>{o.removeEventListener("change",r),e.delete(o)}}}}}),r=(t,e={})=>({name:"morph",extend:(n,s)=>{const{ignoreActiveValue:i=!0,callbacks:o}=e,r=t(),c=s,h=c.m,f=c.u?ShadowRoot.prototype:HTMLElement.prototype,l=Object.getOwnPropertyDescriptor(f,"innerHTML"),u=t=>{r.morph(h,t,{morphStyle:"innerHTML",ignoreActiveValue:i,callbacks:o})};let a=!0;return Object.defineProperty(h,"innerHTML",{set(t){a?(l.set.call(this,t),a=!1):u(t)},get(){return l.get.call(this)},configurable:!0}),n.onDestroy(()=>{delete h.innerHTML}),{morph:u}}}),c=()=>({name:"window",extend:t=>{const e=new Set,n=new Set,s=new Set,i=(t,n={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=n,i=e=>{t(window.innerWidth,window.innerHeight,e)};return window.addEventListener("resize",i),e.add(i),s&&i(new UIEvent("resize")),()=>{window.removeEventListener("resize",i),e.delete(i)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const t of e)window.removeEventListener("resize",t);e.clear();for(const t of s)t.disconnect();s.clear();for(const t of n)window.removeEventListener("scroll",t);n.clear()}}),{onViewportResize:i,onWindowResize:(t,e={})=>{if("undefined"==typeof window)return()=>{};if("undefined"==typeof ResizeObserver)return i((e,n,s)=>t(e,n,s),e);const{immediate:n=!0}=e,o=document.documentElement,r=new ResizeObserver(e=>{const n=e[0];if(!n)return;const{width:s,height:i}=n.contentRect;t(s,i,n)});if(r.observe(o),s.add(r),n){const e=o.getBoundingClientRect();t(e.width,e.height,new UIEvent("resize"))}return()=>{r.disconnect(),s.delete(r)}},onWindowScroll:(t,e={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=e,i=e=>{t(window.scrollX,window.scrollY,e)};return window.addEventListener("scroll",i,{passive:!0}),n.add(i),s&&i(new Event("scroll")),()=>{window.removeEventListener("scroll",i),n.delete(i)}}}}}),h=()=>({name:"inview",extend:(t,e)=>{const n=new Set,s=(t,e,s={})=>{if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return()=>{};const{immediate:i=!0,...o}=s;let r=!i;const c=new IntersectionObserver(n=>{for(const s of n)s.target===t&&(r?r=!1:e(s.isIntersecting,s))},o);return c.observe(t),n.add(c),()=>{c.unobserve(t),c.disconnect(),n.delete(c)}};return t.onDestroy(()=>{for(const t of n)t.disconnect();n.clear()}),{onInView:(t,n)=>s(e,t,n),observeInView:(t,e,n)=>s(t,e,n)}}}),f=t=>({name:"lenis",extend:e=>{const n=new Set;return e.onDestroy(()=>{for(const{lenis:t,handler:e}of n)"function"==typeof t.off&&t.off("scroll",e);n.clear()}),{onLenisScroll:e=>{const s=t();if(!s)return()=>{};const i=t=>{e(t)};s.on("scroll",i);const o={lenis:s,handler:i};return n.add(o),()=>{n.has(o)&&(n.delete(o),"function"==typeof s.off&&s.off("scroll",i))}}}}}),l=()=>({name:"timer",extend:t=>{const e=new Set,n=new Set,s=new Set,i={setTimeout:(t,n,...s)=>{let i;return i=setTimeout((...n)=>{e.delete(i),t(...n)},n,...s),e.add(i),i},setInterval:(t,e,...s)=>{const i=setInterval(t,e,...s);return n.add(i),i},raf:(t,e)=>{let n=0,i=!0,o=0;const r="number"==typeof e&&e>0?1e3/e:0,c=e=>{if(s.delete(n),i){if(r){if(e-o>=r){const n=o?e-o:r;o=e,t(e,n)}}else{const n=o?e-o:0;o=e,t(e,n)}n=requestAnimationFrame(c),s.add(n)}};return n=requestAnimationFrame(c),s.add(n),()=>{i&&(i=!1,s.delete(n),cancelAnimationFrame(n))}}};return t.onDestroy(()=>{for(const t of e)clearTimeout(t);e.clear();for(const t of n)clearInterval(t);n.clear();for(const t of s)cancelAnimationFrame(t);s.clear()}),{timer:i}}}),u=()=>({name:"mouse",extend:t=>{const e=new Map,n=(t,n)=>{if("undefined"==typeof window)return()=>{};const s=t=>{const e=t;n(e.clientX,e.clientY,e)};window.addEventListener(t,s);let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(s),()=>{window.removeEventListener(t,s),i?.delete(s)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const[t,n]of e){for(const e of n)window.removeEventListener(t,e);n.clear()}e.clear()}}),{onMouseMove:t=>n("mousemove",t),onMouseDown:t=>n("mousedown",t),onMouseUp:t=>n("mouseup",t),onMouseWheel:t=>(t=>{if("undefined"==typeof window)return()=>{};const n=e=>{const n=e;t(n.clientX,n.clientY,n.deltaY,n)};window.addEventListener("wheel",n);let s=e.get("wheel");return s||(s=new Set,e.set("wheel",s)),s.add(n),()=>{window.removeEventListener("wheel",n),s?.delete(n)}})(t)}}}),a=t=>Array.isArray(t),d=t=>null!=t&&"object"==typeof t&&!Array.isArray(t),m=t=>a(t)?t.slice():d(t)?{...t}:t,p=(t,e)=>{if(a(t)&&a(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!Object.is(t[n],e[n]))return!1;return!0}if(d(t)&&d(e)){const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n){if(!(s in e))return!1;if(!Object.is(t[s],e[s]))return!1}return!0}return!(a(t)||a(e)||d(t)||d(e))&&Object.is(t,e)},w=(t,e)=>Array.from({length:e},()=>t),y=(t,e)=>e.reduce((e,n)=>(e[n]=t,e),{}),g=({from:t,to:e,velocity:n,label:s})=>{const i={value:t,target:e,velocity:n,arrayLength:null,objectKeys:null,normalizeInput:t=>t},o=t=>{if(null==i.arrayLength){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);i.arrayLength=t,a(i.value)||(i.value=w(i.value,t)),a(i.target)||(i.target=w(i.target,t)),void 0===i.velocity||a(i.velocity)||(i.velocity=w(i.velocity,t))}},r=t=>{if(null==i.objectKeys){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);i.objectKeys=t,d(i.value)||(i.value=y(i.value,t)),d(i.target)||(i.target=y(i.target,t)),void 0===i.velocity||d(i.velocity)||(i.velocity=y(i.velocity,t))}},c=t=>{if(a(t)){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);if(null==i.arrayLength&&o(t.length),t.length!==i.arrayLength)throw new Error(`${s} value length mismatch (expected ${i.arrayLength}, got ${t.length}).`);return t.slice()}if(d(t)){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);const e=Object.keys(t);if(null==i.objectKeys&&r(e),i.objectKeys&&e.length!==i.objectKeys.length)throw new Error(`${s} value keys mismatch (expected ${i.objectKeys.length}, got ${e.length}).`);if(i.objectKeys)for(const e of i.objectKeys)if(!(e in t))throw new Error(`${s} value keys mismatch (missing key "${e}").`);return{...t}}return null!=i.arrayLength?w(t,i.arrayLength):null!=i.objectKeys?y(t,i.objectKeys):t};i.normalizeInput=c;const h=a(t)||a(e)||void 0!==n&&a(n),f=d(t)||d(e)||void 0!==n&&d(n);if(h&&f)throw new Error(`${s} value shape mismatch (array vs object).`);if(h){const s=a(t)?t.length:a(e)?e.length:n.length;o(s),i.value=c(t),i.target=c(e),void 0!==i.velocity&&(i.velocity=c(i.velocity))}else if(f){const s=d(t)?Object.keys(t):d(e)?Object.keys(e):Object.keys(n);r(s),i.value=c(t),i.target=c(e),void 0!==i.velocity&&(i.velocity=c(i.velocity))}return i};let v={x:-1,y:-1};const b={stiffness:300,damping:30,mass:1},S=()=>({name:"pointer",extend:e=>{const{onMouseMove:n}=u().extend(e,e.host),{timer:s}=l().extend(e,e.host);v.x=window.innerWidth/2,v.y=window.innerHeight/2;const i={x:t({from:v.x,to:v.x,...b}),y:t({from:v.y,to:v.y,...b})};return n((t,e)=>{i.x.setTarget(t),i.y.setTarget(e)}),{onPointerMove:t=>{let e=v.x,n=v.y;s.raf(s=>{const o=i.x.next(s),r=i.y.next(s);var c,h;e===o&&n===r||(t({x:o,y:r,v:(c={x:o,y:r},h={x:e,y:n},{x:c.x-h.x,y:c.y-h.y,magnitude:Math.sqrt((c.x-h.x)*(c.x-h.x)+(c.y-h.y)*(c.y-h.y))}).magnitude}),e=o,n=r)})},onMouseMove:n}}}),j=()=>({name:"lerp",extend:t=>{const{timer:e}=l().extend(t,t.host),n=new Set;return t.onDestroy(()=>{for(const t of n)t();n.clear()}),{createLerp:t=>function({from:t=0,to:e=1,lerp:n=.1,tolerance:s=.001,resumeOnTarget:i=!0}={}){function o(){return m(f)}function r(t){if(w)return o();const e=(t=>t<0?0:t>1?1:t)(n);if(0===e)return o();if(1===e)return f=m(l),c.value=f,w=!0,o();const i=t>0?1-Math.pow(1-e,60*t):0;if(a(f)&&a(l)){let t=!0;for(let e=0;e<f.length;e+=1)f[e]+=(l[e]-f[e])*i,Math.abs(l[e]-f[e])>=s&&(t=!1);if(t){for(let t=0;t<f.length;t+=1)f[t]=l[t];w=!0}return c.value=f,m(f)}if(d(f)&&d(l)){const t=c.objectKeys??Object.keys(f);let e=!0;for(const n of t)f[n]+=(l[n]-f[n])*i,Math.abs(l[n]-f[n])>=s&&(e=!1);if(e){for(const e of t)f[e]=l[e];w=!0}return c.value=f,m(f)}const r=l;return f+=(r-f)*i,c.value=f,Math.abs(r-f)<s&&(f=r,c.value=f,w=!0),f}const c=g({from:t,to:e,label:"Lerp"}),h=c.normalizeInput;let f=c.value,l=c.target,u=null,w=!1;const y=new Set;return{setTarget:function(t){const e=h(t),n=!p(e,l);if(l=e,c.target=e,f=c.value,i&&w&&n){w=!1,u=null;for(const t of y)t(l)}},setValue:function(t,e={}){const{resetTime:n=!0,setTarget:s=!1,markDone:i=!1}=e;f=h(t),c.value=f,s&&(l=m(f),c.target=l);const o=w||!p(f,l);if(n&&(u=null),i&&(w=!0),o&&!i){w=!1,u=null;for(const t of y)t(l)}},getValue:o,isDone:function(){return w},onResume:function(t){return y.add(t),()=>{y.delete(t)}},step:r,next:function(t=performance.now()){if(null==u)return u=t,o();const e=(t-u)/1e3;u=t;const n=1/30;let s=e,i=o();for(;s>0&&!w;){const t=Math.min(s,n);i=r(t),s-=t}return i}}}(t),runLerp:(t,s,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&s(t.getValue(),t);const l=()=>{f||(f=e.raf(e=>{if(h)return;const n=t.next(e);s(n,t),c&&t.isDone()&&u()},o))},u=()=>{f&&(f(),f=null)};l();const a=t.onResume(()=>{!h&&c&&(r&&s(t.getValue(),t),l())}),d=()=>{h||(h=!0,a(),u(),n.delete(d))};return n.add(d),d}}}}),M=()=>({name:"spring",extend:e=>{const{timer:n}=l().extend(e,e.host),s=new Set;return e.onDestroy(()=>{for(const t of s)t();s.clear()}),{createSpring:e=>t(e),runSpring:(t,e,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&e(t.getValue(),t);const l=()=>{f||(f=n.raf(n=>{if(h)return;const s=t.next(n);e(s,t),c&&t.isDone()&&u()},o))},u=()=>{f&&(f(),f=null)};l();const a=t.onResume(()=>{!h&&c&&(r&&e(t.getValue(),t),l())}),d=()=>{h||(h=!0,a(),u(),s.delete(d))};return s.add(d),d}}}}),O=(t={})=>({name:"localstorage",extend:n=>{const{prefix:s="",json:i=!0}=t,o="undefined"==typeof window?null:window.localStorage;return{storage:{get:t=>{if(o)try{const n=o.getItem(e(s,t));if(null===n)return;return i?JSON.parse(n):n}catch{return}},set:(t,n)=>{if(o)try{const r=i?JSON.stringify(n):String(n);o.setItem(e(s,t),r)}catch{}},remove:t=>{o&&o.removeItem(e(s,t))},clear:()=>{if(!o)return;if(!s)return;const t=[];for(let e=0;e<o.length;e++){const n=o.key(e);null!=n&&n.startsWith(s+":")&&t.push(n)}for(const e of t)o.removeItem(e)}}}}}),$="0.0.8-beta.2",_=()=>{console.info("The website is using @petit-kit/scoped v"+$,"\nhttps://github.com/petit-kit/scoped")},x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},A=t=>null==t||""===t?"":String(t).replace(/[&<>"']/g,t=>x[t]),E=/\{([A-Za-z_$][\w$]*)\}/g,T="bind:";export{$ as SCOPE_VERSION,i as define,o as devicePlugin,_ as happy,h as inViewPlugin,f as lenisPlugin,j as lerpPlugin,O as localStoragePlugin,r as morphPlugin,u as mousePlugin,S as pointerPlugin,M as springPlugin,l as timerPlugin,c as windowPlugin};
1
+ function t({from:t=0,to:e=1,mass:n=1,stiffness:s=120,damping:i=14,velocity:o=0,tolerance:r=.001,resumeOnTarget:c=!0}={}){function h(){return p(a)}function f(t){if(M)return h();if(d(a)&&d(S)&&d(b)){let e=!0;for(let o=0;o<a.length;o+=1){const c=a[o]-S[o],h=(-s*c-i*b[o])/n;b[o]+=h*t,a[o]+=b[o]*t;const f=a[o]-S[o];(Math.abs(b[o])>=r||Math.abs(f)>=r)&&(e=!1)}if(e){for(let t=0;t<a.length;t+=1)a[t]=S[t],b[t]=0;M=!0}return u.value=a,u.velocity=b,p(a)}if(m(a)&&m(S)&&m(b)){const e=u.objectKeys??Object.keys(a);let o=!0;for(const c of e){const e=a[c]-S[c],h=(-s*e-i*b[c])/n;b[c]+=h*t,a[c]+=b[c]*t;const f=a[c]-S[c];(Math.abs(b[c])>=r||Math.abs(f)>=r)&&(o=!1)}if(o){for(const t of e)a[t]=S[t],b[t]=0;M=!0}return u.value=a,u.velocity=b,p(a)}const e=S;let o=b;o+=(-s*(a-e)-i*o)/n*t,a+=o*t,b=o,u.value=a,u.velocity=b;const c=a-e;return Math.abs(o)<r&&Math.abs(c)<r&&(a=e,b=0,u.value=a,u.velocity=b,M=!0),a}const u=v({from:t,to:e,velocity:o,label:"Spring"}),l=u.normalizeInput;let a=u.value,b=u.velocity??o,S=u.target,j=null,M=!1;const O=new Set;return{setTarget:function(t){const e=l(t),n=!w(e,S);if(S=e,u.target=e,a=u.value,c&&M&&n){M=!1,j=null;for(const t of O)t(S)}},setValue:function(t,e={}){const{resetVelocity:n=!0,resetTime:s=!0,setTarget:i=!1,markDone:o=!1}=e;a=l(t),u.value=a,i&&(S=p(a),u.target=S);const r=M||!w(a,S);if(n&&(b=null!=u.arrayLength?y(0,u.arrayLength):null!=u.objectKeys?g(0,u.objectKeys):0,u.velocity=b),s&&(j=null),o&&(M=!0),r&&!o){M=!1,j=null;for(const t of O)t(S)}},getValue:h,isDone:function(){return M},onResume:function(t){return O.add(t),()=>{O.delete(t)}},step:f,next:function(t=performance.now()){if(null==j)return j=t,h();const e=(t-j)/1e3;j=t;const n=1/30;let s=e,i=h();for(;s>0&&!M;){const t=Math.min(s,n);i=f(t),s-=t}return i}}}function e(t,e){return t?`${t}:${e}`:e}function n(t,e){if(!e||"object"!=typeof e||null==e.type)return null!=t?t:e;const{type:n,default:s}=e;if(null==t)return s;try{switch(n){case String:return String(t);case Number:{const e=Number(t);return Number.isNaN(e)?s:e}case Boolean:return""===t||"true"===t||"false"!==t&&"0"!==t&&null!=t;case Object:case Array:try{return"string"==typeof t?JSON.parse(t):t}catch{return n===Array?Array.isArray(s)?s:[]:s}default:return t}}catch{return s}}function s(t){if(!t)return;const e=t.default;return"function"==typeof e?e():e}function i(t,e,n,s){if(!s||"object"!=typeof s||!s.reflect)return;let i=null;const o=s.type;if(o!==Boolean){if(o===Object||o===Array)try{i=null==n?null:JSON.stringify(n)}catch{i=null}else i=null==n?null:String(n);null==i?t.removeAttribute(e):t.setAttribute(e,i)}else n?t.setAttribute(e,""):t.removeAttribute(e)}function o(t,e={},o){const{props:r={},shadow:c=!1,styles:h,plugins:f}=e,u=f??[],l=()=>{};class a extends HTMLElement{constructor(){super(),this.version=x,this.t={};for(const t of Object.keys(r)){const e=r[t];this.t[t]=e&&"object"==typeof e&&("type"in e||"default"in e)?e:{type:void 0,default:e,reflect:!1}}this.props={},this.state={},this.actions={},this.refs={},this.emit=this.emit.bind(this),this.listen=this.listen.bind(this),this.setState=this.setState.bind(this),this.updateState=this.updateState.bind(this),this.setProps=this.setProps.bind(this),this.scheduleUpdate=this.scheduleUpdate.bind(this),this.update=this.update.bind(this),this.forceRender=this.forceRender.bind(this),this.destroy=this.destroy.bind(this),this.$=this.$.bind(this),this.i=null,this.o=null,this.h=!1,this.u=!1,this.l=c,this.m=c?this.attachShadow({mode:"open"}):this,this.p=null,this.S=[],this.j=[],this.M=[],this.O=[],this._=[],this.A=[],this.T=[],this.k=[],this.L=null,this.C="mount",this.F=void 0,this.I=new Map,this.R=!1,this.V=!1,this.q={},this.D=t,this.H=!1,this.N=new Set,this.U=!1,this.B=new Map,this.W=0,this.J=!1}P(t){const e=this.l?this.m.host:this;let n=t.parentElement;for(;n;){if(n===e)return!1;if(n.tagName.includes("-"))return!0;n=n.parentElement}return!1}static get observedAttributes(){return Object.keys(r)}attributeChangedCallback(t,e,s){if(e===s)return;const i=this.t[t],o=this.q[t],r=n(s,i);if(this.props[t]=r,this.R&&o!==r)for(const e of this.k)try{e(t,o,r)}catch(t){l(String(t?.message||t))}this.q[t]=r,this.N.has(t)?this.N.delete(t):this.i&&this.isConnected?this.U?this.H=!0:(this.C="props",this.F=[t],this.update(!0)):this.H=!0}connectedCallback(){for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=n(this.getAttribute(t),this.t[t]);this.props[t]=e,this.q[t]=e}c||this.p||(this.p=this.K());let t=null;try{if(o){const e={props:this.props,state:this.state,actions:this.actions,refs:this.refs,emit:this.emit,listen:this.listen,updateState:this.updateState.bind(this),$:this.$,host:this,onMount:t=>this.M.push(t),onDestroy:t=>this.O.push(t),onUpdate:t=>this._.push(t),onBeforeUpdate:t=>this.A.push(t),onFirstUpdate:t=>this.T.push(t),onPropsChanged:t=>this.k.push(t),shouldRender:t=>{this.L=t},link:(t,e)=>{const n=e||t;this.state[n]=this.props[t],this.k.push((e,s,i)=>{e===t&&(Object.is(this.state[n],i)||(this.state[n]=i))});const s={fn:()=>{const e=this.state[n];if(Object.is(this.props[t],e))return;this.props[t]=e,this.q[t]=e;const s=this.t[t],o=s?{...s,reflect:!0}:s,r=this.getAttribute(t);this.N.add(t),i(this,t,e,o),r===this.getAttribute(t)&&this.N.delete(t)},deps:()=>[this.state[n]]};this.S.push(s)},computed:(t,e)=>{let n;if(void 0!==e)try{const t="function"==typeof e?e():e;Array.isArray(t)&&(n=t)}catch(t){String(t?.message||t)}const s={getter:t,deps:e,value:void 0!==e?t(n):t()};this.j.push(s);const i=()=>s.value;return i.Z=s,this.G(i),i},effect:(t,e)=>{const n={fn:t,deps:e};return this.S.push(n),()=>this.X(n)},delegate:(t,e,n)=>(this.Y(t,e,n),()=>this.tt(t,e,n)),escapeHtml:E};for(const t of u)if(t)try{const n=t.extend(e,this);n&&"object"==typeof n&&Object.assign(e,n)}catch(t){l(String(t?.message||t))}t=o(e)}}catch(t){throw String(t?.message||t),t}this.i="function"!=typeof t?()=>"":t,this.U=!0,this.C="mount",this.F=void 0,this.update(!0),this.U=!1,this.H&&(this.H=!1,this.C="props",this.F=void 0,this.update(!0))}disconnectedCallback(){this.destroy()}remove(){super.remove()}$(t){const e=this.m.querySelectorAll(t);return 0===e.length?null:1===e.length?e[0]:Array.from(e)}destroy(){for(const t of this.O)try{t()}catch(t){l(String(t?.message||t))}for(const t of this.S)if(t.cleanup){try{t.cleanup()}catch(t){l(String(t?.message||t))}t.cleanup=void 0}for(const[,t]of this.I)try{this.m.removeEventListener(t.eventType,t.listener)}catch{}this.I.clear(),this.R=!1}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}listen(t,e,n,s){const i=n;t.addEventListener(e,i,s);const o=()=>{try{t.removeEventListener(e,i,s)}catch{}};return this.O.push(o),o}setState(t){const e=[],n=t,s=this.state;for(const t in n){if(!Object.prototype.hasOwnProperty.call(n,t))continue;const i=n[t];Object.is(s[t],i)||(s[t]=i,e.push(t))}if(0!==e.length)if(this.U||!this.R)this.C="state",this.F=e,this.update(!0);else{if(!this.i||!this.isConnected)return;if(this.h)return;this.h=!0;const t=[...e];requestAnimationFrame(()=>{this.h=!1,this.i&&this.isConnected&&(this.C="state",this.F=t,this.update(!0))})}}updateState(t){Object.assign(this.state,t),this.i&&this.isConnected&&this.et()}setProps(t){const e=Object.keys(t);if(0===e.length)return;const n=[],s={};for(const o of e){const e=t[o],r=this.q[o];this.props[o]=e,this.R&&r!==e&&(n.push(o),s[o]=r);const c=this.t[o];c&&c.reflect&&i(this,o,e,c),this.R&&r===e||(this.q[o]=e)}if(this.R&&n.length>0)for(const e of n){const n=s[e],i=t[e];for(const t of this.k)try{t(e,n,i)}catch(t){l(String(t?.message||t))}}this.i&&this.isConnected?(this.C="props",this.F=n,this.update(!0)):this.H=!0}scheduleUpdate(){this.i&&this.isConnected&&this.et()}et(){this.u||this.h||(this.u=!0,("function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t))(()=>{this.u=!1,this.i&&this.isConnected&&(this.h||this.update(!1))}))}update(t){if(this.i){if(t&&this.R)for(const t of this.A)try{t()}catch(t){l(String(t?.message||t))}if(t){const t={reason:this.C,changedKeys:this.F};if(null===this.L||this.L(t)){this.nt();let t="";try{t=this.i()}catch(e){String(e?.message||e),t=""}if("string"!=typeof t&&(t=null==t?"":String(t)),t=((t,e,n)=>{const s=Object.prototype.hasOwnProperty;return t.replace(z,(t,i,o)=>{if("text"===i||"html"===i)return t;const r=o.trim();if(!r)return t;const c=s.call(e,r),h=s.call(n,r);if(!c&&!h)return t;const f=c?e[r]:n[r];return k.has(i)?f?`${i}="" ${t}`:t:null==f?t:`${i}="${E(String(f))}" ${t}`})})(t,this.state,this.props),!this.l){const e=`data-scope-owner="${this.D}"`;t=t.replace(/<slot(?![^>]*data-scope-owner)(\s|>)/g,`<slot ${e}$1`)}this.J=!1;const e=null!==this.o&&Object.is(this.o,t);let n=!1;e&&this.R||(this.m.innerHTML=t,this.o=t,n=!0),this.U?("function"==typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,0))(()=>{if(this.i&&this.isConnected){if(n&&!c&&this.projectSlots(),n&&this.st(),!this.R){this.R=!0;for(const t of this.M)try{t()}catch(t){l(String(t?.message||t))}for(const t in this.t){if(!this.t.hasOwnProperty(t))continue;const e=this.t[t],n=this.props[t],i=s(e);if(n!==i)for(const e of this.k)try{e(t,i,n)}catch(t){l(String(t?.message||t))}}}this.it(),this.ot()}}):(n&&!c&&this.projectSlots(),n&&this.st(),this.it(),this.ot())}else this.it(),this.R&&this.ot()}else this.J&&this.nt(),this.it(),this.R&&this.ot()}}forceRender(){this.o=null,this.i&&this.isConnected?this.U?this.H=!0:(this.C="force",this.F=void 0,this.update(!0)):this.H=!0}ot(){if(!this.V){this.V=!0;for(const t of this.T)try{t()}catch(t){l(String(t?.message||t))}}for(const t of this._)try{t()}catch(t){l(String(t?.message||t))}this.rt()}rt(){const t=(this.l?this.m:this).querySelectorAll("*"),e=Object.prototype.hasOwnProperty,n=this.state,s=this.props;this.actions;for(let i=0;i<t.length;i++){const o=t[i];if(this.P(o))continue;if(0===o.attributes.length)continue;const r=o.attributes;for(let t=r.length-1;t>=0;t--){const i=r[t];if(!i.name.startsWith(T))continue;const c=i.name.slice(5),h=i.value,f=h?h.trim():"";let u,l=!1;if(f){const t=this.B.get(f);if(t){t.Z&&(this.J=!0);try{u=t()}catch{}l=!0}}if(!l){const t=f||c,i=e.call(n,t),o=!i&&e.call(s,t);i?u=n[t]:o&&(u=s[t])}if("text"===c){const t=null==u?"":String(u);o.textContent!==t&&(o.textContent=t)}else if("html"===c){const t=null==u?"":String(u);o.innerHTML!==t&&(o.innerHTML=t)}else if(c in o){if(!Object.is(o[c],u))try{o[c]=u}catch{}if("value"===c)try{null==u?o.removeAttribute("value"):o.setAttribute("value",String(u))}catch{}}else if(null!=u)try{o.setAttribute(c,String(u))}catch{}const a=`__scopeBind_${c}`,d=o[a];if(d){const t=d.ct;t&&o.removeEventListener(t,d),delete o[a]}}}}ht(t,e){if(!t||!e||t.length!==e.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(t[n],e[n]))return!0;return!1}nt(){for(const t of this.j){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){try{t.value=void 0!==t.deps?t.getter(e):t.getter()}catch(t){l(String(t?.message||t))}e&&(t.prevDeps=e.slice())}}}it(){for(const t of this.S){let e,n=!0;if(void 0!==t.deps)try{const s="function"==typeof t.deps?t.deps():t.deps;Array.isArray(s)&&(e=s,n=this.ht(t.prevDeps,e))}catch(t){l(String(t?.message||t)),n=!0,e=void 0}if(n){if(t.cleanup){try{t.cleanup()}catch{}t.cleanup=void 0}try{const n=void 0!==t.deps?t.fn(e):t.fn();"function"==typeof n&&(t.cleanup=n)}catch{}e&&(t.prevDeps=e.slice())}}}X(t){const e=this.S.indexOf(t);if(-1!==e){if(t.cleanup)try{t.cleanup()}catch{}this.S.splice(e,1)}}G(t){const e=t.ft;if(e&&"string"==typeof e)return this.B.set(e,t),e;const n=`__scope_bind_${++this.W}__`;this.B.set(n,t);try{t.ft=n,t.toString=()=>n}catch{}return n}st(){const t=(this.l?this.m:this).querySelectorAll("*"),e=this.refs;for(const t in e)e.hasOwnProperty(t)&&delete e[t];for(let n=0;n<t.length;n++){const s=t[n];if(this.P(s))continue;const i=s.getAttribute("ref");if(i&&(e[i]?Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]:e[i]=s),s.attributes.length>0){const t=s.attributes;for(let e=t.length-1;e>=0;e--){const n=t[e];if(!n.name.startsWith("on:"))continue;const i=n.name.slice(3),o=n.value,r=`__tinyHandler_${i}`,c=s[r];c&&s.removeEventListener(i,c),s.removeAttribute(n.name);const h=this.actions[o];if(h&&"function"==typeof h){const t=t=>{h.call(this.actions,t)};s[r]=t,s.addEventListener(i,t)}}}}}K(){const t=new Map,e=this.childNodes,n=[];for(let t=0;t<e.length;t++)n.push(e[t]);for(let e=0;e<n.length;e++){const s=n[e];let i="";1===s.nodeType&&s.getAttribute&&(i=s.getAttribute("slot")||""),t.has(i)||t.set(i,[]),t.get(i).push(s)}for(let t=0;t<n.length;t++){const e=n[t];e.parentNode&&e.parentNode.removeChild(e)}return t}projectSlots(){const t=this.p||new Map,e=(this.l?this.m:this).querySelectorAll(`slot[data-scope-owner="${this.D}"]`);if(0!==e.length)for(let n=0;n<e.length;n++){const s=e[n],i=s.getAttribute("name")||"",o=t.get(i)||[];if(o.length){const t=document.createDocumentFragment();for(let e=0;e<o.length;e++){const n=o[e];let s;if(1===n.nodeType&&n.tagName.includes("-")&&n.p instanceof Map){const t=n,e=document.createElement(t.tagName.toLowerCase());for(let n=0;n<t.attributes.length;n++){const s=t.attributes[n];e.setAttribute(s.name,s.value)}for(const n of t.p.values())for(let t=0;t<n.length;t++)e.appendChild(n[t].cloneNode(!0));s=e}else s=n.cloneNode(!0);t.appendChild(s)}s.replaceWith(t)}else{const t=s.childNodes,e=[];for(let n=0;n<t.length;n++)e.push(t[n]);if(e.length>0){const t=document.createDocumentFragment();for(let n=0;n<e.length;n++)t.appendChild(e[n]);s.replaceWith(t)}}}}Y(t,e,n){const s=`${t}::${e}`;let i=this.I.get(s);if(!i){const n=t=>{const n=t.target&&t.target.closest?t.target.closest(e):null;if(n)for(const e of i.handlers)try{e(t,n)}catch{}};i={eventType:t,selector:e,listener:n,handlers:new Set},this.I.set(s,i),this.m.addEventListener(t,n)}i.handlers.add(n)}tt(t,e,n){const s=`${t}::${e}`,i=this.I.get(s);if(i&&(i.handlers.delete(n),0===i.handlers.size)){try{this.m.removeEventListener(t,i.listener)}catch{}this.I.delete(s)}}}if(!customElements.get(t)){if(h&&"undefined"!=typeof document){const e=`scope-${t}-styles`;if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=h,document.head.appendChild(t)}}try{customElements.define(t,a)}catch(t){String(t?.message||t)}}return a}const r=()=>({name:"device",extend:t=>{const e=new Map;return t.onDestroy(()=>{for(const[t,n]of e)t.removeEventListener("change",n);e.clear()}),{onMediaQuery:(t,n,s={})=>{if("undefined"==typeof window||"undefined"==typeof matchMedia)return()=>{};const{immediate:i=!0}=s,o=matchMedia(t),r=t=>{n(t.matches,t)};return o.addEventListener("change",r),e.set(o,r),i&&n(o.matches,null),()=>{o.removeEventListener("change",r),e.delete(o)}}}}}),c=(t,e={})=>({name:"morph",extend:(n,s)=>{const{ignoreActiveValue:i=!0,callbacks:o}=e,r=t(),c=s,h=c.m,f=c.l?ShadowRoot.prototype:HTMLElement.prototype,u=Object.getOwnPropertyDescriptor(f,"innerHTML"),l=t=>{r.morph(h,t,{morphStyle:"innerHTML",ignoreActiveValue:i,callbacks:o})};let a=!0;return Object.defineProperty(h,"innerHTML",{set(t){a?(u.set.call(this,t),a=!1):l(t)},get(){return u.get.call(this)},configurable:!0}),n.onDestroy(()=>{delete h.innerHTML}),{morph:l}}}),h=()=>({name:"window",extend:t=>{const e=new Set,n=new Set,s=new Set,i=(t,n={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=n,i=e=>{t(window.innerWidth,window.innerHeight,e)};return window.addEventListener("resize",i),e.add(i),s&&i(new UIEvent("resize")),()=>{window.removeEventListener("resize",i),e.delete(i)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const t of e)window.removeEventListener("resize",t);e.clear();for(const t of s)t.disconnect();s.clear();for(const t of n)window.removeEventListener("scroll",t);n.clear()}}),{onViewportResize:i,onWindowResize:(t,e={})=>{if("undefined"==typeof window)return()=>{};if("undefined"==typeof ResizeObserver)return i((e,n,s)=>t(e,n,s),e);const{immediate:n=!0}=e,o=document.documentElement,r=new ResizeObserver(e=>{const n=e[0];if(!n)return;const{width:s,height:i}=n.contentRect;t(s,i,n)});if(r.observe(o),s.add(r),n){const e=o.getBoundingClientRect();t(e.width,e.height,new UIEvent("resize"))}return()=>{r.disconnect(),s.delete(r)}},onWindowScroll:(t,e={})=>{if("undefined"==typeof window)return()=>{};const{immediate:s=!0}=e,i=e=>{t(window.scrollX,window.scrollY,e)};return window.addEventListener("scroll",i,{passive:!0}),n.add(i),s&&i(new Event("scroll")),()=>{window.removeEventListener("scroll",i),n.delete(i)}}}}}),f=()=>({name:"inview",extend:(t,e)=>{const n=new Set,s=(t,e,s={})=>{if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return()=>{};const{immediate:i=!0,...o}=s;let r=!i;const c=new IntersectionObserver(n=>{for(const s of n)s.target===t&&(r?r=!1:e(s.isIntersecting,s))},o);return c.observe(t),n.add(c),()=>{c.unobserve(t),c.disconnect(),n.delete(c)}};return t.onDestroy(()=>{for(const t of n)t.disconnect();n.clear()}),{onInView:(t,n)=>s(e,t,n),observeInView:(t,e,n)=>s(t,e,n)}}}),u=t=>({name:"lenis",extend:e=>{const n=new Set;return e.onDestroy(()=>{for(const{lenis:t,handler:e}of n)"function"==typeof t.off&&t.off("scroll",e);n.clear()}),{onLenisScroll:e=>{const s=t();if(!s)return()=>{};const i=t=>{e(t)};s.on("scroll",i);const o={lenis:s,handler:i};return n.add(o),()=>{n.has(o)&&(n.delete(o),"function"==typeof s.off&&s.off("scroll",i))}}}}}),l=()=>({name:"timer",extend:t=>{const e=new Set,n=new Set,s=new Set,i={setTimeout:(t,n,...s)=>{let i;return i=setTimeout((...n)=>{e.delete(i),t(...n)},n,...s),e.add(i),i},setInterval:(t,e,...s)=>{const i=setInterval(t,e,...s);return n.add(i),i},raf:(t,e)=>{let n=0,i=!0,o=0;const r="number"==typeof e&&e>0?1e3/e:0,c=e=>{if(s.delete(n),i){if(r){if(e-o>=r){const n=o?e-o:r;o=e,t(e,n)}}else{const n=o?e-o:0;o=e,t(e,n)}n=requestAnimationFrame(c),s.add(n)}};return n=requestAnimationFrame(c),s.add(n),()=>{i&&(i=!1,s.delete(n),cancelAnimationFrame(n))}}};return t.onDestroy(()=>{for(const t of e)clearTimeout(t);e.clear();for(const t of n)clearInterval(t);n.clear();for(const t of s)cancelAnimationFrame(t);s.clear()}),{timer:i}}}),a=()=>({name:"mouse",extend:t=>{const e=new Map,n=(t,n)=>{if("undefined"==typeof window)return()=>{};const s=t=>{const e=t;n(e.clientX,e.clientY,e)};window.addEventListener(t,s);let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.add(s),()=>{window.removeEventListener(t,s),i?.delete(s)}};return t.onDestroy(()=>{if("undefined"!=typeof window){for(const[t,n]of e){for(const e of n)window.removeEventListener(t,e);n.clear()}e.clear()}}),{onMouseMove:t=>n("mousemove",t),onMouseDown:t=>n("mousedown",t),onMouseUp:t=>n("mouseup",t),onMouseWheel:t=>(t=>{if("undefined"==typeof window)return()=>{};const n=e=>{const n=e;t(n.clientX,n.clientY,n.deltaY,n)};window.addEventListener("wheel",n);let s=e.get("wheel");return s||(s=new Set,e.set("wheel",s)),s.add(n),()=>{window.removeEventListener("wheel",n),s?.delete(n)}})(t)}}}),d=t=>Array.isArray(t),m=t=>null!=t&&"object"==typeof t&&!Array.isArray(t),p=t=>d(t)?t.slice():m(t)?{...t}:t,w=(t,e)=>{if(d(t)&&d(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!Object.is(t[n],e[n]))return!1;return!0}if(m(t)&&m(e)){const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const s of n){if(!(s in e))return!1;if(!Object.is(t[s],e[s]))return!1}return!0}return!(d(t)||d(e)||m(t)||m(e))&&Object.is(t,e)},y=(t,e)=>Array.from({length:e},()=>t),g=(t,e)=>e.reduce((e,n)=>(e[n]=t,e),{}),v=({from:t,to:e,velocity:n,label:s})=>{const i={value:t,target:e,velocity:n,arrayLength:null,objectKeys:null,normalizeInput:t=>t},o=t=>{if(null==i.arrayLength){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);i.arrayLength=t,d(i.value)||(i.value=y(i.value,t)),d(i.target)||(i.target=y(i.target,t)),void 0===i.velocity||d(i.velocity)||(i.velocity=y(i.velocity,t))}},r=t=>{if(null==i.objectKeys){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);i.objectKeys=t,m(i.value)||(i.value=g(i.value,t)),m(i.target)||(i.target=g(i.target,t)),void 0===i.velocity||m(i.velocity)||(i.velocity=g(i.velocity,t))}},c=t=>{if(d(t)){if(null!=i.objectKeys)throw new Error(`${s} value shape mismatch (array vs object).`);if(null==i.arrayLength&&o(t.length),t.length!==i.arrayLength)throw new Error(`${s} value length mismatch (expected ${i.arrayLength}, got ${t.length}).`);return t.slice()}if(m(t)){if(null!=i.arrayLength)throw new Error(`${s} value shape mismatch (object vs array).`);const e=Object.keys(t);if(null==i.objectKeys&&r(e),i.objectKeys&&e.length!==i.objectKeys.length)throw new Error(`${s} value keys mismatch (expected ${i.objectKeys.length}, got ${e.length}).`);if(i.objectKeys)for(const e of i.objectKeys)if(!(e in t))throw new Error(`${s} value keys mismatch (missing key "${e}").`);return{...t}}return null!=i.arrayLength?y(t,i.arrayLength):null!=i.objectKeys?g(t,i.objectKeys):t};i.normalizeInput=c;const h=d(t)||d(e)||void 0!==n&&d(n),f=m(t)||m(e)||void 0!==n&&m(n);if(h&&f)throw new Error(`${s} value shape mismatch (array vs object).`);if(h){const s=d(t)?t.length:d(e)?e.length:n.length;o(s),i.value=c(t),i.target=c(e),void 0!==i.velocity&&(i.velocity=c(i.velocity))}else if(f){const s=m(t)?Object.keys(t):m(e)?Object.keys(e):Object.keys(n);r(s),i.value=c(t),i.target=c(e),void 0!==i.velocity&&(i.velocity=c(i.velocity))}return i};let b={x:-1,y:-1};const S={stiffness:300,damping:30,mass:1},j=()=>({name:"pointer",extend:e=>{const{onMouseMove:n}=a().extend(e,e.host),{timer:s}=l().extend(e,e.host);b.x=window.innerWidth/2,b.y=window.innerHeight/2;const i={x:t({from:b.x,to:b.x,...S}),y:t({from:b.y,to:b.y,...S})};return n((t,e)=>{i.x.setTarget(t),i.y.setTarget(e)}),{onPointerMove:t=>{let e=b.x,n=b.y;s.raf(s=>{const o=i.x.next(s),r=i.y.next(s);var c,h;e===o&&n===r||(t({x:o,y:r,v:(c={x:o,y:r},h={x:e,y:n},{x:c.x-h.x,y:c.y-h.y,magnitude:Math.sqrt((c.x-h.x)*(c.x-h.x)+(c.y-h.y)*(c.y-h.y))}).magnitude}),e=o,n=r)})},onMouseMove:n}}}),M=()=>({name:"lerp",extend:t=>{const{timer:e}=l().extend(t,t.host),n=new Set;return t.onDestroy(()=>{for(const t of n)t();n.clear()}),{createLerp:t=>function({from:t=0,to:e=1,lerp:n=.1,tolerance:s=.001,resumeOnTarget:i=!0}={}){function o(){return p(f)}function r(t){if(a)return o();const e=(t=>t<0?0:t>1?1:t)(n);if(0===e)return o();if(1===e)return f=p(u),c.value=f,a=!0,o();const i=t>0?1-Math.pow(1-e,60*t):0;if(d(f)&&d(u)){let t=!0;for(let e=0;e<f.length;e+=1)f[e]+=(u[e]-f[e])*i,Math.abs(u[e]-f[e])>=s&&(t=!1);if(t){for(let t=0;t<f.length;t+=1)f[t]=u[t];a=!0}return c.value=f,p(f)}if(m(f)&&m(u)){const t=c.objectKeys??Object.keys(f);let e=!0;for(const n of t)f[n]+=(u[n]-f[n])*i,Math.abs(u[n]-f[n])>=s&&(e=!1);if(e){for(const e of t)f[e]=u[e];a=!0}return c.value=f,p(f)}const r=u;return f+=(r-f)*i,c.value=f,Math.abs(r-f)<s&&(f=r,c.value=f,a=!0),f}const c=v({from:t,to:e,label:"Lerp"}),h=c.normalizeInput;let f=c.value,u=c.target,l=null,a=!1;const y=new Set;return{setTarget:function(t){const e=h(t),n=!w(e,u);if(u=e,c.target=e,f=c.value,i&&a&&n){a=!1,l=null;for(const t of y)t(u)}},setValue:function(t,e={}){const{resetTime:n=!0,setTarget:s=!1,markDone:i=!1}=e;f=h(t),c.value=f,s&&(u=p(f),c.target=u);const o=a||!w(f,u);if(n&&(l=null),i&&(a=!0),o&&!i){a=!1,l=null;for(const t of y)t(u)}},getValue:o,isDone:function(){return a},onResume:function(t){return y.add(t),()=>{y.delete(t)}},step:r,next:function(t=performance.now()){if(null==l)return l=t,o();const e=(t-l)/1e3;l=t;const n=1/30;let s=e,i=o();for(;s>0&&!a;){const t=Math.min(s,n);i=r(t),s-=t}return i}}}(t),runLerp:(t,s,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&s(t.getValue(),t);const u=()=>{f||(f=e.raf(e=>{if(h)return;const n=t.next(e);s(n,t),c&&t.isDone()&&l()},o))},l=()=>{f&&(f(),f=null)};u();const a=t.onResume(()=>{!h&&c&&(r&&s(t.getValue(),t),u())}),d=()=>{h||(h=!0,a(),l(),n.delete(d))};return n.add(d),d}}}}),O=()=>({name:"spring",extend:e=>{const{timer:n}=l().extend(e,e.host),s=new Set;return e.onDestroy(()=>{for(const t of s)t();s.clear()}),{createSpring:e=>t(e),runSpring:(t,e,i={})=>{const{fps:o,immediate:r=!0,stopWhenDone:c=!0}=i;let h=!1,f=null;r&&e(t.getValue(),t);const u=()=>{f||(f=n.raf(n=>{if(h)return;const s=t.next(n);e(s,t),c&&t.isDone()&&l()},o))},l=()=>{f&&(f(),f=null)};u();const a=t.onResume(()=>{!h&&c&&(r&&e(t.getValue(),t),u())}),d=()=>{h||(h=!0,a(),l(),s.delete(d))};return s.add(d),d}}}}),$=(t={})=>({name:"localstorage",extend:n=>{const{prefix:s="",json:i=!0}=t,o="undefined"==typeof window?null:window.localStorage;return{storage:{get:t=>{if(o)try{const n=o.getItem(e(s,t));if(null===n)return;return i?JSON.parse(n):n}catch{return}},set:(t,n)=>{if(o)try{const r=i?JSON.stringify(n):String(n);o.setItem(e(s,t),r)}catch{}},remove:t=>{o&&o.removeItem(e(s,t))},clear:()=>{if(!o)return;if(!s)return;const t=[];for(let e=0;e<o.length;e++){const n=o.key(e);null!=n&&n.startsWith(s+":")&&t.push(n)}for(const e of t)o.removeItem(e)}}}}}),x="0.0.8-beta.22",_=()=>{console.info("The website is using @petit-kit/scoped v"+x,"\nhttps://github.com/petit-kit/scoped")},A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=t=>null==t||""===t?"":String(t).replace(/[&<>"']/g,t=>A[t]),T="bind:",k=new Set(["checked","disabled","readonly","required","selected","autofocus","multiple","hidden"]),z=/bind:([a-zA-Z_$][\w$]*)="([^"]*)"/g;export{x as SCOPE_VERSION,o as define,r as devicePlugin,_ as happy,f as inViewPlugin,u as lenisPlugin,M as lerpPlugin,$ as localStoragePlugin,c as morphPlugin,a as mousePlugin,j as pointerPlugin,O as springPlugin,l as timerPlugin,h as windowPlugin};
2
2
  //# sourceMappingURL=index.js.map
@@ -34,7 +34,7 @@ export type LerpControls = {
34
34
  * define("my-component", { plugins: [lerpPlugin()] }, ({ createLerp, runLerp, host }) => {
35
35
  * const opacity = createLerp({ from: 0, to: 1 });
36
36
  * runLerp(opacity, (value) => host.updateState({ opacity: value }));
37
- * return () => `<div bind:style="opacity: {opacity}"></div>`;
37
+ * return () => `<div bind:style="opacity: ${state.opacity}"></div>`;
38
38
  * });
39
39
  */
40
40
  export declare const lerpPlugin: () => ComponentPlugin<LerpControls>;
@@ -40,14 +40,14 @@ export type LocalStorageControls = {
40
40
  *
41
41
  * @example
42
42
  * ```ts
43
- * define("c-settings", { plugins: [localStoragePlugin({ prefix: "app" })] }, ({ storage }) => {
43
+ * define("c-settings", { plugins: [localStoragePlugin({ prefix: "app" })] }, ({ storage, state, actions }) => {
44
44
  * state.theme = storage.get("theme") ?? "dark";
45
45
  * actions.toggleTheme = () => {
46
46
  * const next = state.theme === "dark" ? "light" : "dark";
47
47
  * storage.set("theme", next);
48
48
  * state.theme = next;
49
49
  * };
50
- * return () => `<div class="{theme}">...</div>`;
50
+ * return () => `<div class="${state.theme}">...</div>`;
51
51
  * });
52
52
  * ```
53
53
  */
@@ -42,7 +42,7 @@ export type MorphOptions = {
42
42
  * };
43
43
  * return () => `
44
44
  * <input type="text" on:input="onInput" />
45
- * <p>Results for: {query}</p>
45
+ * <p>Results for: ${state.query}</p>
46
46
  * `;
47
47
  * }
48
48
  * );
@@ -77,7 +77,7 @@ export type MorphControls = {
77
77
  * define("c-counter", { plugins: [morphPlugin(() => Idiomorph)] }, ({ state, actions, host }) => {
78
78
  * state.count = 0;
79
79
  * actions.increment = () => host.setState({ count: state.count + 1 });
80
- * return () => `<button on:click="increment">Count: {count}</button>`;
80
+ * return () => `<button on:click="increment">Count: ${state.count}</button>`;
81
81
  * });
82
82
  * ```
83
83
  *
@@ -14,7 +14,7 @@ export type MouseUnsubscribe = () => void;
14
14
  * const stop = onMouseMove((x, y) => {
15
15
  * host.updateState({ cursorX: x, cursorY: y });
16
16
  * });
17
- * return () => `<div style="left: {cursorX}px; top: {cursorY}px">...</div>`;
17
+ * return () => `<div style="left: ${state.cursorX}px; top: ${state.cursorY}px">...</div>`;
18
18
  * });
19
19
  * ```
20
20
  *
@@ -17,7 +17,7 @@ export type PointerMoveHandler = (pos: PointerPosition) => void;
17
17
  * onPointerMove(({ x, y, v }) => {
18
18
  * host.updateState({ cursorX: x, cursorY: y, speed: v });
19
19
  * });
20
- * return () => `<div style="left: {cursorX}px; top: {cursorY}px">...</div>`;
20
+ * return () => `<div style="left: ${state.cursorX}px; top: ${state.cursorY}px">...</div>`;
21
21
  * });
22
22
  * ```
23
23
  */
@@ -51,7 +51,7 @@ export type PointerControls = {
51
51
  * ```ts
52
52
  * define("my-component", { plugins: [pointerPlugin()] }, ({ onPointerMove, onMouseMove }) => {
53
53
  * onPointerMove(({ x, y, v }) => host.updateState({ cx: x, cy: y, velocity: v }));
54
- * return () => `<div style="transform: translate({cx}px, {cy}px)">...</div>`;
54
+ * return () => `<div style="transform: translate(${state.cx}px, ${state.cy}px)">...</div>`;
55
55
  * });
56
56
  * ```
57
57
  */
@@ -34,7 +34,7 @@ export type SpringControls = {
34
34
  * define("my-component", { plugins: [springPlugin()] }, ({ createSpring, runSpring, host }) => {
35
35
  * const scale = createSpring({ from: 0.8, to: 1 });
36
36
  * runSpring(scale, (value) => host.updateState({ scale: value }));
37
- * return () => `<div bind:style="transform: scale({scale})"></div>`;
37
+ * return () => `<div bind:style="transform: scale(${state.scale})"></div>`;
38
38
  * });
39
39
  */
40
40
  export declare const springPlugin: () => ComponentPlugin<SpringControls>;
@@ -72,7 +72,7 @@ export type TimerControls = {
72
72
  * const stop = timer.raf((time, dt) => {
73
73
  * host.updateState({ elapsed: time });
74
74
  * });
75
- * return () => `<div>{elapsed}</div>`;
75
+ * return () => `<div>${state.elapsed}</div>`;
76
76
  * });
77
77
  * ```
78
78
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petit-kit/scoped",
3
- "version": "0.0.8-beta.2",
3
+ "version": "0.0.8-beta.22",
4
4
  "description": "A lightweight, reactive web component framework with built-in plugins for modern web development.",
5
5
  "keywords": [
6
6
  "web-components",