import t,{_ProxyMethods as e}from"../core/Interaction.prod.js";import*as n from"../utils/rect.prod.js";e.offsetBy="";export function addTotal(t){t.pointerIsDown&&(f(t.coords.cur,t.offset.total),t.offset.pending.x=0,t.offset.pending.y=0)}function o({interaction:t}){applyPending(t)}export function applyPending(t){if(!(t=>!(!t.offset.pending.x&&!t.offset.pending.y))(t))return!1;const{pending:e}=t.offset;return f(t.coords.cur,e),f(t.coords.delta,e),n.addEdges(t.edges,t.rect,e),e.x=0,e.y=0,!0}function i({x:t,y:e}){this.offset.pending.x+=t,this.offset.pending.y+=e,this.offset.total.x+=t,this.offset.total.y+=e}function f({page:t,client:e},{x:n,y:o}){t.x+=n,t.y+=o,e.x+=n,e.y+=o}const s={id:"offset",before:["modifiers","pointer-events","actions","inertia"],install(t){t.Interaction.prototype.offsetBy=i},listeners:{"interactions:new"({interaction:t}){t.offset={total:{x:0,y:0},pending:{x:0,y:0}}},"interactions:update-pointer":({interaction:t})=>addTotal(t),"interactions:before-action-start":o,"interactions:before-action-move":o,"interactions:before-action-end"({interaction:t}){if(applyPending(t))return t.move({offset:!0}),t.end(),!1},"interactions:stop"({interaction:t}){t.offset.total.x=0,t.offset.total.y=0,t.offset.pending.x=0,t.offset.pending.y=0}}};export default s; //# sourceMappingURL=plugin.prod.js.map