@oyerinde/caliper 0.1.3 → 0.2.0

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.
@@ -0,0 +1,327 @@
1
+ (function(){'use strict';/**
2
+ * @name @oyerinde/caliper
3
+ * @author Daniel Oyerinde
4
+ * @license MIT
5
+ *
6
+ * Caliper - Browser Measurement Tool
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ var vi=(e,t)=>e===t;var xi=Symbol("solid-track");var Et={equals:vi},Sn=Ln,Me=1,ft=2,En={owned:null,cleanups:null,context:null,owner:null};var R=null,T=null,Je=null,Z=null,le=null,fe=null,It=0;function et(e,t){let n=Z,i=R,r=e.length===0,o=t===void 0?i:t,l=r?En:{owned:null,cleanups:null,context:o?o.context:null,owner:o},a=r?e:()=>e(()=>me(()=>Xe(l)));R=l,Z=null;try{return Ce(a,!0)}finally{Z=n,R=i;}}function _(e,t){t=t?Object.assign({},Et,t):Et;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=r=>(typeof r=="function"&&(r=r(n.value)),Tn(n,r));return [kn.bind(n),i]}function F(e,t,n){let i=Ft(e,t,false,Me);mt(i);}function pe(e,t,n){Sn=Ni;let i=Ft(e,t,false,Me);(!n||!n.render)&&(i.user=true),fe?fe.push(i):mt(i);}function U(e,t,n){n=n?Object.assign({},Et,n):Et;let i=Ft(e,t,true,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,mt(i),kn.bind(i)}function me(e){if(Z===null)return e();let t=Z;Z=null;try{return Je?Je.untrack(e):e()}finally{Z=t;}}function Nn(e,t,n){let i=Array.isArray(e),r;return l=>{let a;if(i){a=Array(e.length);for(let u=0;u<e.length;u++)a[u]=e[u]();}else a=e();let c=me(()=>t(a,r,l));return r=a,c}}function kt(e){pe(()=>me(e));}function ye(e){return R===null||(R.cleanups===null?R.cleanups=[e]:R.cleanups.push(e)),e}function Tt(){return R}function In(e,t){let n=R,i=Z;R=e,Z=null;try{return Ce(t,!0)}catch(r){Lt(r);}finally{R=n,Z=i;}}var[sr,vn]=_(false);function kn(){let e=T;if(this.sources&&(this.state))if((this.state)===Me)mt(this);else {let t=le;le=null,Ce(()=>Nt(this),false),le=t;}if(Z){let t=this.observers?this.observers.length:0;Z.sources?(Z.sources.push(this),Z.sourceSlots.push(t)):(Z.sources=[this],Z.sourceSlots=[t]),this.observers?(this.observers.push(Z),this.observerSlots.push(Z.sources.length-1)):(this.observers=[Z],this.observerSlots=[Z.sources.length-1]);}return e&&T.sources.has(this)?this.tValue:this.value}function Tn(e,t,n){let i=e.value;if(!e.comparator||!e.comparator(i,t)){e.value=t;e.observers&&e.observers.length&&Ce(()=>{for(let r=0;r<e.observers.length;r+=1){let o=e.observers[r],l=T&&T.running;l&&T.disposed.has(o)||((l?!o.tState:!o.state)&&(o.pure?le.push(o):fe.push(o),o.observers&&Cn(o)),l?o.tState=Me:o.state=Me);}if(le.length>1e6)throw le=[],new Error},false);}return t}function mt(e){if(!e.fn)return;Xe(e);let t=It;xn(e,e.value,t);}function xn(e,t,n){let i,r=R,o=Z;Z=R=e;try{i=e.fn(t);}catch(l){return e.pure&&((e.state=Me,e.owned&&e.owned.forEach(Xe),e.owned=null)),e.updatedAt=n+1,Lt(l)}finally{Z=o,R=r;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Tn(e,i):e.value=i,e.updatedAt=n);}function Ft(e,t,n,i=Me,r){let o={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:R,context:R?R.context:null,pure:n};if(R===null||R!==En&&(R.owned?R.owned.push(o):R.owned=[o]),Je);return o}function dt(e){let t=T;if((e.state)===0)return;if((e.state)===ft)return Nt(e);if(e.suspense&&me(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<It);){(e.state)&&n.push(e);}for(let i=n.length-1;i>=0;i--){if(e=n[i],t);if((e.state)===Me)mt(e);else if((e.state)===ft){let r=le;le=null,Ce(()=>Nt(e,n[0]),false),le=r;}}}function Ce(e,t){if(le)return e();let n=false;t||(le=[]),fe?n=true:fe=[],It++;try{let i=e();return Si(n),i}catch(i){n||(fe=null),le=null,Lt(i);}}function Si(e){if(le&&(Ln(le),le=null),e)return;let n=fe;fe=null,n.length&&Ce(()=>Sn(n),false);}function Ln(e){for(let t=0;t<e.length;t++)dt(e[t]);}function Ni(e){let t,n=0;for(t=0;t<e.length;t++){let i=e[t];i.user?e[n++]=i:dt(i);}for(t=0;t<n;t++)dt(e[t]);}function Nt(e,t){e.state=0;for(let i=0;i<e.sources.length;i+=1){let r=e.sources[i];if(r.sources){let o=r.state;o===Me?r!==t&&(!r.updatedAt||r.updatedAt<It)&&dt(r):o===ft&&Nt(r,t);}}}function Cn(e){for(let n=0;n<e.observers.length;n+=1){let i=e.observers[n];(!i.state)&&(i.state=ft,i.pure?le.push(i):fe.push(i),i.observers&&Cn(i));}}function Xe(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),i=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){let o=r.pop(),l=n.observerSlots.pop();i<r.length&&(o.sourceSlots[l]=i,r[i]=o,n.observerSlots[i]=l);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Xe(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Xe(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function Ii(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Lt(e,t=R){let i=Ii(e);throw i;}var ki=Symbol("fallback");function Mn(e){for(let t=0;t<e.length;t++)e[t]();}function Ti(e,t,n={}){let i=[],r=[],o=[],l=0,a=t.length>1?[]:null;return ye(()=>Mn(o)),()=>{let c=e()||[],u=c.length,d,s;return c[xi],me(()=>{let m,y,b,x,g,h,w,p,k;if(u===0)l!==0&&(Mn(o),o=[],i=[],r=[],l=0,a&&(a=[])),n.fallback&&(i=[ki],r[0]=et(L=>(o[0]=L,n.fallback())),l=1);else if(l===0){for(r=new Array(u),s=0;s<u;s++)i[s]=c[s],r[s]=et(f);l=u;}else {for(b=new Array(u),x=new Array(u),a&&(g=new Array(u)),h=0,w=Math.min(l,u);h<w&&i[h]===c[h];h++);for(w=l-1,p=u-1;w>=h&&p>=h&&i[w]===c[p];w--,p--)b[p]=r[w],x[p]=o[w],a&&(g[p]=a[w]);for(m=new Map,y=new Array(p+1),s=p;s>=h;s--)k=c[s],d=m.get(k),y[s]=d===void 0?-1:d,m.set(k,s);for(d=h;d<=w;d++)k=i[d],s=m.get(k),s!==void 0&&s!==-1?(b[s]=r[d],x[s]=o[d],a&&(g[s]=a[d]),s=y[s],m.set(k,s)):o[d]();for(s=h;s<u;s++)s in b?(r[s]=b[s],o[s]=x[s],a&&(a[s]=g[s],a[s](s))):r[s]=et(f);r=r.slice(0,l=u),i=c.slice(0);}return r});function f(m){if(o[s]=m,a){let[y,b]=_(s);return a[s]=b,t(c[s],y)}return t(c[s])}}}function C(e,t){return me(()=>e(t||{}))}var Ci=e=>`Stale read from <${e}>.`;function Re(e){let t="fallback"in e&&{fallback:()=>e.fallback};return U(Ti(()=>e.each,e.children,t||void 0))}function Q(e){let t=e.keyed,n=U(()=>e.when,void 0,void 0),i=t?n:U(n,void 0,{equals:(r,o)=>!r==!o});return U(()=>{let r=i();if(r){let o=e.children;return typeof o=="function"&&o.length>0?me(()=>o(t?r:()=>{if(!me(i))throw Ci("Show");return n()})):o}return e.fallback},void 0,void 0)}var Se=e=>U(()=>e());function Ai(e,t,n){let i=n.length,r=t.length,o=i,l=0,a=0,c=t[r-1].nextSibling,u=null;for(;l<r||a<o;){if(t[l]===n[a]){l++,a++;continue}for(;t[r-1]===n[o-1];)r--,o--;if(r===l){let d=o<i?a?n[a-1].nextSibling:n[o-a]:c;for(;a<o;)e.insertBefore(n[a++],d);}else if(o===a)for(;l<r;)(!u||!u.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[o-1]&&n[a]===t[r-1]){let d=t[--r].nextSibling;e.insertBefore(n[a++],t[l++].nextSibling),e.insertBefore(n[--o],d),t[r]=n[o];}else {if(!u){u=new Map;let s=a;for(;s<o;)u.set(n[s],s++);}let d=u.get(t[l]);if(d!=null)if(a<d&&d<o){let s=l,f=1,m;for(;++s<r&&s<o&&!((m=u.get(t[s]))==null||m!==d+f);)f++;if(f>d-a){let y=t[l];for(;a<d;)e.insertBefore(n[a++],y);}else e.replaceChild(n[a++],t[l++]);}else l++;else t[l++].remove();}}}var An="_$DX_DELEGATE";function $n(e,t,n,i={}){let r;return et(o=>{r=o,t===document?e():V(t,e(),t.firstChild?null:void 0,n);},i.owner),()=>{r(),t.textContent="";}}function X(e,t,n,i){let r,o=()=>{let a=i?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,n?a.content.firstChild.firstChild:i?a.firstChild:a.content.firstChild},l=t?()=>me(()=>document.importNode(r||(r=o()),!0)):()=>(r||(r=o())).cloneNode(true);return l.cloneNode=l,l}function Fe(e,t=window.document){let n=t[An]||(t[An]=new Set);for(let i=0,r=e.length;i<r;i++){let o=e[i];n.has(o)||(n.add(o),t.addEventListener(o,ji));}}function D(e,t,n){(n==null?e.removeAttribute(t):e.setAttribute(t,n));}function B(e,t){(t==null?e.removeAttribute("class"):e.className=t);}function Ye(e,t,n){if(!t)return n?D(e,"style"):t;let i=e.style;if(typeof t=="string")return i.cssText=t;typeof n=="string"&&(i.cssText=n=void 0),n||(n={}),t||(t={});let r,o;for(o in n)t[o]==null&&i.removeProperty(o),delete n[o];for(o in t)r=t[o],r!==n[o]&&(i.setProperty(o,r),n[o]=r);return n}function J(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t);}function V(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return Ct(e,t,i,n);F(r=>Ct(e,t(),r,n),i);}function ji(e){let t=e.target,n=`$$${e.type}`,i=e.target,r=e.currentTarget,o=c=>Object.defineProperty(e,"target",{configurable:true,value:c}),l=()=>{let c=t[n];if(c&&!t.disabled){let u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&o(t.host),true},a=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();o(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!l());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===r)break}}else a();o(i);}function Ct(e,t,n,i,r){for(;typeof n=="function";)n=n();if(t===n)return n;let l=typeof t,a=i!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(l==="number"&&(t=t.toString(),t===n))return n;if(a){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=tt(e,n,i,c);}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;}else if(t==null||l==="boolean"){n=tt(e,n,i);}else {if(l==="function")return F(()=>{let c=t();for(;typeof c=="function";)c=c();n=Ct(e,c,n,i);}),()=>n;if(Array.isArray(t)){let c=[],u=n&&Array.isArray(n);if(Ht(c,t,n,r))return F(()=>n=Ct(e,c,n,i,true)),()=>n;if(c.length===0){if(n=tt(e,n,i),a)return n}else u?n.length===0?jn(e,c,i):Ai(e,n,c):(n&&tt(e),jn(e,c));n=c;}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=tt(e,n,i,t);tt(e,n,null,t);}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t;}}return n}function Ht(e,t,n,i){let r=false;for(let o=0,l=t.length;o<l;o++){let a=t[o],c=n&&n[e.length],u;if(!(a==null||a===true||a===false))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))r=Ht(e,a,c)||r;else if(u==="function")if(i){for(;typeof a=="function";)a=a();r=Ht(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||r;}else e.push(a),r=true;else {let d=String(a);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d));}}return r}function jn(e,t,n=null){for(let i=0,r=t.length;i<r;i++)e.insertBefore(t[i],n);}function tt(e,t,n,i){if(n===void 0)return e.textContent="";let r=i||document.createTextNode("");if(t.length){let o=false;for(let l=t.length-1;l>=0;l--){let a=t[l];if(r!==a){let c=a.parentNode===e;!o&&!l?c?e.replaceChild(r,a):e.insertBefore(r,n):c&&a.remove();}else o=true;}}else e.insertBefore(r,n);return [r]}var $i="http://www.w3.org/2000/svg";function Pi(e,t=false,n=void 0){return t?document.createElementNS($i,e):document.createElement(e,{is:n})}function De(e){let {useShadow:t}=e,n=document.createTextNode(""),i=()=>e.mount||document.body,r=Tt(),o;return pe(()=>{o||(o=In(r,()=>U(()=>e.children)));let a=i();if(a instanceof HTMLHeadElement){let[c,u]=_(false),d=()=>u(true);et(s=>V(a,()=>c()?s():o(),null)),ye(d);}else {let c=Pi(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:true}),V(u,o),a.appendChild(c),e.ref&&e.ref(c),ye(()=>a.removeChild(c));}},void 0,{render:true}),n}function Oi(){let e=null,t=null,n=null,i=null;function r(){return "scheduler"in globalThis?"scheduler":"requestIdleCallback"in window?"idle":"post-raf"}function o(s,f){if(!("scheduler"in globalThis)){l(s,f);return}let m=globalThis.scheduler,y=globalThis.TaskController;if(!y){l(s,f);return}n=new y({priority:f?"user-visible":"background"}),m.postTask(()=>{s();},{signal:n?.signal,priority:f?"user-visible":"background"}).catch(()=>{});}function l(s,f){if(!("requestIdleCallback"in window)){a(s);return}t=requestIdleCallback(m=>{m.timeRemaining()>0||m.didTimeout?s():f?a(s):l(s,false);},{timeout:f?5:50});}function a(s){e=requestAnimationFrame(()=>{Promise.resolve().then(()=>{s();});});}function c(s){i=setTimeout(()=>{s();},0);}function u(s,f=false){switch(d(),r()){case "scheduler":o(s,f);break;case "idle":l(s,f);break;case "post-raf":a(s);break;case "timeout":c(s);break}}function d(){e!==null&&(cancelAnimationFrame(e),e=null),t!==null&&"cancelIdleCallback"in window&&(cancelIdleCallback(t),t=null),n&&(n.abort(),n=null),i!==null&&(clearTimeout(i),i=null);}return {scheduleRead:u,cancel:d}}var Ri=30,Yi=16,zi=8,zn=60,_i=30,Vi=8,Xi=Vi*2,_n=6,Zt=11,Y="caliper-",Fi="caliper-bridge-tab-id",$t="caliper-overlay-root",Vn=2147483647,Hi=["caliper-","is-","has-","js-","framer-","motion-"];function Wi(e){let t=0,n=Yi,i=[],r=null,o=null;function l(s){n=Math.ceil(1e3/(s/2));}function a(s){if(i.push(s),i.length>Ri&&i.shift(),i.length>=2){let f=i[i.length-1],m=i[0];if(f!==void 0&&m!==void 0){let y=f-m,b=i.length/y*1e3;l(b);}}}function c(){if(!o)return;let{callback:s,urgent:f}=o;o=null,t=performance.now(),e.scheduleRead(s,f);}function u(s,f=false){o={callback:s,urgent:f};let y=performance.now()-t;if(f||y>=n){r!==null&&(clearTimeout(r),r=null),c();return}r===null&&(r=setTimeout(()=>{r=null,c();},n-y));}function d(){e.cancel(),o=null,r!==null&&(clearTimeout(r),r=null);}return {scheduleRead:u,cancel:d,adaptToFrameRate:l,recordFrameTime:a}}function Qt(e,t={}){let n=t.maxFrames??zi,i=t.delay??_i,r=0,o=null;return {execute(l,...a){o&&(clearTimeout(o),o=null),l&&r<n?(r++,o=setTimeout(()=>{r=0,e(...a),o=null;},i)):(r=0,e(...a));},cancel(){o&&(clearTimeout(o),o=null),r=0;}}}function Pt(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return false;let n=e.ownerDocument?.defaultView,i=n?.HTMLElement,r=n?.SVGElement;return i&&e instanceof i||r&&e instanceof r?true:"tagName"in e&&"getAttribute"in e}function Ae(){return document.getElementById($t)||document.documentElement}function Ui(e){if(!Pt(e))return false;let t=e.tagName.toUpperCase();if(["STYLE","SCRIPT","NOSCRIPT","TEMPLATE","META","LINK","HEAD"].includes(t))return false;let n=window.getComputedStyle(e),i=n.contentVisibility||n.getPropertyValue("content-visibility");return !(n.display==="none"||i==="hidden")}function Bi(e){if(!Pt(e))return false;let t=e.getBoundingClientRect();return t.width>0&&t.height>0}function Xn(e){return e.closest("[data-caliper-ignore]")?false:Ui(e)&&Bi(e)}var Gi=2;function Fn(e){return !e||!(e instanceof Element)?false:!!(e.closest("#caliper-overlay-root")||e.closest("[class*='caliper-']"))}function Zi(e,t){return document.elementsFromPoint(e,t).find(i=>Fn(i)?false:Xn(i))||null}function qt(e,t){let n=document.elementFromPoint(e,t);return !n||Fn(n)||!Xn(n)?null:n}function Qi(e,t,n){let i=Zi(t,n);if(!i)return null;for(;i;){if(i!==e)return e.contains(i)?{context:"child",element:i}:i.contains(e)?{context:"parent",element:i}:{context:"sibling",element:i};i=i.parentElement;}return null}function qi(e,t,n){let i=Math.min(Math.abs(e-n.left),Math.abs(e-n.right)),r=Math.min(Math.abs(t-n.top),Math.abs(t-n.bottom));return Math.min(i,r)}function Ki(e,t,n,i,r=null){let o=Qi(e,t,n);if(!o)return null;let{context:l,element:a}=o;if(i&&r&&(l!==i||a!==r)){let c=r.getBoundingClientRect();if(qi(t,n,c)<=Gi&&!((l==="sibling"||l==="child")&&i==="parent"))return {context:i,element:r}}return o}function ze(e){let t=window.getComputedStyle(e);return {position:t.position,overflow:t.overflow,overflowX:t.overflowX,overflowY:t.overflowY,transform:t.transform,filter:t.filter,perspective:t.perspective,contain:t.contain,willChange:t.willChange,top:t.top,bottom:t.bottom,left:t.left,right:t.right}}function Hn(e){return new DOMRect(e.left+window.scrollX,e.top+window.scrollY,e.width,e.height)}function Wn(e){return /(auto|scroll|hidden|clip)/.test(e.overflow+e.overflowY+e.overflowX)}function Pn(e){if(!Pt(e)||e.tagName.toLowerCase()==="svg")return false;let t=ze(e);return Wn(t)}function Un(e){let t=ze(e);return /(auto|scroll|hidden)/.test(t.overflow+t.overflowY+t.overflowX)}function Ji(e){let t=[],n=e;for(;n&&(t.push(n),n!==document.documentElement);)n=n.parentElement;let i=t.length;if(i<=1)return {scrollHierarchy:[],positionMode:"static",scrollAnchor:null,containingBlock:null,treeDepth:0,anchorAbsoluteDepth:-1};let r=[];for(let s=0;s<i;s++){let f=t[s];f!==void 0&&r.push(ze(f));}let o=[];o[i-1]=false;for(let s=i-2;s>=0;s--){let f=r[s+1];o[s]=f!==void 0&&f.position==="sticky"||(o[s+1]??false);}let l=[],a="static",c=null,u=null,d=-1;for(let s=0;s<i;s++){let f=t[s];if(f===void 0||f===document.documentElement)break;if(!Pt(f))continue;let m=r[s];if(m===void 0)continue;let y=i-1-s;if(a==="static"&&(m.position==="fixed"?(a="fixed",c=f,d=y):m.position==="sticky"&&(a="sticky",c=f,d=y)),f!==e&&!u&&(m.transform!=="none"||m.filter!=="none"||m.perspective!=="none"||m.contain==="paint"||m.contain==="layout"||m.willChange==="transform"||m.willChange==="filter")&&(u=f),s>=1&&Wn(m)){let b=f;l.push({element:b,initialScrollTop:b.scrollTop,initialScrollLeft:b.scrollLeft,containerRect:Hn(b.getBoundingClientRect()),absoluteDepth:y,hasStickyAncestor:o[s]??false});}}return {scrollHierarchy:l,positionMode:a,scrollAnchor:c,containingBlock:u,treeDepth:i-1,anchorAbsoluteDepth:d}}function On(e,t,n,i,r,o){let l=t-e,a=i<0,c=Math.abs(i);if(o){let u=Math.min(l,c-r-n);return u=Math.max(u,0),u}else {let u=Math.max(l,n);if(a){let d=t+c-r-e;u=Math.min(u,d);}else u=Math.min(u,c-r);return u}}function Dt(e,t,n,i,r,o,l=false){if(i===null)return e-t;let a=On(t,n,i??-1/0,r,o,l),c=On(e,n,i??-1/0,r,o,l);return a-c}function it(e,t="static",n,i=0,r=0,o=false){let l=0,a=0,c=false;for(let u=0;u<e.length;u++){let d=e[u];if(!d)continue;let s=d.element,m=ze(s).position==="fixed";if(Un(s)){let b=n&&d.absoluteDepth>n.anchorAbsoluteDepth,x=null,g=null,h=false,w=false;!c&&t==="sticky"&&n&&!b&&(n.top!==null?g=n.top:n.bottom!==null&&(g=n.bottom,w=true),n.left!==null?x=n.left:n.right!==null&&(x=n.right,h=true)),l+=Dt(s.scrollLeft,d.initialScrollLeft,n?.naturalLeft??0,x,n?.containerWidth??0,n?.elementWidth??0,h),a+=Dt(s.scrollTop,d.initialScrollTop,n?.naturalTop??0,g,n?.containerHeight??0,n?.elementHeight??0,w),(x!==null||g!==null)&&(c=true);}if(m&&!o)return l+=i-window.scrollX,a+=r-window.scrollY,{deltaX:l,deltaY:a}}if(!o){if(t==="fixed")l+=i-window.scrollX,a+=r-window.scrollY;else if(t==="sticky"&&n&&!c){let u=i-window.scrollX,d=r-window.scrollY,s=null,f=null,m=false,y=false;n.top!==null?f=n.top:n.bottom!==null&&(f=n.bottom,y=true),n.left!==null?s=n.left:n.right!==null&&(s=n.right,m=true);let b=Dt(window.scrollX,i,n.naturalLeft,s,n.containerWidth,n.elementWidth,m),x=Dt(window.scrollY,r,n.naturalTop,f,n.containerHeight,n.elementHeight,y);l+=b+u,a+=x+d;}}return {deltaX:l,deltaY:a}}function Bn(e,t,n,i,r=0,o=0){let l=new Map;for(let x=0;x<e.length;x++){let g=e[x];g&&g.element&&l.set(g.element,x);}let a=new Map;for(let x=0;x<t.length;x++){let g=t[x];g&&g.element&&a.set(g.element,x);}let c=[];for(let x=0;x<e.length;x++){let g=e[x];g&&g.element&&a.has(g.element)&&c.push(g);}if(Pn(i)){let x=l.get(i);if(x!==void 0){let g=e[x];g&&!c.includes(g)&&c.push(g);}}if(Pn(n)){let x=a.get(n);if(x!==void 0){let g=t[x];g&&!c.includes(g)&&c.push(g);}}if(c.length===0)return {minX:-1/0,maxX:1/0,minY:-1/0,maxY:1/0};let u=-1/0,d=1/0,s=-1/0,f=1/0,m=x=>{let g=new Float64Array(x.length+1),h=new Float64Array(x.length+1);for(let w=x.length-1;w>=0;w--){let p=x[w];p&&p.element?(g[w]=(g[w+1]??0)+(p.element.scrollLeft-p.initialScrollLeft),h[w]=(h[w+1]??0)+(p.element.scrollTop-p.initialScrollTop)):p&&(g[w]=g[w+1]??0,h[w]=h[w+1]??0);}return {sumsX:g,sumsY:h}},y=m(e),b=m(t);for(let x=0;x<c.length;x++){let g=c[x];if(!g||!g.element)continue;let h=l.has(g.element),w=h?y:b,p=h?l.get(g.element):a.get(g.element);if(p===void 0||p===-1)continue;let k=g.containerRect;if(!k)continue;let L=w.sumsX[p+1]??0,M=w.sumsY[p+1]??0,E=0,N=0,v;if(typeof g.hasStickyAncestor=="boolean")v=g.hasStickyAncestor;else if(g.element){let q=g.element;for(v=false;q&&q!==document.documentElement;){let se=ze(q);if(se.position==="sticky"){v=true;break}if(se.position==="fixed")break;q=q.parentElement;}}else v=false;v&&(E=window.scrollX-r,N=window.scrollY-o);let I=k.left-L+E,$=k.top-M+N,P=I+(g.element?.clientLeft??0),z=$+(g.element?.clientTop??0),H=P+(g.element?.clientWidth??k.width),te=z+(g.element?.clientHeight??k.height);u===-1/0?(u=P,d=H,s=z,f=te):(u=Math.max(u,P),d=Math.min(d,H),s=Math.max(s,z),f=Math.min(f,te));}return {minX:u,maxX:d,minY:s,maxY:f}}function ce(e,t,n="static",i,r=0,o=0,l=false){if(!e)return null;let{deltaX:a,deltaY:c}=it(t,n,i,r,o,l),u=-1/0,d=1/0,s=-1/0,f=1/0,m=t.length,y=new Float64Array(m+1),b=new Float64Array(m+1);for(let N=m-1;N>=0;N--){let v=t[N];v&&v.element?(y[N]=(y[N+1]??0)+(v.element.scrollLeft-v.initialScrollLeft),b[N]=(b[N+1]??0)+(v.element.scrollTop-v.initialScrollTop)):v&&(y[N]=y[N+1]??0,b[N]=b[N+1]??0);}for(let N=0;N<m;N++){let v=t[N];if(!v)continue;let I=v.containerRect;if(!I)continue;let $=y[N+1]??0,P=b[N+1]??0,z=0,H=0,te;if(typeof v.hasStickyAncestor=="boolean")te=v.hasStickyAncestor;else if(v.element){let ie=v.element;for(te=false;ie&&ie!==document.documentElement;){let ge=ze(ie);if(ge.position==="sticky"){te=true;break}if(ge.position==="fixed")break;ie=ie.parentElement;}}else te=false;te&&(z=window.scrollX-r,H=window.scrollY-o);let q=I.left-$+z,se=I.top-P+H,ee=q+(v.element?.clientLeft??0),re=se+(v.element?.clientTop??0);u===-1/0?(u=ee,d=ee+(v.element?.clientWidth??I.width),s=re,f=re+(v.element?.clientHeight??I.height)):(u=Math.max(u,ee),d=Math.min(d,ee+(v.element?.clientWidth??I.width)),s=Math.max(s,re),f=Math.min(f,re+(v.element?.clientHeight??I.height)));}let x=e.left-a,g=e.top-c,h=e.width,w=e.height,p=u!==-1/0&&(g+w<s||g>f||x+h<u||x>d),k=Math.max(0,s-g),L=Math.max(0,u-x),M=Math.max(0,g+w-f),E=Math.max(0,x+h-d);return {left:x,top:g,width:h,height:w,clipPath:u===-1/0?"none":`inset(${k}px ${E}px ${M}px ${L}px)`,isHidden:p,visibleMinX:u,visibleMaxX:d,visibleMinY:s,visibleMaxY:f}}function At(e){if(e==="auto")return null;let t=parseFloat(e);return isNaN(t)?null:t}function gt(e){let t=0,n=0,i=e;for(;i instanceof HTMLElement;){t+=i.offsetTop,n+=i.offsetLeft;let r=i.offsetParent;r instanceof HTMLElement&&(t+=r.clientTop||0,n+=r.clientLeft||0),i=r;}return {top:t,left:n}}function Ut(e,t){let n=[],i=e;for(;i&&(i instanceof HTMLElement&&ze(i).position==="sticky"&&n.push({element:i,originalPosition:i.style.position}),!(i===t||i===document.documentElement));)i=i.parentElement;return n}function eo(e,t){let n=Ut(e,t);for(let{element:i}of n)i.style.position="static";try{let i=gt(e),r=gt(t);return {offsetX:i.left-r.left,offsetY:i.top-r.top}}finally{for(let{element:i,originalPosition:r}of n)i.style.position=r||"sticky";}}function to(e,t,n){let i=new Set,r=[];for(let{element:o,originalPosition:l}of Ut(e,t))i.has(o)||(i.add(o),r.push({element:o,originalPosition:l}));if(n&&n!==e)for(let{element:o,originalPosition:l}of Ut(n,t))i.has(o)||(i.add(o),r.push({element:o,originalPosition:l}));for(let{element:o}of r)o.style.position="static";try{let o=gt(t),l=gt(e),a={offsetX:l.left-o.left,offsetY:l.top-o.top},c=null;if(n&&n!==t){let u=gt(n);c={offsetX:u.left-o.left,offsetY:u.top-o.top};}return {naturalPosition:a,cappingNaturalPosition:c}}finally{for(let{element:o,originalPosition:l}of r)o.style.position=l||"sticky";}}function Bt(e){let t=e.getBoundingClientRect(),n=window.scrollX,i=window.scrollY,{scrollHierarchy:r,positionMode:o,scrollAnchor:l,containingBlock:a,treeDepth:c,anchorAbsoluteDepth:u}=Ji(e),d;if(o==="sticky"&&l){let s=ze(l),f=document.documentElement,m=l.parentElement;for(;m&&m!==document.documentElement;){if(Un(m)){f=m;break}m=m.parentElement;}let y=l.parentElement||document.documentElement,b=y===document.documentElement||y===document.body,g=(y instanceof HTMLElement?ze(y):null)?.position==="sticky",h=l.getBoundingClientRect(),w=t.top-h.top,p=t.left-h.left,k=h.bottom-t.bottom,L=h.right-t.right,M=At(s.top),E=At(s.bottom),N=At(s.left),v=At(s.right),I=!b&&y!==f&&!g,$,P=null;if(I){let q=to(l,f,y);$=q.naturalPosition,P=q.cappingNaturalPosition;}else $=eo(l,f);let z,H,te=f===document.documentElement;if(b)z=window.innerHeight,H=window.innerWidth;else if(y===f||g)z=f.clientHeight,H=f.clientWidth;else if(te&&P){let q=y.clientHeight,se=y.clientWidth,ee=P.offsetY+q-$.offsetY,re=P.offsetX+se-$.offsetX;z=-ee,H=-re;}else if(P){let q=f.clientHeight,se=f.clientWidth,ee=y.clientHeight,re=y.clientWidth,ie=P.offsetY+ee-$.offsetY,ge=P.offsetX+re-$.offsetX;z=ie<q?-ie:q,H=ge<se?-ge:se;}else z=f.clientHeight,H=f.clientWidth;d={top:M===null?null:M+w,bottom:E===null?null:E+k,left:N===null?null:N+p,right:v===null?null:v+L,naturalTop:$.offsetY+w,naturalLeft:$.offsetX+p,containerWidth:H,containerHeight:z,elementWidth:h.width,elementHeight:h.height,anchorAbsoluteDepth:u};}return {rect:Hn(t),scrollHierarchy:r,position:o,stickyConfig:d,initialWindowX:n,initialWindowY:i,depth:c,hasContainingBlock:!!a,containingBlock:a}}function ot(e,t,n){return t?{x:Math.max(t.visibleMinX-n.scrollX,Math.min(e.x,t.visibleMaxX-n.scrollX)),y:Math.max(t.visibleMinY-n.scrollY,Math.min(e.y,t.visibleMaxY-n.scrollY))}:e}function Gt(e,t,n){if(!e||!n)return [];let i=[];if(e==="sibling"){let r=no(t,n);i.push(r);}else if(e==="parent"||e==="child"){let r=io(t,n,e);i.push(...r);}return i}function no(e,t){let n=Math.max(e.left,t.left),i=Math.min(e.right,t.right),r=i>n,o=Math.max(e.top,t.top),l=Math.min(e.bottom,t.bottom),a=l>o,c={startSync:"primary",endSync:"secondary"};if(r&&!a){let x=(n+i)/2,g=Math.abs(t.top-e.bottom),h=Math.abs(e.top-t.bottom),w=g<h?e.bottom:e.top,p=g<h?t.top:t.bottom;return {type:"distance",value:Math.min(g,h),start:{x,y:w},end:{x,y:p},...c}}if(a&&!r){let x=(o+l)/2,g=Math.abs(t.left-e.right),h=Math.abs(e.left-t.right),w=g<h?e.right:e.left,p=g<h?t.left:t.right;return {type:"distance",value:Math.min(g,h),start:{x:w,y:x},end:{x:p,y:x},...c}}let u=[{x:(e.left+e.right)/2,y:e.top},{x:(e.left+e.right)/2,y:e.bottom}],d=[{x:(t.left+t.right)/2,y:t.top},{x:(t.left+t.right)/2,y:t.bottom}],s=1/0,f=u[0],m=d[0];for(let x of u)for(let g of d){let h=x.x-g.x,w=x.y-g.y,p=h*h+w*w;p<s&&(s=p,f=x,m=g);}let y=f??u[0],b=m??d[0];return {type:"distance",value:Math.sqrt(s),start:{x:y.x,y:y.y},end:{x:b.x,y:b.y},...c}}function io(e,t,n){return n==="parent"?[{type:"left",value:Math.abs(e.left-t.left),start:{x:t.left,y:e.top+e.height/2},end:{x:e.left,y:e.top+e.height/2},startSync:"secondary",endSync:"primary"},{type:"top",value:Math.abs(e.top-t.top),start:{x:e.left+e.width/2,y:t.top},end:{x:e.left+e.width/2,y:e.top},startSync:"secondary",endSync:"primary"},{type:"right",value:Math.abs(t.right-e.right),start:{x:e.right,y:e.top+e.height/2},end:{x:t.right,y:e.top+e.height/2},startSync:"primary",endSync:"secondary"},{type:"bottom",value:Math.abs(t.bottom-e.bottom),start:{x:e.left+e.width/2,y:e.bottom},end:{x:e.left+e.width/2,y:t.bottom},startSync:"primary",endSync:"secondary"}]:[{type:"left",value:Math.abs(t.left-e.left),start:{x:e.left,y:t.top+t.height/2},end:{x:t.left,y:t.top+t.height/2},startSync:"primary",endSync:"secondary"},{type:"top",value:Math.abs(t.top-e.top),start:{x:t.left+t.width/2,y:e.top},end:{x:t.left+t.width/2,y:t.top},startSync:"primary",endSync:"secondary"},{type:"right",value:Math.abs(e.right-t.right),start:{x:t.right,y:t.top+t.height/2},end:{x:e.right,y:t.top+t.height/2},startSync:"secondary",endSync:"primary"},{type:"bottom",value:Math.abs(e.bottom-t.bottom),start:{x:t.left+t.width/2,y:t.bottom},end:{x:t.left+t.width/2,y:e.bottom},startSync:"secondary",endSync:"primary"}]}function We(e,t,n,i,r,o=0,l=0){let a=t==="secondary"?r:i,c=t==="secondary"?r:i;return {x:e.x-(a?.deltaX??0)-o,y:e.y-(c?.deltaY??0)-l}}function Kt(e,t){if(!t)return e.value;let n=it(t.primaryHierarchy,t.primaryPosition,t.primarySticky,t.primaryWinX,t.primaryWinY,!!t.primaryHasContainingBlock),i=it(t.secondaryHierarchy,t.secondaryPosition,t.secondarySticky,t.secondaryWinX,t.secondaryWinY,!!t.secondaryHasContainingBlock),r=We(e.start,e.startSync,e,n,i),o=We(e.end,e.endSync,e,n,i),l=Math.abs(r.x-o.x),a=Math.abs(r.y-o.y);return e.type==="top"||e.type==="bottom"?a:e.type==="left"||e.type==="right"?l:Math.sqrt(l*l+a*a)}function oo(e,t,n,i=null,r=null){let o=Ki(e,t,n,i,r);if(!o)return null;let{context:l,element:a}=o;return ro(e,a,l)}function ro(e,t,n){if(t===e)return null;let i=n??(e.contains(t)?"child":t.contains(e)?"parent":"sibling"),r=Bt(e),o=Bt(t),l=r.rect,a=o.rect,c=Gt(i,l,a);return {element:t,result:{context:i,lines:c,primary:l,secondary:a,timestamp:Date.now(),primaryHierarchy:r.scrollHierarchy,secondaryHierarchy:o.scrollHierarchy,secondaryElement:t,primaryPosition:r.position,secondaryPosition:o.position,primarySticky:r.stickyConfig,secondarySticky:o.stickyConfig,primaryWinX:r.initialWindowX,primaryWinY:r.initialWindowY,secondaryWinX:o.initialWindowX,secondaryWinY:o.initialWindowY}}}function lo(){let e="IDLE";function t(){return e}function n(a){let u={IDLE:["ARMED","FROZEN"],ARMED:["MEASURING","FROZEN","IDLE"],MEASURING:["FROZEN","IDLE"],FROZEN:["MEASURING","IDLE"]}[e];return u&&u.includes(a)?(e=a,true):false}function i(){return e==="IDLE"}function r(){return e==="ARMED"}function o(){return e==="MEASURING"}function l(){return e==="FROZEN"}return {getState:t,transitionTo:n,isIdle:i,isArmed:r,isMeasuring:o,isFrozen:l}}function ao(){let e={baseValue:0,operation:null,inputValue:"",result:null,isActive:false};function t(){let r=e.inputValue===""?"0":e.inputValue,o=parseFloat(r);if(isNaN(o))return null;switch(e.operation){case "+":return e.baseValue+o;case "-":return e.baseValue-o;case "*":return e.baseValue*o;case "/":return o!==0?e.baseValue/o:null;default:return null}}function n(r){switch(r.type){case "OPEN":e={baseValue:r.baseValue,operation:null,inputValue:"",result:null,isActive:true};break;case "SYNC_VALUE":e.isActive&&e.operation===null&&(e={...e,baseValue:r.value});break;case "INPUT_DIGIT":if(!e.isActive||!e.operation)return e;let o=r.digit===".",l=(e.inputValue||"").includes(".");if(o&&l)return e;e.result!==null?e={...e,inputValue:o?"0.":r.digit,result:null}:e={...e,inputValue:e.inputValue==="0"&&!o?r.digit:e.inputValue+r.digit};break;case "INPUT_OPERATION":if(!e.isActive)return e;let a=e.result!==null,c=e.inputValue===""||e.inputValue==="0";a||e.operation&&!c?e={baseValue:a?e.result:t()??e.baseValue,operation:r.operation,inputValue:"",result:null,isActive:true}:e={...e,operation:r.operation,inputValue:"",result:null};break;case "BACKSPACE":if(!e.isActive)return e;e.result!==null?e={...e,result:null}:e.inputValue.length>0?e={...e,inputValue:e.inputValue.slice(0,-1)}:e.operation?e={...e,operation:null}:e={...e,isActive:false};break;case "DELETE":if(!e.isActive)return e;e={baseValue:e.baseValue,operation:null,inputValue:"",result:null,isActive:false};break;case "ENTER":if(!e.isActive||!e.operation)return e;let u=t();e={...e,result:u};break;case "CLOSE":e={baseValue:0,operation:null,inputValue:"",result:null,isActive:false};break}return e}function i(){return {...e}}return {getState:i,dispatch:n,calculate:t}}function so(){let e=ao();function t(u){e.dispatch({type:"OPEN",baseValue:u});}function n(u){/^[0-9.]$/.test(u)?e.dispatch({type:"INPUT_DIGIT",digit:u}):/^[+\-*/]$/.test(u)&&e.dispatch({type:"INPUT_OPERATION",operation:u});}function i(){e.dispatch({type:"BACKSPACE"});}function r(){e.dispatch({type:"DELETE"});}function o(){e.dispatch({type:"ENTER"});}function l(){e.dispatch({type:"CLOSE"});}function a(u){e.dispatch({type:"SYNC_VALUE",value:u});}function c(){return e.getState().result}return {getState:e.getState,open:t,handleInput:n,handleBackspace:i,handleDelete:r,handleEnter:o,close:l,syncValue:a,getResult:c}}function co(){let e={direction:null,value:"",element:null},t=new Set,n=()=>{t.forEach(i=>i({...e}));};return {getState:()=>({...e}),setDirection:i=>{e.direction=i,n();},setElement:i=>{e.element=i,n();},appendValue:(i,r)=>{if(/^[0-9.]$/.test(i)){let o=i===".",l=e.value.includes(".");if(o&&l)return;let a=e.value+i,c=parseFloat(a)||0;r!==void 0&&c>r?e.value=Math.floor(r).toString():e.value=a,n();}},capValue:i=>{(parseFloat(e.value)||0)>i&&(e.value=Math.floor(i).toString(),n());},backspace:()=>{e.value.length>0?(e.value=e.value.slice(0,-1),n()):e.direction&&(e.direction=null,n());},clear:()=>{e={direction:null,value:"",element:null},n();},onUpdate:i=>(t.add(i),()=>t.delete(i))}}function yt(e=""){let t=Math.random().toString(36).substring(2,11);return e?`${e}-${t}`:t}function uo(){let e={lines:[]},t=new Set,n=()=>{t.forEach(i=>i({lines:[...e.lines]}));};return {getState:()=>({lines:[...e.lines]}),addPair:(i,r)=>{if(e.lines.length>=Xi)return null;let o={id:yt("ruler-h"),type:"horizontal",position:r},l={id:yt("ruler-v"),type:"vertical",position:i};return e.lines.push(o,l),n(),l.id},updateLine:(i,r)=>{let o=e.lines.findIndex(l=>l.id===i);o!==-1&&e.lines[o]&&(e.lines[o]={...e.lines[o],position:r},n());},removeLine:i=>{e.lines=e.lines.filter(r=>r.id!==i),n();},clear:()=>{e.lines=[],n();},onUpdate:i=>(t.add(i),()=>t.delete(i))}}function Gn(){let e=Oi(),t=Wi(e),n=lo(),i=so(),r=co(),o=uo(),l=new Set,a=null,c=null,u=null;function d(){l.forEach(I=>I());}function s(I,$){n.transitionTo("ARMED"),t.scheduleRead(()=>{performance.now();let z=oo(I,$.x,$.y,c,u);if(z){let{result:H,element:te}=z;if(!n.isMeasuring()&&!n.isArmed()||n.isMeasuring()&&te===u&&H.context===c)return;a=H,c=H.context,u=te,n.transitionTo("MEASURING"),d();}});}function f(){let I=n.getState();(I==="MEASURING"||I==="IDLE"||I==="ARMED")&&(t.cancel(),n.transitionTo("FROZEN"),d());}function m(I){n.isFrozen()&&(n.transitionTo(I?"MEASURING":"IDLE"),d());}function y(){t.cancel(),n.transitionTo("IDLE"),i.close(),r.clear(),o.clear(),a=null,c=null,u=null,d();}function b(){t.cancel(),n.getState()==="MEASURING"&&(n.transitionTo("IDLE"),d());}function x(){y(),l.clear(),a=null,c=null,u=null;}function g(){return n.getState()}function h(){return a}function w(){return u}function p(){return i}function k(){return r}function L(){return o}function M(I){return l.add(I),()=>{l.delete(I);}}function E(I){if(!a)return;let $=new DOMRect(I.left+window.scrollX,I.top+window.scrollY,I.width,I.height);a={...a,primary:$,primaryWinX:window.scrollX,primaryWinY:window.scrollY,lines:Gt(a.context,$,a.secondary)},d();}function N(I){if(!a)return;let $=new DOMRect(I.left+window.scrollX,I.top+window.scrollY,I.width,I.height);a={...a,secondary:$,secondaryWinX:window.scrollX,secondaryWinY:window.scrollY,lines:Gt(a.context,a.primary,$)},d();}function v(I){a=I,n.transitionTo("MEASURING"),d();}return {measure:s,abort:y,stop:b,freeze:f,unfreeze:m,cleanup:x,getState:g,getCurrentResult:h,getSecondaryElement:w,getCalculator:p,getProjection:k,getRuler:L,onStateChange:M,updatePrimaryRect:E,updateSecondaryRect:N,applyResult:v}}async function fo(e){return new Promise((t,n)=>{if(typeof requestAnimationFrame>"u"||typeof document<"u"&&document.hidden){setTimeout(()=>{try{t(e());}catch(i){n(i);}},0);return}requestAnimationFrame(()=>{Promise.resolve().then(()=>{try{t(e());}catch(i){n(i);}});});})}function Zn(){let e=null,t=null,n=[],i="static",r,o=0,l=0,a=0,c=new Set;function u(){return {element:e,rect:t,scrollHierarchy:n,position:i,stickyConfig:r,initialWindowX:o,initialWindowY:l,depth:a}}function d(){let g=u();c.forEach(h=>h(g));}function s(g){e===g&&(g!==null||t===null)||(e=g,g?fo(()=>{if(e===g&&document.contains(g)){let h=Bt(g);t=h.rect,n=h.scrollHierarchy,i=h.position,r=h.stickyConfig,o=h.initialWindowX,l=h.initialWindowY,a=h.depth,d();}}):(t=null,n=[],i="static",r=void 0,o=0,l=0,a=0,d()));}function f(){return e}function m(){return t}function y(){s(null);}function b(g){return c.add(g),()=>{c.delete(g);}}function x(g){e&&(t=new DOMRect(g.left+window.scrollX,g.top+window.scrollY,g.width,g.height),o=window.scrollX,l=window.scrollY,d());}return {select:s,getSelected:f,getSelectedRect:m,getMetadata:u,clear:y,onUpdate:b,updateRect:x}}var Qn=typeof window<"u";function ho(){if(!Qn)return "other";let e=navigator.userAgentData?.platform;if(e)switch(e){case "macOS":return "macos";case "iOS":return "ios";case "Windows":return "windows";case "Android":return "android";case "Linux":return "linux"}let t=navigator.userAgent;return /iPhone|iPad|iPod/.test(t)?"ios":/Macintosh/.test(t)?"macos":/Windows/.test(t)?"windows":/Android/.test(t)?"android":/Linux/.test(t)?"linux":"other"}var pt=ho(),Rn=pt==="macos"||pt==="ios",mo={IS_BROWSER:Qn,NAME:pt,IS_MAC:pt==="macos",IS_IOS:pt==="ios",IS_APPLE:Rn,getControlKey:()=>Rn?"Meta":"Control"},he={activate:"Alt",freeze:" ",select:mo.getControlKey(),clear:"Escape",calculator:{top:"t",right:"r",bottom:"b",left:"l",distance:"g"},projection:{top:"w",left:"a",bottom:"s",right:"d"},ruler:"r",selectionHoldDuration:250},ae={primary:"rgba(24, 160, 251, 1)",secondary:"rgba(242, 78, 30, 1)",calcBg:"rgba(30, 30, 30, 0.95)",calcShadow:"rgba(0, 0, 0, 0.25)",calcOpHighlight:"rgba(24, 160, 251, 0.3)",calcText:"rgba(255, 255, 255, 1)",text:"rgba(255, 255, 255, 1)",projection:"rgba(155, 81, 224, 1)",ruler:"rgba(24, 160, 251, 1)"},Yn={enabled:true,lerpFactor:.25};function qn(e,t){if(e==null||e==="")return t;let n=Number(e);return isFinite(n)&&!isNaN(n)?n:t}function He(e,t){if(e.startsWith("#")){let n=e.slice(1);n.length===3&&(n=n.split("").map(l=>l+l).join(""));let i=parseInt(n.slice(0,2),16),r=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return `rgba(${i}, ${r}, ${o}, ${t})`}return e.startsWith("rgba")?e.replace(/[\d.]+\)$/g,`${t})`):e.startsWith("rgb")?e.replace(")",`, ${t})`).replace("rgb","rgba"):e}function Kn(e,t=document.documentElement){if(!e||!t)return;let n=t;e.primary&&(n.style.setProperty("--caliper-primary",e.primary),n.style.setProperty("--caliper-primary-90",He(e.primary,.9)),n.style.setProperty("--caliper-primary-95",He(e.primary,.95)),n.style.setProperty("--caliper-primary-50",He(e.primary,.5)),n.style.setProperty("--caliper-primary-05",He(e.primary,.05))),e.secondary&&(n.style.setProperty("--caliper-secondary",e.secondary),n.style.setProperty("--caliper-secondary-50",He(e.secondary,.5)),n.style.setProperty("--caliper-secondary-05",He(e.secondary,.05))),e.calcBg&&n.style.setProperty("--caliper-calc-bg",e.calcBg),e.calcShadow&&n.style.setProperty("--caliper-calc-shadow",e.calcShadow),e.calcOpHighlight&&n.style.setProperty("--caliper-calc-op-highlight",e.calcOpHighlight),e.calcText&&n.style.setProperty("--caliper-calc-text",e.calcText),e.text&&n.style.setProperty("--caliper-text",e.text),e.projection&&(n.style.setProperty("--caliper-projection",e.projection),n.style.setProperty("--caliper-projection-90",He(e.projection,.9)),n.style.setProperty("--caliper-projection-light",He(e.projection,.2))),e.ruler&&n.style.setProperty("--caliper-ruler",e.ruler);}function Jn(e){return {activate:e?.activate??he.activate,freeze:e?.freeze??he.freeze,select:e?.select??he.select,clear:e?.clear??he.clear,calculator:{top:e?.calculator?.top??he.calculator.top,right:e?.calculator?.right??he.calculator.right,bottom:e?.calculator?.bottom??he.calculator.bottom,left:e?.calculator?.left??he.calculator.left,distance:e?.calculator?.distance??he.calculator.distance},projection:{top:e?.projection?.top??he.projection.top,left:e?.projection?.left??he.projection.left,bottom:e?.projection?.bottom??he.projection.bottom,right:e?.projection?.right??he.projection.right},ruler:e?.ruler??he.ruler,selectionHoldDuration:qn(e?.selectionHoldDuration,he.selectionHoldDuration)}}function ei(e){return {enabled:e?.enabled??Yn.enabled,lerpFactor:qn(e?.lerpFactor,Yn.lerpFactor)}}function ti(e){return {primary:e?.primary??ae.primary,secondary:e?.secondary??ae.secondary,calcBg:e?.calcBg??ae.calcBg,calcShadow:e?.calcShadow??ae.calcShadow,calcOpHighlight:e?.calcOpHighlight??ae.calcOpHighlight,calcText:e?.calcText??ae.calcText,text:e?.text??ae.text,projection:e?.projection??ae.projection,ruler:e?.ruler??ae.ruler}}function ni(){if(typeof window<"u"){let e=window.__CALIPER_CONFIG__??{},n=(typeof document<"u"?document.currentScript:null)?.getAttribute("data-config")||(typeof document<"u"?document.querySelector("script[data-config]")?.getAttribute("data-config"):null);if(n)try{let i=JSON.parse(n);return {...e,...i,theme:{...e.theme,...i.theme},commands:{...e.commands,...i.commands},animation:{...e.animation,...i.animation},bridge:{...e.bridge,...i.bridge}}}catch(i){console.warn("[CALIPER] Failed to parse data-config attribute",i);}return e}return {}}var go="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTcyIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgMTcyIDUwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQ3LjIxNDQgNy42MjkzOWUtMDZIMzIuNzkyOEwyNS44MjUgNDMuMzIyNUgzNS4wNjEzTDM2LjE5NTYgMzUuMDE2M0g0NC4xMzU2TDQ1LjI2OTkgNDMuMzIyNUg1NC42NjgzTDQ3LjIxNDQgNy42MjkzOWUtMDZaTTM5LjU5ODUgOC4zMDYySDQwLjczMjhMNDQuMTM1NiAyOC4xNzU5SDM2LjE5NTZMMzkuNTk4NSA4LjMwNjJaIiBmaWxsPSIjQUMyMzIzIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNS4wMjMyOCAwTDAgNS4wNDg4NlYyOC4zMzg4TDUuMTg1MzIgMzMuMzg3NkgxNy41MDA0VjM1LjM0MkgxNS41NTZWNDYuNzQyN0gxOS4xMjA5TDI0LjMwNjIgMzUuNjY3OFYyNS44OTU4SDcuMTI5ODFWNy4zMjg5OUgxMy40NDk0VjBINS4wMjMyOFoiIGZpbGw9IiNBQzIzMjMiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02Ni40OTc0IDcuNjI5MzllLTA2SDU3LjI2MVY0LjM5NzRINjIuNDQ2M1Y1LjIxMTczSDU3LjI2MVY2LjY3NzU0SDYwLjE3NzdWNy4zMjg5OUg1Ny4yNjFWOC45NTc2Nkg2MC4xNzc3VjkuNjA5MTNINTcuMjYxVjExLjA3NDlINjAuMTc3N1YxMS43MjY0SDU3LjI2MVYxMy4xOTIySDYyLjQ0NjNWMTMuODQzN0g1Ny4yNjFWMTUuNDcyM0g2MC4xNzc3VjE2LjEyMzhINTcuMjYxVjE3LjU4OTZINjAuMTc3N1YxOC4yNDExSDU3LjI2MVYxOS44Njk3SDYwLjE3NzdWMjAuNTIxMkg1Ny4yNjFWMjEuODI0MUg2Mi40NDYzVjIyLjYzODRINTcuMjYxVjI0LjI2NzFINjAuMTc3N1YyNC43NTU3SDU3LjI2MVYyNi4zODQ0SDYwLjE3NzdWMjcuMDM1OEg1Ny4yNjFWMjguNTAxNkg2MC4xNzc3VjI5LjE1MzFINTcuMjYxVjMwLjYxODlINjIuNDQ2M1YzMS40MzMySDU3LjI2MVYzMi44OTlINjAuMTc3N1YzMy41NTA1SDU3LjI2MVYzNS4wMTYzSDYwLjE3NzdWMzUuODMwNkg1Ny4yNjFWMzcuMjk2NEg2MC4xNzc3VjM3Ljk0NzlINTcuMjYxVjM5LjQxMzdINjIuNDQ2M1Y0MC4yMjhINTcuMjYxVjQzLjMyMjVINzcuODQwMlYzNS4wMTYzSDY2LjQ5NzRWNy42MjkzOWUtMDZaIiBmaWxsPSIjQUMyMzIzIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNzcuODQwMiAyNy42ODczSDY3LjQ2OTZMNjkuNDE0MSAzMC42MTg5TDc5Ljc4NDcgMzQuMjAyVjQzLjk3MzlDNzcuNTQzOSA0NC4zNzMgNzYuNTQzOSA0NS4yNzY5IDc2LjU0MzkgNDcuMDY4NEM3Ni41NDM5IDQ5LjE4NTcgNzcuNTc4IDQ5Ljg1MjEgNzkuNzg0NyA1MEg4Mi44NjM1VjI4LjUwMTZINzcuODQwMlYyNy42ODczWiIgZmlsbD0iI0FDMjMyMyIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTg5Ljk5MzMgNy42MjkzOWUtMDZIODAuNzU3VjQuMzk3NEg4NS43ODAzVjUuMjExNzNIODAuNzU3VjYuNjc3NTRIODMuNTExN1Y3LjMyODk5SDgwLjc1N1Y4Ljk1NzY2SDgzLjUxMTdWOS40NDYyNkg4MC43NTdWMTEuMDc0OUg4My41MTE3VjExLjcyNjRIODAuNzU3VjEzLjE5MjJIODUuNzgwM1YxMy44NDM3SDgwLjc1N1YxNS40NzIzSDgzLjUxMTdWMTYuMTIzOEg4MC43NTdWMTcuNTg5Nkg4My41MTE3VjE4LjI0MTFIODAuNzU3VjE5Ljg2OTdIODMuNTExN1YyMC41MjEySDgwLjc1N1YyMS44MjQxSDg1Ljc4MDNWMjIuNjM4NEg4MC43NTdWMjcuMDM1OEg4My44MzU4VjQzLjMyMjVIODcuMjM4NlYxMi4zNzc5SDkyLjI2MTlWOS40NDYyNkg5My4wNzIxVjEwLjA5NzdIOTkuNzE1OEM5OC45MDU2IDguNzk0NzkgOTcuMTIzMSA3LjY1NDczIDk0Ljg1NDYgNy4wMDMyN0g4OS45OTMzVjcuNjI5MzllLTA2WiIgZmlsbD0iI0FDMjMyMyIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTkyLjI2MTkgMTMuODQzN0g4OC4wNDg4VjQzLjMyMjVIOTIuMjYxOVYyOC41MDE2SDkzLjA3MjFWMjkuMzE2SDk0Ljg1NDZWMjUuNTdIOTMuMDcyMVYyNi4zODQ0SDkyLjI2MTlWMTMuODQzN1oiIGZpbGw9IiNBQzIzMjMiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik05NS42NjQ4IDYuMzUxOFY3LjYyOTM5ZS0wNkgxMTMuMDAzTDExOS42NDcgNi4zNTE4VjIxLjgyNDFMMTEzLjAwMyAyOC41MDE2SDEwNC45MDFMMTA0LjczOSA0My4zMjI1SDk1LjY2NDhWMTEuMDc0OUgxMDAuODVDMTAwLjUyNiA4LjYzMTkzIDk4LjkwNTYgNy4zMjkgOTUuNjY0OCA2LjM1MThaTTEwNC45MDEgNy45ODA0NkgxMTAuNTczVjIwLjUyMTJIMTA0LjkwMVY3Ljk4MDQ2WiIgZmlsbD0iI0FDMjMyMyIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE0My4zMDUgNy42MjkzOWUtMDZIMTIzLjIxMlY0My4zMjI1SDE0My4zMDVWMzUuMDE2M0gxMzIuNDQ4VjI0LjQzSDE0MS42ODVWMTYuMTIzOEgxMzIuNDQ4VjcuOTgwNDZIMTQzLjMwNVY3LjYyOTM5ZS0wNloiIGZpbGw9IiNBQzIzMjMiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNDcuMTk0IDQzLjMyMjVWNy42MjkzOWUtMDZIMTY1LjE4TDE3MS41IDUuODYzMlYxNi45MzgxTDE2Ni4xNTMgMjEuODI0MUwxNzEuNSAyNS41N1Y0My4zMjI1SDE2Mi40MjZWMjUuNTdIMTU2LjI2OFY0My4zMjI1SDE0Ny4xOTRaTTE1Ni4yNjggNy45ODA0NkgxNjIuNDI2VjE3LjU4OTZIMTU2LjI2OFY3Ljk4MDQ2WiIgZmlsbD0iI0FDMjMyMyIvPgo8L3N2Zz4K";async function po(){try{let t=await fetch("https://unpkg.com/@oyerinde/caliper@latest/dist/version.json",{method:"GET",cache:"no-store",headers:{Accept:"application/json"},signal:AbortSignal.timeout(3e3)});if(t.ok)return await t.json()}catch{}return null}function yo(e,t){let n=e.split(".").map(Number),i=t.split(".").map(Number);for(let r=0;r<Math.max(n.length,i.length);r++){let o=n[r]||0,l=i[r]||0;if(o<l)return -1;if(o>l)return 1}return 0}async function ii(e){if(typeof window>"u")return;let t=`
12
+ font-size: 1px;
13
+ padding: 10px 34px;
14
+ background-image: url('${go}');
15
+ background-size: contain;
16
+ background-repeat: no-repeat;
17
+ background-position: center;
18
+ `;console.log("%c ",t),console.log(`%cMeasurement Tool v${e}
19
+ %cDocs -> https://caliper.danieloyerinde.com`,"color: #3b82f6; font-weight: bold; font-family: monospace; padding-top: 5px;","color: #6b7280; font-family: monospace;"),po().then(n=>{if(!n)return;yo(e,n.version)<0&&console.log(`%c\u26A0 Update available: ${n.version} (you're on ${e})`,"color: #f59e0b; font-weight: bold; font-family: monospace;");}).catch(()=>{});}function jt(e,t,n){return e+(t-e)*n}function oi(e,t,n){return {left:jt(e.left,t.left,n),top:jt(e.top,t.top,n),width:jt(e.width,t.width,n),height:jt(e.height,t.height,n)}}function wo(e,t=100){let n="",i=e.childNodes;for(let o=0;o<i.length;o++){let l=i[o];l?.nodeType===Node.TEXT_NODE&&(n+=l.textContent||"");}let r=n.trim().replace(/\s+/g," ");if(r)return r.length>t?r.slice(0,t):r}function vo(e){return Array.from(e).filter(n=>!Hi.some(i=>n.startsWith(i)))}function Ot(e,t){let n=e.tagName.toLowerCase(),i=e.getAttribute("data-caliper-agent-id");i||(i=yt("caliper"),e.setAttribute("data-caliper-agent-id",i));let r=e.id,o=wo(e),l=vo(e.classList),a=e.parentElement,c=-1;a&&(c=Array.from(a.children).indexOf(e));let u=e.getAttribute("data-caliper-marker")||void 0,d,s;if(t?.rect)d=Math.round(t.rect.left),s=Math.round(t.rect.top);else {let y=e.getBoundingClientRect();d=Math.round(y.left+(typeof window<"u"?window.scrollX:0)),s=Math.round(y.top+(typeof window<"u"?window.scrollY:0));}let f={selector:i,tag:n,timestamp:Date.now(),nthChild:c!==-1?c:void 0,x:d,y:s,marker:u};t?.scrollHierarchy&&(f.scrollHierarchy=t.scrollHierarchy.map(y=>{let{element:b,...x}=y;return x})),t?.position&&(f.position=t.position),t?.stickyConfig&&(f.stickyConfig=t.stickyConfig),t?.initialWindowX!==void 0&&(f.initialWindowX=t.initialWindowX),t?.initialWindowY!==void 0&&(f.initialWindowY=t.initialWindowY),t?.hasContainingBlock!==void 0&&(f.hasContainingBlock=t.hasContainingBlock),t?.rect&&(f.rect=t.rect),r&&(f.id=r),o&&(f.text=o),l.length>0&&(f.classes=l);let m=typeof sessionStorage<"u"?sessionStorage.getItem(Fi):null;return m&&(f.tabId=m),f}var nt=true,xo=class{prefix;constructor(e={}){this.prefix=e.prefix?`[${e.prefix}]`:"[Caliper]";}setEnabled(e){nt=e;}debug(...e){}info(...e){}warn(...e){nt&&console.warn(this.prefix,...e);}error(...e){nt&&console.error(this.prefix,...e);}log(...e){}},ri=new xo({prefix:"Caliper"});var li=e=>{let t=e.getModifierState?.("AltGraph");return {Control:t?false:e.ctrlKey,Meta:e.metaKey,Alt:t||e.altKey,Shift:e.shiftKey}},Rt=e=>e.key==="Control"&&e.getModifierState?.("AltGraph")?"":e.key==="AltGraph"?"Alt":e.key,Ge=(e,t)=>Rt(t)===e;var bo=`
20
+ :root {
21
+ interpolate-size: allow-keywords;
22
+ --caliper-primary: ${ae.primary};
23
+ --caliper-secondary: ${ae.secondary};
24
+ --caliper-calc-bg: ${ae.calcBg};
25
+ --caliper-calc-shadow: ${ae.calcShadow};
26
+ --caliper-calc-op-highlight: ${ae.calcOpHighlight};
27
+ --caliper-calc-text: ${ae.calcText};
28
+ --caliper-text: ${ae.text};
29
+ --caliper-projection: ${ae.projection};
30
+ --caliper-ruler: ${ae.ruler};
31
+ --caliper-success: rgba(74, 222, 128, 1);
32
+ --caliper-font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
33
+ }
34
+
35
+ #caliper-overlay-root {
36
+ position: fixed;
37
+ top: 0;
38
+ left: 0;
39
+ width: 100vw;
40
+ height: 100vh;
41
+ pointer-events: none;
42
+ overflow: visible;
43
+ }
44
+
45
+ .${Y}viewport-fixed {
46
+ position: fixed;
47
+ top: 0;
48
+ left: 0;
49
+ width: 100vw;
50
+ height: 100vh;
51
+ pointer-events: none;
52
+ overflow: visible;
53
+ }
54
+
55
+ .${Y}overlay {
56
+ position: fixed;
57
+ top: 0;
58
+ left: 0;
59
+ width: 100vw;
60
+ height: 100vh;
61
+ pointer-events: none;
62
+ z-index: 999999;
63
+ }
64
+
65
+ .${Y}ruler-layer {
66
+ position: fixed;
67
+ top: 0;
68
+ left: 0;
69
+ width: 100vw;
70
+ height: 100vh;
71
+ pointer-events: none;
72
+ z-index: 1000000;
73
+ touch-action: none;
74
+ }
75
+
76
+ .${Y}alt-mode * {
77
+ pointer-events: none !important;
78
+ }
79
+
80
+ .${Y}line {
81
+ stroke: var(--caliper-secondary);
82
+ stroke-width: 1px;
83
+ pointer-events: auto;
84
+ cursor: pointer;
85
+ }
86
+
87
+ .${Y}projection-line {
88
+ stroke: var(--caliper-projection);
89
+ stroke-width: 2px;
90
+ stroke-dasharray: 4 2;
91
+ pointer-events: auto;
92
+ }
93
+
94
+ .${Y}label {
95
+ position: fixed;
96
+ pointer-events: auto;
97
+ cursor: pointer;
98
+ background: var(--caliper-secondary);
99
+ color: var(--caliper-text);
100
+ padding: 2px 6px;
101
+ border-radius: 3px;
102
+ font-size: 11px;
103
+ font-weight: 500;
104
+ font-family: var(--caliper-font-sans);
105
+ white-space: nowrap;
106
+ z-index: 1000000;
107
+ will-change: transform;
108
+ }
109
+
110
+ .${Y}projection-label {
111
+ background: var(--caliper-projection);
112
+ z-index: 1000001;
113
+ }
114
+
115
+ .${Y}selection-label {
116
+ position: fixed;
117
+ pointer-events: none;
118
+ background: var(--caliper-primary);
119
+ color: white;
120
+ padding: 2px 6px;
121
+ border-radius: 2px;
122
+ font-size: 10px;
123
+ font-weight: 600;
124
+ font-family: var(--caliper-font-sans);
125
+ white-space: nowrap;
126
+ z-index: 1000001;
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ will-change: transform, opacity, background-color;
131
+ transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
132
+ }
133
+
134
+ .${Y}selection-label-success {
135
+ background: var(--caliper-success);
136
+ }
137
+
138
+ .${Y}selection-label-content {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ animation: caliper-fade-in 0.15s forwards ease-in-out;
143
+ }
144
+
145
+ @keyframes caliper-fade-in {
146
+ from { opacity: 0; }
147
+ to { opacity: 1; }
148
+ }
149
+
150
+ @keyframes caliper-fade-out {
151
+ from { opacity: 1; }
152
+ to { opacity: 0; }
153
+ }
154
+
155
+ .${Y}boundary-box {
156
+ position: fixed;
157
+ pointer-events: none;
158
+ box-sizing: border-box;
159
+ touch-action: none;
160
+ }
161
+
162
+ .${Y}boundary-box-selected {
163
+ border: 2px solid var(--caliper-primary);
164
+ background: transparent;
165
+ z-index: 999998;
166
+ will-change: transform, width, height;
167
+ }
168
+
169
+ .${Y}boundary-box-secondary {
170
+ border: 1px dashed var(--caliper-secondary-50);
171
+ background: var(--caliper-secondary-05);
172
+ z-index: 999997;
173
+ }
174
+
175
+ .${Y}calculator, .${Y}projection-input {
176
+ position: fixed;
177
+ pointer-events: auto;
178
+ background: var(--caliper-calc-bg);
179
+ color: var(--caliper-calc-text);
180
+ padding: 0 8px;
181
+ border-radius: 4px;
182
+ font-size: 12px;
183
+ font-weight: 500;
184
+ font-family: var(--caliper-font-sans);
185
+ z-index: 1000005;
186
+ box-shadow: 0 4px 12px var(--caliper-calc-shadow);
187
+ display: flex;
188
+ align-items: center;
189
+ gap: 6px;
190
+ height: 28px;
191
+ user-select: none;
192
+ overflow: hidden;
193
+ will-change: transform, width;
194
+ transform-origin: center;
195
+ width: fit-content;
196
+ min-width: 32px;
197
+ white-space: nowrap;
198
+ transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
199
+ border: 1px solid transparent;
200
+ }
201
+
202
+ .${Y}calculator-focused, .${Y}projection-input-focused {
203
+ border-color: var(--caliper-primary);
204
+ box-shadow: 0 0 0 2px var(--caliper-primary-50), 0 4px 12px var(--caliper-calc-shadow);
205
+ background: var(--caliper-calc-bg);
206
+ }
207
+
208
+ .${Y}projection-input {
209
+ border-left: 3px solid var(--caliper-projection);
210
+ }
211
+
212
+ .${Y}projection-direction-tag {
213
+ background: var(--caliper-projection-light);
214
+ color: var(--caliper-projection);
215
+ font-size: 10px;
216
+ padding: 2px 4px;
217
+ border-radius: 2px;
218
+ text-transform: uppercase;
219
+ font-weight: 700;
220
+ }
221
+
222
+ .${Y}calculator-base {
223
+ opacity: 0.7;
224
+ transition: opacity 0.2s;
225
+ }
226
+
227
+ .${Y}calculator-base-active {
228
+ opacity: 1;
229
+ }
230
+
231
+ .${Y}calculator-operation {
232
+ background-color: var(--caliper-calc-op-highlight);
233
+ padding: 4px;
234
+ border-radius: 2px;
235
+ transition: all 0.2s;
236
+ display: inline-flex;
237
+ align-items: center;
238
+ justify-content: center;
239
+ animation: pulse 0.3s ease-in-out;
240
+ }
241
+
242
+ .${Y}calculator-input, .${Y}projection-current-value {
243
+ min-width: 8px;
244
+ text-align: right;
245
+ transition: all 0.2s;
246
+ }
247
+
248
+ .${Y}projection-current-value {
249
+ color: var(--caliper-projection);
250
+ font-weight: bold;
251
+ }
252
+
253
+ .${Y}calculator-result {
254
+ font-weight: bold;
255
+ color: var(--caliper-primary);
256
+ animation: slideIn 0.3s ease-out;
257
+ }
258
+
259
+ @keyframes pulse {
260
+ 0%, 100% { transform: scale(1); }
261
+ 50% { transform: scale(1.1); }
262
+ }
263
+
264
+ @keyframes slideIn {
265
+ from {
266
+ opacity: 0;
267
+ transform: translateX(-10px);
268
+ }
269
+ to {
270
+ opacity: 1;
271
+ transform: translateX(0);
272
+ }
273
+ }
274
+
275
+ @keyframes slideOut {
276
+ from {
277
+ opacity: 1;
278
+ transform: translateX(0);
279
+ }
280
+ to {
281
+ opacity: 0;
282
+ transform: translateX(10px);
283
+ }
284
+ }
285
+
286
+ .${Y}line-clickable {
287
+ pointer-events: auto;
288
+ cursor: pointer;
289
+ transition: stroke-width 0.2s;
290
+ }
291
+
292
+ .${Y}line-hit-target {
293
+ stroke: transparent;
294
+ stroke-width: 12px;
295
+ pointer-events: auto;
296
+ cursor: pointer;
297
+ }
298
+
299
+
300
+ .${Y}line-clickable:hover {
301
+ }
302
+
303
+ .${Y}ruler-line-visual {
304
+ transition: transform 0.1s ease-out;
305
+ will-change: transform;
306
+ position: fixed;
307
+ background-color: var(--caliper-ruler, var(--caliper-primary, rgba(24, 160, 251, 1)));
308
+ z-index: 1000000;
309
+ }
310
+
311
+ .${Y}ruler-label {
312
+ background: var(--caliper-primary);
313
+ border: 1px solid rgba(255, 255, 255, 0.2);
314
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
315
+ position: fixed;
316
+ z-index: 1000002;
317
+ }
318
+
319
+ .${Y}ruler-bridge-label {
320
+ position: fixed;
321
+ background: var(--caliper-secondary);
322
+ z-index: 1000003;
323
+ color: white;
324
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
325
+ }
326
+ `,A=Y,Mo=X("<svg><defs><clipPath><rect></svg>",false,true,false),So=X("<svg style=z-index:999999><g>"),Eo=X("<svg><g data-caliper-ignore style=pointer-events:auto;cursor:pointer><line></line><line></svg>",false,true,false);function No(e){let[t,n]=_(null),i=()=>isFinite(e.data.common.minX),r=_(yt("lines-clip"))[0](),o=()=>({minX:e.data.common.minX-e.viewport.scrollX,maxX:e.data.common.maxX-e.viewport.scrollX,minY:e.data.common.minY-e.viewport.scrollY,maxY:e.data.common.maxY-e.viewport.scrollY});return (()=>{var l=So(),a=l.firstChild;return D(l,"class",`${A}viewport-fixed`),V(l,C(Q,{get when(){return i()},get children(){var c=Mo(),u=c.firstChild,d=u.firstChild;return D(u,"id",r),F(s=>{var f=o().minX,m=o().minY,y=Math.max(0,o().maxX-o().minX),b=Math.max(0,o().maxY-o().minY);return f!==s.e&&D(d,"x",s.e=f),m!==s.t&&D(d,"y",s.t=m),y!==s.a&&D(d,"width",s.a=y),b!==s.o&&D(d,"height",s.o=b),s},{e:void 0,t:void 0,a:void 0,o:void 0}),c}}),a),V(a,C(Re,{get each(){return e.lines},children:(c,u)=>{let d=U(()=>{let f=We(c.start,c.startSync,c,e.data.primary.delta,e.data.secondary.delta,e.viewport.scrollX,e.viewport.scrollY),m=We(c.end,c.endSync,c,e.data.primary.delta,e.data.secondary.delta,e.viewport.scrollX,e.viewport.scrollY),y=f,b=m;e.data.isSameContext||(y=ot(f,c.startSync==="secondary"?e.data.secondary.geo:e.data.primary.geo,e.viewport),b={...ot(m,c.endSync==="secondary"?e.data.secondary.geo:e.data.primary.geo,e.viewport)}),c.type==="top"||c.type==="bottom"?c.startSync==="primary"?b.x=y.x:y.x=b.x:(c.type==="left"||c.type==="right")&&(c.startSync==="primary"?b.y=y.y:y.y=b.y);let x=0;return c.type==="top"||c.type==="bottom"?x=Math.abs(y.y-b.y):c.type==="left"||c.type==="right"?x=Math.abs(y.x-b.x):x=Math.sqrt(Math.pow(y.x-b.x,2)+Math.pow(y.y-b.y,2)),{x1:y.x,y1:y.y,x2:b.x,y2:b.y,liveValue:x}}),s=()=>t()===u();return (()=>{var f=Eo(),m=f.firstChild,y=m.nextSibling;return f.$$click=b=>{b.stopPropagation();let x=d();e.onLineClick?.(c,x.liveValue);},f.addEventListener("mouseleave",()=>n(null)),f.addEventListener("mouseenter",()=>n(u())),D(m,"class",`${A}line-hit-target`),D(y,"class",`${A}line ${A}line-clickable`),F(b=>{var x=d().x1,g=d().y1,h=d().x2,w=d().y2,p=d().x1,k=d().y1,L=d().x2,M=d().y2,E=s()?2:1;return x!==b.e&&D(m,"x1",b.e=x),g!==b.t&&D(m,"y1",b.t=g),h!==b.a&&D(m,"x2",b.a=h),w!==b.o&&D(m,"y2",b.o=w),p!==b.i&&D(y,"x1",b.i=p),k!==b.n&&D(y,"y1",b.n=k),L!==b.s&&D(y,"x2",b.s=L),M!==b.h&&D(y,"y2",b.h=M),E!==b.r&&D(y,"stroke-width",b.r=E),b},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),f})()}})),F(()=>D(a,"clip-path",i()?`url(#${r})`:void 0)),l})()}Fe(["click"]);var Io=X("<div style=z-index:1000000>"),ko=X("<div data-caliper-ignore style=left:0;top:0>");function To(e){return (()=>{var n=Io();return B(n,`${A}viewport-fixed`),V(n,C(Re,{get each(){return e.lines},children:i=>{let r=U(()=>{e.viewport.version;let o=We(i.start,i.startSync,i,e.data.primary.delta,e.data.secondary.delta,e.viewport.scrollX,e.viewport.scrollY),l=We(i.end,i.endSync,i,e.data.primary.delta,e.data.secondary.delta,e.viewport.scrollX,e.viewport.scrollY),a=Math.abs(o.x-l.x),c=Math.abs(o.y-l.y),u=0;i.type==="top"||i.type==="bottom"?u=c:i.type==="left"||i.type==="right"?u=a:u=Math.sqrt(a*a+c*c);let d=o,s=l;e.data.isSameContext||(d=ot(o,i.startSync==="secondary"?e.data.secondary.geo:e.data.primary.geo,e.viewport),s={...ot(l,i.endSync==="secondary"?e.data.secondary.geo:e.data.primary.geo,e.viewport)}),i.type==="top"||i.type==="bottom"?i.startSync==="primary"?s.x=d.x:d.x=s.x:(i.type==="left"||i.type==="right")&&(i.startSync==="primary"?s.y=d.y:d.y=s.y);let f=(d.x+s.x)/2,m=(d.y+s.y)/2,y=0,b=e.viewport.width,x=0,g=e.viewport.height,h=e.data.common,w=isFinite(h.minX),p=w?Math.max(y,h.minX-e.viewport.scrollX):y,k=w?Math.min(b,h.maxX-e.viewport.scrollX):b,L=w?Math.max(x,h.minY-e.viewport.scrollY):x,M=w?Math.min(g,h.maxY-e.viewport.scrollY):g,E=Math.min(d.x,s.x),N=Math.max(d.x,s.x),v=Math.min(d.y,s.y),I=Math.max(d.y,s.y);if(I<L||v>M||N<p||E>k)return {x:0,y:0,isHidden:true,value:0};let P=Math.max(E,p),z=Math.min(N,k),H=Math.max(v,L),te=Math.min(I,M),q=(P+z)/2,se=(H+te)/2,ee=f,re=m;return Math.abs(d.x-s.x)<1?(re=se,ee=Math.max(p+16,Math.min(k-16,ee))):Math.abs(d.y-s.y)<1?(ee=q,re=Math.max(L+16,Math.min(M-16,re))):(ee=Math.max(p+16,Math.min(k-16,f)),re=Math.max(L+16,Math.min(M-16,m))),{x:ee,y:re,isHidden:false,value:u}});return C(Q,{get when(){return Se(()=>!!r())()&&!r().isHidden},get children(){var o=ko();return o.$$click=l=>{l.stopPropagation();let a=r();a&&!a.isHidden&&e.onLineClick?.(i,a.value);},B(o,`${A}label`),V(o,()=>Math.round(r().value*100)/100),F(l=>J(o,"transform",`translate3d(${r().x}px, ${r().y}px, 0) translate(-50%, -50%)`)),o}})}})),n})()}Fe(["click"]);var Lo=X('<svg viewBox="0 0 24 24"><line x1=12 y1=5 x2=12 y2=19></line><line x1=5 y1=12 x2=19 y2=12>'),Co=X('<svg viewBox="0 0 24 24"><line x1=5 y1=12 x2=19 y2=12>'),Do=X('<svg viewBox="0 0 24 24"><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>'),Ao=X('<svg viewBox="0 0 24 24"><line x1=19 y1=5 x2=5 y2=19>'),Yt={width:"12px",height:"12px","stroke-width":"2.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round",display:"block"},jo={"+":()=>(()=>{var e=Lo();return F(t=>Ye(e,Yt,t)),e})(),"-":()=>(()=>{var e=Co();return F(t=>Ye(e,Yt,t)),e})(),"*":()=>(()=>{var e=Do();return F(t=>Ye(e,Yt,t)),e})(),"/":()=>(()=>{var e=Ao();return F(t=>Ye(e,Yt,t)),e})()},ai=X("<span>"),$o=X("<span>= "),Po=X("<div data-caliper-ignore style=top:0;left:0><span>");function Oo(e){let t=n=>Math.round(n*100)/100+"";return C(Q,{get when(){return e.state.isActive},get children(){var n=Po(),i=n.firstChild;return V(i,()=>t(e.state.baseValue)),V(n,C(Q,{keyed:true,get when(){return e.state.operation},children:r=>{let o=jo[r];return (()=>{var l=ai();return B(l,`${A}calculator-operation`),V(l,C(Q,{when:o,fallback:r,get children(){return C(o,{})}})),l})()}}),null),V(n,C(Q,{get when(){return e.state.inputValue||e.state.operation},get children(){var r=ai();return B(r,`${A}calculator-input`),V(r,()=>e.state.inputValue||"0"),r}}),null),V(n,C(Q,{get when(){return e.state.result!==null},get children(){var r=$o();r.firstChild;return B(r,`${A}calculator-result`),V(r,(()=>{var l=Se(()=>e.state.result!==null);return ()=>l()?t(e.state.result):""})(),null),r}}),null),F(r=>{var o=`${A}calculator ${e.isFocused?`${A}calculator-focused`:""}`,l=`translate3d(${e.position.x+10}px, ${e.position.y+10}px, 0)`,a=`${A}calculator-base ${e.state.operation?`${A}calculator-base-active`:""}`;return o!==r.e&&B(n,r.e=o),l!==r.t&&J(n,"transform",r.t=l),a!==r.a&&B(i,r.a=a),r},{e:void 0,t:void 0,a:void 0}),n}})}var si=X("<div style=left:0;top:0>");function Ro(e){let[t,n]=_(null),[i,r]=_(null),o=null,l=null,a=(s,f,m=.1)=>!s||!f?false:Math.abs(s.left-f.left)<m&&Math.abs(s.top-f.top)<m&&Math.abs(s.width-f.width)<m&&Math.abs(s.height-f.height)<m,c=(s,f,m)=>{if(!f)return null;if(!s)return {...f};let y=oi(s,f,m);return a(y,f,.1)?{...f}:{...f,left:y.left,top:y.top,width:y.width,height:y.height}},u=U(()=>(e.viewport.version,ce(e.metadata.rect,e.metadata.scrollHierarchy,e.metadata.position,e.metadata.stickyConfig,e.metadata.initialWindowX,e.metadata.initialWindowY))),d=U(()=>{e.viewport.version;let s=e.result;return !(e.isActivatePressed||e.isFrozen)||!s?null:ce(s.secondary,s.secondaryHierarchy,s.secondaryPosition,s.secondarySticky,s.secondaryWinX,s.secondaryWinY)});return pe(Nn([u,d,()=>e.animation.lerpFactor,()=>e.metadata.element],([s,f,m,y])=>{if(!s){n(null),r(null),o=null,l&&(cancelAnimationFrame(l),l=null);return}let b=o!==y,x=e.animation.enabled!==false;if(r(f),b)if(o=y,x){let g=()=>{let h=t(),w=c(h,s,m);n(w),s&&!a(w,s,.05)?l=requestAnimationFrame(g):l=null;};l&&cancelAnimationFrame(l),l=requestAnimationFrame(g);}else l&&(cancelAnimationFrame(l),l=null),n(s);else l||n(s);})),ye(()=>{l&&cancelAnimationFrame(l);}),[C(Q,{get when(){return t()},children:s=>C(De,{get mount(){return Ae()},get children(){var f=si();return B(f,`${A}boundary-box ${A}boundary-box-selected`),F(m=>{var y=`${s().width}px`,b=`${s().height}px`,x=`translate3d(${s().left-e.viewport.scrollX}px, ${s().top-e.viewport.scrollY}px, 0)`,g=s().clipPath;return y!==m.e&&J(f,"width",m.e=y),b!==m.t&&J(f,"height",m.t=b),x!==m.a&&J(f,"transform",m.a=x),g!==m.o&&J(f,"clip-path",m.o=g),m},{e:void 0,t:void 0,a:void 0,o:void 0}),f}})}),C(Q,{get when(){return i()},children:s=>C(De,{get mount(){return Ae()},get children(){var f=si();return B(f,`${A}boundary-box ${A}boundary-box-secondary`),F(m=>{var y=`${s().width}px`,b=`${s().height}px`,x=`translate3d(${s().left-e.viewport.scrollX}px, ${s().top-e.viewport.scrollY}px, 0)`,g=s().clipPath;return y!==m.e&&J(f,"width",m.e=y),b!==m.t&&J(f,"height",m.t=b),x!==m.a&&J(f,"transform",m.a=x),g!==m.o&&J(f,"clip-path",m.o=g),m},{e:void 0,t:void 0,a:void 0,o:void 0}),f}})})]}var Yo=X("<span>Copied!"),zo=X("<div style=left:0;top:0>"),_o=X("<span> \xD7 ");function Vo(e){let n=U(()=>(e.viewport.version,ce(e.metadata.rect,e.metadata.scrollHierarchy,e.metadata.position,e.metadata.stickyConfig,e.metadata.initialWindowX,e.metadata.initialWindowY))),i=U(()=>{let r=n();if(!r||r.isHidden)return null;let o=e.viewport.scrollX,l=e.viewport.scrollX+e.viewport.width,a=e.viewport.scrollY+e.viewport.height,c=r.visibleMinX,u=r.visibleMaxX,d=r.visibleMaxY,s=Math.max(o,c),f=Math.min(l,u),m=Math.min(a,d),y=Math.max(r.left,s+16),b=Math.min(r.left+r.width,f-16),x=(y+b)/2,g=r.top+r.height+8;return g>m-16-24&&r.top<m-16&&(g=m-16-24),g=Math.max(g,r.top+16),{width:Math.round(r.width),height:Math.round(r.height),x,y:g}});return C(Q,{get when(){return i()},children:r=>C(De,{get mount(){return Ae()},get children(){var o=zo();return V(o,C(Q,{get when(){return e.isCopied},get fallback(){return (()=>{var l=_o(),a=l.firstChild;return B(l,`${A}selection-label-content`),V(l,()=>r().width,a),V(l,()=>r().height,null),l})()},get children(){var l=Yo();return B(l,`${A}selection-label-content`),l}})),F(l=>{var a=`${A}selection-label ${e.isCopied?`${A}selection-label-success`:""}`,c=`translate3d(${r().x-e.viewport.scrollX}px, ${r().y-e.viewport.scrollY}px, 0) translate(-50%, 0)`,u=e.isActivatePressed?0:1;return a!==l.e&&B(o,l.e=a),c!==l.t&&J(o,"transform",l.t=c),u!==l.a&&J(o,"opacity",l.a=u),l},{e:void 0,t:void 0,a:void 0}),o}})})}var Xo=X("<svg style=z-index:1000000><line data-caliper-ignore stroke=transparent stroke-width=15></line><line>"),Fo=X("<div data-caliper-ignore style=top:0;left:0>"),Ho=X("<div data-caliper-ignore><span></span><span>");function Wo(e){return C(Q,{get when(){return Se(()=>!!e.metadata().element)()&&e.projectionState().direction},get children(){return [C(Uo,{get projectionState(){return e.projectionState},get metadata(){return e.metadata},get viewport(){return e.viewport},get onLineClick(){return e.onLineClick}}),C(Bo,{get projectionState(){return e.projectionState},get metadata(){return e.metadata},get viewport(){return e.viewport},get isFocused(){return e.isFocused}})]}})}function Uo(e){let t=U(()=>{let o=e.viewport();o.version;let l=e.projectionState(),a=parseFloat(l.value)||0,c=e.metadata(),u=ce(c.rect,c.scrollHierarchy,c.position,c.stickyConfig,c.initialWindowX,c.initialWindowY);if(!u)return null;let d=0,s=0,f=0,m=0,y=0,b=0,x=0,g=0,h=0,w=0,p=document.documentElement.scrollWidth,k=document.documentElement.scrollHeight,L=u.left-o.scrollX,M=u.top-o.scrollY,E=false;switch(l.direction){case "top":d=f=L+u.width/2,s=M,m=Math.max(-o.scrollY,s-a),y=d,x=Math.max(0,Math.min(o.height,s)),g=Math.max(0,Math.min(o.height,m)),Math.abs(x-g)<1&&(E=true),b=(Math.min(x,g)+Math.max(x,g))/2;break;case "bottom":d=f=L+u.width/2,s=M+u.height,m=Math.min(k-o.scrollY,s+a),y=d,x=Math.max(0,Math.min(o.height,s)),g=Math.max(0,Math.min(o.height,m)),Math.abs(x-g)<1&&(E=true),b=(Math.min(x,g)+Math.max(x,g))/2;break;case "left":s=m=M+u.height/2,d=L,f=Math.max(-o.scrollX,d-a),h=Math.max(0,Math.min(o.width,d)),w=Math.max(0,Math.min(o.width,f)),Math.abs(h-w)<1&&(E=true),y=(Math.min(h,w)+Math.max(h,w))/2,b=s;break;case "right":s=m=M+u.height/2,d=L+u.width,f=Math.min(p-o.scrollX,d+a),h=Math.max(0,Math.min(o.width,d)),w=Math.max(0,Math.min(o.width,f)),Math.abs(h-w)<1&&(E=true),y=(Math.min(h,w)+Math.max(h,w))/2,b=s;break}let N=Math.sqrt((f-d)**2+(m-s)**2),v=Number.isInteger(N)?N:Math.round(N*100)/100,$=(l.value||String(v)).length*8+12,P=20,z=l.direction==="left"||l.direction==="right",q=Math.abs(z?h-w:x-g)>=(z?$:P)*1.5;return {x1:d,y1:s,x2:f,y2:m,labelX:y,labelY:b,actualValue:v,isHidden:u.isHidden||E,showLabel:q}}),[n,i]=_(false),r=o=>{o.stopPropagation();let l=t();l&&e.onLineClick?.({type:"distance",value:l.actualValue,start:{x:l.x1,y:l.y1},end:{x:l.x2,y:l.y2}},l.actualValue);};return C(Q,{get when(){return Se(()=>!!t())()&&!t()?.isHidden},get children(){return [(()=>{var o=Xo(),l=o.firstChild,a=l.nextSibling;return D(o,"class",`${A}viewport-fixed`),l.addEventListener("mouseleave",()=>i(false)),l.addEventListener("mouseenter",()=>i(true)),l.$$click=r,D(l,"class",`${A}line-hit-target`),D(a,"class",`${A}projection-line`),F(c=>{var u=t().x1,d=t().y1,s=t().x2,f=t().y2,m=t().x1,y=t().y1,b=t().x2,x=t().y2,g=n()?2:1;return u!==c.e&&D(l,"x1",c.e=u),d!==c.t&&D(l,"y1",c.t=d),s!==c.a&&D(l,"x2",c.a=s),f!==c.o&&D(l,"y2",c.o=f),m!==c.i&&D(a,"x1",c.i=m),y!==c.n&&D(a,"y1",c.n=y),b!==c.s&&D(a,"x2",c.s=b),x!==c.h&&D(a,"y2",c.h=x),g!==c.r&&D(a,"stroke-width",c.r=g),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),o})(),C(Q,{get when(){return t().showLabel},get children(){var o=Fo();return o.$$click=r,B(o,`${A}label ${A}projection-label`),V(o,()=>t().actualValue),F(l=>J(o,"transform",`translate3d(${t().labelX}px, ${t().labelY}px, 0) translate(-50%, -50%)`)),o}})]}})}function Bo(e){let t=U(()=>{let n=e.viewport();n.version;let i=e.metadata(),r=ce(i.rect,i.scrollHierarchy,i.position,i.stickyConfig,i.initialWindowX,i.initialWindowY);if(!r||r.isHidden)return {display:"none"};let o=r.top-n.scrollY,l=r.left-n.scrollX,a=35,c=10,d=o<a+c?o+r.height+c:o-a;return {top:"0",left:"0",transform:`translate3d(${l}px, ${d}px, 0)`}});return (()=>{var n=Ho(),i=n.firstChild,r=i.nextSibling;return B(i,`${A}projection-direction-tag`),V(i,()=>e.projectionState().direction),B(r,`${A}projection-current-value`),V(r,()=>e.projectionState().value||"0"),F(o=>{var l=`${A}projection-input ${e.isFocused?`${A}projection-input-focused`:""}`,a=t();return l!==o.e&&B(n,o.e=l),o.t=Ye(n,a,o.t),o},{e:void 0,t:void 0}),n})()}Fe(["click"]);var Go=X("<div data-caliper-ignore><svg style=z-index:999999>"),Zo=X('<svg><g data-caliper-ignore style=cursor:pointer;pointer-events:auto><line stroke=transparent stroke-width=15></line><line stroke=var(--caliper-secondary) stroke-width=1 stroke-dasharray="4 2"></line><circle r=2.5 fill=var(--caliper-secondary)></circle><circle r=2.5 fill=var(--caliper-secondary)></svg>',false,true,false),ui=X("<div data-caliper-ignore style=left:0;top:0>"),Qo=X("<div data-caliper-ignore style=position:fixed;left:0;top:0;pointer-events:auto;z-index:1000001>"),qo=X("<div data-caliper-ignore>");function Ko(e){let[t,n]=_(null),[i,r]=_(null),[o,l]=_(new Set),[a,c]=_(new Map);pe(()=>{let h=e.state().lines,w=o(),p=new Set;w.forEach(k=>{h.find(L=>L.id===k)&&p.add(k);}),p.size!==w.size&&l(p);}),pe(()=>{let h=e.state().lines,w=e.viewport(),p=a(),k=false,L=new Map(p);h.forEach(E=>{L.has(E.id)||(L.set(E.id,{width:w.width,height:w.height}),k=true);});let M=new Set(h.map(E=>E.id));L.forEach((E,N)=>{M.has(N)||(L.delete(N),k=true);}),k&&c(L);});let u=h=>{let w=e.viewport(),p=a().get(h.id);if(!p)return h.position;let k=h.type==="vertical",L=k?p.width:p.height,M=k?w.width:w.height;return L===0?h.position:h.position/L*M},d=h=>{let w=[],p=e.projectionState?.(),k=e.metadata?.(),L=e.result?.(),M=e.viewport();if(k&&k.element){let E=ce(k.rect,k.scrollHierarchy,k.position,k.stickyConfig,k.initialWindowX,k.initialWindowY);if(E){let N=E.left-M.scrollX,v=E.top-M.scrollY;if(h?w.push(N,N+E.width,N+E.width/2):w.push(v,v+E.height,v+E.height/2),p&&p.direction&&p.element===k.element){let I=parseFloat(p.value)||0;h?p.direction==="left"?w.push(N-I):p.direction==="right"&&w.push(N+E.width+I):p.direction==="top"?w.push(v-I):p.direction==="bottom"&&w.push(v+E.height+I);}}}if(L&&L.secondary){let E=ce(L.secondary,L.secondaryHierarchy,L.secondaryPosition,L.secondarySticky,L.secondaryWinX,L.secondaryWinY);if(E){let N=E.left-M.scrollX,v=E.top-M.scrollY;h?w.push(N,N+E.width,N+E.width/2):w.push(v,v+E.height,v+E.height/2);}}return w},s=(h,w)=>{let p=d(w);for(let k of p)if(Math.abs(h-k)<=_n)return k;return h},f=h=>{let w=o();if(w.size===0)return;if(h.key==="Delete"||h.key==="Backspace"){Array.from(w).forEach(I=>e.onRemove(I)),l(new Set);return}let k=e.state().lines.filter(v=>w.has(v.id));if(k.length===0)return;let L=1;h.ctrlKey||h.metaKey?L=10:h.shiftKey&&(L=.1);let M=k[0];if(!M)return;let E=M.type==="vertical",N=0;if(E?(h.key==="ArrowLeft"&&(N=-L),h.key==="ArrowRight"&&(N=L)):(h.key==="ArrowUp"&&(N=-L),h.key==="ArrowDown"&&(N=L)),N!==0){h.preventDefault();let v=e.viewport();k.forEach(I=>{let $=I.type==="vertical",P=($?v.width:v.height)-1,z=u(I),H=Math.max(0,Math.min(z+N,P));H=s(H,$),c(te=>{let q=new Map(te);return q.set(I.id,{width:v.width,height:v.height}),q}),e.onUpdate(I.id,H);});}};kt(()=>{let h=w=>{let p=w.target;!p.closest(`.${A}ruler-line-hit`)&&!p.closest(`.${A}ruler-bridge-label`)&&!p.closest(`.${A}line-hit-target`)&&!p.closest("[data-caliper-ignore]")&&l(new Set);};window.addEventListener("pointerdown",h,{capture:true}),window.addEventListener("keydown",f,{capture:true}),ye(()=>{window.removeEventListener("pointerdown",h,{capture:true}),window.removeEventListener("keydown",f,{capture:true});});});let m=h=>{let w=h.target,p=w.getAttribute("data-ruler-id"),k=w.getAttribute("data-ruler-type");if(!p||!k)return;h.preventDefault(),h.stopPropagation(),n(p),w.setPointerCapture(h.pointerId);let L=e.viewport(),M=e.state().lines.find(v=>v.id===p);if(M){let v=u(M);c(I=>{let $=new Map(I);return $.set(p,{width:L.width,height:L.height}),$}),e.onUpdate(p,v);}h.shiftKey?l(v=>{let I=new Set(v);return I.has(p)?I.delete(p):I.add(p),I}):o().has(p)||l(new Set([p]));let E=v=>{let I=e.viewport(),$=k==="vertical",P=$?v.clientX:v.clientY,z=($?I.width:I.height)-1;P=Math.max(0,Math.min(P,z)),P=s(P,$),e.onUpdate(p,P);},N=v=>{n(null),w.releasePointerCapture(v.pointerId),window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",N);};window.addEventListener("pointermove",E),window.addEventListener("pointerup",N);},y=h=>{let p=h.target.getAttribute("data-ruler-id");p&&r(p);},b=h=>{h.target.hasAttribute("data-ruler-id")&&r(null);},x=U(()=>{let h=o();if(h.size<2)return [];let w=e.state().lines.filter(E=>h.has(E.id)),p=w.filter(E=>E.type==="vertical").map(E=>({line:E,pos:u(E)})).sort((E,N)=>E.pos-N.pos),k=w.filter(E=>E.type==="horizontal").map(E=>({line:E,pos:u(E)})).sort((E,N)=>E.pos-N.pos),L=[],M=e.viewport();for(let E=0;E<p.length-1;E++){let N=p[E],v=p[E+1],I=v.pos-N.pos;I>0&&L.push({x1:N.pos,y1:M.height/2+100,x2:v.pos,y2:M.height/2+100,value:I,type:"vertical",labelX:N.pos+I/2,labelY:M.height/2+85});}for(let E=0;E<k.length-1;E++){let N=k[E],v=k[E+1],I=v.pos-N.pos;I>0&&L.push({x1:M.width/2+100,y1:N.pos,x2:M.width/2+100,y2:v.pos,value:I,type:"horizontal",labelX:M.width/2+115,labelY:N.pos+I/2});}return L}),g=(h,w)=>{w.stopPropagation(),e.onLineClick?.({type:"distance",value:h.value,start:{x:h.x1,y:h.y1},end:{x:h.x2,y:h.y2}},h.value);};return (()=>{var h=Go(),w=h.firstChild;return h.$$pointerout=b,h.$$pointerover=y,h.$$pointerdown=m,B(h,`${A}ruler-layer`),D(w,"class",`${A}viewport-fixed`),V(w,C(Re,{get each(){return x()},children:p=>(()=>{var k=Zo(),L=k.firstChild,M=L.nextSibling,E=M.nextSibling,N=E.nextSibling;return k.$$click=v=>g(p,v),D(L,"class",`${A}line-hit-target`),F(v=>{var I=p.x1,$=p.y1,P=p.x2,z=p.y2,H=p.x1,te=p.y1,q=p.x2,se=p.y2,ee=p.x1,re=p.y1,ie=p.x2,ge=p.y2;return I!==v.e&&D(L,"x1",v.e=I),$!==v.t&&D(L,"y1",v.t=$),P!==v.a&&D(L,"x2",v.a=P),z!==v.o&&D(L,"y2",v.o=z),H!==v.i&&D(M,"x1",v.i=H),te!==v.n&&D(M,"y1",v.n=te),q!==v.s&&D(M,"x2",v.s=q),se!==v.h&&D(M,"y2",v.h=se),ee!==v.r&&D(E,"cx",v.r=ee),re!==v.d&&D(E,"cy",v.d=re),ie!==v.l&&D(N,"cx",v.l=ie),ge!==v.u&&D(N,"cy",v.u=ge),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0}),k})()})),V(h,C(Re,{get each(){return x()},children:p=>(()=>{var k=ui();return k.$$click=L=>g(p,L),B(k,`${A}label ${A}ruler-bridge-label`),V(k,()=>Math.round(p.value*100)/100),F(L=>J(k,"transform",`translate3d(${p.labelX}px, ${p.labelY}px, 0) translate(-50%, -50%)`)),k})()}),null),V(h,C(Re,{get each(){return e.state().lines},children:p=>C(Jo,{line:p,get pixelPosition(){return u(p)},get isDragging(){return t()===p.id},get isHovered(){return i()===p.id},get isSelected(){return o().has(p.id)},get onLineClick(){return e.onLineClick},get viewport(){return e.viewport}})}),null),h})()}function Jo(e){let t=U(()=>{let r=e.line.type==="vertical",o=e.pixelPosition,l=e.isDragging||e.isHovered||e.isSelected;return {left:"0",top:"0",width:r?"1px":"100%",height:r?"100%":"1px",transform:`translate3d(${r?o:0}px, ${r?0:o}px, 0) ${l?r?"scaleX(1.5)":"scaleY(1.5)":"scale(1)"}`,opacity:e.isSelected?"1":e.isHovered?"0.8":"0.6",filter:e.isSelected?"drop-shadow(0 0 1.5px var(--caliper-primary))":"none","transform-origin":"center"}}),n=U(()=>`${Zt}px`),i=U(()=>(Zt-1)/2);return [(()=>{var r=Qo();return B(r,`${A}ruler-line-hit`),F(o=>{var l=e.line.id,a=e.line.type,c=e.line.type==="vertical"?n():"100%",u=e.line.type==="vertical"?"100%":n(),d=`translate3d(${e.line.type==="vertical"?e.pixelPosition-i():0}px, ${e.line.type==="vertical"?0:e.pixelPosition-i()}px, 0)`,s=e.line.type==="vertical"?"col-resize":"row-resize";return l!==o.e&&D(r,"data-ruler-id",o.e=l),a!==o.t&&D(r,"data-ruler-type",o.t=a),c!==o.a&&J(r,"width",o.a=c),u!==o.o&&J(r,"height",o.o=u),d!==o.i&&J(r,"transform",o.i=d),s!==o.n&&J(r,"cursor",o.n=s),o},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})(),(()=>{var r=qo();return B(r,`${A}ruler-line-visual`),F(o=>Ye(r,{...t()},o)),r})(),C(Q,{get when(){return e.isDragging||e.isHovered||e.isSelected},get children(){var r=ui();return r.$$click=o=>{o.stopPropagation();let l=e.line.type==="vertical",a=e.viewport(),c=e.pixelPosition;e.onLineClick?.({type:"distance",value:c,start:l?{x:c,y:0}:{x:0,y:c},end:l?{x:c,y:a.height}:{x:a.width,y:c}},c);},B(r,`${A}label ${A}ruler-label`),V(r,()=>Math.round(e.pixelPosition*100)/100),F(o=>{var l=`translate3d(${e.line.type==="vertical"?e.pixelPosition+10:20}px, ${e.line.type==="vertical"?20:e.pixelPosition+10}px, 0)`,a=e.isSelected&&!e.isHovered&&!e.isDragging?"0.7":"1";return l!==o.e&&J(r,"transform",o.e=l),a!==o.t&&J(r,"opacity",o.t=a),o},{e:void 0,t:void 0}),r}})]}Fe(["pointerdown","pointerover","pointerout","click"]);var er=X("<div>");function tr(e){let t=U(()=>{let n=e.result();if(!n)return null;e.viewport().version;let i=ce(n.primary,n.primaryHierarchy,n.primaryPosition,n.primarySticky,n.primaryWinX,n.primaryWinY,!!n.primaryHasContainingBlock);if(!i)return null;let r={primary:{geo:i,delta:it(n.primaryHierarchy,n.primaryPosition,n.primarySticky,n.primaryWinX,n.primaryWinY,!!n.primaryHasContainingBlock)},secondary:{geo:ce(n.secondary,n.secondaryHierarchy,n.secondaryPosition,n.secondarySticky,n.secondaryWinX,n.secondaryWinY,!!n.secondaryHasContainingBlock),delta:it(n.secondaryHierarchy,n.secondaryPosition,n.secondarySticky,n.secondaryWinX,n.secondaryWinY,!!n.secondaryHasContainingBlock)},common:Bn(n.primaryHierarchy,n.secondaryHierarchy,e.selectionMetadata().element,n.secondaryElement,n.primaryWinX,n.primaryWinY)},o=n.primaryPosition===n.secondaryPosition&&n.primaryHierarchy.length===n.secondaryHierarchy.length&&n.primaryHierarchy.every((a,c)=>a.element===n.secondaryHierarchy[c]?.element),l=n.primaryHierarchy.length>0&&n.primaryHierarchy[0]?.element===n.secondaryElement||n.secondaryHierarchy.length>0&&n.secondaryHierarchy[0]?.element===e.selectionMetadata().element;return {...r,isSameContext:o||l}});return [C(Ro,{get metadata(){return e.selectionMetadata()},get result(){return e.result()},get isActivatePressed(){return e.isActivatePressed()},get isFrozen(){return e.isFrozen()},get animation(){return e.animation},get viewport(){return e.viewport()}}),C(Vo,{get metadata(){return e.selectionMetadata()},get isActivatePressed(){return e.isActivatePressed()},get isCopied(){return e.isCopied?.()??false},get viewport(){return e.viewport()}}),C(Q,{get when(){return Se(()=>!!(e.isActivatePressed()||e.isFrozen()))()&&t()},get children(){return C(De,{get mount(){return Ae()},get children(){var n=er();return B(n,`${A}overlay`),V(n,C(No,{get lines(){return e.result().lines},get data(){return t()},get viewport(){return e.viewport()},get onLineClick(){return e.onLineClick}}),null),V(n,C(To,{get lines(){return e.result().lines},get data(){return t()},get viewport(){return e.viewport()},get onLineClick(){return e.onLineClick}}),null),n}})}}),C(Q,{get when(){return Se(()=>!!e.calculatorState)()&&e.calculatorState()!==null},get children(){return C(De,{get mount(){return Ae()},get children(){return C(Oo,{get state(){return e.calculatorState()},get onClose(){return e.onCalculatorClose||(()=>{})},get position(){return {x:e.cursor().x,y:e.cursor().y}},get isFocused(){return e.activeFocus?.()==="calculator"}})}})}}),C(Q,{get when(){return Se(()=>!!(e.projectionState&&e.projectionState()?.direction!==null))()&&e.projectionState()?.element===e.selectionMetadata().element},get children(){return C(De,{get mount(){return Ae()},get children(){return C(Wo,{get projectionState(){return e.projectionState},get metadata(){return e.selectionMetadata},get viewport(){return e.viewport},get isFocused(){return e.activeFocus?.()==="projection"},get onLineClick(){return e.onLineClick}})}})}}),C(Q,{get when(){return Se(()=>!!e.rulerState)()&&e.rulerState().lines.length>0},get children(){return C(De,{get mount(){return Ae()},get children(){return C(Ko,{get state(){return e.rulerState},get viewport(){return e.viewport},get projectionState(){return e.projectionState},get metadata(){return e.selectionMetadata},get result(){return e.result},get onUpdate(){return e.onRulerUpdate||(()=>{})},get onRemove(){return e.onRulerRemove||(()=>{})},get onLineClick(){return e.onLineClick}})}})}})]}function nr(e){let{commands:t,animation:n}=e,[i,r]=_(null),[o,l]=_({x:0,y:0}),[a,c]=_({scrollX:window.scrollX,scrollY:window.scrollY,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,version:0}),[u,d]=_({element:null,rect:null,scrollHierarchy:[],position:"static",initialWindowX:0,initialWindowY:0,depth:0}),[s,f]=_(null),[m,y]=_({direction:null,value:"",element:null}),[b,x]=_(null),[g,h]=_(false),[w,p]=_("calculator"),[k,L]=_(null),M=null,E=null,N=null,v=null,[I,$]=_({lines:[]}),[P,z]=_(false),[H,te]=_(false),[q,se]=_(false),[ee,re]=_(false),ie=null,ge=new WeakSet,Qe=null,Ie=null,vt=false,Ee=null,we=null,xt=()=>{ie&&(window.clearTimeout(ie),ie=null),se(false);},qe=()=>{f(null),x(null),L(null),m().direction!==null&&p("projection");},rt=j=>{if(!j.isActive){qe();return}f(j),j.operation&&x(null);},je=U(()=>!!u().element||!!i()||I().lines.length>0||m().direction!==null),en=()=>{c(j=>({scrollX:window.scrollX,scrollY:window.scrollY,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,version:(j.version||0)+1})),Qe=null;},bt=()=>{je()&&(Qe||(Qe=requestAnimationFrame(en)));};kt(()=>{E=Zn(),M=Gn(),N=M.getProjection(),v=M.getRuler(),e.onSystemsReady&&e.onSystemsReady({measurementSystem:M,selectionSystem:E});let j=N.onUpdate(S=>{y(S),S.direction===null?(s()?.isActive&&p("calculator"),M?.getState()==="FROZEN"&&M?.unfreeze(false)):p("projection");}),G=v.onUpdate(S=>{$(S);}),ne=M.onStateChange(()=>{M&&(r(M.getCurrentResult()),te(M.getState()==="FROZEN"));}),ke=E.onUpdate(S=>{d(S);}),Te=S=>{re(S.detail.locked);},de=null,ve={x:0,y:0},Mt=(S,O)=>{if(ee())return;let W=qt(S,O);W&&E&&(M&&M.abort(),qe(),xt(),p("calculator"),_e=null,at.cancel(),st.cancel(),E.select(W));},Ke=S=>{let O=li(S),W=t.select;return W in O?Object.entries(O).every(([ue,Ne])=>ue===W?Ne===true:Ne===false):g()&&!O.Control&&!O.Meta&&!O.Alt&&!O.Shift},lt=S=>Ge(t.activate,S),$e=S=>{ee()||(ve={x:S.clientX,y:S.clientY},Ke(S)?(S.preventDefault(),S.stopImmediatePropagation(),de&&window.clearTimeout(de),de=window.setTimeout(()=>{Mt(ve.x,ve.y),de=null;},t.selectionHoldDuration)):de&&window.clearTimeout(de));},rn=S=>{ee()||Ke(S)&&(S.preventDefault(),S.stopImmediatePropagation());},ln=S=>{de&&(window.clearTimeout(de),de=null);let O=S.target;(O.closest("[data-caliper-ignore]")||O.closest(`.${A}projection-input`))&&(O.closest(`.${A}projection-input`)?p("projection"):O.closest(`.${A}calculator`)&&p("calculator"));},an=S=>{if(ee())return;let O=u().element,W=i();if(O||W){S.preventDefault(),S.stopImmediatePropagation();let ue="";if(S.shiftKey&&O)ue=O.getAttribute("data-caliper-agent-id")||"";else if(W&&M&&E){let Ne=E.getSelected(),xe=M.getSecondaryElement();Ne&&xe&&(ue=JSON.stringify({primary:Ot(Ne,u()),secondary:Ot(xe,{rect:W.secondary,scrollHierarchy:W.secondaryHierarchy,position:W.secondaryPosition,stickyConfig:W.secondarySticky,initialWindowX:W.secondaryWinX,initialWindowY:W.secondaryWinY,hasContainingBlock:W.secondaryHasContainingBlock})}));}else O&&(ue=JSON.stringify(Ot(O,u())));ue&&navigator.clipboard.writeText(ue).then(()=>{ie&&clearTimeout(ie),se(true),ie=window.setTimeout(()=>{se(false),ie=null;},1500);}).catch(()=>{});return}Ke(S)&&S.preventDefault();},zt=null,Be=null,_e=null,at=Qt(S=>{E?.getSelected()!==S&&(M?.abort(),xt()),_e=S,E?.select(S);}),st=Qt((S,O,W)=>{W&&(_e=W),M?.measure(S,O);}),pi=()=>{if(!zt||!E){Be=null;return}if(ee()){Be=null;return}let S=zt,O={x:S.clientX,y:S.clientY};l(O);let W=E.getSelected(),ue=P(),Ne=M?.getState();if(W){let xe=qt(S.clientX,S.clientY),ct=xe&&_e&&xe.contains(_e)&&xe!==_e;ue?M&&st.execute(!!ct,W,O,xe):Ne!=="FROZEN"&&xe&&at.execute(!!ct,xe);}Be=null;},sn=S=>{zt=S,ve={x:S.clientX,y:S.clientY},Be||(Be=requestAnimationFrame(pi));},cn=S=>{if(!(ee()&&!Ge(t.clear,S))){if(Ge(t.clear,S)){if(!je())return;S.preventDefault(),S.stopImmediatePropagation(),z(false),qe(),xt(),M&&M.abort(),E&&(_e=null,at.cancel(),st.cancel(),E.clear());return}if(Ge(t.select,S)&&h(true),Rt(S).toLowerCase()===t.ruler.toLowerCase()&&S.shiftKey&&v&&!ee()){S.preventDefault();let O=a(),W=Math.max(0,Math.min(o().x,O.width)),ue=Math.max(0,Math.min(o().y,O.height));v.addPair(W,ue);return}if(lt(S))u().element&&(S.preventDefault(),S.stopImmediatePropagation()),!P()&&je()&&(M&&M.abort(),qe()),z(true);else if(Ge(t.freeze,S)&&M)M.getState()==="FROZEN"?(S.preventDefault(),S.stopImmediatePropagation(),M.unfreeze(P())):u().element&&(S.preventDefault(),S.stopImmediatePropagation(),M.freeze());else {let O=Rt(S),{calculator:W,projection:ue}=t,Ne=!!s(),xe=m().direction!==null,ct=Ne&&(w()==="calculator"||!xe);if(Ne&&(ct||!/^\d$/.test(S.key))){let Le=/^[0-9]$/.test(S.key),Pe=/^[+\-*/]$/.test(S.key),Oe=S.key===".",be=S.key==="Backspace",oe=S.key==="Delete",Ve=S.key==="Enter",ut=S.key==="Escape";if((Le||Pe||Oe||be||oe||Ve||ut)&&!((Le||be||Oe)&&!ct)){S.preventDefault(),S.stopImmediatePropagation(),Le||Pe||Oe?di(S.key):be?hi():oe?mi():Ve?gi():ut&&on();return}}let _t={[ue.top]:"top",[ue.left]:"left",[ue.bottom]:"bottom",[ue.right]:"right"}[O];if(_t&&u().element){S.preventDefault(),S.stopImmediatePropagation(),p("projection");let Le=u().element;Le&&N?.setElement(Le),N?.setDirection(_t),M&&M.freeze();let Oe=(be=>{let oe=u(),Ve=ce(oe.rect,oe.scrollHierarchy,oe.position,oe.stickyConfig,oe.initialWindowX,oe.initialWindowY);if(Ve)return ci(be,Ve)})(_t);Oe!==void 0&&N?.capValue(Oe);return}if(xe){let Le=/^[0-9.]$/.test(O),Pe=S.key==="Backspace",Oe=w()==="projection"||!Ne;if((Le||Pe)&&Oe){S.preventDefault(),S.stopImmediatePropagation();let be=m().direction;if(Le&&be){let oe=u(),Ve=ce(oe.rect,oe.scrollHierarchy,oe.position,oe.stickyConfig,oe.initialWindowX,oe.initialWindowY),ut;Ve&&(ut=ci(be,Ve)),N?.appendValue(O,ut);}else Pe&&N?.backspace();return}}if(H()&&i()){let Pe={[W.top]:"top",[W.right]:"right",[W.bottom]:"bottom",[W.left]:"left",[W.distance]:"distance"}[O];if(Pe){let be=(i()?.lines||[]).find(oe=>oe.type===Pe);if(be){S.preventDefault(),S.stopImmediatePropagation();let oe=Kt(be,i());nn(be,oe);}}}}}},un=S=>{Ge(t.select,S)&&h(false),lt(S)&&(S.preventDefault(),P()&&(z(false),M&&je()&&M.stop()));},fn=()=>{P()&&(z(false),M&&je()&&M.stop());},dn=()=>{je()&&(bt(),window.focus());},hn=S=>{if(!s()?.isActive)return;S.target.closest(`.${A}calculator`)?(S.preventDefault(),S.stopImmediatePropagation(),L(null)):k()===null&&(S.preventDefault(),S.stopImmediatePropagation(),L({x:S.clientX,y:S.clientY}));};window.addEventListener("caliper:agent-lock-change",Te),window.addEventListener("pointerdown",$e,{capture:true}),window.addEventListener("pointerup",ln,{capture:true}),window.addEventListener("click",rn,{capture:true}),window.addEventListener("dblclick",hn,{capture:true}),window.addEventListener("mousemove",sn),window.addEventListener("keydown",cn,{capture:true}),window.addEventListener("keyup",un,{capture:true}),window.addEventListener("contextmenu",an,{capture:true}),window.addEventListener("blur",fn),window.addEventListener("focus",dn);let mn=location.pathname,St=()=>{let S=location.pathname;S!==mn&&(mn=S,z(false),qe(),xt(),M&&M.abort(),E&&(_e=null,at.cancel(),st.cancel(),E.clear()));},gn=history.pushState.bind(history),pn=history.replaceState.bind(history);history.pushState=function(...S){gn(...S),St();},history.replaceState=function(...S){pn(...S),St();},window.addEventListener("popstate",St),ye(()=>{window.removeEventListener("caliper:agent-lock-change",Te),window.removeEventListener("pointerdown",$e,{capture:true}),window.removeEventListener("pointerup",ln,{capture:true}),window.removeEventListener("click",rn,{capture:true}),window.removeEventListener("dblclick",hn,{capture:true}),window.removeEventListener("mousemove",sn),window.removeEventListener("keydown",cn,{capture:true}),window.removeEventListener("keyup",un,{capture:true}),window.removeEventListener("contextmenu",an,{capture:true}),window.removeEventListener("blur",fn),window.removeEventListener("focus",dn),window.removeEventListener("popstate",St),history.pushState=gn,history.replaceState=pn,Be&&cancelAnimationFrame(Be),at.cancel(),st.cancel(),ne(),ke(),j(),G(),M&&M.cleanup(),N&&(N=null),v&&(v=null);});}),pe(()=>{je()&&(window.addEventListener("scroll",bt,{passive:true,capture:true}),en(),ye(()=>{window.removeEventListener("scroll",bt,{capture:true}),Qe&&(cancelAnimationFrame(Qe),Qe=null);}));});let tn=(j,G,ne)=>{Ie&&(j&&!vt?(Ie.observe(document.documentElement),vt=true):!j&&vt&&(Ie.unobserve(document.documentElement),vt=false),!(G===Ee&&ne===we)&&(Ee&&Ee!==G&&(Ie.unobserve(Ee),Ee=null),we&&we!==ne&&we!==G&&(Ie.unobserve(we),we=null),G&&G!==Ee&&(ge.add(G),Ie.observe(G),Ee=G),ne&&ne!==G&&ne!==we&&(ge.add(ne),Ie.observe(ne),we=ne)));};pe(()=>{let j=null,G=0,ne=false,ke=false,Te=false,de=()=>{if((ne||ke)&&Ee){let ve=Ee.getBoundingClientRect();E?.updateRect(ve),M&&M.updatePrimaryRect(ve);}if((ne||Te)&&we){let ve=we.getBoundingClientRect();M?.updateSecondaryRect(ve);}ne=false,ke=false,Te=false;};Ie=new ResizeObserver(ve=>{if(!je())return;let Mt=false;for(let $e of ve){if(ge.has($e.target)){ge.delete($e.target);continue}Mt=true;}if(!Mt)return;for(let $e of ve)$e.target===document.documentElement?ne=true:$e.target===Ee?ke=true:$e.target===we&&(Te=true);ne&&bt();let Ke=Date.now(),lt=zn-(Ke-G);lt<=0?(j&&clearTimeout(j),G=Ke,de()):j||(j=window.setTimeout(()=>{G=Date.now(),j=null,de();},lt));}),ye(()=>{Ie?.disconnect(),Ie=null,Ee=null,we=null,j&&clearTimeout(j);});}),pe(()=>{let j=je(),G=u().element,ne=i(),ke=H()?ne?.secondaryElement??null:null;if(!j){tn(false,null,null);return}tn(true,G,ke);}),pe(()=>{let j=b(),G=i();if(j&&G&&M&&me(()=>s())?.isActive){a().version;let ke=G.lines.find(Te=>Te.type===j.type);if(ke){let Te=Kt(ke,G),de=M.getCalculator();de.syncValue(Te),f(de.getState());}}});let nn=(j,G)=>{if(M){let ne=M.getCalculator();ne.open(G),p("calculator"),rt(ne.getState()),"startSync"in j&&x(j);}},di=j=>{if(M){let G=M.getCalculator();G.handleInput(j),/^[+\-*/.]$/.test(j)&&p("calculator"),rt(G.getState());}},hi=()=>{if(M){let j=M.getCalculator();j.handleBackspace(),rt(j.getState());}},mi=()=>{if(M){let j=M.getCalculator();j.handleDelete(),rt(j.getState());}},gi=()=>{if(M){let j=M.getCalculator();j.handleEnter(),rt(j.getState());}},on=()=>{M&&(M.getCalculator().close(),qe());};return C(tr,{result:i,cursor:()=>k()??o(),selectionMetadata:u,isActivatePressed:P,isFrozen:H,animation:n,viewport:a,calculatorState:s,projectionState:m,rulerState:I,activeFocus:w,isCopied:q,onLineClick:nn,onRulerUpdate:(j,G)=>{v?.updateLine(j,G);},onRulerRemove:j=>{v?.removeLine(j);},onCalculatorClose:on})}function ci(e,t){let n=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight;switch(e){case "top":return t.top;case "bottom":return i-(t.top+t.height);case "left":return t.left;case "right":return n-(t.left+t.width)}}var Ue=null,wt=0;function ir(){if(Ue){wt++;return}Ue=document.createElement("style"),Ue.textContent=bo,Ue.setAttribute("data-caliper-styles","true"),(document.head||document.getElementsByTagName("head")[0]).appendChild(Ue),wt=1;}function or(){Ue&&(wt--,wt<=0&&(Ue.remove(),Ue=null,wt=0));}var Jt=typeof window<"u",Ze=null;function fi(e){if(!Jt)return {mount:()=>{},dispose:()=>{},getSystems:()=>null,waitForSystems:()=>new Promise(()=>{}),use:()=>f,mounted:false};if(Ze?.mounted)return Ze;if(window.__CALIPER__?.mounted)return Ze=window.__CALIPER__,Ze;let t=ni(),n={theme:{...t?.theme,...e?.theme},commands:{...t?.commands,...e?.commands,calculator:{...t?.commands?.calculator,...e?.commands?.calculator},projection:{...t?.commands?.projection,...e?.commands?.projection}},animation:{...t?.animation,...e?.animation}},i=Jn(n.commands),r=ei(n.animation),o=ti(n.theme),l=t?.debug??true;ri.setEnabled(l);let a=null,c=null,u=new Map,d=[],f={mounted:false,mount:m=>{if(f.mounted)return;if(document.getElementById($t)){f.mounted=true;return}let y=m||document.documentElement;ir();let b=document.createElement("div");b.id=$t,b.style.zIndex=Vn.toString(),y.appendChild(b),Kn(o,b);let x=$n(()=>nr({commands:i,animation:r,onSystemsReady:g=>{c=g;let h=[...d];d.length=0,h.forEach(({resolve:w})=>w(g));}}),b);a=()=>{x(),b.remove(),or(),f.mounted=false,c=null,u.forEach(g=>g.dispose?.()),u.clear(),d.forEach(({reject:g})=>g(new Error("Overlay disposed"))),d.length=0,Ze===f&&(Ze=null);},f.mounted=true;},dispose:()=>{a&&(a(),a=null);},getSystems:()=>c,waitForSystems:()=>c?Promise.resolve(c):new Promise((m,y)=>d.push({resolve:m,reject:y})),use:m=>(u.has(m.name)||(u.set(m.name,m),m.install(f)),f)};return Ze=f,window.__CALIPER__=f,Jt&&f.mount(),f}Jt&&ii("0.2.0").catch(()=>{});typeof window<"u"&&fi();})();//# sourceMappingURL=index.global.min.js.map
327
+ //# sourceMappingURL=index.global.min.js.map