/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var Ma=Object.create;var $t=Object.defineProperty;var Oa=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Ca=Object.getPrototypeOf,La=Object.prototype.hasOwnProperty;var kr=g=>$t(g,"__esModule",{value:!0});var Tr=(g,s)=>()=>(s||g((s={exports:{}}).exports,s),s.exports),Ia=(g,s)=>{kr(g);for(var u in s)$t(g,u,{get:s[u],enumerable:!0})},Aa=(g,s,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let h of _a(s))!La.call(g,h)&&h!=="default"&&$t(g,h,{get:()=>s[h],enumerable:!(u=Oa(s,h))||u.enumerable});return g},be=g=>Aa(kr($t(g!=null?Ma(Ca(g)):{},"default",g&&g.__esModule&&"default"in g?{get:()=>g.default,enumerable:!0}:{value:g,enumerable:!0})),g);var Or=Tr((Ya,Mr)=>{Mr.exports=function(s,u){u||(u=[0,""]),s=String(s);var h=parseFloat(s,10);return u[0]=h,u[1]=s.match(/[\d.\-\+]*\s*(.*)/)[1]||"",u}});var $r=Tr((Kr,Zn)=>{(function(g){typeof Kr=="object"&&typeof Zn!="undefined"?Zn.exports=g():typeof define=="function"&&define.amd?define([],g):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).interact=g()})(function(){var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0,g.default=function(e){return!(!e||!e.Window)&&e instanceof e.Window};var s={};Object.defineProperty(s,"__esModule",{value:!0}),s.init=v,s.getWindow=function(e){return(0,g.default)(e)?e:(e.ownerDocument||e).defaultView||h.window},s.window=s.realWindow=void 0;var u=void 0;s.realWindow=u;var h=void 0;function v(e){s.realWindow=u=e;var t=e.document.createTextNode("");t.ownerDocument!==e.document&&typeof e.wrap=="function"&&e.wrap(t)===t&&(e=e.wrap(e)),s.window=h=e}s.window=h,typeof window!="undefined"&&window&&v(window);var d={};function E(e){return(E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}Object.defineProperty(d,"__esModule",{value:!0}),d.default=void 0;var T=function(e){return!!e&&E(e)==="object"},k=function(e){return typeof e=="function"},S={window:function(e){return e===s.window||(0,g.default)(e)},docFrag:function(e){return T(e)&&e.nodeType===11},object:T,func:k,number:function(e){return typeof e=="number"},bool:function(e){return typeof e=="boolean"},string:function(e){return typeof e=="string"},element:function(e){if(!e||E(e)!=="object")return!1;var t=s.getWindow(e)||s.window;return/object|function/.test(E(t.Element))?e instanceof t.Element:e.nodeType===1&&typeof e.nodeName=="string"},plainObject:function(e){return T(e)&&!!e.constructor&&/function Object\b/.test(e.constructor.toString())},array:function(e){return T(e)&&e.length!==void 0&&k(e.splice)}};d.default=S;var H={};function M(e){var t=e.interaction;if(t.prepared.name==="drag"){var o=t.prepared.axis;o==="x"?(t.coords.cur.page.y=t.coords.start.page.y,t.coords.cur.client.y=t.coords.start.client.y,t.coords.velocity.client.y=0,t.coords.velocity.page.y=0):o==="y"&&(t.coords.cur.page.x=t.coords.start.page.x,t.coords.cur.client.x=t.coords.start.client.x,t.coords.velocity.client.x=0,t.coords.velocity.page.x=0)}}function V(e){var t=e.iEvent,o=e.interaction;if(o.prepared.name==="drag"){var n=o.prepared.axis;if(n==="x"||n==="y"){var r=n==="x"?"y":"x";t.page[r]=o.coords.start.page[r],t.client[r]=o.coords.start.client[r],t.delta[r]=0}}}Object.defineProperty(H,"__esModule",{value:!0}),H.default=void 0;var D={id:"actions/drag",install:function(e){var t=e.actions,o=e.Interactable,n=e.defaults;o.prototype.draggable=D.draggable,t.map.drag=D,t.methodDict.drag="draggable",n.actions.drag=D.defaults},listeners:{"interactions:before-action-move":M,"interactions:action-resume":M,"interactions:action-move":V,"auto-start:check":function(e){var t=e.interaction,o=e.interactable,n=e.buttons,r=o.options.drag;if(r&&r.enabled&&(!t.pointerIsDown||!/mouse|pointer/.test(t.pointerType)||(n&o.options.drag.mouseButtons)!=0))return e.action={name:"drag",axis:r.lockAxis==="start"?r.startAxis:r.lockAxis},!1}},draggable:function(e){return d.default.object(e)?(this.options.drag.enabled=e.enabled!==!1,this.setPerAction("drag",e),this.setOnEvents("drag",e),/^(xy|x|y|start)$/.test(e.lockAxis)&&(this.options.drag.lockAxis=e.lockAxis),/^(xy|x|y)$/.test(e.startAxis)&&(this.options.drag.startAxis=e.startAxis),this):d.default.bool(e)?(this.options.drag.enabled=e,this):this.options.drag},beforeMove:M,move:V,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor:function(){return"move"}},X=D;H.default=X;var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default=void 0;var W={init:function(e){var t=e;W.document=t.document,W.DocumentFragment=t.DocumentFragment||J,W.SVGElement=t.SVGElement||J,W.SVGSVGElement=t.SVGSVGElement||J,W.SVGElementInstance=t.SVGElementInstance||J,W.Element=t.Element||J,W.HTMLElement=t.HTMLElement||W.Element,W.Event=t.Event,W.Touch=t.Touch||J,W.PointerEvent=t.PointerEvent||t.MSPointerEvent},document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function J(){}var le=W;A.default=le;var $={};Object.defineProperty($,"__esModule",{value:!0}),$.default=void 0;var Q={init:function(e){var t=A.default.Element,o=e.navigator||{};Q.supportsTouch="ontouchstart"in e||d.default.func(e.DocumentTouch)&&A.default.document instanceof e.DocumentTouch,Q.supportsPointerEvent=o.pointerEnabled!==!1&&!!A.default.PointerEvent,Q.isIOS=/iP(hone|od|ad)/.test(o.platform),Q.isIOS7=/iP(hone|od|ad)/.test(o.platform)&&/OS 7[^\d]/.test(o.appVersion),Q.isIe9=/MSIE 9/.test(o.userAgent),Q.isOperaMobile=o.appName==="Opera"&&Q.supportsTouch&&/Presto/.test(o.userAgent),Q.prefixedMatchesSelector="matches"in t.prototype?"matches":"webkitMatchesSelector"in t.prototype?"webkitMatchesSelector":"mozMatchesSelector"in t.prototype?"mozMatchesSelector":"oMatchesSelector"in t.prototype?"oMatchesSelector":"msMatchesSelector",Q.pEventTypes=Q.supportsPointerEvent?A.default.PointerEvent===e.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,Q.wheelEvent=A.default.document&&"onmousewheel"in A.default.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null},rn=Q;$.default=rn;var I={};function ht(e){var t=e.parentNode;if(d.default.docFrag(t)){for(;(t=t.host)&&d.default.docFrag(t););return t}return t}function vt(e,t){return s.window!==s.realWindow&&(t=t.replace(/\/deep\//g," ")),e[$.default.prefixedMatchesSelector](t)}Object.defineProperty(I,"__esModule",{value:!0}),I.nodeContains=function(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1},I.closest=function(e,t){for(;d.default.element(e);){if(vt(e,t))return e;e=ht(e)}return null},I.parentNode=ht,I.matchesSelector=vt,I.indexOfDeepestElement=function(e){for(var t,o=[],n=0;n=(parseInt(s.getWindow(y).getComputedStyle(y).zIndex,10)||0)&&(t=n);else t=n}else t=n}var w,y;return t},I.matchesUpTo=function(e,t,o){for(;d.default.element(e);){if(vt(e,t))return!0;if((e=ht(e))===o)return vt(e,t)}return!1},I.getActualElement=function(e){return e.correspondingUseElement||e},I.getScrollXY=eo,I.getElementClientRect=to,I.getElementRect=function(e){var t=to(e);if(!$.default.isIOS7&&t){var o=eo(s.getWindow(e));t.left+=o.x,t.right+=o.x,t.top+=o.y,t.bottom+=o.y}return t},I.getPath=function(e){for(var t=[];e;)t.push(e),e=ht(e);return t},I.trySelector=function(e){return!!d.default.string(e)&&(A.default.document.querySelector(e),!0)};var an=function(e){return e.parentNode||e.host};function Jn(e,t){for(var o,n=[],r=e;(o=an(r))&&r!==t&&o!==r.ownerDocument;)n.unshift(r),r=o;return n}function eo(e){return{x:(e=e||s.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}function to(e){var t=e instanceof A.default.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return t&&{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width||t.right-t.left,height:t.height||t.bottom-t.top}}var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.default=function(e,t){for(var o in t)e[o]=t[o];return e};var G={};function sn(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o1?ao(t):t[0];ro(n,e.page),io(n,e.client),e.timeStamp=o},C.getTouchPair=gt,C.pointerAverage=ao,C.touchBBox=function(e){if(!e.length)return null;var t=gt(e),o=Math.min(t[0].pageX,t[1].pageX),n=Math.min(t[0].pageY,t[1].pageY),r=Math.max(t[0].pageX,t[1].pageX),i=Math.max(t[0].pageY,t[1].pageY);return{x:o,y:n,left:o,top:n,right:r,bottom:i,width:r-o,height:i-n}},C.touchDistance=function(e,t){var o=t+"X",n=t+"Y",r=gt(e),i=r[0][o]-r[1][o],c=r[0][n]-r[1][n];return(0,we.default)(i,c)},C.touchAngle=function(e,t){var o=t+"X",n=t+"Y",r=gt(e),i=r[1][o]-r[0][o],c=r[1][n]-r[0][n];return 180*Math.atan2(c,i)/Math.PI},C.getPointerType=function(e){return d.default.string(e.pointerType)?e.pointerType:d.default.number(e.pointerType)?[void 0,void 0,"touch","pen","mouse"][e.pointerType]:/touch/.test(e.type||"")||e instanceof A.default.Touch?"touch":"mouse"},C.getEventTargets=function(e){var t=d.default.func(e.composedPath)?e.composedPath():e.path;return[I.getActualElement(t?t[0]:e.target),I.getActualElement(e.currentTarget)]},C.newCoords=function(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}},C.coordsToEvent=function(e){return{coords:e,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault:function(){}}},Object.defineProperty(C,"pointerExtend",{enumerable:!0,get:function(){return Ze.default}});var je={};function Qr(e,t){for(var o=0;ox.left&&q.xx.top&&q.y=x.left&&ue<=x.right&&ye>=x.top&&ye<=x.bottom}return Y&&d.default.number(j)&&(_=Math.max(0,Math.min(x.right,Y.right)-Math.max(x.left,Y.left))*Math.max(0,Math.min(x.bottom,Y.bottom)-Math.max(x.top,Y.top))/(Y.width*Y.height)>=j),m.options.drop.checker&&(_=m.options.drop.checker(b,w,_,m,O,y,P)),_}(this,i,c,a,l,p,f)},o.dynamicDrop=function(i){return d.default.bool(i)?(e.dynamicDrop=i,o):e.dynamicDrop},(0,L.default)(t.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),t.methodDict.drop="dropzone",e.dynamicDrop=!1,r.actions.drop=go.defaults},listeners:{"interactions:before-action-start":function(e){var t=e.interaction;t.prepared.name==="drag"&&(t.dropState={cur:{dropzone:null,element:null},prev:{dropzone:null,element:null},rejected:null,events:null,activeDrops:[]})},"interactions:after-action-start":function(e,t){var o=e.interaction,n=(e.event,e.iEvent);if(o.prepared.name==="drag"){var r=o.dropState;r.activeDrops=null,r.events=null,r.activeDrops=pn(t,o.element),r.events=dn(o,0,n),r.events.activate&&(fo(r.activeDrops,r.events.activate),t.fire("actions/drop:start",{interaction:o,dragEvent:n}))}},"interactions:action-move":vo,"interactions:after-action-move":function(e,t){var o=e.interaction,n=e.iEvent;o.prepared.name==="drag"&&(fn(o,o.dropState.events),t.fire("actions/drop:move",{interaction:o,dragEvent:n}),o.dropState.events={})},"interactions:action-end":function(e,t){if(e.interaction.prepared.name==="drag"){var o=e.interaction,n=e.iEvent;vo(e,t),fn(o,o.dropState.events),t.fire("actions/drop:end",{interaction:o,dragEvent:n})}},"interactions:stop":function(e){var t=e.interaction;if(t.prepared.name==="drag"){var o=t.dropState;o&&(o.activeDrops=null,o.events=null,o.cur.dropzone=null,o.cur.element=null,o.prev.dropzone=null,o.prev.element=null,o.rejected=!1)}}},getActiveDrops:pn,getDrop:ho,getDropEvents:dn,fireDropEvents:fn,defaults:{enabled:!1,accept:null,overlap:"pointer"}},ni=go;mt.default=ni;var yt={};function hn(e){var t=e.interaction,o=e.iEvent,n=e.phase;if(t.prepared.name==="gesture"){var r=t.pointers.map(function(p){return p.pointer}),i=n==="start",c=n==="end",a=t.interactable.options.deltaSource;if(o.touches=[r[0],r[1]],i)o.distance=C.touchDistance(r,a),o.box=C.touchBBox(r),o.scale=1,o.ds=0,o.angle=C.touchAngle(r,a),o.da=0,t.gesture.startDistance=o.distance,t.gesture.startAngle=o.angle;else if(c){var l=t.prevEvent;o.distance=l.distance,o.box=l.box,o.scale=l.scale,o.ds=0,o.angle=l.angle,o.da=0}else o.distance=C.touchDistance(r,a),o.box=C.touchBBox(r),o.scale=o.distance/t.gesture.startDistance,o.angle=C.touchAngle(r,a),o.ds=o.scale-t.gesture.scale,o.da=o.angle-t.gesture.angle;t.gesture.distance=o.distance,t.gesture.angle=o.angle,d.default.number(o.scale)&&o.scale!==1/0&&!isNaN(o.scale)&&(t.gesture.scale=o.scale)}}Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=void 0;var vn={id:"actions/gesture",before:["actions/drag","actions/resize"],install:function(e){var t=e.actions,o=e.Interactable,n=e.defaults;o.prototype.gesturable=function(r){return d.default.object(r)?(this.options.gesture.enabled=r.enabled!==!1,this.setPerAction("gesture",r),this.setOnEvents("gesture",r),this):d.default.bool(r)?(this.options.gesture.enabled=r,this):this.options.gesture},t.map.gesture=vn,t.methodDict.gesture="gesturable",n.actions.gesture=vn.defaults},listeners:{"interactions:action-start":hn,"interactions:action-move":hn,"interactions:action-end":hn,"interactions:new":function(e){e.interaction.gesture={angle:0,distance:0,scale:1,startAngle:0,startDistance:0}},"auto-start:check":function(e){if(!(e.interaction.pointers.length<2)){var t=e.interactable.options.gesture;if(t&&t.enabled)return e.action={name:"gesture"},!1}}},defaults:{},getCursor:function(){return""}},oi=vn;yt.default=oi;var bt={};function ri(e,t,o,n,r,i,c){if(!t)return!1;if(t===!0){var a=d.default.number(i.width)?i.width:i.right-i.left,l=d.default.number(i.height)?i.height:i.bottom-i.top;if(c=Math.min(c,Math.abs((e==="left"||e==="right"?a:l)/2)),a<0&&(e==="left"?e="right":e==="right"&&(e="left")),l<0&&(e==="top"?e="bottom":e==="bottom"&&(e="top")),e==="left")return o.x<(a>=0?i.left:i.right)+c;if(e==="top")return o.y<(l>=0?i.top:i.bottom)+c;if(e==="right")return o.x>(a>=0?i.right:i.left)-c;if(e==="bottom")return o.y>(l>=0?i.bottom:i.top)-c}return!!d.default.element(n)&&(d.default.element(t)?t===n:I.matchesUpTo(n,t,r))}function mo(e){var t=e.iEvent,o=e.interaction;if(o.prepared.name==="resize"&&o.resizeAxes){var n=t;o.interactable.options.resize.square?(o.resizeAxes==="y"?n.delta.x=n.delta.y:n.delta.y=n.delta.x,n.axes="xy"):(n.axes=o.resizeAxes,o.resizeAxes==="x"?n.delta.y=0:o.resizeAxes==="y"&&(n.delta.x=0))}}Object.defineProperty(bt,"__esModule",{value:!0}),bt.default=void 0;var ve={id:"actions/resize",before:["actions/drag"],install:function(e){var t=e.actions,o=e.browser,n=e.Interactable,r=e.defaults;ve.cursors=function(i){return i.isIe9?{x:"e-resize",y:"s-resize",xy:"se-resize",top:"n-resize",left:"w-resize",bottom:"s-resize",right:"e-resize",topleft:"se-resize",bottomright:"se-resize",topright:"ne-resize",bottomleft:"ne-resize"}:{x:"ew-resize",y:"ns-resize",xy:"nwse-resize",top:"ns-resize",left:"ew-resize",bottom:"ns-resize",right:"ew-resize",topleft:"nwse-resize",bottomright:"nwse-resize",topright:"nesw-resize",bottomleft:"nesw-resize"}}(o),ve.defaultMargin=o.supportsTouch||o.supportsPointerEvent?20:10,n.prototype.resizable=function(i){return function(c,a,l){return d.default.object(a)?(c.options.resize.enabled=a.enabled!==!1,c.setPerAction("resize",a),c.setOnEvents("resize",a),d.default.string(a.axis)&&/^x$|^y$|^xy$/.test(a.axis)?c.options.resize.axis=a.axis:a.axis===null&&(c.options.resize.axis=l.defaults.actions.resize.axis),d.default.bool(a.preserveAspectRatio)?c.options.resize.preserveAspectRatio=a.preserveAspectRatio:d.default.bool(a.square)&&(c.options.resize.square=a.square),c):d.default.bool(a)?(c.options.resize.enabled=a,c):c.options.resize}(this,i,e)},t.map.resize=ve,t.methodDict.resize="resizable",r.actions.resize=ve.defaults},listeners:{"interactions:new":function(e){e.interaction.resizeAxes="xy"},"interactions:action-start":function(e){(function(t){var o=t.iEvent,n=t.interaction;if(n.prepared.name==="resize"&&n.prepared.edges){var r=o,i=n.rect;n._rects={start:(0,L.default)({},i),corrected:(0,L.default)({},i),previous:(0,L.default)({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},r.edges=n.prepared.edges,r.rect=n._rects.corrected,r.deltaRect=n._rects.delta}})(e),mo(e)},"interactions:action-move":function(e){(function(t){var o=t.iEvent,n=t.interaction;if(n.prepared.name==="resize"&&n.prepared.edges){var r=o,i=n.interactable.options.resize.invert,c=i==="reposition"||i==="negate",a=n.rect,l=n._rects,p=l.start,f=l.corrected,m=l.delta,b=l.previous;if((0,L.default)(b,f),c){if((0,L.default)(f,a),i==="reposition"){if(f.top>f.bottom){var w=f.top;f.top=f.bottom,f.bottom=w}if(f.left>f.right){var y=f.left;f.left=f.right,f.right=y}}}else f.top=Math.min(a.top,p.bottom),f.bottom=Math.max(a.bottom,p.top),f.left=Math.min(a.left,p.right),f.right=Math.max(a.right,p.left);for(var P in f.width=f.right-f.left,f.height=f.bottom-f.top,f)m[P]=f[P]-b[P];r.edges=n.prepared.edges,r.rect=f,r.deltaRect=m}})(e),mo(e)},"interactions:action-end":function(e){var t=e.iEvent,o=e.interaction;if(o.prepared.name==="resize"&&o.prepared.edges){var n=t;n.edges=o.prepared.edges,n.rect=o._rects.corrected,n.deltaRect=o._rects.delta}},"auto-start:check":function(e){var t=e.interaction,o=e.interactable,n=e.element,r=e.rect,i=e.buttons;if(r){var c=(0,L.default)({},t.coords.cur.page),a=o.options.resize;if(a&&a.enabled&&(!t.pointerIsDown||!/mouse|pointer/.test(t.pointerType)||(i&a.mouseButtons)!=0)){if(d.default.object(a.edges)){var l={left:!1,right:!1,top:!1,bottom:!1};for(var p in l)l[p]=ri(p,a.edges[p],c,t._latestPointer.eventTarget,n,r,a.margin||ve.defaultMargin);l.left=l.left&&!l.right,l.top=l.top&&!l.bottom,(l.left||l.right||l.top||l.bottom)&&(e.action={name:"resize",edges:l})}else{var f=a.axis!=="y"&&c.x>r.right-ve.defaultMargin,m=a.axis!=="x"&&c.y>r.bottom-ve.defaultMargin;(f||m)&&(e.action={name:"resize",axes:(f?"x":"")+(m?"y":"")})}return!e.action&&void 0}}}},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor:function(e){var t=e.edges,o=e.axis,n=e.name,r=ve.cursors,i=null;if(o)i=r[n+o];else if(t){for(var c="",a=["top","bottom","left","right"],l=0;l=1){var p={x:R.x*l,y:R.y*l};if(p.x||p.y){var f=Je(i);d.default.window(i)?i.scrollBy(p.x,p.y):i&&(i.scrollLeft+=p.x,i.scrollTop+=p.y);var m=Je(i),b={x:m.x-f.x,y:m.y-f.y};(b.x||b.y)&&t.fire({type:"autoscroll",target:o,interactable:t,delta:b,interaction:e,container:i})}R.prevTime=c}R.isScrolling&&(de.default.cancel(R.i),R.i=de.default.request(R.scroll))},check:function(e,t){var o;return(o=e.options[t].autoScroll)==null?void 0:o.enabled},onInteractionMove:function(e){var t=e.interaction,o=e.pointer;if(t.interacting()&&R.check(t.interactable,t.prepared.name))if(t.simulation)R.x=R.y=0;else{var n,r,i,c,a=t.interactable,l=t.element,p=t.prepared.name,f=a.options[p].autoScroll,m=Et(f.container,a,l);if(d.default.window(m))c=o.clientXm.innerWidth-R.margin,i=o.clientY>m.innerHeight-R.margin;else{var b=I.getElementClientRect(m);c=o.clientXb.right-R.margin,i=o.clientY>b.bottom-R.margin}R.x=r?1:c?-1:0,R.y=i?1:n?-1:0,R.isScrolling||(R.margin=f.margin,R.speed=f.speed,R.start(t))}}};function Et(e,t,o){return(d.default.string(e)?(0,G.getStringOptionResult)(e,t,o):e)||(0,s.getWindow)(o)}function Je(e){return d.default.window(e)&&(e=window.document.body),{x:e.scrollLeft,y:e.scrollTop}}var li={id:"auto-scroll",install:function(e){var t=e.defaults,o=e.actions;e.autoScroll=R,R.now=function(){return e.now()},o.phaselessTypes.autoscroll=!0,t.perAction.autoScroll=R.defaults},listeners:{"interactions:new":function(e){e.interaction.autoScroll=null},"interactions:destroy":function(e){e.interaction.autoScroll=null,R.stop(),R.interaction&&(R.interaction=null)},"interactions:stop":R.stop,"interactions:action-move":function(e){return R.onInteractionMove(e)}}};Ee.default=li;var ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.warnOnce=function(e,t){var o=!1;return function(){return o||(s.window.console.warn(t),o=!0),e.apply(this,arguments)}},ae.copyAction=function(e,t){return e.name=t.name,e.axis=t.axis,e.edges=t.edges,e},ae.sign=void 0,ae.sign=function(e){return e>=0?1:-1};var xt={};function ci(e){return d.default.bool(e)?(this.options.styleCursor=e,this):e===null?(delete this.options.styleCursor,this):this.options.styleCursor}function ui(e){return d.default.func(e)?(this.options.actionChecker=e,this):e===null?(delete this.options.actionChecker,this):this.options.actionChecker}Object.defineProperty(xt,"__esModule",{value:!0}),xt.default=void 0;var pi={id:"auto-start/interactableMethods",install:function(e){var t=e.Interactable;t.prototype.getAction=function(o,n,r,i){var c=function(a,l,p,f,m){var b=a.getRect(f),w={action:null,interactable:a,interaction:p,element:f,rect:b,buttons:l.buttons||{0:1,1:4,3:8,4:16}[l.button]};return m.fire("auto-start:check",w),w.action}(this,n,r,i,e);return this.options.actionChecker?this.options.actionChecker(o,n,c,this,i,r):c},t.prototype.ignoreFrom=(0,ae.warnOnce)(function(o){return this._backCompatOption("ignoreFrom",o)},"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),t.prototype.allowFrom=(0,ae.warnOnce)(function(o){return this._backCompatOption("allowFrom",o)},"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),t.prototype.actionChecker=ui,t.prototype.styleCursor=ci}};xt.default=pi;var He={};function bo(e,t,o,n,r){return t.testIgnoreAllow(t.options[e.name],o,n)&&t.options[e.name].enabled&&St(t,o,e,r)?e:null}function di(e,t,o,n,r,i,c){for(var a=0,l=n.length;a=a||b.interactable===e&&((p+=w===o.name?1:0)>=i||b.element===t&&(f++,w===o.name&&f>=c))))return!1}return a>0}function xo(e,t){return d.default.number(e)?(t.autoStart.maxInteractions=e,this):t.autoStart.maxInteractions}function gn(e,t,o){var n=o.autoStart.cursorElement;n&&n!==e&&(n.style.cursor=""),e.ownerDocument.documentElement.style.cursor=t,e.style.cursor=t,o.autoStart.cursorElement=t?e:null}function So(e,t){var o=e.interactable,n=e.element,r=e.prepared;if(e.pointerType==="mouse"&&o&&o.options.styleCursor){var i="";if(r.name){var c=o.options[r.name].cursorChecker;i=d.default.func(c)?c(r,o,n,e._interacting):t.actions.map[r.name].getCursor(r)}gn(e.element,i||"",t)}else t.autoStart.cursorElement&&gn(t.autoStart.cursorElement,"",t)}Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0;var fi={id:"auto-start/base",before:["actions"],install:function(e){var t=e.interactStatic,o=e.defaults;e.usePlugin(xt.default),o.base.actionChecker=null,o.base.styleCursor=!0,(0,L.default)(o.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),t.maxInteractions=function(n){return xo(n,e)},e.autoStart={maxInteractions:1/0,withinInteractionLimit:St,cursorElement:null}},listeners:{"interactions:down":function(e,t){var o=e.interaction,n=e.pointer,r=e.event,i=e.eventTarget;o.interacting()||Eo(o,wo(o,n,r,i,t),t)},"interactions:move":function(e,t){(function(o,n){var r=o.interaction,i=o.pointer,c=o.event,a=o.eventTarget;r.pointerType!=="mouse"||r.pointerIsDown||r.interacting()||Eo(r,wo(r,i,c,a,n),n)})(e,t),function(o,n){var r=o.interaction;if(r.pointerIsDown&&!r.interacting()&&r.pointerWasMoved&&r.prepared.name){n.fire("autoStart:before-start",o);var i=r.interactable,c=r.prepared.name;c&&i&&(i.options[c].manualStart||!St(i,r.element,r.prepared,n)?r.stop():(r.start(r.prepared,i,r.element),So(r,n)))}}(e,t)},"interactions:stop":function(e,t){var o=e.interaction,n=o.interactable;n&&n.options.styleCursor&&gn(o.element,"",t)}},maxInteractions:xo,withinInteractionLimit:St,validateAction:bo};He.default=fi;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.default=void 0;var hi={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":function(e,t){var o=e.interaction,n=e.eventTarget,r=e.dx,i=e.dy;if(o.prepared.name==="drag"){var c=Math.abs(r),a=Math.abs(i),l=o.interactable.options.drag,p=l.startAxis,f=c>a?"x":c0&&(t.autoStartHoldTimer=setTimeout(function(){t.start(t.prepared,t.interactable,t.element)},o))},"interactions:move":function(e){var t=e.interaction,o=e.duplicate;t.autoStartHoldTimer&&t.pointerWasMoved&&!o&&(clearTimeout(t.autoStartHoldTimer),t.autoStartHoldTimer=null)},"autoStart:before-start":function(e){var t=e.interaction;mn(t)>0&&(t.prepared.name=null)}},getHoldDuration:mn};kt.default=vi;var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=void 0;var gi={id:"auto-start",install:function(e){e.usePlugin(He.default),e.usePlugin(kt.default),e.usePlugin(Pt.default)}};Tt.default=gi;var Re={};function mi(e){return/^(always|never|auto)$/.test(e)?(this.options.preventDefault=e,this):d.default.bool(e)?(this.options.preventDefault=e?"always":"never",this):this.options.preventDefault}function yi(e){var t=e.interaction,o=e.event;t.interactable&&t.interactable.checkAndPreventDefault(o)}function Po(e){var t=e.Interactable;t.prototype.preventDefault=mi,t.prototype.checkAndPreventDefault=function(o){return function(n,r,i){var c=n.options.preventDefault;if(c!=="never")if(c!=="always"){if(r.events.supportsPassive&&/^touch(start|move)$/.test(i.type)){var a=(0,s.getWindow)(i.target).document,l=r.getDocOptions(a);if(!l||!l.events||l.events.passive!==!1)return}/^(mouse|pointer|touch)*(down|start)/i.test(i.type)||d.default.element(i.target)&&(0,I.matchesSelector)(i.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||i.preventDefault()}else i.preventDefault()}(this,e,o)},e.interactions.docEvents.push({type:"dragstart",listener:function(o){for(var n=0;ne.length)&&(t=e.length);for(var o=0,n=Array(t);o1&&arguments[1]!==void 0?arguments[1]:{},o=t.logger,n=e.Interactable,r=e.defaults;e.logger=o||console,r.base.devTools={ignore:{}},n.prototype.devTools=function(i){return i?((0,L.default)(this.options.devTools,i),this):this.options.devTools},e.usePlugin(Mt.default)},listeners:{"interactions:action-start":function(e,t){for(var o=e.interaction,n=0;ne.length)&&(t=e.length);for(var o=0,n=Array(t);o150)return null;var l=180*Math.atan2(a.prevEvent.velocityY,a.prevEvent.velocityX)/Math.PI;l<0&&(l+=360);var p=112.5<=l&&l<247.5,f=202.5<=l&&l<337.5;return{up:f,down:!f&&22.5<=l&&l<157.5,left:p,right:!p&&(292.5<=l||l<67.5),angle:l,speed:a.prevEvent.speed,velocity:{x:a.prevEvent.velocityX,y:a.prevEvent.velocityY}}}},{key:"preventDefault",value:function(){}},{key:"stopImmediatePropagation",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}}])&&Pi(t.prototype,o),c}(je.BaseEvent);tt.InteractEvent=Ao,Object.defineProperties(Ao.prototype,{pageX:{get:function(){return this.page.x},set:function(e){this.page.x=e}},pageY:{get:function(){return this.page.y},set:function(e){this.page.y=e}},clientX:{get:function(){return this.client.x},set:function(e){this.client.x=e}},clientY:{get:function(){return this.client.y},set:function(e){this.client.y=e}},dx:{get:function(){return this.delta.x},set:function(e){this.delta.x=e}},dy:{get:function(){return this.delta.y},set:function(e){this.delta.y=e}},velocityX:{get:function(){return this.velocity.x},set:function(e){this.velocity.x=e}},velocityY:{get:function(){return this.velocity.y},set:function(e){this.velocity.y=e}}});var nt={};Object.defineProperty(nt,"__esModule",{value:!0}),nt.PointerInfo=void 0,nt.PointerInfo=function e(t,o,n,r,i){(function(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")})(this,e),this.id=void 0,this.pointer=void 0,this.event=void 0,this.downTime=void 0,this.downTarget=void 0,this.id=t,this.pointer=o,this.event=n,this.downTime=r,this.downTarget=i};var Lt,It,re={};function Ti(e,t){for(var o=0;othis.pointerMoveTolerance);var p=this.getPointerIndex(n),f={pointer:n,pointerIndex:p,pointerInfo:this.pointers[p],event:r,type:"move",eventTarget:i,dx:c,dy:a,duplicate:l,interaction:this};l||C.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",f),l||this.simulation||(this.interacting()&&(f.type=null,this.move(f)),this.pointerWasMoved&&C.copyCoords(this.coords.prev,this.coords.cur))}},{key:"move",value:function(n){n&&n.event||C.setZeroCoords(this.coords.delta),(n=(0,L.default)({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},n||{})).phase="move",this._doPhase(n)}},{key:"pointerUp",value:function(n,r,i,c){var a=this.getPointerIndex(n);a===-1&&(a=this.updatePointer(n,r,i,!1));var l=/cancel$/i.test(r.type)?"cancel":"up";this._scopeFire("interactions:".concat(l),{pointer:n,pointerIndex:a,pointerInfo:this.pointers[a],event:r,eventTarget:i,type:l,curEventTarget:c,interaction:this}),this.simulation||this.end(r),this.removePointer(n,r)}},{key:"documentBlur",value:function(n){this.end(n),this._scopeFire("interactions:blur",{event:n,type:"blur",interaction:this})}},{key:"end",value:function(n){var r;this._ending=!0,n=n||this._latestPointer.event,this.interacting()&&(r=this._doPhase({event:n,interaction:this,phase:"end"})),this._ending=!1,r===!0&&this.stop()}},{key:"currentAction",value:function(){return this._interacting?this.prepared.name:null}},{key:"interacting",value:function(){return this._interacting}},{key:"stop",value:function(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}},{key:"getPointerIndex",value:function(n){var r=C.getPointerId(n);return this.pointerType==="mouse"||this.pointerType==="pen"?this.pointers.length-1:K.findIndex(this.pointers,function(i){return i.id===r})}},{key:"getPointerInfo",value:function(n){return this.pointers[this.getPointerIndex(n)]}},{key:"updatePointer",value:function(n,r,i,c){var a=C.getPointerId(n),l=this.getPointerIndex(n),p=this.pointers[l];return c=c!==!1&&(c||/(down|start)$/i.test(r.type)),p?p.pointer=n:(p=new nt.PointerInfo(a,n,r,null,null),l=this.pointers.length,this.pointers.push(p)),C.setCoords(this.coords.cur,this.pointers.map(function(f){return f.pointer}),this._now()),C.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),c&&(this.pointerIsDown=!0,p.downTime=this.coords.cur.timeStamp,p.downTarget=i,C.pointerExtend(this.downPointer,n),this.interacting()||(C.copyCoords(this.coords.start,this.coords.cur),C.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=r,this.pointerWasMoved=!1)),this._updateLatestPointer(n,r,i),this._scopeFire("interactions:update-pointer",{pointer:n,event:r,eventTarget:i,down:c,pointerInfo:p,pointerIndex:l,interaction:this}),l}},{key:"removePointer",value:function(n,r){var i=this.getPointerIndex(n);if(i!==-1){var c=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:n,event:r,eventTarget:null,pointerIndex:i,pointerInfo:c,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}}},{key:"_updateLatestPointer",value:function(n,r,i){this._latestPointer.pointer=n,this._latestPointer.event=r,this._latestPointer.eventTarget=i}},{key:"destroy",value:function(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}},{key:"_createPreparedEvent",value:function(n,r,i,c){return new tt.InteractEvent(this,n,this.prepared.name,r,this.element,i,c)}},{key:"_fireEvent",value:function(n){this.interactable.fire(n),(!this.prevEvent||n.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=n)}},{key:"_doPhase",value:function(n){var r=n.event,i=n.phase,c=n.preEnd,a=n.type,l=this.rect;if(l&&i==="move"&&(G.addEdges(this.edges,l,this.coords.delta[this.interactable.options.deltaSource]),l.width=l.right-l.left,l.height=l.bottom-l.top),this._scopeFire("interactions:before-action-".concat(i),n)===!1)return!1;var p=n.iEvent=this._createPreparedEvent(r,i,c,a);return this._scopeFire("interactions:action-".concat(i),n),i==="start"&&(this.prevEvent=p),this._fireEvent(p),this._scopeFire("interactions:after-action-".concat(i),n),!0}},{key:"_now",value:function(){return Date.now()}}])&&Ti(t.prototype,o),e}();re.Interaction=Do;var Oi=Do;re.default=Oi;var _e={};function jo(e){e.pointerIsDown&&(Sn(e.coords.cur,e.offset.total),e.offset.pending.x=0,e.offset.pending.y=0)}function Ho(e){xn(e.interaction)}function xn(e){if(!function(o){return!(!o.offset.pending.x&&!o.offset.pending.y)}(e))return!1;var t=e.offset.pending;return Sn(e.coords.cur,t),Sn(e.coords.delta,t),G.addEdges(e.edges,e.rect,t),t.x=0,t.y=0,!0}function _i(e){var t=e.x,o=e.y;this.offset.pending.x+=t,this.offset.pending.y+=o,this.offset.total.x+=t,this.offset.total.y+=o}function Sn(e,t){var o=e.page,n=e.client,r=t.x,i=t.y;o.x+=r,o.y+=i,n.x+=r,n.y+=i}Object.defineProperty(_e,"__esModule",{value:!0}),_e.addTotal=jo,_e.applyPending=xn,_e.default=void 0,re._ProxyMethods.offsetBy="";var Ci={id:"offset",before:["modifiers","pointer-events","actions","inertia"],install:function(e){e.Interaction.prototype.offsetBy=_i},listeners:{"interactions:new":function(e){e.interaction.offset={total:{x:0,y:0},pending:{x:0,y:0}}},"interactions:update-pointer":function(e){return jo(e.interaction)},"interactions:before-action-start":Ho,"interactions:before-action-move":Ho,"interactions:before-action-end":function(e){var t=e.interaction;if(xn(t))return t.move({offset:!0}),t.end(),!1},"interactions:stop":function(e){var t=e.interaction;t.offset.total.x=0,t.offset.total.y=0,t.offset.pending.x=0,t.offset.pending.y=0}}};_e.default=Ci;var We={};function Li(e,t){for(var o=0;oi.minSpeed&&a>i.endSpeed)this.startInertia();else{if(l.result=l.setAll(this.modifierArg),!l.result.changed)return!1;this.startSmoothEnd()}return r.modification.result.rect=null,r.offsetBy(this.targetOffset),r._doPhase({interaction:r,event:n,phase:"inertiastart"}),r.offsetBy({x:-this.targetOffset.x,y:-this.targetOffset.y}),r.modification.result.rect=null,this.active=!0,r.simulation=this,!0}},{key:"startInertia",value:function(){var n=this,r=this.interaction.coords.velocity.client,i=At(this.interaction),c=i.resistance,a=-Math.log(i.endSpeed/this.v0)/c;this.targetOffset={x:(r.x-a)/c,y:(r.y-a)/c},this.te=a,this.lambda_v0=c/this.v0,this.one_ve_v0=1-i.endSpeed/this.v0;var l=this.modification,p=this.modifierArg;p.pageCoords={x:this.startCoords.x+this.targetOffset.x,y:this.startCoords.y+this.targetOffset.y},l.result=l.setAll(p),l.result.changed&&(this.isModified=!0,this.modifiedOffset={x:this.targetOffset.x+l.result.delta.x,y:this.targetOffset.y+l.result.delta.y}),this.onNextFrame(function(){return n.inertiaTick()})}},{key:"startSmoothEnd",value:function(){var n=this;this.smoothEnd=!0,this.isModified=!0,this.targetOffset={x:this.modification.result.delta.x,y:this.modification.result.delta.y},this.onNextFrame(function(){return n.smoothEndTick()})}},{key:"onNextFrame",value:function(n){var r=this;this.timeout=de.default.request(function(){r.active&&n()})}},{key:"inertiaTick",value:function(){var n,r,i,c,a,l=this,p=this.interaction,f=At(p).resistance,m=(p._now()-this.t0)/1e3;if(m=0;i--){var c=r[i],a=c.selector,l=c.context,p=c.listeners;a===this.target&&l===this._context&&r.splice(i,1);for(var f=p.length-1;f>=0;f--)this._scopeEvents.removeDelegate(this.target,this._context,n,p[f][0],p[f][1])}else this._scopeEvents.remove(this.target,"all")}}])&&ji(t.prototype,o),e}();Dt.Interactable=Hi;var jt={};function Ri(e,t){for(var o=0;oe.length)&&(t=e.length);for(var o=0,n=Array(t);o=0;P--){var j=x[P];if(j.selector===f&&j.context===m){for(var F=j.listeners,q=F.length-1;q>=0;q--){var Z=kn(F[q],2),N=Z[0],Y=Z[1],ue=Y.capture,ye=Y.passive;if(N===w&&ue===O.capture&&ye===O.passive){F.splice(q,1),F.length||(x.splice(P,1),a(m,b,l),a(m,b,p,!0)),_=!0;break}}if(_)break}}},delegateListener:l,delegateUseCapture:p,delegatedEvents:n,documents:r,targets:o,supportsOptions:!1,supportsPassive:!1};function c(f,m,b,w){var y=it(w),P=K.find(o,function(O){return O.eventTarget===f});P||(P={eventTarget:f,events:{}},o.push(P)),P.events[m]||(P.events[m]=[]),f.addEventListener&&!K.contains(P.events[m],b)&&(f.addEventListener(m,b,i.supportsOptions?y:y.capture),P.events[m].push(b))}function a(f,m,b,w){var y=it(w),P=K.findIndex(o,function(q){return q.eventTarget===f}),O=o[P];if(O&&O.events)if(m!=="all"){var x=!1,_=O.events[m];if(_){if(b==="all"){for(var j=_.length-1;j>=0;j--)a(f,m,_[j],y);return}for(var F=0;F<_.length;F++)if(_[F]===b){f.removeEventListener(m,b,i.supportsOptions?y:y.capture),_.splice(F,1),_.length===0&&(delete O.events[m],x=!0);break}}x&&!Object.keys(O.events).length&&o.splice(P,1)}else for(m in O.events)O.events.hasOwnProperty(m)&&a(f,m,"all")}function l(f,m){for(var b=it(m),w=new Fi(f),y=n[f.type],P=kn(C.getEventTargets(f),1)[0],O=P;d.default.element(O);){for(var x=0;x=2)continue;if(!r.interacting()&&t===r.pointerType)return r}return null}};function Bo(e,t){return e.pointers.some(function(o){return o.id===t})}var Bi=zt;Rt.default=Bi;var Wt={};function No(e){return(No=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function qo(e,t){return function(o){if(Array.isArray(o))return o}(e)||function(o,n){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(o)){var r=[],i=!0,c=!1,a=void 0;try{for(var l,p=o[Symbol.iterator]();!(i=(l=p.next()).done)&&(r.push(l.value),!n||r.length!==n);i=!0);}catch(f){c=!0,a=f}finally{try{i||p.return==null||p.return()}finally{if(c)throw a}}return r}}(e,t)||function(o,n){if(o){if(typeof o=="string")return Xo(o,n);var r=Object.prototype.toString.call(o).slice(8,-1);return r==="Object"&&o.constructor&&(r=o.constructor.name),r==="Map"||r==="Set"?Array.from(o):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xo(o,n):void 0}}(e,t)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Xo(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o=0;n--){var r=t.interactions.list[n];r.interactable===o&&(r.stop(),t.fire("interactions:destroy",{interaction:r}),r.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(n,1))}}},onDocSignal:On,doOnInteractions:Uo,methodNames:Mn};Wt.default=Yi;var at={};function $o(e){return($o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function _n(e,t,o){return(_n=typeof Reflect!="undefined"&&Reflect.get?Reflect.get:function(n,r,i){var c=function(l,p){for(;!Object.prototype.hasOwnProperty.call(l,p)&&(l=Fe(l))!==null;);return l}(n,r);if(c){var a=Object.getOwnPropertyDescriptor(c,r);return a.get?a.get.call(i):a.value}})(e,t,o||e)}function Go(e,t){return(Go=Object.setPrototypeOf||function(o,n){return o.__proto__=n,o})(e,t)}function Ui(e,t){return!t||$o(t)!=="object"&&typeof t!="function"?function(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}(e):t}function Fe(e){return(Fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}function Zo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qo(e,t){for(var o=0;oe.length)&&(t=e.length);for(var o=0,n=Array(t);oMath.abs(l.y),a.coords,a.rect),(0,L.default)(n,a.coords)),a.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function Ji(e,t,o){var n=e.startCoords,r=e.edgeSign;t?o.y=n.y+(o.x-n.x)*r:o.x=n.x+(o.y-n.y)*r}function ea(e,t,o,n){var r=e.startRect,i=e.startCoords,c=e.ratio,a=e.edgeSign;if(t){var l=n.width/c;o.y=i.y+(l-r.height)*a}else{var p=n.height*c;o.x=i.x+(p-r.width)*a}}Ve.aspectRatio=ar;var ta=(0,ee.makeModifier)(ar,"aspectRatio");Ve.default=ta;var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.default=void 0;var sr=function(){};sr._defaults={};var na=sr;Ce.default=na;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0}),Object.defineProperty(Ln,"default",{enumerable:!0,get:function(){return Ce.default}});var ne={};function In(e,t,o){return d.default.func(e)?G.resolveRectLike(e,t.interactable,t.element,[o.x,o.y,t]):G.resolveRectLike(e,t.interactable,t.element)}Object.defineProperty(ne,"__esModule",{value:!0}),ne.getRestrictionRect=In,ne.restrict=ne.default=void 0;var lr={start:function(e){var t=e.rect,o=e.startOffset,n=e.state,r=e.interaction,i=e.pageCoords,c=n.options,a=c.elementRect,l=(0,L.default)({left:0,top:0,right:0,bottom:0},c.offset||{});if(t&&a){var p=In(c.restriction,r,i);if(p){var f=p.right-p.left-t.width,m=p.bottom-p.top-t.height;f<0&&(l.left+=f,l.right+=f),m<0&&(l.top+=m,l.bottom+=m)}l.left+=o.left-t.width*a.left,l.top+=o.top-t.height*a.top,l.right+=o.right-t.width*(1-a.right),l.bottom+=o.bottom-t.height*(1-a.bottom)}n.offset=l},set:function(e){var t=e.coords,o=e.interaction,n=e.state,r=n.options,i=n.offset,c=In(r.restriction,o,t);if(c){var a=G.xywhToTlbr(c);t.x=Math.max(Math.min(a.right-i.right,t.x),a.left+i.left),t.y=Math.max(Math.min(a.bottom-i.bottom,t.y),a.top+i.top)}},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};ne.restrict=lr;var oa=(0,ee.makeModifier)(lr,"restrict");ne.default=oa;var fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.restrictEdges=fe.default=void 0;var cr={top:1/0,left:1/0,bottom:-1/0,right:-1/0},ur={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function pr(e,t){for(var o=["top","left","bottom","right"],n=0;ne.length)&&(t=e.length);for(var o=0,n=Array(t);oon,genId:()=>qn});function ie(g,s){let u=Object.keys(s).map(h=>Da(g,h,s[h]));return u.length===1?u[0]:function(){u.forEach(h=>h())}}function Da(g,s,u){let h=g[s],v=g.hasOwnProperty(s),d=u(h);return h&&Object.setPrototypeOf(d,h),Object.setPrototypeOf(E,d),g[s]=E,T;function E(...k){return d===h&&g[s]===E&&T(),d.apply(this,k)}function T(){g[s]===E&&(v?g[s]=h:delete g[s]),d!==h&&(d=h,Object.setPrototypeOf(E,h||Function))}}var B=be(require("obsidian"));var Pe=be(require("obsidian"));var z=be(require("obsidian"));function Fn(g){let s=Or(),[u,h]=s(g);if(!u)return!1;if(h||(h="px"),["em","ex","ch","rem","vw","vh","vmin","vmax","%","cm","mm","in","px","pt","pc"].contains(h))return u+h}function pe(g,s){var u;return g instanceof s||((u=g==null?void 0:g.instanceOf)==null?void 0:u.call(g,s))}var _r=10,Vn=60;function Ye(g){let s=g.body.querySelector(".app-container, .workspace-split"),u=g.body.querySelector(".mod-left.workspace-ribbon"),h=s.offsetTop,v=g.body.hasClass("hider-ribbon")?0:u?u.offsetWidth:0;return{top:h,left:v}}function ja(g){let s=g.getAttribute("data-orig-height"),u=g.getAttribute("data-orig-width"),h=parseFloat(g.getAttribute("data-orig-pos-left")||"0"),v=parseFloat(g.getAttribute("data-orig-pos-top")||"0"),d=Ye(g.ownerDocument).top;return vd.body.offsetWidth-_r,k=g.client.y<30;if((E||T||k)&&(v=Ye(d),ut(s)),E&&g.buttons){Ae(s,"left",v);return}else if(T&&g.buttons){Ae(s,"right",v);return}else if(k&&g.buttons){Ae(s,"viewport",v);return}else if(s.hasClass("snap-to-viewport")){if(g.client.y{var h;let u=(h=U.activePopover)==null?void 0:h.hoverEl;if(u&&pe(u,HTMLElement)){if(!s){Cr(u)?Ue(u,!0):ut(u),u.removeClasses(["snap-to-left","snap-to-right","snap-to-viewport"]);let v=Ye(u.ownerDocument);Ae(u,g,v)}return!0}return!1},Dr=g=>{var u;let s=(u=U.activePopover)==null?void 0:u.hoverEl;return s&&pe(s,HTMLElement)?(g||Cr(s)&&(s.removeClasses(["snap-to-left","snap-to-right","snap-to-viewport"]),Ue(s)),!0):!1},jr=g=>{var h;let s=(h=U.activePopover)==null?void 0:h.hoverEl,u=U.activePopovers().find(v=>v.hoverEl===s);return u?(g||u.toggleMinimized(),!0):!1};var Zt=new WeakMap,Qt={x:0,y:0};function Ha(g){let s=function(){return Object.setPrototypeOf(new z.Component,new.target.prototype)};return s.prototype=g.prototype,Object.setPrototypeOf(s,g)}var Rr,zr,Wr,Fr,Vr,U=class extends Ha(z.HoverPopover){constructor(s,u,h,v,d){super();this.targetEl=u;this.plugin=h;this.onShowCallback=d;this.isPinned=this.plugin.settings.autoPin==="always";this.abortController=this.addChild(new z.Component);this.detaching=!1;this.opening=!1;this.rootSplit=new z.WorkspaceSplit(window.app.workspace,"vertical");this.targetRect=(Rr=this.targetEl)==null?void 0:Rr.getBoundingClientRect();this.oldPopover=(zr=this.parent)==null?void 0:zr.hoverPopover;this.document=(Vr=(Fr=(Wr=this.targetEl)==null?void 0:Wr.ownerDocument)!=null?Fr:window.activeDocument)!=null?Vr:window.document;this.interactStatic=this.plugin.interact.forDom(this.document.body).interact;this.id=qn(8);this.hoverEl=this.document.defaultView.createDiv({cls:"popover hover-popover",attr:{id:"he"+this.id}});v===void 0&&(v=300),this.onTarget=!0,this.onHover=!1,this.shownPos=null,this.parent=s,this.waitTime=v,this.state=z.PopoverState.Showing;let{hoverEl:E}=this;this.onMouseIn=this._onMouseIn.bind(this),this.onMouseOut=this._onMouseOut.bind(this),this.abortController.load(),u&&(u.addEventListener("mouseover",this.onMouseIn),u.addEventListener("mouseout",this.onMouseOut)),E.addEventListener("mouseover",k=>{Jt(k,E)&&(this.onHover=!0,this.onTarget=!1,this.transition())}),E.addEventListener("mouseout",k=>{Jt(k,E)&&(this.onHover=!1,this.onTarget=!1,this.transition())}),this.timer=window.setTimeout(this.show.bind(this),v),this.document.addEventListener("mousemove",dt),Zt.set(this.hoverEl,this),this.hoverEl.addClass("hover-editor"),this.containerEl=this.hoverEl.createDiv("popover-content"),this.buildWindowControls(),this.setInitialDimensions();let T=this.pinEl=this.document.defaultView.createEl("a","popover-header-icon mod-pin-popover");this.titleEl.prepend(this.pinEl),T.onclick=()=>{this.togglePin()},z.requireApiVersion&&(0,z.requireApiVersion)("0.13.27")?(0,z.setIcon)(T,"lucide-pin",17):(0,z.setIcon)(T,"pin",17),this.createResizeHandles(),this.plugin.settings.imageZoom&&this.registerZoomImageHandlers()}static activeWindows(){let s=[window],{floatingSplit:u}=app.workspace;if(u)for(let h of u.children)h.win&&s.push(h.win);return s}static containerForDocument(s){if(s!==document&&app.workspace.floatingSplit){for(let u of app.workspace.floatingSplit.children)if(u.doc===s)return u}return app.workspace.rootSplit}static activePopovers(){return this.activeWindows().flatMap(this.popoversForWindow)}static popoversForWindow(s){var u,h;return Array.prototype.slice.call((h=(u=s==null?void 0:s.document)==null?void 0:u.body.querySelectorAll(".hover-popover"))!=null?h:[]).map(v=>Zt.get(v)).filter(v=>v)}static forLeaf(s){let u=s&&document.body.matchParent.call(s.containerEl,".hover-popover");return u?Zt.get(u):void 0}static iteratePopoverLeaves(s,u){for(let h of this.activePopovers())if(h.rootSplit&&s.iterateLeaves(u,h.rootSplit))return!0;return!1}adopt(s){if(this.targetEl===s)return!0;let u=s==null?void 0:s.getBoundingClientRect();if(Hr(this.targetRect,u)){this.targetEl.removeEventListener("mouseover",this.onMouseIn),this.targetEl.removeEventListener("mouseout",this.onMouseOut),s.addEventListener("mouseover",this.onMouseIn),s.addEventListener("mouseout",this.onMouseOut),this.targetEl=s,this.targetRect=u;let{x:h,y:v}=Qt;return this.onTarget=Hr(u,{left:h,right:h,top:v,bottom:v}),this.transition(),!0}else this.onTarget=!1,this.transition();return!1}onZoomOut(){this.document.body.removeEventListener("mouseup",this.boundOnZoomOut),this.document.body.removeEventListener("dragend",this.boundOnZoomOut),this.hoverEl.hasClass("do-not-restore")?this.hoverEl.removeClass("do-not-restore"):Gt(this.hoverEl)}onZoomIn(s){if(s.button!==0)return;this.hoverEl.hasClass("snap-to-viewport")&&this.hoverEl.addClass("do-not-restore"),this.document.body.addEventListener("mouseup",this.boundOnZoomOut,{once:!0}),this.document.body.addEventListener("dragend",this.boundOnZoomOut,{once:!0});let u=Ye(this.document);return ut(this.hoverEl),Ae(this.hoverEl,"viewport",u),!1}registerZoomImageHandlers(){this.hoverEl.addClass("image-zoom"),this.boundOnZoomOut=this.onZoomOut.bind(this),this.hoverEl.on("mousedown","img",this.onZoomIn.bind(this))}togglePin(s){var u;s===void 0&&(s=!this.isPinned),s&&((u=this.abortController)==null||u.unload()),this.hoverEl.toggleClass("is-pinned",s),this.pinEl.toggleClass("is-active",s),this.isPinned=s}getDefaultMode(){var s,u;return((u=(s=this.parent)==null?void 0:s.view)==null?void 0:u.getMode)?this.parent.view.getMode():"preview"}updateLeaves(){this.onTarget&&this.targetEl&&!this.document.contains(this.targetEl)&&(this.onTarget=!1,this.transition());let s=0;this.plugin.app.workspace.iterateLeaves(u=>{s++},this.rootSplit),s===0?this.hide():s>1&&this.toggleConstrainAspectRatio(!1),this.hoverEl.setAttribute("data-leaf-count",s.toString())}get headerHeight(){let s=this.hoverEl;return this.titleEl.getBoundingClientRect().bottom-s.getBoundingClientRect().top}toggleMinimized(s){var v;let u=this.hoverEl,h=this.headerHeight;if(!u.hasAttribute("data-restore-height"))this.plugin.settings.rollDown&&Bn(u,!1),u.setAttribute("data-restore-height",String(u.offsetHeight)),u.style.minHeight=h+"px",u.style.maxHeight=h+"px",u.toggleClass("is-minimized",!0);else{let d=u.getAttribute("data-restore-height");d&&(u.removeAttribute("data-restore-height"),u.style.height=d+"px"),u.style.removeProperty("max-height"),u.toggleClass("is-minimized",!1),this.plugin.settings.rollDown&&Bn(u,!0)}(v=this.interact)==null||v.reflow({name:"drag",axis:"xy"})}attachLeaf(){this.rootSplit.getRoot=()=>app.workspace[this.document===document?"rootSplit":"floatingSplit"],this.rootSplit.getContainer=()=>U.containerForDocument(this.document),this.titleEl.insertAdjacentElement("afterend",this.rootSplit.containerEl);let s=this.plugin.app.workspace.createLeafInParent(this.rootSplit,0);return this.updateLeaves(),s}onload(){super.onload(),this.registerEvent(this.plugin.app.workspace.on("layout-change",this.updateLeaves,this)),this.registerEvent(app.workspace.on("layout-change",()=>{this.rootSplit.children.forEach((s,u)=>{s instanceof z.WorkspaceTabs&&this.rootSplit.replaceChild(u,s.children[0])})}))}leaves(){let s=[];return this.plugin.app.workspace.iterateLeaves(u=>{s.push(u)},this.rootSplit),s}setInitialDimensions(){this.hoverEl.style.height=this.plugin.settings.initialHeight,this.hoverEl.style.width=this.plugin.settings.initialWidth}adjustHeight(s){this.hoverEl.style.height=this.hoverEl.offsetHeight+s+"px"}toggleViewHeader(s,u){var d;s===void 0&&(s=!this.hoverEl.hasClass("show-navbar")),(d=this.hideNavBarEl)==null||d.toggleClass("is-active",s),this.hoverEl.toggleClass("show-navbar",s);let h=this.hoverEl.querySelector(".view-header");if(!h||u)return;let v=parseFloat(getComputedStyle(h).getPropertyValue("--he-view-header-height"));this.hoverEl.style.transition="height 0.2s",this.adjustHeight(s?v:-v),setTimeout(()=>{this.hoverEl.style.removeProperty("transition")},200),this.requestLeafMeasure()}buildWindowControls(){this.titleEl=this.document.defaultView.createDiv("popover-titlebar"),this.titleEl.createDiv("popover-title");let s=this.titleEl.createDiv("popover-actions"),u=this.hideNavBarEl=s.createEl("a","popover-action mod-show-navbar");(0,z.setIcon)(u,"sidebar-open",14),u.addEventListener("click",E=>{this.toggleViewHeader()}),this.plugin.settings.showViewHeader&&this.toggleViewHeader(!0,!0);let h=s.createEl("a","popover-action mod-minimize");(0,z.setIcon)(h,"minus"),h.addEventListener("click",E=>{Gt(this.hoverEl),this.toggleMinimized()});let v=s.createEl("a","popover-action mod-maximize");(0,z.setIcon)(v,"maximize",14),v.addEventListener("click",E=>{if(this.hoverEl.hasClass("snap-to-viewport")){(0,z.setIcon)(v,"maximize",14),Gt(this.hoverEl);return}(0,z.setIcon)(v,"minimize",14);let T=Ye(this.document);ut(this.hoverEl),Ae(this.hoverEl,"viewport",T)});let d=s.createEl("a","popover-action mod-close");(0,z.setIcon)(d,"x"),d.addEventListener("click",E=>{this.hide()}),this.containerEl.prepend(this.titleEl)}requestLeafMeasure(){let s=this.leaves();s.length&&setTimeout(()=>{s.forEach(u=>u.onResize())},200)}onShow(){var u,h;let{closeDelay:s}=this.plugin.settings;setTimeout(()=>this.waitTime=s,s),(u=this.oldPopover)==null||u.hide(),this.oldPopover=null,this.hoverEl.toggleClass("is-new",!0),this.document.body.addEventListener("click",()=>{this.hoverEl.toggleClass("is-new",!1)},{once:!0,capture:!0}),this.parent&&(this.parent.hoverPopover=this),(0,z.requireApiVersion)("0.15.1")&&!(0,z.requireApiVersion)("0.15.7")&&app.workspace.iterateLeaves(v=>{var d,E;v.view instanceof z.MarkdownView&&((E=(d=v.view.editMode).reinit)==null||E.call(d))},this.rootSplit),this.togglePin(this.isPinned),(h=this.onShowCallback)==null||h.call(this),this.onShowCallback=void 0}startBounce(){this.bounce=setTimeout(()=>{this.hoverEl.style.left=parseFloat(this.hoverEl.style.left)+this.xspeed+"px",this.hoverEl.style.top=parseFloat(this.hoverEl.style.top)+this.yspeed+"px",this.checkHitBox(),this.startBounce()},20)}toggleBounce(){if(this.xspeed=7,this.yspeed=7,this.bounce){clearTimeout(this.bounce),this.bounce=void 0;let s=this.hoverEl.querySelector(".view-content");(s==null?void 0:s.style)&&s.style.removeProperty("backgroundColor")}else this.startBounce()}checkHitBox(){let s=parseFloat(this.hoverEl.style.left),u=parseFloat(this.hoverEl.style.top),h=parseFloat(this.hoverEl.style.width),v=parseFloat(this.hoverEl.style.height);(s<=0||s+h>=this.document.body.offsetWidth)&&(this.xspeed*=-1,this.pickColor()),(u<=0||u+v>=this.document.body.offsetHeight)&&(this.yspeed*=-1,this.pickColor())}pickColor(){let s=Math.random()*(254-0)+0,u=Math.random()*(254-0)+0,h=Math.random()*(254-0)+0,v=this.hoverEl.querySelector(".view-content");(v==null?void 0:v.style)&&(v.style.backgroundColor="rgb("+s+","+u+", "+h+")")}transition(){this.shouldShow()?this.state===z.PopoverState.Hiding&&(this.state=z.PopoverState.Shown,clearTimeout(this.timer)):this.state===z.PopoverState.Showing?this.hide():this.state===z.PopoverState.Shown&&(this.state=z.PopoverState.Hiding,this.timer=window.setTimeout(()=>{this.shouldShow()?this.transition():this.hide()},this.waitTime))}detect(s){let{targetEl:u,hoverEl:h}=this;u&&(this.onTarget=s===u||u.contains(s)),this.onHover=s===h||h.contains(s)}_onMouseIn(s){this.targetEl&&!Jt(s,this.targetEl)||(this.onTarget=!0,this.transition())}_onMouseOut(s){this.targetEl&&!Jt(s,this.targetEl)||(this.onTarget=!1,this.transition())}position(s){s===void 0&&(s=this.shownPos);let u;if(s)u={top:s.y-10,bottom:s.y+10,left:s.x,right:s.x};else if(this.targetEl){let h=za(this.targetEl,this.document.body);u={top:h.top,bottom:h.top+this.targetEl.offsetHeight,left:h.left,right:h.left+this.targetEl.offsetWidth}}else u={top:0,bottom:0,left:0,right:0};this.document.body.appendChild(this.hoverEl),Ra(u,this.hoverEl,{gap:10},this.document),s&&setTimeout(()=>{let h=parseFloat(this.hoverEl.style.left),v=parseFloat(this.hoverEl.style.top);this.hoverEl.setAttribute("data-x",String(h)),this.hoverEl.setAttribute("data-y",String(v))},0)}shouldShow(){return this.shouldShowSelf()||this.shouldShowChild()}shouldShowChild(){return U.activePopovers().some(s=>s!==this&&s.targetEl&&this.hoverEl.contains(s.targetEl)?s.shouldShow():!1)}shouldShowSelf(){return!this.detaching&&!!(this.onTarget||this.onHover||this.state==z.PopoverState.Shown&&this.isPinned||this.document.querySelector(`body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container`))}calculateMinSize(){return{width:40,height:this.headerHeight}}calculateBoundaries(s,u,h){let v=h.element.closest("body"),d=(v==null?void 0:v.querySelector(".workspace"))||(v==null?void 0:v.querySelector(".workspace-window"));return d==null?void 0:d.getBoundingClientRect()}calculateMaxSize(s,u,h){let v=h.pointerType==="reflow"?this.document.body.offsetWidth/1.5:this.document.body.offsetWidth,d=h.pointerType==="reflow"?this.document.body.offsetHeight/1.5:this.document.body.offsetHeight;return{width:v,height:d}}toggleConstrainAspectRatio(s,u){let h=this.resizeModifiers.find(v=>v.name=="aspectRatio");!h||(s===void 0&&(s=!h.options.enabled),s?(h.enable(),this.constrainAspectRatio=!0,u!==void 0&&h.options.ratio!==u&&(h.options.ratio=u)):(h.disable(),this.constrainAspectRatio=!1))}registerInteract(){var S,H;let s=this.document.querySelector("div.app-container, div.workspace-split"),u=this,h=function(M,V,D){let{top:X,right:A,bottom:W,left:J,x:le,y:$,width:Q,height:rn}=s.getBoundingClientRect(),I={top:X,right:A,bottom:W,left:J,x:le,y:$,width:Q,height:rn};return D.pointerType==="reflow"?u.dragElementRect.bottom=1:u.dragElementRect.bottom=0,u.plugin.settings.snapToEdges&&(I.top=X-30),I.bottom=W-u.headerHeight,I},v=!0,d,E=((S=this.hoverEl.dataset)==null?void 0:S.imgRatio)?parseFloat((H=this.hoverEl.dataset)==null?void 0:H.imgRatio):void 0;this.resizeModifiers=[this.interactStatic.modifiers.restrictEdges({outer:u.calculateBoundaries.bind(this)}),this.interactStatic.modifiers.restrictSize({min:u.calculateMinSize.bind(this),max:u.calculateMaxSize.bind(this)}),this.interactStatic.modifiers.aspectRatio({ratio:E||"preserve",enabled:!1})],this.dragElementRect={top:0,left:1,bottom:0,right:0};let T=[this.interactStatic.modifiers.restrict({restriction:h,offset:{top:0,left:40,bottom:0,right:40},elementRect:this.dragElementRect,endOnly:!1})];this.constrainAspectRatio&&E!==void 0&&this.toggleConstrainAspectRatio(!0,E);let k=this.interactStatic(this.hoverEl).preventDefault("always").on("doubletap",this.onDoubleTap.bind(this)).draggable({modifiers:T,allowFrom:".popover-titlebar",listeners:{start(M){M.buttons&&u.togglePin(!0),M.buttons&&pe(M.target,HTMLElement)&&M.target.addClass("is-dragging")},end(M){pe(M.target,HTMLElement)&&M.target.removeClass("is-dragging")},move:Lr.bind(u)}}).resizable({edges:{top:".top-left, .top-right, .top",left:".top-left, .bottom-left, .left",bottom:".bottom-left, .bottom-right, .bottom",right:".top-right, .bottom-right, .right"},modifiers:this.resizeModifiers,listeners:{start(M){var A;M.target.style.removeProperty("max-height");let D=(A=u.hoverEl.querySelector(".view-header"))==null?void 0:A.offsetHeight;d=u.titleEl.offsetHeight+D,v=!0,M.buttons&&u.togglePin(!0)},move:function(M){var J,le,$;if(!(M==null?void 0:M.deltaRect)||!M.edges)return;let{target:V}=M,{x:D,y:X}=V.dataset,A=M.rect.height,W=M.rect.width;D=D||V.style.left,X=X||V.style.top,D=String((parseFloat(D)||0)+((J=M.deltaRect)==null?void 0:J.left)),X=String((parseFloat(X)||0)+((le=M.deltaRect)==null?void 0:le.top)),u.constrainAspectRatio&&E&&M.buttons!==void 0?(v&&(M.edges.top&&(M.edges.right||M.edges.left)?X=String(parseFloat(X)-d):M.edges.top?D=String(parseFloat(D)+d*E):M.edges.left&&!(M.edges.top||M.edges.bottom)&&(X=String(parseFloat(X)-d))),v=!1,(M.edges.top&&!(M.edges.right||M.edges.left)||M.edges.bottom&&!(M.edges.right||M.edges.left))&&(A=A-d,W=W-d*E),A=A+d,(V.hasClass("snap-to-left")||V.hasClass("snap-to-right"))&&(X=String(parseFloat(V.style.top)),D=String(parseFloat(V.style.left)))):E&&A>(($=this==null?void 0:this.document)==null?void 0:$.body.offsetHeight)&&(A=A/1.5,W=A*E),Object.assign(V.style,{width:`${W}px`,height:`${A}px`,top:`${X}px`,left:D==="NaN"?"unset":`${D}px`}),Object.assign(V.dataset,{x:D,y:X})},end:function(M){M.rect.height>u.headerHeight&&M.target.removeAttribute("data-restore-height"),k.reflow({name:"drag",axis:"xy"})}}});this.interact=k}createResizeHandles(){this.hoverEl.createDiv("resize-handle bottom-left"),this.hoverEl.createDiv("resize-handle bottom-right"),this.hoverEl.createDiv("resize-handle top-left"),this.hoverEl.createDiv("resize-handle top-right"),this.hoverEl.createDiv("resize-handle right"),this.hoverEl.createDiv("resize-handle left"),this.hoverEl.createDiv("resize-handle bottom"),this.hoverEl.createDiv("resize-handle top")}onDoubleTap(s){s.target.tagName==="DIV"&&s.target.closest(".popover-titlebar")&&(s.preventDefault(),this.togglePin(!0),this.toggleMinimized())}show(){var s,u;!this.targetEl||this.document.body.contains(this.targetEl)?(this.state=z.PopoverState.Shown,this.timer=0,this.shownPos=Qt,this.position(Qt),this.document.removeEventListener("mousemove",dt),this.onShow(),app.workspace.onLayoutChange(),this.load()):this.hide(),this.hoverEl.dataset.imgHeight&&this.hoverEl.dataset.imgWidth&&(this.hoverEl.style.height=parseFloat(this.hoverEl.dataset.imgHeight)+this.titleEl.offsetHeight+"px",this.hoverEl.style.width=parseFloat(this.hoverEl.dataset.imgWidth)+"px"),this.registerInteract(),(s=this.interact)==null||s.reflow({name:"resize",edges:{right:!0,bottom:!0}}),(u=this.interact)==null||u.reflow({name:"drag",axis:"xy"})}onHide(){var s;this.oldPopover=null,((s=this.parent)==null?void 0:s.hoverPopover)===this&&(this.parent.hoverPopover=null)}hide(){var u,h;if(this.onTarget=this.onHover=!1,this.isPinned=!1,this.detaching=!0,this.document.removeEventListener("mousemove",dt),this.timer&&(clearTimeout(this.timer),this.timer=0),this.hoverEl.hide(),this.opening)return;let s=this.leaves();if(s.length)s.forEach(v=>{v.detach(),v===app.workspace.activeLeaf&&(app.workspace.activeLeaf=null)});else return this.parent=null,((u=this.interact)==null?void 0:u.unset)&&this.interact.unset(),(h=this.abortController)==null||h.unload(),this.abortController=void 0,this.interact=void 0,this.nativeHide()}nativeHide(){var h;let{hoverEl:s,targetEl:u}=this;if(this.state=z.PopoverState.Hidden,s.detach(),u){let v=u.matchParent(".hover-popover");v&&((h=Zt.get(v))==null||h.transition()),u.removeEventListener("mouseover",this.onMouseIn),u.removeEventListener("mouseout",this.onMouseOut)}this.onHide(),this.unload()}resolveLink(s,u){let h=(0,z.parseLinktext)(s);return h?this.plugin.app.metadataCache.getFirstLinkpathDest(h.path,u):null}async openLink(s,u,h,v){var D,X,A;let d=this.resolveLink(s,u),E=(0,z.parseLinktext)(s);if(!d&&v){let W=this.plugin.app.fileManager.getNewFileParent(u);d=await this.plugin.app.fileManager.createNewMarkdownFile(W,E.path)}if(!d){this.displayCreateFileAction(s,u,h);return}let{viewRegistry:T}=this.plugin.app,k=T.typeByExtension[d.extension];if(!k||!T.viewByType[k]){this.displayOpenFileAction(d);return}h=Object.assign(this.buildEphemeralState(d,E),h);let S=this.getDefaultMode(),H=this.buildState(S,h),M=await this.openFile(d,H,v),V=(D=M==null?void 0:M.view)==null?void 0:D.getViewType();if(V==="image"){this.plugin.settings.autoFocus&&((X=this.parent)==null?void 0:X.hasOwnProperty("editorEl"))&&this.parent.editorEl.hasClass("is-live-preview")&&(this.waitTime=3e3),this.constrainAspectRatio=!0;let W=M.view.contentEl.querySelector("img");this.hoverEl.dataset.imgHeight=String(W.naturalHeight),this.hoverEl.dataset.imgWidth=String(W.naturalWidth),this.hoverEl.dataset.imgRatio=String(W.naturalWidth/W.naturalHeight)}else V==="pdf"&&(this.hoverEl.style.height="800px",this.hoverEl.style.width="600px");((A=H.state)==null?void 0:A.mode)==="source"&&this.whenShown(()=>{var W,J,le,$;(0,z.requireApiVersion)("1.0")&&((le=(J=(W=M==null?void 0:M.view)==null?void 0:W.editMode)==null?void 0:J.reinit)==null||le.call(J)),($=M==null?void 0:M.view)==null||$.setEphemeralState(H.eState)})}displayOpenFileAction(s){let h=this.attachLeaf().view;h.emptyTitleEl.hide(),h.actionListEl.empty();let{actionListEl:v}=h;v.createDiv({cls:"file-embed-title"},d=>{d.createSpan({cls:"file-embed-icon"},E=>(0,z.setIcon)(E,"document",22)),d.appendText(" "+s.name)}),v.addEventListener("click",()=>this.plugin.app.openWithDefaultApp(s.path)),v.setAttribute("aria-label",i18next.t("interface.embed-open-in-default-app-tooltip"))}displayCreateFileAction(s,u,h){var E,T,k;let v=this.attachLeaf(),d=v.view;if(d){(E=d.emptyTitleEl)==null||E.hide(),(T=d.actionListEl)==null||T.empty();let S=(k=d.actionListEl)==null?void 0:k.createEl("button","empty-state-action");if(!S)return;S.textContent=`${s} is not yet created. Click to create.`,this.plugin.settings.autoFocus&&setTimeout(()=>{S==null||S.focus()},200),S.addEventListener("click",async()=>{this.togglePin(!0),await this.openLink(s,u,h,v)},{once:!0})}}whenShown(s){if(this.detaching)return;let u=this.onShowCallback;this.onShowCallback=()=>{this.detaching||(s(),typeof u=="function"&&u())},this.state===z.PopoverState.Shown&&(this.onShowCallback(),this.onShowCallback=void 0)}async openFile(s,u,h){var d,E,T;if(this.detaching)return;let v=h!=null?h:this.attachLeaf();this.opening=!0;try{if(await v.openFile(s,u),this.plugin.settings.autoFocus&&!this.detaching)this.whenShown(()=>{app.workspace.setActiveLeaf(v,!1,!1),app.workspace.activeLeaf===v&&v.setEphemeralState({focus:!0}),setTimeout(ie(z.Workspace.prototype,{recordMostRecentOpenedFile(S){return function(H){if(H!==s)return S.call(this,H)}}}),1);let k=this.plugin.app.plugins.plugins["recent-files-obsidian"];k&&setTimeout(ie(k,{shouldAddFile(S){return function(H){return H!==s&&S.call(this,H)}}}),1)});else if(!this.plugin.settings.autoFocus&&!this.detaching){let k=this.hoverEl.querySelector(".popover-title");if(!k)return;k.textContent=(d=v.view)==null?void 0:d.getDisplayText(),k.setAttribute("data-path",(T=(E=v.view)==null?void 0:E.file)==null?void 0:T.path)}}catch(k){console.error(k)}finally{this.opening=!1,this.detaching&&this.hide()}return v}buildState(s,u){let v=this.plugin.settings.defaultMode==="match"?s:this.plugin.settings.defaultMode;return{active:!1,state:{mode:v},eState:u}}buildEphemeralState(s,u){let h=this.plugin.app.metadataCache.getFileCache(s),v=h?(0,z.resolveSubpath)(h,(u==null?void 0:u.subpath)||""):void 0,d={subpath:u==null?void 0:u.subpath};return v&&(d.line=v.start.line,d.startLoc=v.start,d.endLoc=v.end||void 0),d}};function pt(g){return g.containerEl.matches(".popover.hover-popover.hover-editor .workspace-leaf")}function Ra(g,s,u,h){u=u||{},s.show();let v=u.gap||0,d=u.preference||"bottom",E=u.offsetParent||s.offsetParent||h.documentElement,T=u.horizontalAlignment||"left",k=E.scrollTop+10,S=E.scrollTop+E.clientHeight-10,H=Math.min(g.top,S),M=Math.max(g.bottom,k),V=s.offsetHeight,D=g.top-k>=V+v,X=S-g.bottom>=V+v,A=0,W="";!D||d!=="top"&&X?!X||d!=="bottom"&&D?E.clientHeightle-$&&(Q=le-$),s.style.top="".concat(A.toString(),"px"),s.style.left="".concat(Q.toString(),"px"),{top:A,left:Q,vresult:W}}function za(g,s){let u=0,h=0;for(let v=s?s.offsetParent:null;g&&g!==s&&g!==v;){u+=g.offsetTop,h+=g.offsetLeft;let d=g.offsetParent;for(let E=g.parentElement;E&&E!==d;)u-=E.scrollTop,h-=E.scrollLeft,E=E.parentElement;d&&d!==s&&d!==v&&(u-=d.scrollTop,h-=d.scrollLeft),g=d}return{top:u,left:h}}function dt(g){Qt={x:g.clientX,y:g.clientY}}function Jt(g,s){let u=g.relatedTarget;return!(pe(u,Node)&&s.contains(u))}function Hr(g,s){return!!(g&&s&&g.right>s.left&&g.lefts.top&&g.top div')&&(u=u.parentElement);let T=en.has(u)?en.get(u):s.hoverPopover;if(T==null?void 0:T.lockedOut)return;if(T&&T.state!==Pe.PopoverState.Hidden&&(!T.isPinned||g.settings.autoPin==="always")&&T.targetEl!==null&&T.originalLinkText===h&&T.originalPath===v&&u&&T.adopt(u))en.set(u,T);else{let S=new U(s,u,g,g.settings.triggerDelay);u&&en.set(u,S),S.originalLinkText=h,S.originalPath=v,s.hoverPopover=S;let H=S.abortController,M=function(){!S||(S.lockedOut=!1)},V=function(A){!S||pe(A.target,HTMLElement)&&!A.target.closest(".hover-editor, .menu")&&(S.state=Pe.PopoverState.Hidden,S.hide(),S.lockedOut=!0,setTimeout(M,1e3))},{document:D}=S,X=function(A){if(!S)return;let W=Pe.Platform.isMacOS?"Meta":"Control";!S.onHover&&S.state!==Pe.PopoverState.Shown&&A.key!==W?(S.state=Pe.PopoverState.Hidden,S.hide(),S.lockedOut=!0,setTimeout(M,1e3)):D.body.removeEventListener("keyup",X,!0)};D.addEventListener("pointerdown",V,!0),D.addEventListener("mousedown",V,!0),D.body.addEventListener("keyup",X,!0),H.register(()=>{D.removeEventListener("pointerdown",V,!0),D.removeEventListener("mousedown",V,!0),D.body.removeEventListener("keyup",X,!0)}),setTimeout(()=>{(S==null?void 0:S.state)!=Pe.PopoverState.Hidden&&(S==null||S.openLink(h,v,d))},0)}}var Ge=be(require("obsidian"));var Xn=Symbol.for("v1.to-use.peak-dev.org"),Yn=Symbol.for("v1.factory.to-use.peak-dev.org"),Ke,ft,se=function(){return Object.defineProperties(g(),{this:{get(){if(Ke)return Ke;throw new TypeError("No current context")}},me:{value:Xn},factory:{value:Yn}});function g(v){let d=new Map;d.prev=v;let E=Object.assign(v?k=>{let S=d.get(k);if(!S){for(let D=d.prev;D;D=D.prev)if(S=D.get(k)){S=Object.assign(Object.assign({},S),{s:S.s||1});break}S=S||{s:2,v:u},d.set(k,S)}let H,M,V;for(;;)switch(S.s){case 0:return Ke===E&&ft&&ft.push(k),S.v;case 1:if(H=S.d,!H||T(()=>H.k.every(D=>E(D)===H.c(D)))){S.s=0;break}S.v=H.f;case 2:S.s=4;try{s(d,k,0,T(M=S.v,k,V=[])),V.length&&(S.d={c:E,f:M,k:V});break}catch(D){S.s=3,S.v=D,S.d=null}case 3:throw S.v;case 4:throw new Error(`Factory ${String(S.v)} didn't resolve ${String(k)}`)}}:k=>se.this(k),{def(k,S){return s(d,k,2,S),E},set(k,S){return s(d,k,1,S),E},fork(k){let S=g(d);return k!=null?S(k):S}});return v?E.use=E:E;function T(k,S,H){let M=Ke,V=ft;try{return Ke=E,ft=H,k(S)}finally{Ke=M,ft=V}}}function s(v,d,E,T){if(v.has(d)){let k=v.get(d);if(!k.s)throw new Error(`Already read: ${String(d)}`);k.s=E,k.v=T,k.d=null}else v.set(d,{s:E,v:T})}function u(v){if(typeof v[Xn]=="function")return v[Xn](v);if(h(v))return typeof v.prototype[Yn]=="function"?v.prototype[Yn]():new v;throw new ReferenceError(`No config for ${String(v)}`)}function h(v){return typeof v=="function"&&v.prototype!==void 0&&(Object.getPrototypeOf(v.prototype)!==Object.prototype||Object.getOwnPropertyNames(v.prototype).length>1||v.toString().startsWith("class"))}}();var Nr,$e=(Nr=window.queueMicrotask)!=null?Nr:(g=>s=>g.then(s))(Promise.resolve());se.def(Ge.Plugin,()=>{throw new Error("Plugin not created yet")});var tn=class extends Ge.Component{constructor(){super(...arguments);this.use=se.service(this)}};se.service=function g(g){return se(Un).addChild(g),se.this};se.plugin=function g(g){let s=se.fork().set(Ge.Plugin,g).set(g.constructor,g);return g.addChild(s.use(Un)),s};var Un=class extends Ge.Component{constructor(){super(...arguments);this.children=new Set([this])}onload(){this.loaded=!0}onunload(){this.loaded=!1,this.children.clear()}addChild(s){return this.children.has(s)||(this.children.add(s),this.loaded?$e(()=>super.addChild(s)):super.addChild(s)),s}};var qr=be(require("obsidian"));var Kn=2,_s=Symbol.for(`v${Kn}.layout-storage-events.ophidian.peak-dev.org`);var Cs=`ophidian-layout-storage:v${Kn}:item-load`,Ls=`ophidian-layout-storage:v${Kn}:item-save`;var Xr=be(require("obsidian"));var Yr=be(require("obsidian"));var $n=class extends Yr.Component{constructor(s,u){super();this.use=s;this.win=u}get container(){return Va(this.win)}[se.factory](){return new Ur(this.constructor)}},Ur=class extends tn{constructor(s){super();this.factory=s;this.instances=new WeakMap;this.watching=!1}watch(){if(!this._loaded)this.onload=()=>this.watch();else if(!this.watching){let{workspace:s}=app;this.watching=!0,this.registerEvent(s.on("window-open",(u,h)=>{s.onLayoutReady(()=>$e(()=>this.forWindow(h)))})),s.onLayoutReady(()=>$e(()=>this.forAll()))}return this}forWindow(s=(h=>(h=window.activeWindow)!=null?h:window)(),u=!0){let v=this.instances.get(s);return!v&&u&&(v=new this.factory(this.use,s),v&&(this.instances.set(s,v),v.registerDomEvent(s,"beforeunload",()=>{this.removeChild(v),this.instances.delete(s)}),this.addChild(v))),v||void 0}forDom(s,u=!0){return this.forWindow(Fa(s),u)}forLeaf(s,u=!0){return this.forDom(s.containerEl,u)}forView(s,u=!0){return this.forLeaf(s.leaf,u)}forAll(s=!0){return Wa().map(u=>this.forWindow(u,s)).filter(u=>u)}};function Wa(){let g=[window],{floatingSplit:s}=app.workspace;if(s)for(let u of s.children)u.win&&g.push(u.win);return g}function Fa(g){return g.win||(g.ownerDocument||g).defaultView||window}function Va(g){if(g===window)return app.workspace.rootSplit;let{floatingSplit:s}=app.workspace;if(s){for(let u of s.children)if(g===u.win)return u}}var oe=be(require("obsidian"));var nn={defaultMode:"preview",autoPin:"onMove",triggerDelay:300,closeDelay:600,autoFocus:!0,rollDown:!1,snapToEdges:!1,initialHeight:"340px",initialWidth:"400px",showViewHeader:!1,imageZoom:!0,hoverEmbeds:!1},Ba={preview:"Reading view",source:"Editing view",match:"Match current view"},Na={onMove:"On drag or resize",always:"Always"},Gn=class extends oe.PluginSettingTab{constructor(s,u){super(s,u);this.plugin=u}hide(){}display(){let{containerEl:s}=this;s.empty(),new oe.Setting(s).setName("Default Mode").addDropdown(u=>{u.addOptions(Ba),u.setValue(this.plugin.settings.defaultMode),u.onChange(async h=>{this.plugin.settings.defaultMode=h,await this.plugin.saveSettings()})}),new oe.Setting(s).setName("Auto Pin").addDropdown(u=>{u.addOptions(Na),u.setValue(this.plugin.settings.autoPin),u.onChange(async h=>{this.plugin.settings.autoPin=h,await this.plugin.saveSettings()})}),new oe.Setting(s).setName("Trigger hover preview on embeds").setDesc("Allow hover preview to trigger when hovering over any type of rendered embed such as images or block references").addToggle(u=>u.setValue(this.plugin.settings.hoverEmbeds).onChange(h=>{this.plugin.settings.hoverEmbeds=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Auto Focus").setDesc("Set the hover editor as the active pane when opened").addToggle(u=>u.setValue(this.plugin.settings.autoFocus).onChange(h=>{this.plugin.settings.autoFocus=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Minimize downwards").setDesc("When double clicking to minimize, the window will roll down instead of rolling up").addToggle(u=>u.setValue(this.plugin.settings.rollDown).onChange(h=>{this.plugin.settings.rollDown=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Snap to edges").setDesc(`Quickly arrange popovers by dragging them to the edges of the screen. The left and right edges will maximize the popover vertically. The top edge will maximize the popover to fill the entire screen. Dragging the popovers away from the edges will restore the popver to its original size.`).addToggle(u=>u.setValue(this.plugin.settings.snapToEdges).onChange(h=>{this.plugin.settings.snapToEdges=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Show view header by default").setDesc(`Show the view header by default when triggering a hover editor. When disabled, view headers will only show if you click the view header icon to the left of the minimize button.`).addToggle(u=>u.setValue(this.plugin.settings.showViewHeader).onChange(h=>{this.plugin.settings.showViewHeader=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Click to zoom image").setDesc(`Click and hold an image within a hover editor to temporarily maximize the popover and image to fill the entire viewport. On mouse up, the hover editor will restore to its original size.`).addToggle(u=>u.setValue(this.plugin.settings.imageZoom).onChange(h=>{this.plugin.settings.imageZoom=h,this.plugin.saveSettings()})),new oe.Setting(s).setName("Initial popover width").setDesc("Enter any valid CSS unit").addText(u=>{u.setPlaceholder(this.plugin.settings.initialWidth),u.inputEl.type="text",u.setValue(this.plugin.settings.initialWidth),u.onChange(async h=>{h=Fn(h),h||(h=nn.initialWidth),this.plugin.settings.initialWidth=h,this.plugin.saveSettings()})}),new oe.Setting(s).setName("Initial popover height").setDesc("Enter any valid CSS unit").addText(u=>{u.setPlaceholder(String(this.plugin.settings.initialHeight)),u.inputEl.type="text",u.setValue(String(this.plugin.settings.initialHeight)),u.onChange(async h=>{h=Fn(h),h||(h=nn.initialHeight),this.plugin.settings.initialHeight=h,this.plugin.saveSettings()})}),new oe.Setting(s).setName("Hover Trigger Delay (ms)").setDesc("How long to wait before showing a Hover Editor when hovering over a link").addText(u=>{u.setPlaceholder(String(this.plugin.settings.triggerDelay)),u.inputEl.type="number",u.setValue(String(this.plugin.settings.triggerDelay)),u.onChange(async h=>{this.plugin.settings.triggerDelay=Number(h),this.plugin.saveSettings()})}),new oe.Setting(s).setName("Hover Close Delay (ms)").setDesc("How long to wait before closing a Hover Editor once the mouse leaves").addText(u=>{u.setPlaceholder(String(this.plugin.settings.closeDelay)),u.inputEl.type="number",u.setValue(String(this.plugin.settings.closeDelay)),u.onChange(async h=>{this.plugin.settings.closeDelay=Number(h),this.plugin.saveSettings()})})}};var Qn=be($r());var Gr=class extends $n{constructor(){super(...arguments);this.interact=this.createInteractor();this.plugin=this.use(on)}createInteractor(){if(this.win===window)return Qn.default;let s=Qn.default.scope,h=new s.constructor().init(this.win).interactStatic;for(let v of s._plugins.list)h.use(v);return h}onload(){this.win.addEventListener("resize",this.plugin.debouncedPopoverReflow)}onunload(){this.win.removeEventListener("resize",this.plugin.debouncedPopoverReflow);try{this.interact.removeDocument(this.win.document)}catch(s){console.error(s)}}},on=class extends B.Plugin{constructor(){super(...arguments);this.use=se.plugin(this);this.interact=this.use(Gr);this.debouncedPopoverReflow=(0,B.debounce)(()=>{U.activePopovers().forEach(s=>{var u;(u=s.interact)==null||u.reflow({name:"drag",axis:"xy"})})},100,!0)}async onload(){this.registerActivePopoverHandler(),this.registerFileRenameHandler(),this.registerContextMenuHandler(),this.registerCommands(),this.patchUnresolvedGraphNodeHover(),this.patchWorkspace(),this.patchQuickSwitcher(),this.patchWorkspaceLeaf(),this.patchItemView(),this.patchMarkdownPreviewRenderer(),await this.loadSettings(),this.registerSettingsTab(),this.app.workspace.onLayoutReady(()=>{this.patchSlidingPanes(),this.patchLinkHover(),setTimeout(()=>{this.app.workspace.trigger("css-change")},2e3)})}get activePopovers(){return U.activePopovers()}patchWorkspaceLeaf(){this.register(ie(B.WorkspaceLeaf.prototype,{getRoot(s){return function(){let u=s.call(this);return u.getRoot===this.getRoot?u:u.getRoot()}},onResize(s){return function(){var u;(u=this.view)==null||u.onResize()}},setViewState(s){return async function(u,h){var d,E,T;let v=await s.call(this,u,h);try{let k=U.forLeaf(this);if(k){u.type&&k.hoverEl.setAttribute("data-active-view-type",u.type);let S=k.hoverEl.querySelector(".popover-title");S&&(S.textContent=(d=this.view)==null?void 0:d.getDisplayText(),((T=(E=this.view)==null?void 0:E.file)==null?void 0:T.path)?S.setAttribute("data-path",this.view.file.path):S.removeAttribute("data-path"))}}catch(k){}return v}},setEphemeralState(s){return function(u){var h;s.call(this,u),u.focus&&((h=this.view)==null?void 0:h.getViewType())==="empty"&&(this.view.contentEl.tabIndex=-1,this.view.contentEl.focus())}}})),this.register(ie(B.WorkspaceItem.prototype,{getContainer(s){return function(){if(!!s)return!this.parentSplit||this instanceof B.WorkspaceContainer?s.call(this):this.parentSplit.getContainer()}}}))}patchQuickSwitcher(){let s=this,{QuickSwitcherModal:u}=this.app.internalPlugins.plugins.switcher.instance,h=ie(u.prototype,{open(v){return function(){let d=v.call(this);return this.setInstructions([{command:B.Platform.isMacOS?"cmd p":"ctrl p",purpose:"to open in new popover"}]),this.scope.register(["Mod"],"p",E=>{this.close();let T=this.chooser.values[this.chooser.selectedItem];if(!(T==null?void 0:T.file))return;let k=s.spawnPopover(void 0,()=>this.app.workspace.setActiveLeaf(k,!1,!0));return k.openFile(T.file),!1}),d}}});this.register(h)}patchItemView(){let s=this,[u,h]=B.View.prototype.onPaneMenu?[B.View,"onPaneMenu"]:[B.ItemView,"onMoreOptionsMenu"],v=ie(u.prototype,{[h](d){return function(E,...T){return(this.leaf?U.forLeaf(this.leaf):void 0)?E.addItem(S=>{var H,M;(M=(H=S.setIcon("popup-open").setTitle("Dock Hover Editor to workspace").onClick(()=>{s.dockPopoverToWorkspace(this.leaf)})).setSection)==null||M.call(H,"open")}):(E.addItem(S=>{var H,M;(M=(H=S.setIcon("popup-open").setTitle("Open in Hover Editor").onClick(()=>{var D;let V=s.spawnPopover();((D=this.leaf)==null?void 0:D.getViewState)&&V.setViewState(this.leaf.getViewState())})).setSection)==null||M.call(H,"open")}),E.addItem(S=>{var H,M;(M=(H=S.setIcon("popup-open").setTitle("Convert to Hover Editor").onClick(()=>{s.convertLeafToPopover(this.leaf)})).setSection)==null||M.call(H,"open")})),d.call(this,E,...T)}}});this.register(v)}patchMarkdownPreviewRenderer(){let s=this,u=ie(B.MarkdownPreviewRenderer,{registerDomEvents(h){return function(v,d,...E){return v==null||v.on("mouseover",".internal-embed.is-loaded",(T,k)=>{var S,H,M,V,D;k&&s.settings.hoverEmbeds&&app.workspace.trigger("hover-link",{event:T,source:k.matchParent(".markdown-source-view")?"editor":"preview",hoverParent:(S=d.hoverParent)!=null?S:d.info,targetEl:k,linktext:k.getAttribute("src"),sourcePath:((D=(V=(M=(H=d.info)!=null?H:d).getFile)==null?void 0:V.call(M))==null?void 0:D.path)||""})}),h.call(this,v,d,...E)}}});this.register(u)}patchWorkspace(){let s=!1,u=ie(B.Workspace.prototype,{changeLayout(h){return async function(v){s=!0;try{await h.call(this,v)}finally{s=!1}}},recordHistory(h){return function(v,d,...E){var k;if(!(!((k=this.app.plugins.plugins["pane-relief"])==null?void 0:k._loaded)&&pt(v)))return h.call(this,v,d,...E)}},iterateLeaves(h){return function(v,d){if(h.call(this,v,d))return!0;let E=typeof v=="function"?v:d,T=typeof v=="function"?d:v;if(!T||s)return!1;if(T===app.workspace.rootSplit||B.WorkspaceContainer&&T instanceof B.WorkspaceContainer){for(let k of U.popoversForWindow(T.win))if(h.call(this,E,k.rootSplit))return!0}return!1}},getDropLocation(h){return function(d){for(let E of U.activePopovers()){let T=this.recursiveGetTarget(d,E.rootSplit);if(T)return B.requireApiVersion&&(0,B.requireApiVersion)("0.15.3")?T:{target:T,sidedock:!1}}return h.call(this,d)}},onDragLeaf(h){return function(v,d){let E=U.forLeaf(d);return E==null||E.togglePin(!0),h.call(this,v,d)}}});this.register(u)}patchSlidingPanes(){var u;let s=(u=this.app.plugins.plugins["sliding-panes-obsidian"])==null?void 0:u.constructor;if(s){let h=ie(s.prototype,{handleFileOpen(v){return function(...d){if(!pt(this.app.workspace.activeLeaf))return v.call(this,...d)}},handleLayoutChange(v){return function(...d){if(!pt(this.app.workspace.activeLeaf))return v.call(this,...d)}},focusActiveLeaf(v){return function(...d){if(!pt(this.app.workspace.activeLeaf))return v.call(this,...d)}}});this.register(h)}}patchLinkHover(){let s=this,u=this.app.internalPlugins.plugins["page-preview"];if(!u.enabled)return;let h=ie(u.instance.constructor.prototype,{onHoverLink(v){return function(d,...E){return d&&pe(d.event,MouseEvent)&&dt(d.event),v.call(this,d,...E)}},onLinkHover(v){return function(d,E,T,k,S,...H){Br(s,d,E,T,k,S,...H)}}});this.register(h),u.disable(),u.enable(),s.register(function(){!u.enabled||(u.disable(),u.enable())})}registerContextMenuHandler(){this.registerEvent(this.app.workspace.on("file-menu",(s,u,h,v)=>{let d=v?U.forLeaf(v):void 0;u instanceof B.TFile&&!d&&!v&&s.addItem(E=>{var T,k;(k=(T=E.setIcon("popup-open").setTitle("Open in Hover Editor").onClick(()=>{this.spawnPopover().openFile(u)})).setSection)==null||k.call(T,"open")})}))}registerActivePopoverHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",s=>{var h,v,d,E,T;(h=U.activePopover)==null||h.hoverEl.removeClass("is-active");let u=U.activePopover=s?U.forLeaf(s):void 0;if(u&&s){u.hoverEl.addClass("is-active");let k=u.hoverEl.querySelector(".popover-title");if(!k)return;k.textContent=(v=s.view)==null?void 0:v.getDisplayText(),((d=s==null?void 0:s.view)==null?void 0:d.getViewType())&&u.hoverEl.setAttribute("data-active-view-type",s.view.getViewType()),((T=(E=s.view)==null?void 0:E.file)==null?void 0:T.path)?k.setAttribute("data-path",s.view.file.path):k.removeAttribute("data-path")}}))}registerFileRenameHandler(){this.app.vault.on("rename",(s,u)=>{U.iteratePopoverLeaves(this.app.workspace,h=>{var v,d;if(s===((v=h==null?void 0:h.view)==null?void 0:v.file)&&s instanceof B.TFile){let E=U.forLeaf(h);if(E==null?void 0:E.hoverEl){let T=E.hoverEl.querySelector(".popover-title");if(!T)return;let k=T.getAttribute("data-path");u===k&&(T.textContent=(d=h.view)==null?void 0:d.getDisplayText(),T.setAttribute("data-path",s.path))}}})})}patchUnresolvedGraphNodeHover(){var d,E;let s=new B.WorkspaceLeaf(this.app),u=this.app.internalPlugins.plugins.graph.views.localgraph(s),h=u.engine.constructor;s.detach(),(E=(d=u.renderer)==null?void 0:d.worker)==null||E.terminate();let v=ie(h.prototype,{onNodeHover(T){return function(k,S,H,...M){if(H==="unresolved"){if(this.onNodeUnhover(),pe(k,MouseEvent)){if(this.hoverPopover&&this.hoverPopover.state!==B.PopoverState.Hidden&&this.lastHoverLink===S)return this.hoverPopover.onTarget=!0,void this.hoverPopover.transition();this.lastHoverLink=S,this.app.workspace.trigger("hover-link",{event:k,source:"graph",hoverParent:this,targetEl:null,linktext:S})}}else return T.call(this,k,S,H,...M)}}});this.register(v),s.detach()}onunload(){U.activePopovers().forEach(s=>s.hide())}async loadSettings(){this.settings=Object.assign({},nn,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}registerCommands(){this.addCommand({id:"bounce-popovers",name:"Toggle bouncing popovers",callback:()=>{this.activePopovers.forEach(s=>{s.toggleBounce()})}}),this.addCommand({id:"open-new-popover",name:"Open new Hover Editor",callback:()=>{let s=this.spawnPopover(void 0,()=>this.app.workspace.setActiveLeaf(s,!1,!0))}}),this.addCommand({id:"open-link-in-new-popover",name:"Open link under cursor in new Hover Editor",checkCallback:s=>{let u=this.app.workspace.getActiveViewOfType(B.MarkdownView);if(u){if(!s){let h=u.editor.getClickableTokenAt(u.editor.getCursor());if((h==null?void 0:h.type)==="internal-link"){let v=this.spawnPopover(void 0,()=>this.app.workspace.setActiveLeaf(v,!1,!0));v.openLinkText(h.text,u.file.path)}}return!0}return!1}}),this.addCommand({id:"open-current-file-in-new-popover",name:"Open current file in new Hover Editor",checkCallback:s=>{let u=this.app.workspace.getActiveViewOfType(B.MarkdownView);if(u){if(!s){let h=this.spawnPopover(void 0,()=>this.app.workspace.setActiveLeaf(h,!1,!0));h.openFile(u.file)}return!0}return!1}}),this.addCommand({id:"convert-active-pane-to-popover",name:"Convert active pane to Hover Editor",checkCallback:s=>{let{activeLeaf:u}=this.app.workspace;return u?(s||this.convertLeafToPopover(u),!0):!1}}),this.addCommand({id:"dock-active-popover-to-workspace",name:"Dock active Hover Editor to workspace",checkCallback:s=>{let{activeLeaf:u}=this.app.workspace;return u&&U.forLeaf(u)?(s||this.dockPopoverToWorkspace(u),!0):!1}}),this.addCommand({id:"restore-active-popover",name:"Restore active Hover Editor",checkCallback:s=>Dr(s)}),this.addCommand({id:"minimize-active-popover",name:"Minimize active Hover Editor",checkCallback:s=>jr(s)}),Ir.forEach(s=>{this.addCommand({id:`snap-active-popover-to-${s}`,name:`Snap active Hover Editor to ${s}`,checkCallback:u=>Ar(s,u)})})}convertLeafToPopover(s){if(!s)return;let u=this.spawnPopover(void 0,()=>{let{parentSplit:h}=u,{parentSplit:v}=s;v.removeChild(s),h.replaceChild(0,s,!0),this.app.workspace.setActiveLeaf(s,!1,!0)});return u}dockPopoverToWorkspace(s){if(!s)return;s.parentSplit.removeChild(s);let{rootSplit:u}=this.app.workspace;return(0,B.requireApiVersion)("0.16.3")&&u.children[0]instanceof B.WorkspaceTabs?u.children[0].insertChild(-1,s):u.insertChild(-1,s),app.workspace.activeLeaf=null,app.workspace.setActiveLeaf(s,!1,!0),s}spawnPopover(s,u){let h=this.app.workspace.activeLeaf;s||(s=h.containerEl);let v=new U(h,s,this,void 0,u);return v.togglePin(!0),v.attachLeaf()}registerSettingsTab(){this.settingsTab=new Gn(this.app,this),this.addSettingTab(this.settingsTab)}};function qn(g){let s=[];for(let u=0;u