@spscommerce/positioning 8.21.0 → 8.21.2

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 @@
1
+ (function(D,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","@spscommerce/utils"],k):(D=typeof globalThis<"u"?globalThis:D||self,k(D.Positioning={},D.utils))})(this,function(D,k){"use strict";var r;var A=(g=>(g.TOP_LEFT="top left",g.TOP_MIDDLE="top middle",g.TOP_RIGHT="top right",g.RIGHT_TOP="right top",g.RIGHT_MIDDLE="right middle",g.RIGHT_BOTTOM="right bottom",g.BOTTOM_RIGHT="bottom right",g.BOTTOM_MIDDLE="bottom middle",g.BOTTOM_LEFT="bottom left",g.LEFT_BOTTOM="left bottom",g.LEFT_MIDDLE="left middle",g.LEFT_TOP="left top",g))(A||{}),P=(g=>(g.TOP_LEFT="top left",g.TOP_RIGHT="top right",g.BOTTOM_LEFT="bottom left",g.BOTTOM_RIGHT="bottom right",g))(P||{});const C={anchor:P.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 g(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch{return null}}var n=function(t){for(var e=t,o=g(e);o;)e=o.ownerDocument,o=g(e);return e}(window.document),i=[],p=null,f=null;function w(t){this.time=t.time,this.target=t.target,this.rootBounds=b(t.rootBounds),this.boundingClientRect=b(t.boundingClientRect),this.intersectionRect=b(t.intersectionRect||y()),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,s=this.intersectionRect,u=s.width*s.height;o?this.intersectionRatio=Number((u/o).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function a(t,e){var o=e||{};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=v(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(s){return s.value+s.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}a.prototype.THROTTLE_TIMEOUT=100,a.prototype.POLL_INTERVAL=null,a.prototype.USE_MUTATION_OBSERVER=!0,a._setupCrossOriginUpdater=function(){return p||(p=function(t,e){!t||!e?f=y():f=x(t,e),i.forEach(function(o){o._checkForIntersections()})}),p},a._resetCrossOriginUpdater=function(){p=null,f=null},a.prototype.observe=function(t){var e=this._observationTargets.some(function(o){return o.element==t});if(!e){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()}},a.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._unmonitorIntersections(t.ownerDocument),this._observationTargets.length==0&&this._unregisterInstance()},a.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},a.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},a.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(o,s,u){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!==u[s-1]})},a.prototype._parseRootMargin=function(t){var e=t||"0px",o=e.split(/\s+/).map(function(s){var u=/^(-?\d*\.?\d+)(px|%)$/.exec(s);if(!u)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(u[1]),unit:u[2]}});return o[1]=o[1]||o[0],o[2]=o[2]||o[0],o[3]=o[3]||o[1],o},a.prototype._monitorIntersections=function(t){var e=t.defaultView;if(e&&this._monitoringDocuments.indexOf(t)==-1){var o=this._checkForIntersections,s=null,u=null;this.POLL_INTERVAL?s=e.setInterval(o,this.POLL_INTERVAL):(c(e,"resize",o,!0),c(t,"scroll",o,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in e&&(u=new e.MutationObserver(o),u.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(t),this._monitoringUnsubscribes.push(function(){var I=t.defaultView;I&&(s&&I.clearInterval(s),l(I,"resize",o,!0)),l(t,"scroll",o,!0),u&&u.disconnect()});var O=this.root&&(this.root.ownerDocument||this.root)||n;if(t!=O){var E=g(t);E&&this._monitorIntersections(E.ownerDocument)}}},a.prototype._unmonitorIntersections=function(t){var e=this._monitoringDocuments.indexOf(t);if(e!=-1){var o=this.root&&(this.root.ownerDocument||this.root)||n,s=this._observationTargets.some(function(E){var I=E.element.ownerDocument;if(I==t)return!0;for(;I&&I!=o;){var L=g(I);if(I=L&&L.ownerDocument,I==t)return!0}return!1});if(!s){var u=this._monitoringUnsubscribes[e];if(this._monitoringDocuments.splice(e,1),this._monitoringUnsubscribes.splice(e,1),u(),t!=o){var O=g(t);O&&this._unmonitorIntersections(O.ownerDocument)}}}},a.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},a.prototype._checkForIntersections=function(){if(!(!this.root&&p&&!f)){var t=this._rootIsInDom(),e=t?this._getRootRect():y();this._observationTargets.forEach(function(o){var s=o.element,u=T(s),O=this._rootContainsTarget(s),E=o.entry,I=t&&O&&this._computeTargetAndRootIntersection(s,u,e),L=null;this._rootContainsTarget(s)?(!p||this.root)&&(L=e):L=y();var M=o.entry=new w({time:m(),target:s,boundingClientRect:u,rootBounds:L,intersectionRect:I});E?t&&O?this._hasCrossedThreshold(E,M)&&this._queuedEntries.push(M):E&&E.isIntersecting&&this._queuedEntries.push(M):this._queuedEntries.push(M)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},a.prototype._computeTargetAndRootIntersection=function(t,e,o){if(window.getComputedStyle(t).display!="none"){for(var s=e,u=_(t),O=!1;!O&&u;){var E=null,I=u.nodeType==1?window.getComputedStyle(u):{};if(I.display=="none")return null;if(u==this.root||u.nodeType==9)if(O=!0,u==this.root||u==n)p&&!this.root?!f||f.width==0&&f.height==0?(u=null,E=null,s=null):E=f:E=o;else{var L=_(u),M=L&&T(L),N=L&&this._computeTargetAndRootIntersection(L,M,o);M&&N?(u=L,E=x(M,N)):(u=null,s=null)}else{var H=u.ownerDocument;u!=H.body&&u!=H.documentElement&&I.overflow!="visible"&&(E=T(u))}if(E&&(s=d(E,s)),!s)break;u=u&&_(u)}return s}},a.prototype._getRootRect=function(){var t;if(this.root&&!R(this.root))t=T(this.root);else{var e=R(this.root)?this.root:n,o=e.documentElement,s=e.body;t={top:0,left:0,right:o.clientWidth||s.clientWidth,width:o.clientWidth||s.clientWidth,bottom:o.clientHeight||s.clientHeight,height:o.clientHeight||s.clientHeight}}return this._expandRectByRootMargin(t)},a.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(s,u){return s.unit=="px"?s.value:s.value*(u%2?t.width:t.height)/100}),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},a.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,s=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==s)for(var u=0;u<this.thresholds.length;u++){var O=this.thresholds[u];if(O==o||O==s||O<o!=O<s)return!0}},a.prototype._rootIsInDom=function(){return!this.root||h(n,this.root)},a.prototype._rootContainsTarget=function(t){var e=this.root&&(this.root.ownerDocument||this.root)||n;return h(e,t)&&(!this.root||e==t.ownerDocument)},a.prototype._registerInstance=function(){i.indexOf(this)<0&&i.push(this)},a.prototype._unregisterInstance=function(){var t=i.indexOf(this);t!=-1&&i.splice(t,1)};function m(){return window.performance&&performance.now&&performance.now()}function v(t,e){var o=null;return function(){o||(o=setTimeout(function(){t(),o=null},e))}}function c(t,e,o,s){typeof t.addEventListener=="function"?t.addEventListener(e,o,s):typeof t.attachEvent=="function"&&t.attachEvent("on"+e,o)}function l(t,e,o,s){typeof t.removeEventListener=="function"?t.removeEventListener(e,o,s):typeof t.detatchEvent=="function"&&t.detatchEvent("on"+e,o)}function d(t,e){var o=Math.max(t.top,e.top),s=Math.min(t.bottom,e.bottom),u=Math.max(t.left,e.left),O=Math.min(t.right,e.right),E=O-u,I=s-o;return E>=0&&I>=0&&{top:o,bottom:s,left:u,right:O,width:E,height:I}||null}function T(t){var e;try{e=t.getBoundingClientRect()}catch{}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):y()}function y(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function b(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,e){var o=e.top-t.top,s=e.left-t.left;return{top:o,left:s,height:e.height,width:e.width,bottom:o+e.height,right:s+e.width}}function h(t,e){for(var o=e;o;){if(o==t)return!0;o=_(o)}return!1}function _(t){var e=t.parentNode;return t.nodeType==9&&t!=n?g(t):(e&&e.assignedSlot&&(e=e.assignedSlot.parentNode),e&&e.nodeType==11&&e.host?e.host:e)}function R(t){return t&&t.nodeType===9}window.IntersectionObserver=a,window.IntersectionObserverEntry=w})();var F={exports:{}};(function(g){var n=Object.prototype.hasOwnProperty,i="~";function p(){}Object.create&&(p.prototype=Object.create(null),new p().__proto__||(i=!1));function f(v,c,l){this.fn=v,this.context=c,this.once=l||!1}function w(v,c,l,d,T){if(typeof l!="function")throw new TypeError("The listener must be a function");var y=new f(l,d||v,T),b=i?i+c:c;return v._events[b]?v._events[b].fn?v._events[b]=[v._events[b],y]:v._events[b].push(y):(v._events[b]=y,v._eventsCount++),v}function a(v,c){--v._eventsCount===0?v._events=new p:delete v._events[c]}function m(){this._events=new p,this._eventsCount=0}m.prototype.eventNames=function(){var c=[],l,d;if(this._eventsCount===0)return c;for(d in l=this._events)n.call(l,d)&&c.push(i?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},m.prototype.listeners=function(c){var l=i?i+c:c,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var T=0,y=d.length,b=new Array(y);T<y;T++)b[T]=d[T].fn;return b},m.prototype.listenerCount=function(c){var l=i?i+c:c,d=this._events[l];return d?d.fn?1:d.length:0},m.prototype.emit=function(c,l,d,T,y,b){var x=i?i+c:c;if(!this._events[x])return!1;var h=this._events[x],_=arguments.length,R,t;if(h.fn){switch(h.once&&this.removeListener(c,h.fn,void 0,!0),_){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,l),!0;case 3:return h.fn.call(h.context,l,d),!0;case 4:return h.fn.call(h.context,l,d,T),!0;case 5:return h.fn.call(h.context,l,d,T,y),!0;case 6:return h.fn.call(h.context,l,d,T,y,b),!0}for(t=1,R=new Array(_-1);t<_;t++)R[t-1]=arguments[t];h.fn.apply(h.context,R)}else{var e=h.length,o;for(t=0;t<e;t++)switch(h[t].once&&this.removeListener(c,h[t].fn,void 0,!0),_){case 1:h[t].fn.call(h[t].context);break;case 2:h[t].fn.call(h[t].context,l);break;case 3:h[t].fn.call(h[t].context,l,d);break;case 4:h[t].fn.call(h[t].context,l,d,T);break;default:if(!R)for(o=1,R=new Array(_-1);o<_;o++)R[o-1]=arguments[o];h[t].fn.apply(h[t].context,R)}}return!0},m.prototype.on=function(c,l,d){return w(this,c,l,d,!1)},m.prototype.once=function(c,l,d){return w(this,c,l,d,!0)},m.prototype.removeListener=function(c,l,d,T){var y=i?i+c:c;if(!this._events[y])return this;if(!l)return a(this,y),this;var b=this._events[y];if(b.fn)b.fn===l&&(!T||b.once)&&(!d||b.context===d)&&a(this,y);else{for(var x=0,h=[],_=b.length;x<_;x++)(b[x].fn!==l||T&&!b[x].once||d&&b[x].context!==d)&&h.push(b[x]);h.length?this._events[y]=h.length===1?h[0]:h:a(this,y)}return this},m.prototype.removeAllListeners=function(c){var l;return c?(l=i?i+c:c,this._events[l]&&a(this,l)):(this._events=new p,this._eventsCount=0),this},m.prototype.off=m.prototype.removeListener,m.prototype.addListener=m.prototype.on,m.prefixed=i,m.EventEmitter=m,g.exports=m})(F);var j=F.exports,U=Object.defineProperty,V=Object.getOwnPropertyDescriptor,G=(g,n,i,p)=>{for(var f=V(n,i),w=g.length-1,a;w>=0;w--)(a=g[w])&&(f=a(n,i,f)||f);return f&&U(n,i,f),f};const B=60,S=(r=class{static on(n,i){r.events.on(n,i)}static off(n,i){r.events.off(n,i)}static once(n,i){r.events.once(n,i)}static checkCollisions(n,i){const p=i||Array.from(r.elements.keys()),f=n.getBoundingClientRect(),w=[];for(const a of p)if(a!==n){const m=a.getBoundingClientRect();m.left<=f.right&&m.right>=f.left&&m.top<=f.bottom&&m.bottom>=f.top&&w.push(a)}w.length&&r.onElementIntersection(n,w)}static isPositioned(n){return r.elements.has(n)}static getPositioningOptions(n){return r.elements.has(n)?r.elements.get(n):null}static position(n,i={}){const p={...C,...i};let f=n;for(;f!==document.body;)if(f=f.parentElement,f.classList.contains("sps-focused-task")){p.scrollParent=f,r.registeredScrollParents.has(f)||(r.registeredScrollParents.add(f),f.addEventListener("scroll",r.update));break}if(n.style.visibility="hidden",r.elements.size===0&&(window.addEventListener("resize",r.update),window.addEventListener("scroll",r.update)),!p.relativeTo)throw new Error("You must provide an element for the relativeTo option to position an element.");r.elements.set(n,p),k.onNextTick(()=>{r.fixElementPosition(n),r.viewportObserver.observe(n),n.style.visibility="",r.checkCollisions(n)})}static release(n){if(r.elements.has(n)){r.clearStyles(n);const i=r.elements.get(n);i.scrollParent&&(i.scrollParent.removeEventListener("scroll",r.update),r.registeredScrollParents.delete(i.scrollParent)),r.elements.delete(n),r.elements.size===0&&(window.removeEventListener("resize",r.update),window.removeEventListener("scroll",r.update)),r.viewportObserver.unobserve(n)}}static releaseAll(){for(const n of r.elements.keys())r.release(n)}static refresh(n){r.elements.has(n)&&(r.clearStyles(n),r.fixElementPosition(n),r.checkCollisions(n))}static refreshAll(){for(const n of r.elements.keys())r.refresh(n)}static reposition(n,i){if(r.elements.has(n)){const p=r.elements.get(n);r.elements.set(n,Object.assign(p,i)),r.refresh(n)}}static onViewportIntersection(n){for(const i of n){const p=Object.keys(IntersectionObserverEntry.prototype).reduce((f,w)=>({...f,[w]:i[w]}),{});p.rootBounds=p.rootBounds||r.getRootBounds(),r.events.emit("viewportIntersection",Object.freeze(p))}}static onElementIntersection(n,i){r.events.emit("elementIntersection",{target:n,intersectingWith:i})}static getRootBounds(){const n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{x:0,y:B,left:0,top:B,right:n,bottom:i,height:i-B,width:n}}static clearStyles(n){Object.assign(n.style,{position:"",width:"",top:"",left:"",right:"",bottom:"",visibility:"",zIndex:""})}static fixElementPosition(n,i){if(!this.elements.has(n))return;const p=i||this.elements.get(n),f=this.getRootBounds(),w=n.getBoundingClientRect(),a=p.relativeTo.getBoundingClientRect(),{width:m}=p.useRelativeTargetWidth?a:w;Object.assign(n.style,{minWidth:`${m}px`,position:"fixed",zIndex:p.zIndex||""});let v,c;const l=p.position.split(" "),d=p.offsets[0]||0,T=p.offsets[1]||0;switch(v=0,c=0,l[0]){case"top":v=a.top-w.height-d;break;case"left":c=a.left-m-d;break;case"right":c=a.right+d;break;case"bottom":v=a.bottom+d;break;default:throw new Error(`${p.position} is not a valid position`)}switch(l[1]){case"left":c=a.left-T;break;case"top":v=a.top-T;break;case"middle":l[0]==="top"||l[0]==="bottom"?c=a.left+a.width/2-m/2+T:(l[0]==="left"||l[0]==="right")&&(v=a.top+a.height/2-w.height/2+T);break;case"bottom":v=a.bottom-w.height+T;break;case"right":c=a.right-m+T;break;default:throw new Error(`${p.position} is not a valid position`)}const y=v+w.height,b=c+w.width,x=`${Math.round(v)}px`,h=`${Math.round(f.bottom-y)}px`,_=`${Math.round(c)}px`,R=`${Math.round(f.right-b)}px`;switch(p.anchor){case P.TOP_LEFT:Object.assign(n.style,{top:x,bottom:"auto",left:_,right:"auto"});break;case P.TOP_RIGHT:Object.assign(n.style,{top:x,bottom:"auto",left:"auto",right:R});break;case P.BOTTOM_LEFT:Object.assign(n.style,{top:"auto",bottom:h,left:_,right:"auto"});break;case P.BOTTOM_RIGHT:Object.assign(n.style,{top:"auto",bottom:h,left:"auto",right:R});break}}static update(n){const i=r.elements.entries(),p=[];for(const[f,w]of i)(!n||n.target===document||n.target===w.scrollParent||n.target===window)&&(r.fixElementPosition(f,w),r.checkCollisions(f,p),p.push(f))}on(n,i){r.on(n,i)}off(n,i){r.off(n,i)}once(n,i){r.once(n,i)}isPositioned(n){return r.isPositioned(n)}getPositioningOptions(n){return r.getPositioningOptions(n)}position(n,i={}){r.position(n,i)}release(n){r.release(n)}releaseAll(){r.releaseAll()}refresh(n){r.refresh(n)}refreshAll(){r.refreshAll()}reposition(n,i){r.reposition(n,i)}},r.elements=new Map,r.registeredScrollParents=new Set,r.events=new j.EventEmitter,r.viewportObserver=new IntersectionObserver(r.onViewportIntersection,{rootMargin:`-${B}px 0px 0px`,threshold:1}),r);G([k.lockedToAnimationFrames],S,"update");let z=S;D.DEFAULT_POSITIONING_OPTIONS=C,D.Position=A,D.PositionAnchor=P,D.PositioningService=z,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@spscommerce/positioning",
3
3
  "description": "Service for positioning dropdown/popup elements.",
4
- "version": "8.21.0",
4
+ "version": "8.21.2",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/positioning",
8
8
  "homepage": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/positioning#readme",
9
- "module": "./lib/index.es.js",
10
9
  "type": "module",
11
- "main": "./lib/index.cjs.js",
10
+ "module": "./lib/index.js",
11
+ "main": "./lib/index.umd.cjs",
12
12
  "types": "./lib/index.d.ts",
13
13
  "exports": {
14
- "import": "./lib/index.es.js",
15
- "require": "./lib/index.cjs.js",
16
- "default": "./lib/index.cjs.js",
14
+ "require": "./lib/index.umd.cjs",
15
+ "import": "./lib/index.js",
16
+ "default": "./lib/index.js",
17
17
  "types": "./lib/index.d.ts"
18
18
  },
19
19
  "publishConfig": {
package/vite.config.mjs CHANGED
@@ -1,20 +1,20 @@
1
- import path from 'path';
1
+ import path from "path";
2
2
 
3
- import { defineConfig } from 'vite';
3
+ import { defineConfig } from "vite";
4
4
 
5
- import pkg from './package.json';
5
+ import pkg from "./package.json";
6
6
 
7
7
  export default defineConfig({
8
8
  build: {
9
9
  lib: {
10
- entry: path.resolve(__dirname, 'src/index.ts'),
11
- formats: ['es', 'cjs'],
12
- fileName: (format) => `index.${format}.js`,
10
+ entry: path.resolve(__dirname, "src/index.ts"),
11
+ name: "Positioning",
12
+ fileName: "index",
13
13
  },
14
- outDir: path.resolve(__dirname, './lib'),
14
+ outDir: path.resolve(__dirname, "./lib"),
15
15
  emptyOutDir: false,
16
16
  rollupOptions: {
17
17
  external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
18
18
  },
19
19
  },
20
- });
20
+ });
package/lib/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@spscommerce/utils");var k=(g=>(g.TOP_LEFT="top left",g.TOP_MIDDLE="top middle",g.TOP_RIGHT="top right",g.RIGHT_TOP="right top",g.RIGHT_MIDDLE="right middle",g.RIGHT_BOTTOM="right bottom",g.BOTTOM_RIGHT="bottom right",g.BOTTOM_MIDDLE="bottom middle",g.BOTTOM_LEFT="bottom left",g.LEFT_BOTTOM="left bottom",g.LEFT_MIDDLE="left middle",g.LEFT_TOP="left top",g))(k||{}),M=(g=>(g.TOP_LEFT="top left",g.TOP_RIGHT="top right",g.BOTTOM_LEFT="bottom left",g.BOTTOM_RIGHT="bottom right",g))(M||{});const F={anchor:M.TOP_LEFT,offsets:[],position:k.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 g(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch{return null}}var n=function(t){for(var e=t,o=g(e);o;)e=o.ownerDocument,o=g(e);return e}(window.document),i=[],p=null,f=null;function w(t){this.time=t.time,this.target=t.target,this.rootBounds=b(t.rootBounds),this.boundingClientRect=b(t.boundingClientRect),this.intersectionRect=b(t.intersectionRect||y()),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,s=this.intersectionRect,l=s.width*s.height;o?this.intersectionRatio=Number((l/o).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function a(t,e){var o=e||{};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(s){return s.value+s.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}a.prototype.THROTTLE_TIMEOUT=100,a.prototype.POLL_INTERVAL=null,a.prototype.USE_MUTATION_OBSERVER=!0,a._setupCrossOriginUpdater=function(){return p||(p=function(t,e){!t||!e?f=y():f=x(t,e),i.forEach(function(o){o._checkForIntersections()})}),p},a._resetCrossOriginUpdater=function(){p=null,f=null},a.prototype.observe=function(t){var e=this._observationTargets.some(function(o){return o.element==t});if(!e){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()}},a.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._unmonitorIntersections(t.ownerDocument),this._observationTargets.length==0&&this._unregisterInstance()},a.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},a.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},a.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(o,s,l){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!==l[s-1]})},a.prototype._parseRootMargin=function(t){var e=t||"0px",o=e.split(/\s+/).map(function(s){var l=/^(-?\d*\.?\d+)(px|%)$/.exec(s);if(!l)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(l[1]),unit:l[2]}});return o[1]=o[1]||o[0],o[2]=o[2]||o[0],o[3]=o[3]||o[1],o},a.prototype._monitorIntersections=function(t){var e=t.defaultView;if(e&&this._monitoringDocuments.indexOf(t)==-1){var o=this._checkForIntersections,s=null,l=null;this.POLL_INTERVAL?s=e.setInterval(o,this.POLL_INTERVAL):(c(e,"resize",o,!0),c(t,"scroll",o,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in e&&(l=new e.MutationObserver(o),l.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(t),this._monitoringUnsubscribes.push(function(){var I=t.defaultView;I&&(s&&I.clearInterval(s),u(I,"resize",o,!0)),u(t,"scroll",o,!0),l&&l.disconnect()});var O=this.root&&(this.root.ownerDocument||this.root)||n;if(t!=O){var E=g(t);E&&this._monitorIntersections(E.ownerDocument)}}},a.prototype._unmonitorIntersections=function(t){var e=this._monitoringDocuments.indexOf(t);if(e!=-1){var o=this.root&&(this.root.ownerDocument||this.root)||n,s=this._observationTargets.some(function(E){var I=E.element.ownerDocument;if(I==t)return!0;for(;I&&I!=o;){var L=g(I);if(I=L&&L.ownerDocument,I==t)return!0}return!1});if(!s){var l=this._monitoringUnsubscribes[e];if(this._monitoringDocuments.splice(e,1),this._monitoringUnsubscribes.splice(e,1),l(),t!=o){var O=g(t);O&&this._unmonitorIntersections(O.ownerDocument)}}}},a.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},a.prototype._checkForIntersections=function(){if(!(!this.root&&p&&!f)){var t=this._rootIsInDom(),e=t?this._getRootRect():y();this._observationTargets.forEach(function(o){var s=o.element,l=T(s),O=this._rootContainsTarget(s),E=o.entry,I=t&&O&&this._computeTargetAndRootIntersection(s,l,e),L=null;this._rootContainsTarget(s)?(!p||this.root)&&(L=e):L=y();var D=o.entry=new w({time:m(),target:s,boundingClientRect:l,rootBounds:L,intersectionRect:I});E?t&&O?this._hasCrossedThreshold(E,D)&&this._queuedEntries.push(D):E&&E.isIntersecting&&this._queuedEntries.push(D):this._queuedEntries.push(D)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},a.prototype._computeTargetAndRootIntersection=function(t,e,o){if(window.getComputedStyle(t).display!="none"){for(var s=e,l=_(t),O=!1;!O&&l;){var E=null,I=l.nodeType==1?window.getComputedStyle(l):{};if(I.display=="none")return null;if(l==this.root||l.nodeType==9)if(O=!0,l==this.root||l==n)p&&!this.root?!f||f.width==0&&f.height==0?(l=null,E=null,s=null):E=f:E=o;else{var L=_(l),D=L&&T(L),B=L&&this._computeTargetAndRootIntersection(L,D,o);D&&B?(l=L,E=x(D,B)):(l=null,s=null)}else{var A=l.ownerDocument;l!=A.body&&l!=A.documentElement&&I.overflow!="visible"&&(E=T(l))}if(E&&(s=v(E,s)),!s)break;l=l&&_(l)}return s}},a.prototype._getRootRect=function(){var t;if(this.root&&!R(this.root))t=T(this.root);else{var e=R(this.root)?this.root:n,o=e.documentElement,s=e.body;t={top:0,left:0,right:o.clientWidth||s.clientWidth,width:o.clientWidth||s.clientWidth,bottom:o.clientHeight||s.clientHeight,height:o.clientHeight||s.clientHeight}}return this._expandRectByRootMargin(t)},a.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(s,l){return s.unit=="px"?s.value:s.value*(l%2?t.width:t.height)/100}),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},a.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,s=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==s)for(var l=0;l<this.thresholds.length;l++){var O=this.thresholds[l];if(O==o||O==s||O<o!=O<s)return!0}},a.prototype._rootIsInDom=function(){return!this.root||h(n,this.root)},a.prototype._rootContainsTarget=function(t){var e=this.root&&(this.root.ownerDocument||this.root)||n;return h(e,t)&&(!this.root||e==t.ownerDocument)},a.prototype._registerInstance=function(){i.indexOf(this)<0&&i.push(this)},a.prototype._unregisterInstance=function(){var t=i.indexOf(this);t!=-1&&i.splice(t,1)};function m(){return window.performance&&performance.now&&performance.now()}function d(t,e){var o=null;return function(){o||(o=setTimeout(function(){t(),o=null},e))}}function c(t,e,o,s){typeof t.addEventListener=="function"?t.addEventListener(e,o,s):typeof t.attachEvent=="function"&&t.attachEvent("on"+e,o)}function u(t,e,o,s){typeof t.removeEventListener=="function"?t.removeEventListener(e,o,s):typeof t.detatchEvent=="function"&&t.detatchEvent("on"+e,o)}function v(t,e){var o=Math.max(t.top,e.top),s=Math.min(t.bottom,e.bottom),l=Math.max(t.left,e.left),O=Math.min(t.right,e.right),E=O-l,I=s-o;return E>=0&&I>=0&&{top:o,bottom:s,left:l,right:O,width:E,height:I}||null}function T(t){var e;try{e=t.getBoundingClientRect()}catch{}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):y()}function y(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function b(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,e){var o=e.top-t.top,s=e.left-t.left;return{top:o,left:s,height:e.height,width:e.width,bottom:o+e.height,right:s+e.width}}function h(t,e){for(var o=e;o;){if(o==t)return!0;o=_(o)}return!1}function _(t){var e=t.parentNode;return t.nodeType==9&&t!=n?g(t):(e&&e.assignedSlot&&(e=e.assignedSlot.parentNode),e&&e.nodeType==11&&e.host?e.host:e)}function R(t){return t&&t.nodeType===9}window.IntersectionObserver=a,window.IntersectionObserverEntry=w})();var S={exports:{}};(function(g){var n=Object.prototype.hasOwnProperty,i="~";function p(){}Object.create&&(p.prototype=Object.create(null),new p().__proto__||(i=!1));function f(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function w(d,c,u,v,T){if(typeof u!="function")throw new TypeError("The listener must be a function");var y=new f(u,v||d,T),b=i?i+c:c;return d._events[b]?d._events[b].fn?d._events[b]=[d._events[b],y]:d._events[b].push(y):(d._events[b]=y,d._eventsCount++),d}function a(d,c){--d._eventsCount===0?d._events=new p:delete d._events[c]}function m(){this._events=new p,this._eventsCount=0}m.prototype.eventNames=function(){var c=[],u,v;if(this._eventsCount===0)return c;for(v in u=this._events)n.call(u,v)&&c.push(i?v.slice(1):v);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},m.prototype.listeners=function(c){var u=i?i+c:c,v=this._events[u];if(!v)return[];if(v.fn)return[v.fn];for(var T=0,y=v.length,b=new Array(y);T<y;T++)b[T]=v[T].fn;return b},m.prototype.listenerCount=function(c){var u=i?i+c:c,v=this._events[u];return v?v.fn?1:v.length:0},m.prototype.emit=function(c,u,v,T,y,b){var x=i?i+c:c;if(!this._events[x])return!1;var h=this._events[x],_=arguments.length,R,t;if(h.fn){switch(h.once&&this.removeListener(c,h.fn,void 0,!0),_){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,u),!0;case 3:return h.fn.call(h.context,u,v),!0;case 4:return h.fn.call(h.context,u,v,T),!0;case 5:return h.fn.call(h.context,u,v,T,y),!0;case 6:return h.fn.call(h.context,u,v,T,y,b),!0}for(t=1,R=new Array(_-1);t<_;t++)R[t-1]=arguments[t];h.fn.apply(h.context,R)}else{var e=h.length,o;for(t=0;t<e;t++)switch(h[t].once&&this.removeListener(c,h[t].fn,void 0,!0),_){case 1:h[t].fn.call(h[t].context);break;case 2:h[t].fn.call(h[t].context,u);break;case 3:h[t].fn.call(h[t].context,u,v);break;case 4:h[t].fn.call(h[t].context,u,v,T);break;default:if(!R)for(o=1,R=new Array(_-1);o<_;o++)R[o-1]=arguments[o];h[t].fn.apply(h[t].context,R)}}return!0},m.prototype.on=function(c,u,v){return w(this,c,u,v,!1)},m.prototype.once=function(c,u,v){return w(this,c,u,v,!0)},m.prototype.removeListener=function(c,u,v,T){var y=i?i+c:c;if(!this._events[y])return this;if(!u)return a(this,y),this;var b=this._events[y];if(b.fn)b.fn===u&&(!T||b.once)&&(!v||b.context===v)&&a(this,y);else{for(var x=0,h=[],_=b.length;x<_;x++)(b[x].fn!==u||T&&!b[x].once||v&&b[x].context!==v)&&h.push(b[x]);h.length?this._events[y]=h.length===1?h[0]:h:a(this,y)}return this},m.prototype.removeAllListeners=function(c){var u;return c?(u=i?i+c:c,this._events[u]&&a(this,u)):(this._events=new p,this._eventsCount=0),this},m.prototype.off=m.prototype.removeListener,m.prototype.addListener=m.prototype.on,m.prefixed=i,m.EventEmitter=m,g.exports=m})(S);var H=S.exports,U=Object.defineProperty,j=Object.getOwnPropertyDescriptor,V=(g,n,i,p)=>{for(var f=j(n,i),w=g.length-1,a;w>=0;w--)(a=g[w])&&(f=a(n,i,f)||f);return f&&U(n,i,f),f};const P=60;var r;const N=(r=class{static on(n,i){r.events.on(n,i)}static off(n,i){r.events.off(n,i)}static once(n,i){r.events.once(n,i)}static checkCollisions(n,i){const p=i||Array.from(r.elements.keys()),f=n.getBoundingClientRect(),w=[];for(const a of p)if(a!==n){const m=a.getBoundingClientRect();m.left<=f.right&&m.right>=f.left&&m.top<=f.bottom&&m.bottom>=f.top&&w.push(a)}w.length&&r.onElementIntersection(n,w)}static isPositioned(n){return r.elements.has(n)}static getPositioningOptions(n){return r.elements.has(n)?r.elements.get(n):null}static position(n,i={}){const p={...F,...i};let f=n;for(;f!==document.body;)if(f=f.parentElement,f.classList.contains("sps-focused-task")){p.scrollParent=f,r.registeredScrollParents.has(f)||(r.registeredScrollParents.add(f),f.addEventListener("scroll",r.update));break}if(n.style.visibility="hidden",r.elements.size===0&&(window.addEventListener("resize",r.update),window.addEventListener("scroll",r.update)),!p.relativeTo)throw new Error("You must provide an element for the relativeTo option to position an element.");r.elements.set(n,p),C.onNextTick(()=>{r.fixElementPosition(n),r.viewportObserver.observe(n),n.style.visibility="",r.checkCollisions(n)})}static release(n){if(r.elements.has(n)){r.clearStyles(n);const i=r.elements.get(n);i.scrollParent&&(i.scrollParent.removeEventListener("scroll",r.update),r.registeredScrollParents.delete(i.scrollParent)),r.elements.delete(n),r.elements.size===0&&(window.removeEventListener("resize",r.update),window.removeEventListener("scroll",r.update)),r.viewportObserver.unobserve(n)}}static releaseAll(){for(const n of r.elements.keys())r.release(n)}static refresh(n){r.elements.has(n)&&(r.clearStyles(n),r.fixElementPosition(n),r.checkCollisions(n))}static refreshAll(){for(const n of r.elements.keys())r.refresh(n)}static reposition(n,i){if(r.elements.has(n)){const p=r.elements.get(n);r.elements.set(n,Object.assign(p,i)),r.refresh(n)}}static onViewportIntersection(n){for(const i of n){const p=Object.keys(IntersectionObserverEntry.prototype).reduce((f,w)=>({...f,[w]:i[w]}),{});p.rootBounds=p.rootBounds||r.getRootBounds(),r.events.emit("viewportIntersection",Object.freeze(p))}}static onElementIntersection(n,i){r.events.emit("elementIntersection",{target:n,intersectingWith:i})}static getRootBounds(){const n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{x:0,y:P,left:0,top:P,right:n,bottom:i,height:i-P,width:n}}static clearStyles(n){Object.assign(n.style,{position:"",width:"",top:"",left:"",right:"",bottom:"",visibility:"",zIndex:""})}static fixElementPosition(n,i){if(!this.elements.has(n))return;const p=i||this.elements.get(n),f=this.getRootBounds(),w=n.getBoundingClientRect(),a=p.relativeTo.getBoundingClientRect(),{width:m}=p.useRelativeTargetWidth?a:w;Object.assign(n.style,{minWidth:`${m}px`,position:"fixed",zIndex:p.zIndex||""});let d,c;const u=p.position.split(" "),v=p.offsets[0]||0,T=p.offsets[1]||0;switch(d=0,c=0,u[0]){case"top":d=a.top-w.height-v;break;case"left":c=a.left-m-v;break;case"right":c=a.right+v;break;case"bottom":d=a.bottom+v;break;default:throw new Error(`${p.position} is not a valid position`)}switch(u[1]){case"left":c=a.left-T;break;case"top":d=a.top-T;break;case"middle":u[0]==="top"||u[0]==="bottom"?c=a.left+a.width/2-m/2+T:(u[0]==="left"||u[0]==="right")&&(d=a.top+a.height/2-w.height/2+T);break;case"bottom":d=a.bottom-w.height+T;break;case"right":c=a.right-m+T;break;default:throw new Error(`${p.position} is not a valid position`)}const y=d+w.height,b=c+w.width,x=`${Math.round(d)}px`,h=`${Math.round(f.bottom-y)}px`,_=`${Math.round(c)}px`,R=`${Math.round(f.right-b)}px`;switch(p.anchor){case M.TOP_LEFT:Object.assign(n.style,{top:x,bottom:"auto",left:_,right:"auto"});break;case M.TOP_RIGHT:Object.assign(n.style,{top:x,bottom:"auto",left:"auto",right:R});break;case M.BOTTOM_LEFT:Object.assign(n.style,{top:"auto",bottom:h,left:_,right:"auto"});break;case M.BOTTOM_RIGHT:Object.assign(n.style,{top:"auto",bottom:h,left:"auto",right:R});break}}static update(n){const i=r.elements.entries(),p=[];for(const[f,w]of i)(!n||n.target===document||n.target===w.scrollParent||n.target===window)&&(r.fixElementPosition(f,w),r.checkCollisions(f,p),p.push(f))}on(n,i){r.on(n,i)}off(n,i){r.off(n,i)}once(n,i){r.once(n,i)}isPositioned(n){return r.isPositioned(n)}getPositioningOptions(n){return r.getPositioningOptions(n)}position(n,i={}){r.position(n,i)}release(n){r.release(n)}releaseAll(){r.releaseAll()}refresh(n){r.refresh(n)}refreshAll(){r.refreshAll()}reposition(n,i){r.reposition(n,i)}},r.elements=new Map,r.registeredScrollParents=new Set,r.events=new H.EventEmitter,r.viewportObserver=new IntersectionObserver(r.onViewportIntersection,{rootMargin:`-${P}px 0px 0px`,threshold:1}),r);V([C.lockedToAnimationFrames],N,"update");let G=N;exports.DEFAULT_POSITIONING_OPTIONS=F;exports.Position=k;exports.PositionAnchor=M;exports.PositioningService=G;
File without changes