@spscommerce/positioning 6.37.3 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var j=Object.defineProperty,V=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var S=(e,i,r)=>i in e?j(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,D=(e,i)=>{for(var r in i||(i={}))z.call(i,r)&&S(e,r,i[r]);if(C)for(var r of C(i))W.call(i,r)&&S(e,r,i[r]);return e},F=(e,i)=>V(e,G(i));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var N=require("@spscommerce/utils");exports.Position=void 0;(function(e){e.TOP_LEFT="top left",e.TOP_MIDDLE="top middle",e.TOP_RIGHT="top right",e.RIGHT_TOP="right top",e.RIGHT_MIDDLE="right middle",e.RIGHT_BOTTOM="right bottom",e.BOTTOM_RIGHT="bottom right",e.BOTTOM_MIDDLE="bottom middle",e.BOTTOM_LEFT="bottom left",e.LEFT_BOTTOM="left bottom",e.LEFT_MIDDLE="left middle",e.LEFT_TOP="left top"})(exports.Position||(exports.Position={}));exports.PositionAnchor=void 0;(function(e){e.TOP_LEFT="top left",e.TOP_RIGHT="top right",e.BOTTOM_LEFT="bottom left",e.BOTTOM_RIGHT="bottom right"})(exports.PositionAnchor||(exports.PositionAnchor={}));const H={anchor:exports.PositionAnchor.TOP_LEFT,offsets:[],position:exports.Position.TOP_LEFT};(function(){if(typeof window!="object")return;if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype){"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});return}function e(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch{return null}}var i=function(t){for(var o=t,n=e(o);n;)o=n.ownerDocument,n=e(o);return o}(window.document),r=[],f=null,g=null;function b(t){this.time=t.time,this.target=t.target,this.rootBounds=m(t.rootBounds),this.boundingClientRect=m(t.boundingClientRect),this.intersectionRect=m(t.intersectionRect||w()),this.isIntersecting=!!t.intersectionRect;var o=this.boundingClientRect,n=o.width*o.height,c=this.intersectionRect,a=c.width*c.height;n?this.intersectionRatio=Number((a/n).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function l(t,o){var n=o||{};if(typeof t!="function")throw new Error("callback must be a function");if(n.root&&n.root.nodeType!=1&&n.root.nodeType!=9)throw new Error("root must be a Document or Element");this._checkForIntersections=d(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(n.rootMargin),this.thresholds=this._initThresholds(n.threshold),this.root=n.root||null,this.rootMargin=this._rootMarginValues.map(function(c){return c.value+c.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}l.prototype.THROTTLE_TIMEOUT=100,l.prototype.POLL_INTERVAL=null,l.prototype.USE_MUTATION_OBSERVER=!0,l._setupCrossOriginUpdater=function(){return f||(f=function(t,o){!t||!o?g=w():g=x(t,o),r.forEach(function(n){n._checkForIntersections()})}),f},l._resetCrossOriginUpdater=function(){f=null,g=null},l.prototype.observe=function(t){var o=this._observationTargets.some(function(n){return n.element==t});if(!o){if(!(t&&t.nodeType==1))throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},l.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(o){return o.element!=t}),this._unmonitorIntersections(t.ownerDocument),this._observationTargets.length==0&&this._unregisterInstance()},l.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},l.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},l.prototype._initThresholds=function(t){var o=t||[0];return Array.isArray(o)||(o=[o]),o.sort().filter(function(n,c,a){if(typeof n!="number"||isNaN(n)||n<0||n>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return n!==a[c-1]})},l.prototype._parseRootMargin=function(t){var o=t||"0px",n=o.split(/\s+/).map(function(c){var a=/^(-?\d*\.?\d+)(px|%)$/.exec(c);if(!a)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(a[1]),unit:a[2]}});return n[1]=n[1]||n[0],n[2]=n[2]||n[0],n[3]=n[3]||n[1],n},l.prototype._monitorIntersections=function(t){var o=t.defaultView;if(!!o&&this._monitoringDocuments.indexOf(t)==-1){var n=this._checkForIntersections,c=null,a=null;this.POLL_INTERVAL?c=o.setInterval(n,this.POLL_INTERVAL):(u(o,"resize",n,!0),u(t,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(a=new o.MutationObserver(n),a.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(t),this._monitoringUnsubscribes.push(function(){var O=t.defaultView;O&&(c&&O.clearInterval(c),p(O,"resize",n,!0)),p(t,"scroll",n,!0),a&&a.disconnect()});var E=this.root&&(this.root.ownerDocument||this.root)||i;if(t!=E){var y=e(t);y&&this._monitorIntersections(y.ownerDocument)}}},l.prototype._unmonitorIntersections=function(t){var o=this._monitoringDocuments.indexOf(t);if(o!=-1){var n=this.root&&(this.root.ownerDocument||this.root)||i,c=this._observationTargets.some(function(y){var O=y.element.ownerDocument;if(O==t)return!0;for(;O&&O!=n;){var R=e(O);if(O=R&&R.ownerDocument,O==t)return!0}return!1});if(!c){var a=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),a(),t!=n){var E=e(t);E&&this._unmonitorIntersections(E.ownerDocument)}}}},l.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var o=0;o<t.length;o++)t[o]()},l.prototype._checkForIntersections=function(){if(!(!this.root&&f&&!g)){var t=this._rootIsInDom(),o=t?this._getRootRect():w();this._observationTargets.forEach(function(n){var c=n.element,a=T(c),E=this._rootContainsTarget(c),y=n.entry,O=t&&E&&this._computeTargetAndRootIntersection(c,a,o),R=null;this._rootContainsTarget(c)?(!f||this.root)&&(R=o):R=w();var L=n.entry=new b({time:_(),target:c,boundingClientRect:a,rootBounds:R,intersectionRect:O});y?t&&E?this._hasCrossedThreshold(y,L)&&this._queuedEntries.push(L):y&&y.isIntersecting&&this._queuedEntries.push(L):this._queuedEntries.push(L)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},l.prototype._computeTargetAndRootIntersection=function(t,o,n){if(window.getComputedStyle(t).display!="none"){for(var c=o,a=I(t),E=!1;!E&&a;){var y=null,O=a.nodeType==1?window.getComputedStyle(a):{};if(O.display=="none")return null;if(a==this.root||a.nodeType==9)if(E=!0,a==this.root||a==i)f&&!this.root?!g||g.width==0&&g.height==0?(a=null,y=null,c=null):y=g:y=n;else{var R=I(a),L=R&&T(R),k=R&&this._computeTargetAndRootIntersection(R,L,n);L&&k?(a=R,y=x(L,k)):(a=null,c=null)}else{var B=a.ownerDocument;a!=B.body&&a!=B.documentElement&&O.overflow!="visible"&&(y=T(a))}if(y&&(c=v(y,c)),!c)break;a=a&&I(a)}return c}},l.prototype._getRootRect=function(){var t;if(this.root&&!P(this.root))t=T(this.root);else{var o=P(this.root)?this.root:i,n=o.documentElement,c=o.body;t={top:0,left:0,right:n.clientWidth||c.clientWidth,width:n.clientWidth||c.clientWidth,bottom:n.clientHeight||c.clientHeight,height:n.clientHeight||c.clientHeight}}return this._expandRectByRootMargin(t)},l.prototype._expandRectByRootMargin=function(t){var o=this._rootMarginValues.map(function(c,a){return c.unit=="px"?c.value:c.value*(a%2?t.width:t.height)/100}),n={top:t.top-o[0],right:t.right+o[1],bottom:t.bottom+o[2],left:t.left-o[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},l.prototype._hasCrossedThreshold=function(t,o){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,c=o.isIntersecting?o.intersectionRatio||0:-1;if(n!==c)for(var a=0;a<this.thresholds.length;a++){var E=this.thresholds[a];if(E==n||E==c||E<n!=E<c)return!0}},l.prototype._rootIsInDom=function(){return!this.root||h(i,this.root)},l.prototype._rootContainsTarget=function(t){var o=this.root&&(this.root.ownerDocument||this.root)||i;return h(o,t)&&(!this.root||o==t.ownerDocument)},l.prototype._registerInstance=function(){r.indexOf(this)<0&&r.push(this)},l.prototype._unregisterInstance=function(){var t=r.indexOf(this);t!=-1&&r.splice(t,1)};function _(){return window.performance&&performance.now&&performance.now()}function d(t,o){var n=null;return function(){n||(n=setTimeout(function(){t(),n=null},o))}}function u(t,o,n,c){typeof t.addEventListener=="function"?t.addEventListener(o,n,c||!1):typeof t.attachEvent=="function"&&t.attachEvent("on"+o,n)}function p(t,o,n,c){typeof t.removeEventListener=="function"?t.removeEventListener(o,n,c||!1):typeof t.detatchEvent=="function"&&t.detatchEvent("on"+o,n)}function v(t,o){var n=Math.max(t.top,o.top),c=Math.min(t.bottom,o.bottom),a=Math.max(t.left,o.left),E=Math.min(t.right,o.right),y=E-a,O=c-n;return y>=0&&O>=0&&{top:n,bottom:c,left:a,right:E,width:y,height:O}||null}function T(t){var o;try{o=t.getBoundingClientRect()}catch{}return o?(o.width&&o.height||(o={top:o.top,right:o.right,bottom:o.bottom,left:o.left,width:o.right-o.left,height:o.bottom-o.top}),o):w()}function w(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function m(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function x(t,o){var n=o.top-t.top,c=o.left-t.left;return{top:n,left:c,height:o.height,width:o.width,bottom:n+o.height,right:c+o.width}}function h(t,o){for(var n=o;n;){if(n==t)return!0;n=I(n)}return!1}function I(t){var o=t.parentNode;return t.nodeType==9&&t!=i?e(t):(o&&o.assignedSlot&&(o=o.assignedSlot.parentNode),o&&o.nodeType==11&&o.host?o.host:o)}function P(t){return t&&t.nodeType===9}window.IntersectionObserver=l,window.IntersectionObserverEntry=b})();var U={exports:{}};(function(e){var i=Object.prototype.hasOwnProperty,r="~";function f(){}Object.create&&(f.prototype=Object.create(null),new f().__proto__||(r=!1));function g(d,u,p){this.fn=d,this.context=u,this.once=p||!1}function b(d,u,p,v,T){if(typeof p!="function")throw new TypeError("The listener must be a function");var w=new g(p,v||d,T),m=r?r+u:u;return d._events[m]?d._events[m].fn?d._events[m]=[d._events[m],w]:d._events[m].push(w):(d._events[m]=w,d._eventsCount++),d}function l(d,u){--d._eventsCount==0?d._events=new f:delete d._events[u]}function _(){this._events=new f,this._eventsCount=0}_.prototype.eventNames=function(){var u=[],p,v;if(this._eventsCount===0)return u;for(v in p=this._events)i.call(p,v)&&u.push(r?v.slice(1):v);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(p)):u},_.prototype.listeners=function(u){var p=r?r+u:u,v=this._events[p];if(!v)return[];if(v.fn)return[v.fn];for(var T=0,w=v.length,m=new Array(w);T<w;T++)m[T]=v[T].fn;return m},_.prototype.listenerCount=function(u){var p=r?r+u:u,v=this._events[p];return v?v.fn?1:v.length:0},_.prototype.emit=function(u,p,v,T,w,m){var x=r?r+u:u;if(!this._events[x])return!1;var h=this._events[x],I=arguments.length,P,t;if(h.fn){switch(h.once&&this.removeListener(u,h.fn,void 0,!0),I){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,p),!0;case 3:return h.fn.call(h.context,p,v),!0;case 4:return h.fn.call(h.context,p,v,T),!0;case 5:return h.fn.call(h.context,p,v,T,w),!0;case 6:return h.fn.call(h.context,p,v,T,w,m),!0}for(t=1,P=new Array(I-1);t<I;t++)P[t-1]=arguments[t];h.fn.apply(h.context,P)}else{var o=h.length,n;for(t=0;t<o;t++)switch(h[t].once&&this.removeListener(u,h[t].fn,void 0,!0),I){case 1:h[t].fn.call(h[t].context);break;case 2:h[t].fn.call(h[t].context,p);break;case 3:h[t].fn.call(h[t].context,p,v);break;case 4:h[t].fn.call(h[t].context,p,v,T);break;default:if(!P)for(n=1,P=new Array(I-1);n<I;n++)P[n-1]=arguments[n];h[t].fn.apply(h[t].context,P)}}return!0},_.prototype.on=function(u,p,v){return b(this,u,p,v,!1)},_.prototype.once=function(u,p,v){return b(this,u,p,v,!0)},_.prototype.removeListener=function(u,p,v,T){var w=r?r+u:u;if(!this._events[w])return this;if(!p)return l(this,w),this;var m=this._events[w];if(m.fn)m.fn===p&&(!T||m.once)&&(!v||m.context===v)&&l(this,w);else{for(var x=0,h=[],I=m.length;x<I;x++)(m[x].fn!==p||T&&!m[x].once||v&&m[x].context!==v)&&h.push(m[x]);h.length?this._events[w]=h.length===1?h[0]:h:l(this,w)}return this},_.prototype.removeAllListeners=function(u){var p;return u?(p=r?r+u:u,this._events[p]&&l(this,p)):(this._events=new f,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=r,_.EventEmitter=_,e.exports=_})(U);var $=Object.defineProperty,q=Object.getOwnPropertyDescriptor,Y=(e,i,r,f)=>{for(var g=f>1?void 0:f?q(i,r):i,b=e.length-1,l;b>=0;b--)(l=e[b])&&(g=(f?l(i,r,g):l(g))||g);return f&&g&&$(i,r,g),g};const A=60,s=class{static on(e,i){s.events.on(e,i)}static off(e,i){s.events.off(e,i)}static once(e,i){s.events.once(e,i)}static checkCollisions(e,i){const r=i||Array.from(s.elements.keys()),f=e.getBoundingClientRect(),g=[];for(const b of r)if(b!==e){const l=b.getBoundingClientRect();l.left<=f.right&&l.right>=f.left&&l.top<=f.bottom&&l.bottom>=f.top&&g.push(b)}g.length&&s.onElementIntersection(e,g)}static isPositioned(e){return s.elements.has(e)}static getPositioningOptions(e){return s.elements.has(e)?s.elements.get(e):null}static position(e,i={}){const r=D(D({},H),i);let f=e;for(;f!==document.body;)if(f=f.parentElement,f.classList.contains("sps-focused-task")){r.scrollParent=f,s.registeredScrollParents.has(f)||(s.registeredScrollParents.add(f),f.addEventListener("scroll",s.update));break}if(e.style.visibility="hidden",s.elements.size===0&&(window.addEventListener("resize",s.update),window.addEventListener("scroll",s.update)),!r.relativeTo)throw new Error("You must provide an element for the relativeTo option to position an element.");s.elements.set(e,r),N.onNextTick(()=>{s.fixElementPosition(e),s.viewportObserver.observe(e),e.style.visibility="",s.checkCollisions(e)})}static release(e){if(s.elements.has(e)){s.clearStyles(e);const i=s.elements.get(e);i.scrollParent&&(i.scrollParent.removeEventListener("scroll",s.update),s.registeredScrollParents.delete(i.scrollParent)),s.elements.delete(e),s.elements.size===0&&(window.removeEventListener("resize",s.update),window.removeEventListener("scroll",s.update)),s.viewportObserver.unobserve(e)}}static releaseAll(){for(const e of s.elements.keys())s.release(e)}static refresh(e){s.elements.has(e)&&(s.clearStyles(e),s.fixElementPosition(e),s.checkCollisions(e))}static refreshAll(){for(const e of s.elements.keys())s.refresh(e)}static reposition(e,i){if(s.elements.has(e)){const r=s.elements.get(e);s.elements.set(e,Object.assign(r,i)),s.refresh(e)}}static onViewportIntersection(e){for(const i of e){const r=Object.keys(IntersectionObserverEntry.prototype).reduce((f,g)=>F(D({},f),{[g]:i[g]}),{});r.rootBounds=r.rootBounds||s.getRootBounds(),s.events.emit("viewportIntersection",Object.freeze(r))}}static onElementIntersection(e,i){s.events.emit("elementIntersection",{target:e,intersectingWith:i})}static getRootBounds(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{x:0,y:A,left:0,top:A,right:e,bottom:i,height:i-A,width:e}}static clearStyles(e){Object.assign(e.style,{position:"",width:"",top:"",left:"",right:"",bottom:"",visibility:"",zIndex:""})}static fixElementPosition(e,i){if(!this.elements.has(e))return;const r=i||this.elements.get(e),f=this.getRootBounds(),g=e.getBoundingClientRect(),b=r.relativeTo.getBoundingClientRect(),{width:l}=r.useRelativeTargetWidth?b:g;Object.assign(e.style,{minWidth:`${l}px`,position:"fixed",zIndex:r.zIndex||""});let _,d;const u=r.position.split(" "),p=r.offsets[0]||0,v=r.offsets[1]||0;switch(_=0,d=0,u[0]){case"top":_=b.top-g.height-p;break;case"left":d=b.left-l-p;break;case"right":d=b.right+p;break;case"bottom":_=b.bottom+p;break;default:throw new Error(`${r.position} is not a valid position`)}switch(u[1]){case"left":d=b.left-v;break;case"top":_=b.top-v;break;case"middle":u[0]==="top"||u[0]==="bottom"?d=b.left+b.width/2-l/2+v:(u[0]==="left"||u[0]==="right")&&(_=b.top+b.height/2-g.height/2+v);break;case"bottom":_=b.bottom-g.height+v;break;case"right":d=b.right-l+v;break;default:throw new Error(`${r.position} is not a valid position`)}const T=_+g.height,w=d+g.width,m=`${Math.round(_)}px`,x=`${Math.round(f.bottom-T)}px`,h=`${Math.round(d)}px`,I=`${Math.round(f.right-w)}px`;switch(r.anchor){case exports.PositionAnchor.TOP_LEFT:Object.assign(e.style,{top:m,bottom:"auto",left:h,right:"auto"});break;case exports.PositionAnchor.TOP_RIGHT:Object.assign(e.style,{top:m,bottom:"auto",left:"auto",right:I});break;case exports.PositionAnchor.BOTTOM_LEFT:Object.assign(e.style,{top:"auto",bottom:x,left:h,right:"auto"});break;case exports.PositionAnchor.BOTTOM_RIGHT:Object.assign(e.style,{top:"auto",bottom:x,left:"auto",right:I});break}}static update(e){const i=s.elements.entries(),r=[];for(const[f,g]of i)(!e||e.target===document||e.target===g.scrollParent||e.target===window)&&(s.fixElementPosition(f,g),s.checkCollisions(f,r),r.push(f))}on(e,i){s.on(e,i)}off(e,i){s.off(e,i)}once(e,i){s.once(e,i)}isPositioned(e){return s.isPositioned(e)}getPositioningOptions(e){return s.getPositioningOptions(e)}position(e,i={}){s.position(e,i)}release(e){s.release(e)}releaseAll(){s.releaseAll()}refresh(e){s.refresh(e)}refreshAll(){s.refreshAll()}reposition(e,i){s.reposition(e,i)}};let M=s;M.elements=new Map;M.registeredScrollParents=new Set;M.events=new U.exports.EventEmitter;M.viewportObserver=new IntersectionObserver(s.onViewportIntersection,{rootMargin:`-${A}px 0px 0px`,threshold:1});Y([N.lockedToAnimationFrames],M,"update",1);exports.DEFAULT_POSITIONING_OPTIONS=H;exports.PositioningService=M;
1
+ "use strict";var j=Object.defineProperty;var V=(e,r,s)=>r in e?j(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var k=(e,r,s)=>(V(e,typeof r!="symbol"?r+"":r,s),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const F=require("@spscommerce/utils");var A=(e=>(e.TOP_LEFT="top left",e.TOP_MIDDLE="top middle",e.TOP_RIGHT="top right",e.RIGHT_TOP="right top",e.RIGHT_MIDDLE="right middle",e.RIGHT_BOTTOM="right bottom",e.BOTTOM_RIGHT="bottom right",e.BOTTOM_MIDDLE="bottom middle",e.BOTTOM_LEFT="bottom left",e.LEFT_BOTTOM="left bottom",e.LEFT_MIDDLE="left middle",e.LEFT_TOP="left top",e))(A||{}),D=(e=>(e.TOP_LEFT="top left",e.TOP_RIGHT="top right",e.BOTTOM_LEFT="bottom left",e.BOTTOM_RIGHT="bottom right",e))(D||{});const N={anchor:D.TOP_LEFT,offsets:[],position:A.TOP_LEFT};(function(){if(typeof window!="object")return;if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype){"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});return}function e(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch{return null}}var r=function(t){for(var n=t,o=e(n);o;)n=o.ownerDocument,o=e(n);return n}(window.document),s=[],f=null,g=null;function b(t){this.time=t.time,this.target=t.target,this.rootBounds=m(t.rootBounds),this.boundingClientRect=m(t.boundingClientRect),this.intersectionRect=m(t.intersectionRect||w()),this.isIntersecting=!!t.intersectionRect;var n=this.boundingClientRect,o=n.width*n.height,a=this.intersectionRect,c=a.width*a.height;o?this.intersectionRatio=Number((c/o).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function l(t,n){var o=n||{};if(typeof t!="function")throw new Error("callback must be a function");if(o.root&&o.root.nodeType!=1&&o.root.nodeType!=9)throw new Error("root must be a Document or Element");this._checkForIntersections=d(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(o.rootMargin),this.thresholds=this._initThresholds(o.threshold),this.root=o.root||null,this.rootMargin=this._rootMarginValues.map(function(a){return a.value+a.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}l.prototype.THROTTLE_TIMEOUT=100,l.prototype.POLL_INTERVAL=null,l.prototype.USE_MUTATION_OBSERVER=!0,l._setupCrossOriginUpdater=function(){return f||(f=function(t,n){!t||!n?g=w():g=x(t,n),s.forEach(function(o){o._checkForIntersections()})}),f},l._resetCrossOriginUpdater=function(){f=null,g=null},l.prototype.observe=function(t){var n=this._observationTargets.some(function(o){return o.element==t});if(!n){if(!(t&&t.nodeType==1))throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},l.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(n){return n.element!=t}),this._unmonitorIntersections(t.ownerDocument),this._observationTargets.length==0&&this._unregisterInstance()},l.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},l.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},l.prototype._initThresholds=function(t){var n=t||[0];return Array.isArray(n)||(n=[n]),n.sort().filter(function(o,a,c){if(typeof o!="number"||isNaN(o)||o<0||o>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return o!==c[a-1]})},l.prototype._parseRootMargin=function(t){var n=t||"0px",o=n.split(/\s+/).map(function(a){var c=/^(-?\d*\.?\d+)(px|%)$/.exec(a);if(!c)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(c[1]),unit:c[2]}});return o[1]=o[1]||o[0],o[2]=o[2]||o[0],o[3]=o[3]||o[1],o},l.prototype._monitorIntersections=function(t){var n=t.defaultView;if(!!n&&this._monitoringDocuments.indexOf(t)==-1){var o=this._checkForIntersections,a=null,c=null;this.POLL_INTERVAL?a=n.setInterval(o,this.POLL_INTERVAL):(u(n,"resize",o,!0),u(t,"scroll",o,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in n&&(c=new n.MutationObserver(o),c.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(t),this._monitoringUnsubscribes.push(function(){var O=t.defaultView;O&&(a&&O.clearInterval(a),p(O,"resize",o,!0)),p(t,"scroll",o,!0),c&&c.disconnect()});var E=this.root&&(this.root.ownerDocument||this.root)||r;if(t!=E){var y=e(t);y&&this._monitorIntersections(y.ownerDocument)}}},l.prototype._unmonitorIntersections=function(t){var n=this._monitoringDocuments.indexOf(t);if(n!=-1){var o=this.root&&(this.root.ownerDocument||this.root)||r,a=this._observationTargets.some(function(y){var O=y.element.ownerDocument;if(O==t)return!0;for(;O&&O!=o;){var R=e(O);if(O=R&&R.ownerDocument,O==t)return!0}return!1});if(!a){var c=this._monitoringUnsubscribes[n];if(this._monitoringDocuments.splice(n,1),this._monitoringUnsubscribes.splice(n,1),c(),t!=o){var E=e(t);E&&this._unmonitorIntersections(E.ownerDocument)}}}},l.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var n=0;n<t.length;n++)t[n]()},l.prototype._checkForIntersections=function(){if(!(!this.root&&f&&!g)){var t=this._rootIsInDom(),n=t?this._getRootRect():w();this._observationTargets.forEach(function(o){var a=o.element,c=T(a),E=this._rootContainsTarget(a),y=o.entry,O=t&&E&&this._computeTargetAndRootIntersection(a,c,n),R=null;this._rootContainsTarget(a)?(!f||this.root)&&(R=n):R=w();var M=o.entry=new b({time:_(),target:a,boundingClientRect:c,rootBounds:R,intersectionRect:O});y?t&&E?this._hasCrossedThreshold(y,M)&&this._queuedEntries.push(M):y&&y.isIntersecting&&this._queuedEntries.push(M):this._queuedEntries.push(M)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},l.prototype._computeTargetAndRootIntersection=function(t,n,o){if(window.getComputedStyle(t).display!="none"){for(var a=n,c=I(t),E=!1;!E&&c;){var y=null,O=c.nodeType==1?window.getComputedStyle(c):{};if(O.display=="none")return null;if(c==this.root||c.nodeType==9)if(E=!0,c==this.root||c==r)f&&!this.root?!g||g.width==0&&g.height==0?(c=null,y=null,a=null):y=g:y=o;else{var R=I(c),M=R&&T(R),C=R&&this._computeTargetAndRootIntersection(R,M,o);M&&C?(c=R,y=x(M,C)):(c=null,a=null)}else{var S=c.ownerDocument;c!=S.body&&c!=S.documentElement&&O.overflow!="visible"&&(y=T(c))}if(y&&(a=v(y,a)),!a)break;c=c&&I(c)}return a}},l.prototype._getRootRect=function(){var t;if(this.root&&!L(this.root))t=T(this.root);else{var n=L(this.root)?this.root:r,o=n.documentElement,a=n.body;t={top:0,left:0,right:o.clientWidth||a.clientWidth,width:o.clientWidth||a.clientWidth,bottom:o.clientHeight||a.clientHeight,height:o.clientHeight||a.clientHeight}}return this._expandRectByRootMargin(t)},l.prototype._expandRectByRootMargin=function(t){var n=this._rootMarginValues.map(function(a,c){return a.unit=="px"?a.value:a.value*(c%2?t.width:t.height)/100}),o={top:t.top-n[0],right:t.right+n[1],bottom:t.bottom+n[2],left:t.left-n[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},l.prototype._hasCrossedThreshold=function(t,n){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,a=n.isIntersecting?n.intersectionRatio||0:-1;if(o!==a)for(var c=0;c<this.thresholds.length;c++){var E=this.thresholds[c];if(E==o||E==a||E<o!=E<a)return!0}},l.prototype._rootIsInDom=function(){return!this.root||h(r,this.root)},l.prototype._rootContainsTarget=function(t){var n=this.root&&(this.root.ownerDocument||this.root)||r;return h(n,t)&&(!this.root||n==t.ownerDocument)},l.prototype._registerInstance=function(){s.indexOf(this)<0&&s.push(this)},l.prototype._unregisterInstance=function(){var t=s.indexOf(this);t!=-1&&s.splice(t,1)};function _(){return window.performance&&performance.now&&performance.now()}function d(t,n){var o=null;return function(){o||(o=setTimeout(function(){t(),o=null},n))}}function u(t,n,o,a){typeof t.addEventListener=="function"?t.addEventListener(n,o,a||!1):typeof t.attachEvent=="function"&&t.attachEvent("on"+n,o)}function p(t,n,o,a){typeof t.removeEventListener=="function"?t.removeEventListener(n,o,a||!1):typeof t.detatchEvent=="function"&&t.detatchEvent("on"+n,o)}function v(t,n){var o=Math.max(t.top,n.top),a=Math.min(t.bottom,n.bottom),c=Math.max(t.left,n.left),E=Math.min(t.right,n.right),y=E-c,O=a-o;return y>=0&&O>=0&&{top:o,bottom:a,left:c,right:E,width:y,height:O}||null}function T(t){var n;try{n=t.getBoundingClientRect()}catch{}return n?(n.width&&n.height||(n={top:n.top,right:n.right,bottom:n.bottom,left:n.left,width:n.right-n.left,height:n.bottom-n.top}),n):w()}function w(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function m(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function x(t,n){var o=n.top-t.top,a=n.left-t.left;return{top:o,left:a,height:n.height,width:n.width,bottom:o+n.height,right:a+n.width}}function h(t,n){for(var o=n;o;){if(o==t)return!0;o=I(o)}return!1}function I(t){var n=t.parentNode;return t.nodeType==9&&t!=r?e(t):(n&&n.assignedSlot&&(n=n.assignedSlot.parentNode),n&&n.nodeType==11&&n.host?n.host:n)}function L(t){return t&&t.nodeType===9}window.IntersectionObserver=l,window.IntersectionObserverEntry=b})();var H={exports:{}};(function(e){var r=Object.prototype.hasOwnProperty,s="~";function f(){}Object.create&&(f.prototype=Object.create(null),new f().__proto__||(s=!1));function g(d,u,p){this.fn=d,this.context=u,this.once=p||!1}function b(d,u,p,v,T){if(typeof p!="function")throw new TypeError("The listener must be a function");var w=new g(p,v||d,T),m=s?s+u:u;return d._events[m]?d._events[m].fn?d._events[m]=[d._events[m],w]:d._events[m].push(w):(d._events[m]=w,d._eventsCount++),d}function l(d,u){--d._eventsCount===0?d._events=new f:delete d._events[u]}function _(){this._events=new f,this._eventsCount=0}_.prototype.eventNames=function(){var u=[],p,v;if(this._eventsCount===0)return u;for(v in p=this._events)r.call(p,v)&&u.push(s?v.slice(1):v);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(p)):u},_.prototype.listeners=function(u){var p=s?s+u:u,v=this._events[p];if(!v)return[];if(v.fn)return[v.fn];for(var T=0,w=v.length,m=new Array(w);T<w;T++)m[T]=v[T].fn;return m},_.prototype.listenerCount=function(u){var p=s?s+u:u,v=this._events[p];return v?v.fn?1:v.length:0},_.prototype.emit=function(u,p,v,T,w,m){var x=s?s+u:u;if(!this._events[x])return!1;var h=this._events[x],I=arguments.length,L,t;if(h.fn){switch(h.once&&this.removeListener(u,h.fn,void 0,!0),I){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,p),!0;case 3:return h.fn.call(h.context,p,v),!0;case 4:return h.fn.call(h.context,p,v,T),!0;case 5:return h.fn.call(h.context,p,v,T,w),!0;case 6:return h.fn.call(h.context,p,v,T,w,m),!0}for(t=1,L=new Array(I-1);t<I;t++)L[t-1]=arguments[t];h.fn.apply(h.context,L)}else{var n=h.length,o;for(t=0;t<n;t++)switch(h[t].once&&this.removeListener(u,h[t].fn,void 0,!0),I){case 1:h[t].fn.call(h[t].context);break;case 2:h[t].fn.call(h[t].context,p);break;case 3:h[t].fn.call(h[t].context,p,v);break;case 4:h[t].fn.call(h[t].context,p,v,T);break;default:if(!L)for(o=1,L=new Array(I-1);o<I;o++)L[o-1]=arguments[o];h[t].fn.apply(h[t].context,L)}}return!0},_.prototype.on=function(u,p,v){return b(this,u,p,v,!1)},_.prototype.once=function(u,p,v){return b(this,u,p,v,!0)},_.prototype.removeListener=function(u,p,v,T){var w=s?s+u:u;if(!this._events[w])return this;if(!p)return l(this,w),this;var m=this._events[w];if(m.fn)m.fn===p&&(!T||m.once)&&(!v||m.context===v)&&l(this,w);else{for(var x=0,h=[],I=m.length;x<I;x++)(m[x].fn!==p||T&&!m[x].once||v&&m[x].context!==v)&&h.push(m[x]);h.length?this._events[w]=h.length===1?h[0]:h:l(this,w)}return this},_.prototype.removeAllListeners=function(u){var p;return u?(p=s?s+u:u,this._events[p]&&l(this,p)):(this._events=new f,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=s,_.EventEmitter=_,e.exports=_})(H);var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,W=(e,r,s,f)=>{for(var g=f>1?void 0:f?z(r,s):r,b=e.length-1,l;b>=0;b--)(l=e[b])&&(g=(f?l(r,s,g):l(g))||g);return f&&g&&G(r,s,g),g};const B=60;var P;const i=(P=class{static on(e,r){i.events.on(e,r)}static off(e,r){i.events.off(e,r)}static once(e,r){i.events.once(e,r)}static checkCollisions(e,r){const s=r||Array.from(i.elements.keys()),f=e.getBoundingClientRect(),g=[];for(const b of s)if(b!==e){const l=b.getBoundingClientRect();l.left<=f.right&&l.right>=f.left&&l.top<=f.bottom&&l.bottom>=f.top&&g.push(b)}g.length&&i.onElementIntersection(e,g)}static isPositioned(e){return i.elements.has(e)}static getPositioningOptions(e){return i.elements.has(e)?i.elements.get(e):null}static position(e,r={}){const s={...N,...r};let f=e;for(;f!==document.body;)if(f=f.parentElement,f.classList.contains("sps-focused-task")){s.scrollParent=f,i.registeredScrollParents.has(f)||(i.registeredScrollParents.add(f),f.addEventListener("scroll",i.update));break}if(e.style.visibility="hidden",i.elements.size===0&&(window.addEventListener("resize",i.update),window.addEventListener("scroll",i.update)),!s.relativeTo)throw new Error("You must provide an element for the relativeTo option to position an element.");i.elements.set(e,s),F.onNextTick(()=>{i.fixElementPosition(e),i.viewportObserver.observe(e),e.style.visibility="",i.checkCollisions(e)})}static release(e){if(i.elements.has(e)){i.clearStyles(e);const r=i.elements.get(e);r.scrollParent&&(r.scrollParent.removeEventListener("scroll",i.update),i.registeredScrollParents.delete(r.scrollParent)),i.elements.delete(e),i.elements.size===0&&(window.removeEventListener("resize",i.update),window.removeEventListener("scroll",i.update)),i.viewportObserver.unobserve(e)}}static releaseAll(){for(const e of i.elements.keys())i.release(e)}static refresh(e){i.elements.has(e)&&(i.clearStyles(e),i.fixElementPosition(e),i.checkCollisions(e))}static refreshAll(){for(const e of i.elements.keys())i.refresh(e)}static reposition(e,r){if(i.elements.has(e)){const s=i.elements.get(e);i.elements.set(e,Object.assign(s,r)),i.refresh(e)}}static onViewportIntersection(e){for(const r of e){const s=Object.keys(IntersectionObserverEntry.prototype).reduce((f,g)=>({...f,[g]:r[g]}),{});s.rootBounds=s.rootBounds||i.getRootBounds(),i.events.emit("viewportIntersection",Object.freeze(s))}}static onElementIntersection(e,r){i.events.emit("elementIntersection",{target:e,intersectingWith:r})}static getRootBounds(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),r=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{x:0,y:B,left:0,top:B,right:e,bottom:r,height:r-B,width:e}}static clearStyles(e){Object.assign(e.style,{position:"",width:"",top:"",left:"",right:"",bottom:"",visibility:"",zIndex:""})}static fixElementPosition(e,r){if(!this.elements.has(e))return;const s=r||this.elements.get(e),f=this.getRootBounds(),g=e.getBoundingClientRect(),b=s.relativeTo.getBoundingClientRect(),{width:l}=s.useRelativeTargetWidth?b:g;Object.assign(e.style,{minWidth:`${l}px`,position:"fixed",zIndex:s.zIndex||""});let _,d;const u=s.position.split(" "),p=s.offsets[0]||0,v=s.offsets[1]||0;switch(_=0,d=0,u[0]){case"top":_=b.top-g.height-p;break;case"left":d=b.left-l-p;break;case"right":d=b.right+p;break;case"bottom":_=b.bottom+p;break;default:throw new Error(`${s.position} is not a valid position`)}switch(u[1]){case"left":d=b.left-v;break;case"top":_=b.top-v;break;case"middle":u[0]==="top"||u[0]==="bottom"?d=b.left+b.width/2-l/2+v:(u[0]==="left"||u[0]==="right")&&(_=b.top+b.height/2-g.height/2+v);break;case"bottom":_=b.bottom-g.height+v;break;case"right":d=b.right-l+v;break;default:throw new Error(`${s.position} is not a valid position`)}const T=_+g.height,w=d+g.width,m=`${Math.round(_)}px`,x=`${Math.round(f.bottom-T)}px`,h=`${Math.round(d)}px`,I=`${Math.round(f.right-w)}px`;switch(s.anchor){case D.TOP_LEFT:Object.assign(e.style,{top:m,bottom:"auto",left:h,right:"auto"});break;case D.TOP_RIGHT:Object.assign(e.style,{top:m,bottom:"auto",left:"auto",right:I});break;case D.BOTTOM_LEFT:Object.assign(e.style,{top:"auto",bottom:x,left:h,right:"auto"});break;case D.BOTTOM_RIGHT:Object.assign(e.style,{top:"auto",bottom:x,left:"auto",right:I});break}}static update(e){const r=i.elements.entries(),s=[];for(const[f,g]of r)(!e||e.target===document||e.target===g.scrollParent||e.target===window)&&(i.fixElementPosition(f,g),i.checkCollisions(f,s),s.push(f))}on(e,r){i.on(e,r)}off(e,r){i.off(e,r)}once(e,r){i.once(e,r)}isPositioned(e){return i.isPositioned(e)}getPositioningOptions(e){return i.getPositioningOptions(e)}position(e,r={}){i.position(e,r)}release(e){i.release(e)}releaseAll(){i.releaseAll()}refresh(e){i.refresh(e)}refreshAll(){i.refreshAll()}reposition(e,r){i.reposition(e,r)}},k(P,"elements",new Map),k(P,"registeredScrollParents",new Set),k(P,"events",new H.exports.EventEmitter),k(P,"viewportObserver",new IntersectionObserver(i.onViewportIntersection,{rootMargin:`-${B}px 0px 0px`,threshold:1})),P);let U=i;W([F.lockedToAnimationFrames],U,"update",1);exports.DEFAULT_POSITIONING_OPTIONS=N;exports.Position=A;exports.PositionAnchor=D;exports.PositioningService=U;