"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../../../compute-scroll-into-view@3.1.1/node_modules/compute-scroll-into-view/dist/index.js"),f=t=>t===!1?{block:"end",inline:"nearest"}:(o=>o===Object(o)&&Object.keys(o).length!==0)(t)?t:{block:"start",inline:"nearest"};function p(t,o){if(!t.isConnected||!(n=>{let e=n;for(;e&&e.parentNode;){if(e.parentNode===document)return!0;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1})(t))return;const r=(n=>{const e=window.getComputedStyle(n);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(t);if((n=>typeof n=="object"&&typeof n.behavior=="function")(o))return o.behavior(l.compute(t,o));const a=typeof o=="boolean"||o==null?void 0:o.behavior;for(const{el:n,top:e,left:i}of l.compute(t,f(o))){const s=e-r.top+r.bottom,c=i-r.left+r.right;n.scroll({top:s,left:c,behavior:a})}}exports.default=p;
