help-layer 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +45 -13
- package/README.md +47 -13
- package/dist/help-layer.esm.js +8 -8
- package/dist/help-layer.esm.js.map +4 -4
- package/dist/help-layer.iife.js +9 -9
- package/dist/help-layer.iife.js.map +4 -4
- package/dist/types/floating.d.ts +1 -78
- package/dist/types/floating.floatingui.d.ts +25 -0
- package/dist/types/floating.self.d.ts +26 -0
- package/dist/types/geometry.d.ts +85 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/markers.d.ts +38 -3
- package/dist/types/overlap.d.ts +2 -2
- package/dist/types/popup.d.ts +2 -2
- package/dist/types/reference.d.ts +41 -0
- package/dist/types/toggle.d.ts +4 -4
- package/dist/types/types.d.ts +7 -0
- package/package.json +6 -10
- package/src/blocking-layer.js +1 -1
- package/src/dom-builder.js +11 -2
- package/src/floating.floatingui.js +71 -0
- package/src/floating.js +8 -210
- package/src/floating.self.js +109 -0
- package/src/geometry.js +168 -4
- package/src/index.js +2 -2
- package/src/markers.js +165 -52
- package/src/overlap.js +2 -2
- package/src/popup.js +40 -7
- package/src/reference.js +74 -0
- package/src/style.js +6 -6
- package/src/toggle.js +2 -2
- package/src/types.js +17 -0
package/dist/help-layer.iife.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var HelpLayer=(()=>{var wt=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var We=(t,e)=>{for(var n in e)wt(t,n,{get:e[n],enumerable:!0})},Ie=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Be(e))!He.call(t,i)&&i!==n&&wt(t,i,{get:()=>e[i],enumerable:!(o=Fe(e,i))||o.enumerable});return t};var Ve=t=>Ie(wt({},"__esModule",{value:!0}),t);var Rn={};We(Rn,{initHelpLayer:()=>On});function Nt(t,{toggleEl:e,isLibraryNode:n}){let o=new Set;function i(r){if(r.nodeType!==1)return;let l=r;n(l)||e&&(l===e||l.contains(e))||l.hasAttribute("inert")||(l.toggleAttribute("inert",!0),o.add(l))}for(let r of[...document.body.children])i(r);let s=new MutationObserver(r=>{for(let l of r)l.addedNodes.forEach(i)});s.observe(document.body,{childList:!0}),t.track(()=>{s.disconnect(),o.forEach(r=>r.removeAttribute("inert")),o.clear()})}var ze=0;function _t(){let t=document.createElement("div");return t.className="help-layer-blocking-layer",t}function Ft(t,e="?"){let n=document.createElement("button");return n.type="button",n.className="help-layer-marker",n.textContent=e,n.setAttribute("aria-label",`Help: ${t}`),n}function Bt(){let t=`help-layer-popup-title-${ze++}`,e=document.createElement("div");e.className="help-layer-popup",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby",t),e.tabIndex=-1;let n=document.createElement("div");n.className="help-layer-popup__title",n.id=t;let o=document.createElement("div");o.className="help-layer-popup__text";let i=document.createElement("button");return i.type="button",i.className="help-layer-popup__close",i.textContent="\xD7",i.setAttribute("aria-label","Close"),e.append(n,o,i),{root:e,titleEl:n,textEl:o,closeEl:i}}var U=Math.min,_=Math.max,et=Math.round,nt=Math.floor,S=t=>({x:t,y:t}),je={left:"right",right:"left",bottom:"top",top:"bottom"};function vt(t,e,n){return _(t,U(e,n))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function it(t){return t.split("-")[1]}function bt(t){return t==="x"?"y":"x"}function At(t){return t==="y"?"height":"width"}function F(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function Et(t){return bt(F(t))}function It(t,e,n){n===void 0&&(n=!1);let o=it(t),i=Et(t),s=At(i),r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=tt(r)),[r,tt(r)]}function Vt(t){let e=tt(t);return[ut(t),e,ut(e)]}function ut(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var Ht=["left","right"],Wt=["right","left"],Ke=["top","bottom"],Xe=["bottom","top"];function Ye(t,e,n){switch(t){case"top":case"bottom":return n?e?Wt:Ht:e?Ht:Wt;case"left":case"right":return e?Ke:Xe;default:return[]}}function zt(t,e,n,o){let i=it(t),s=Ye(I(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(ut)))),s}function tt(t){let e=I(t);return je[e]+t.slice(e.length)}function qe(t){return{top:0,right:0,bottom:0,left:0,...t}}function jt(t){return typeof t!="number"?qe(t):{top:t,right:t,bottom:t,left:t}}function z(t){let{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Kt(t,e,n){let{reference:o,floating:i}=t,s=F(e),r=Et(e),l=At(r),c=I(e),f=s==="y",m=o.x+o.width/2-i.width/2,a=o.y+o.height/2-i.height/2,y=o[l]/2-i[l]/2,h;switch(c){case"top":h={x:m,y:o.y-i.height};break;case"bottom":h={x:m,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:a};break;case"left":h={x:o.x-i.width,y:a};break;default:h={x:o.x,y:o.y}}switch(it(e)){case"start":h[r]-=y*(n&&f?-1:1);break;case"end":h[r]+=y*(n&&f?-1:1);break}return h}async function Xt(t,e){var n;e===void 0&&(e={});let{x:o,y:i,platform:s,rects:r,elements:l,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:a="floating",altBoundary:y=!1,padding:h=0}=ot(e,t),u=jt(h),g=l[y?a==="floating"?"reference":"floating":a],d=z(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:m,strategy:c})),x=a==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),b=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},E=z(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(d.top-E.top+u.top)/b.y,bottom:(E.bottom-d.bottom+u.bottom)/b.y,left:(d.left-E.left+u.left)/b.x,right:(E.right-d.right+u.right)/b.x}}var Ue=50,Yt=async(t,e,n)=>{let{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,l=r.detectOverflow?r:{...r,detectOverflow:Xt},c=await(r.isRTL==null?void 0:r.isRTL(e)),f=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:m,y:a}=Kt(f,o,c),y=o,h=0,u={};for(let p=0;p<s.length;p++){let g=s[p];if(!g)continue;let{name:d,fn:x}=g,{x:w,y:b,data:E,reset:A}=await x({x:m,y:a,initialPlacement:o,placement:y,strategy:i,middlewareData:u,rects:f,platform:l,elements:{reference:t,floating:e}});m=w??m,a=b??a,u[d]={...u[d],...E},A&&h<Ue&&(h++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(f=A.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:m,y:a}=Kt(f,y,c)),p=-1)}return{x:m,y:a,placement:y,strategy:i,middlewareData:u}};var qt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;let{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:c,elements:f}=e,{mainAxis:m=!0,crossAxis:a=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:u="none",flipAlignment:p=!0,...g}=ot(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let d=I(i),x=F(l),w=I(l)===l,b=await(c.isRTL==null?void 0:c.isRTL(f.floating)),E=y||(w||!p?[tt(l)]:Vt(l)),A=u!=="none";!y&&A&&E.push(...zt(l,p,u,b));let D=[l,...E],Q=await c.detectOverflow(e,g),q=[],H=((o=s.flip)==null?void 0:o.overflows)||[];if(m&&q.push(Q[d]),a){let N=It(i,r,b);q.push(Q[N[0]],Q[N[1]])}if(H=[...H,{placement:i,overflows:q}],!q.every(N=>N<=0)){var M,L;let N=(((M=s.flip)==null?void 0:M.index)||0)+1,ft=D[N];if(ft&&(!(a==="alignment"?x!==F(ft):!1)||H.every(v=>F(v.placement)===x?v.overflows[0]>0:!0)))return{data:{index:N,overflows:H},reset:{placement:ft}};let V=(L=H.filter(W=>W.overflows[0]<=0).sort((W,v)=>W.overflows[1]-v.overflows[1])[0])==null?void 0:L.placement;if(!V)switch(h){case"bestFit":{var at;let W=(at=H.filter(v=>{if(A){let k=F(v.placement);return k===x||k==="y"}return!0}).map(v=>[v.placement,v.overflows.filter(k=>k>0).reduce((k,_e)=>k+_e,0)]).sort((v,k)=>v[1]-k[1])[0])==null?void 0:at[0];W&&(V=W);break}case"initialPlacement":V=l;break}if(i!==V)return{reset:{placement:V}}}return{}}}};var Ze=new Set(["left","top"]);async function Ge(t,e){let{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=I(n),l=it(n),c=F(n)==="y",f=Ze.has(r)?-1:1,m=s&&c?-1:1,a=ot(e,t),{mainAxis:y,crossAxis:h,alignmentAxis:u}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return l&&typeof u=="number"&&(h=l==="end"?u*-1:u),c?{x:h*m,y:y*f}:{x:y*f,y:h*m}}var Ut=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;let{x:i,y:s,placement:r,middlewareData:l}=e,c=await Ge(e,t);return r===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:r}}}}},Zt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:o,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:d=>{let{x,y:w}=d;return{x,y:w}}},...f}=ot(t,e),m={x:n,y:o},a=await s.detectOverflow(e,f),y=F(I(i)),h=bt(y),u=m[h],p=m[y];if(r){let d=h==="y"?"top":"left",x=h==="y"?"bottom":"right",w=u+a[d],b=u-a[x];u=vt(w,u,b)}if(l){let d=y==="y"?"top":"left",x=y==="y"?"bottom":"right",w=p+a[d],b=p-a[x];p=vt(w,p,b)}let g=c.fn({...e,[h]:u,[y]:p});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[h]:r,[y]:l}}}}}};function pt(){return typeof window<"u"}function K(t){return Jt(t)?(t.nodeName||"").toLowerCase():"#document"}function O(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function P(t){var e;return(e=(Jt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Jt(t){return pt()?t instanceof Node||t instanceof O(t).Node:!1}function R(t){return pt()?t instanceof Element||t instanceof O(t).Element:!1}function $(t){return pt()?t instanceof HTMLElement||t instanceof O(t).HTMLElement:!1}function Gt(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof O(t).ShadowRoot}function G(t){let{overflow:e,overflowX:n,overflowY:o,display:i}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function Qt(t){return/^(table|td|th)$/.test(K(t))}function rt(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var Je=/transform|translate|scale|rotate|perspective|filter/,Qe=/paint|layout|strict|content/,j=t=>!!t&&t!=="none",kt;function dt(t){let e=R(t)?C(t):t;return j(e.transform)||j(e.translate)||j(e.scale)||j(e.rotate)||j(e.perspective)||!mt()&&(j(e.backdropFilter)||j(e.filter))||Je.test(e.willChange||"")||Qe.test(e.contain||"")}function te(t){let e=B(t);for(;$(e)&&!X(e);){if(dt(e))return e;if(rt(e))return null;e=B(e)}return null}function mt(){return kt==null&&(kt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),kt}function X(t){return/^(html|body|#document)$/.test(K(t))}function C(t){return O(t).getComputedStyle(t)}function st(t){return R(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(K(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Gt(t)&&t.host||P(t);return Gt(e)?e.host:e}function ee(t){let e=B(t);return X(e)?t.ownerDocument?t.ownerDocument.body:t.body:$(e)&&G(e)?e:ee(e)}function Z(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=ee(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=O(i);if(s){let l=ht(r);return e.concat(r,r.visualViewport||[],G(i)?i:[],l&&n?Z(l):[])}else return e.concat(i,Z(i,[],n))}function ht(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function re(t){let e=C(t),n=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=$(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,l=et(n)!==s||et(o)!==r;return l&&(n=s,o=r),{width:n,height:o,$:l}}function Rt(t){return R(t)?t:t.contextElement}function J(t){let e=Rt(t);if(!$(e))return S(1);let n=e.getBoundingClientRect(),{width:o,height:i,$:s}=re(e),r=(s?et(n.width):n.width)/o,l=(s?et(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}var tn=S(0);function se(t){let e=O(t);return!mt()||!e.visualViewport?tn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function en(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==O(t)?!1:e}function Y(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),s=Rt(t),r=S(1);e&&(o?R(o)&&(r=J(o)):r=J(t));let l=en(s,n,o)?se(s):S(0),c=(i.left+l.x)/r.x,f=(i.top+l.y)/r.y,m=i.width/r.x,a=i.height/r.y;if(s){let y=O(s),h=o&&R(o)?O(o):o,u=y,p=ht(u);for(;p&&o&&h!==u;){let g=J(p),d=p.getBoundingClientRect(),x=C(p),w=d.left+(p.clientLeft+parseFloat(x.paddingLeft))*g.x,b=d.top+(p.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,f*=g.y,m*=g.x,a*=g.y,c+=w,f+=b,u=O(p),p=ht(u)}}return z({width:m,height:a,x:c,y:f})}function gt(t,e){let n=st(t).scrollLeft;return e?e.left+n:Y(P(t)).left+n}function le(t,e){let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-gt(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function nn(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t,s=i==="fixed",r=P(o),l=e?rt(e.floating):!1;if(o===r||l&&s)return n;let c={scrollLeft:0,scrollTop:0},f=S(1),m=S(0),a=$(o);if((a||!a&&!s)&&((K(o)!=="body"||G(r))&&(c=st(o)),a)){let h=Y(o);f=J(o),m.x=h.x+o.clientLeft,m.y=h.y+o.clientTop}let y=r&&!a&&!s?le(r,c):S(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+m.x+y.x,y:n.y*f.y-c.scrollTop*f.y+m.y+y.y}}function on(t){return Array.from(t.getClientRects())}function rn(t){let e=P(t),n=st(t),o=t.ownerDocument.body,i=_(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=_(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),r=-n.scrollLeft+gt(t),l=-n.scrollTop;return C(o).direction==="rtl"&&(r+=_(e.clientWidth,o.clientWidth)-i),{width:i,height:s,x:r,y:l}}var ne=25;function sn(t,e){let n=O(t),o=P(t),i=n.visualViewport,s=o.clientWidth,r=o.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;let m=mt();(!m||m&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}let f=gt(o);if(f<=0){let m=o.ownerDocument,a=m.body,y=getComputedStyle(a),h=m.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,u=Math.abs(o.clientWidth-a.clientWidth-h);u<=ne&&(s-=u)}else f<=ne&&(s+=f);return{width:s,height:r,x:l,y:c}}function ln(t,e){let n=Y(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=$(t)?J(t):S(1),r=t.clientWidth*s.x,l=t.clientHeight*s.y,c=i*s.x,f=o*s.y;return{width:r,height:l,x:c,y:f}}function oe(t,e,n){let o;if(e==="viewport")o=sn(t,n);else if(e==="document")o=rn(P(t));else if(R(e))o=ln(e,n);else{let i=se(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return z(o)}function ce(t,e){let n=B(t);return n===e||!R(n)||X(n)?!1:C(n).position==="fixed"||ce(n,e)}function cn(t,e){let n=e.get(t);if(n)return n;let o=Z(t,[],!1).filter(l=>R(l)&&K(l)!=="body"),i=null,s=C(t).position==="fixed",r=s?B(t):t;for(;R(r)&&!X(r);){let l=C(r),c=dt(r);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||G(r)&&!c&&ce(t,r))?o=o.filter(m=>m!==r):i=l,r=B(r)}return e.set(t,o),o}function an(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t,r=[...n==="clippingAncestors"?rt(e)?[]:cn(e,this._c):[].concat(n),o],l=oe(e,r[0],i),c=l.top,f=l.right,m=l.bottom,a=l.left;for(let y=1;y<r.length;y++){let h=oe(e,r[y],i);c=_(h.top,c),f=U(h.right,f),m=U(h.bottom,m),a=_(h.left,a)}return{width:f-a,height:m-c,x:a,y:c}}function fn(t){let{width:e,height:n}=re(t);return{width:e,height:n}}function un(t,e,n){let o=$(e),i=P(e),s=n==="fixed",r=Y(t,!0,s,e),l={scrollLeft:0,scrollTop:0},c=S(0);function f(){c.x=gt(i)}if(o||!o&&!s)if((K(e)!=="body"||G(i))&&(l=st(e)),o){let h=Y(e,!0,s,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else i&&f();s&&!o&&i&&f();let m=i&&!o&&!s?le(i,l):S(0),a=r.left+l.scrollLeft-c.x-m.x,y=r.top+l.scrollTop-c.y-m.y;return{x:a,y,width:r.width,height:r.height}}function Ot(t){return C(t).position==="static"}function ie(t,e){if(!$(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return P(t)===n&&(n=n.ownerDocument.body),n}function ae(t,e){let n=O(t);if(rt(t))return n;if(!$(t)){let i=B(t);for(;i&&!X(i);){if(R(i)&&!Ot(i))return i;i=B(i)}return n}let o=ie(t,e);for(;o&&Qt(o)&&Ot(o);)o=ie(o,e);return o&&X(o)&&Ot(o)&&!dt(o)?n:o||te(t)||n}var pn=async function(t){let e=this.getOffsetParent||ae,n=this.getDimensions,o=await n(t.floating);return{reference:un(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function dn(t){return C(t).direction==="rtl"}var mn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:P,getClippingRect:an,getOffsetParent:ae,getElementRects:pn,getClientRects:on,getDimensions:fn,getScale:J,isElement:R,isRTL:dn};function fe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function hn(t,e){let n=null,o,i=P(t);function s(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function r(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();let f=t.getBoundingClientRect(),{left:m,top:a,width:y,height:h}=f;if(l||e(),!y||!h)return;let u=nt(a),p=nt(i.clientWidth-(m+y)),g=nt(i.clientHeight-(a+h)),d=nt(m),w={rootMargin:-u+"px "+-p+"px "+-g+"px "+-d+"px",threshold:_(0,U(1,c))||1},b=!0;function E(A){let D=A[0].intersectionRatio;if(D!==c){if(!b)return r();D?r(!1,D):o=setTimeout(()=>{r(!1,1e-7)},1e3)}D===1&&!fe(f,t.getBoundingClientRect())&&r(),b=!1}try{n=new IntersectionObserver(E,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(t)}return r(!0),s}function yt(t,e,n,o){o===void 0&&(o={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,f=Rt(t),m=i||s?[...f?Z(f):[],...e?Z(e):[]]:[];m.forEach(d=>{i&&d.addEventListener("scroll",n,{passive:!0}),s&&d.addEventListener("resize",n)});let a=f&&l?hn(f,n):null,y=-1,h=null;r&&(h=new ResizeObserver(d=>{let[x]=d;x&&x.target===f&&h&&e&&(h.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),n()}),f&&!c&&h.observe(f),e&&h.observe(e));let u,p=c?Y(t):null;c&&g();function g(){let d=Y(t);p&&!fe(p,d)&&n(),p=d,u=requestAnimationFrame(g)}return n(),()=>{var d;m.forEach(x=>{i&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),a?.(),(d=h)==null||d.disconnect(),h=null,c&&cancelAnimationFrame(u)}}var Ct=Ut;var ue=Zt,pe=qt;var Lt=(t,e,n)=>{let o=new Map,i={platform:mn,...n},s={...i.platform,_c:o};return Yt(t,e,{...i,platform:s})};function de(t,e){let n=t.width||0,o=t.height||0,i=t.left-e.x,s=t.top-e.y;return{x:i,y:s,left:i,top:s,right:i+n,bottom:s+o,width:n,height:o}}function me(t){return{contextElement:document.body,getBoundingClientRect(){return de(t(),{x:window.scrollX,y:window.scrollY})}}}function he(t,e,n){t.style.left=`${e}px`,t.style.top=`${n}px`}function ge(t){if(!(t instanceof Element))return!1;let e=t;for(;e;){if(getComputedStyle(e).position==="fixed")return!0;let n=e.parentElement;if(n)e=n;else{let o=e.getRootNode();e=o instanceof ShadowRoot?o.host:null}}return!1}function gn(t){if(!(t instanceof Element))return!1;if(typeof t.checkVisibility=="function")return!t.checkVisibility({visibilityProperty:!0,contentVisibilityAuto:!0});let e=t.getBoundingClientRect();return e.width===0&&e.height===0}var St=11;function yn(t){let e=t.endsWith("-start");return{mainAxis:-St,crossAxis:e?St:-St}}function ye(t,e,n,o="top-end",i){let s=ge(t)?"fixed":"absolute";s==="fixed"&&e.style.setProperty("position","fixed","important");let r=!1;return yt(t,e,()=>{if(gn(t)){e.style.setProperty("display","none","important"),!r&&i&&i(),r=!0,n&&n();return}r=!1,e.style.removeProperty("display"),Lt(t,e,{placement:o,strategy:s,middleware:[Ct(yn(o))]}).then(({x:c,y:f})=>{he(e,c,f),n&&n()}).catch(()=>{})},{animationFrame:!0})}function xe(t,e,n="bottom-start"){let o=ge(t)?"fixed":"absolute";e.style.setProperty("position",o,"important");let i=()=>{Lt(t,e,{placement:n,strategy:o,middleware:[Ct(8),pe({padding:8}),ue({padding:8})]}).then(({x:r,y:l})=>{he(e,r,l)}).catch(()=>{})},s=yt(t,e,i,{animationFrame:!0});return{update:i,cleanup:s}}function we(t,e,n){return yt(t,e,n)}function xn(t){let e=t.left,n=t.top,o=t.right,i=t.bottom;return`polygon(
|
|
1
|
+
var HelpLayer=(()=>{var H=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var Ce=Object.prototype.hasOwnProperty;var Ae=(e,t)=>{for(var o in t)H(e,o,{get:t[o],enumerable:!0})},Te=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Le(t))!Ce.call(e,n)&&n!==o&&H(e,n,{get:()=>t[n],enumerable:!(r=Ee(t,n))||r.enumerable});return e};var Pe=e=>Te(H({},"__esModule",{value:!0}),e);var He={};Ae(He,{initHelpLayer:()=>Re});function G(e,{toggleEl:t,isLibraryNode:o}){let r=new Set;function n(i){if(i.nodeType!==1)return;let a=i;o(a)||t&&(a===t||a.contains(t))||a.hasAttribute("inert")||(a.toggleAttribute("inert",!0),r.add(a))}for(let i of[...document.body.children])n(i);let l=new MutationObserver(i=>{for(let a of i)a.addedNodes.forEach(n)});l.observe(document.body,{childList:!0}),e.track(()=>{l.disconnect(),r.forEach(i=>i.removeAttribute("inert")),r.clear()})}var Se=0;function U(){let e=document.createElement("div");return e.className="help-layer-blocking-layer",e}function Y(e,t="?"){let o=document.createElement("button");return o.type="button",o.className="help-layer-marker",o.textContent=t,o.setAttribute("aria-label",`Help: ${e}`),o}function X(){let e=Se++,t=`help-layer-popup-title-${e}`,o=`help-layer-popup-text-${e}`,r=document.createElement("div");r.className="help-layer-popup",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-labelledby",t),r.setAttribute("aria-describedby",o),r.tabIndex=-1;let n=document.createElement("div");n.className="help-layer-popup__title",n.id=t;let l=document.createElement("div");l.className="help-layer-popup__text",l.id=o;let i=document.createElement("button");return i.type="button",i.className="help-layer-popup__close",i.textContent="\xD7",i.setAttribute("aria-label","Close"),r.append(n,l,i),{root:r,titleEl:n,textEl:l,closeEl:i}}function Q(e,t){let o=e.width||0,r=e.height||0,n=e.left-t.x,l=e.top-t.y;return{x:n,y:l,left:n,top:l,right:n+o,bottom:l+r,width:o,height:r}}var _=12;function ee(e,t,o="top-end"){let[r,n]=o.split("-"),i=n==="start"?_:-_,a,c;return r==="top"||r==="bottom"?(c=r==="top"?e.top-t+_:e.top+e.height-_,n==="start"?a=e.left:n==="end"?a=e.left+e.width-t:a=e.left+e.width/2-t/2,a+=i):(a=r==="left"?e.left-t+_:e.left+e.width-_,n==="start"?c=e.top:n==="end"?c=e.top+e.height-t:c=e.top+e.height/2-t/2,c+=i),{left:a,top:c}}function D(e,t,o,r,n){return{left:e-o.left-r,top:t-o.top-n}}var J=(e,t,o)=>Math.min(Math.max(e,t),Math.max(t,o));function te(e,t,o,r={}){let n=r.placement??"bottom-start",l=r.offset??8,i=r.padding??8,[a,c]=n.split("-"),m=a==="top"||a==="bottom",h=s=>s==="bottom"?e.top+e.height+l:s==="top"?e.top-t.height-l:s==="right"?e.left+e.width+l:e.left-t.width-l,u=s=>s==="bottom"?o.height-i-(e.top+e.height+l):s==="top"?e.top-l-i:s==="right"?o.width-i-(e.left+e.width+l):e.left-l-i,v={top:"bottom",bottom:"top",left:"right",right:"left"}[a],w=m?t.height:t.width,E=u(a)>=w||u(a)>=u(v)?a:v,b=(s,g,y)=>c==="start"?y:c==="end"?y+s-g:y+s/2-g/2,f,p;return m?(p=h(E),f=b(e.width,t.width,e.left),f=J(f,i,o.width-t.width-i)):(f=h(E),p=b(e.height,t.height,e.top),p=J(p,i,o.height-t.height-i)),{left:f,top:p,placement:c?`${E}-${c}`:E}}function j(e){return{contextElement:document.body,getBoundingClientRect(){return Q(e(),{x:window.scrollX,y:window.scrollY})}}}function I(e){if(!(e instanceof Element))return!1;let t=e;for(;t;){if(getComputedStyle(t).position==="fixed")return!0;let o=t.parentElement;if(o)t=o;else{let r=t.getRootNode();t=r instanceof ShadowRoot?r.host:null}}return!1}function q(e){if(!(e instanceof Element))return!1;if(typeof e.checkVisibility=="function")return!e.checkVisibility({visibilityProperty:!0,contentVisibilityAuto:!0});let t=e.getBoundingClientRect();return t.width===0&&t.height===0}function oe(e,t,o){e.style.left=`${t}px`,e.style.top=`${o}px`}function $e(e,t){return e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}function ne(e,t){t();let o=e.getBoundingClientRect(),r=!1,n=requestAnimationFrame(function i(){if(r)return;let a=e.getBoundingClientRect();$e(a,o)||t(),o=a,n=requestAnimationFrame(i)}),l=()=>t();return window.addEventListener("resize",l),()=>{r=!0,cancelAnimationFrame(n),window.removeEventListener("resize",l)}}function re(e,t,o="bottom-start"){let r=I(e)?"fixed":"absolute";t.style.setProperty("position",r,"important");let n=()=>{let i=e.getBoundingClientRect(),a={width:t.offsetWidth,height:t.offsetHeight},c={width:window.innerWidth,height:window.innerHeight},{left:m,top:h}=te(i,a,c,{placement:o});if(r==="fixed")oe(t,m,h);else{let u=document.body,v=D(m,h,u.getBoundingClientRect(),u.clientLeft,u.clientTop);oe(t,v.left,v.top)}},l=ne(e,n);return{update:n,cleanup:l}}function ie(e,t,o){return ne(e,o)}function _e(e){let t=e.left,o=e.top,r=e.right,n=e.bottom;return`polygon(
|
|
2
2
|
0px 0px, 100% 0px, 100% 100%, 0px 100%, 0px 0px,
|
|
3
|
-
${
|
|
4
|
-
)`}function
|
|
3
|
+
${t}px ${o}px, ${t}px ${n}px, ${r}px ${n}px, ${r}px ${o}px, ${t}px ${o}px
|
|
4
|
+
)`}function le(e,{toggleEl:t,onBackgroundClick:o,isLibraryElement:r,onEscape:n}){let l=U();if(document.body.appendChild(l),e.track(()=>l.remove()),t){let v=ie(t,l,()=>{l.style.clipPath=_e(t.getBoundingClientRect())});e.track(v)}o&&(l.addEventListener("click",o),e.track(()=>l.removeEventListener("click",o)));let i=document.activeElement;i instanceof HTMLElement&&i!==document.body&&i!==t&&i.blur();let a=u=>{r(u.target)||(u.stopPropagation(),t?t.focus({preventScroll:!0}):u.target instanceof HTMLElement&&u.target.blur())};document.addEventListener("focusin",a,!0),e.track(()=>document.removeEventListener("focusin",a,!0));let c=u=>{r(u.target)||(u.stopPropagation(),u.preventDefault())},m=u=>{if(u.key==="Escape"){u.stopPropagation(),u.preventDefault();return}c(u)},h=u=>{if(u.key==="Escape"){u.stopPropagation(),u.preventDefault(),n&&n();return}c(u)};return document.addEventListener("keydown",h,!0),document.addEventListener("keyup",m,!0),document.addEventListener("keypress",m,!0),e.track(()=>{document.removeEventListener("keydown",h,!0),document.removeEventListener("keyup",m,!0),document.removeEventListener("keypress",m,!0)}),l}function N(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function se(e){return N(e)&&Number.isFinite(e.top)&&Number.isFinite(e.left)}function K(e){if(!N(e))throw new Error("helpConfig must be a plain object");for(let[t,o]of Object.entries(e)){if(!N(o))throw new Error(`helpConfig["${t}"] must be an object`);if(typeof o.title!="string"||o.title==="")throw new Error(`helpConfig["${t}"].title must be a non-empty string`);if(typeof o.text!="string"||o.text==="")throw new Error(`helpConfig["${t}"].text must be a non-empty string`);if(o.position!==void 0&&!se(o.position))throw new Error(`helpConfig["${t}"].position must be { top: finite number, left: finite number }`)}}function ae(e){return Object.entries(e).map(([t,o])=>se(o.position)?{key:t,title:o.title,text:o.text,kind:"free",target:null,position:{top:o.position.top,left:o.position.left}}:{key:t,title:o.title,text:o.text,kind:"element",target:null,position:null})}function pe(e,t={}){let o=t.minDistance??26,r=t.iterations??6,n=e.map(l=>({x:l.x,y:l.y}));for(let l=0;l<r;l++){let i=!1;for(let a=0;a<n.length;a++)for(let c=a+1;c<n.length;c++){let m=n[a],h=n[c],u=h.x-m.x,v=h.y-m.y,w=Math.hypot(u,v);if(w>=o)continue;w===0&&(u=1,v=0,w=1);let E=(o-w)/2,b=u/w,f=v/w;m.x-=b*E,m.y-=f*E,h.x+=b*E,h.y+=f*E,i=!0}if(!i)break}return n.map((l,i)=>({dx:l.x-e[i].x,dy:l.y-e[i].y}))}var ce="help-layer-target-highlight",Oe=24;function Me(e){return e.kind==="free"?j(()=>({top:e.position.top,left:e.position.left,width:0,height:0})):e.target}function ue(e,{onMarkerClick:t,onOverlapResolved:o,onMarkerHidden:r,markerLabel:n="?",markerPlacement:l="top-end"}){let i=new Map,a=null,c=!1,m=0,h=-1;function u(){if(c||i.size===0)return;let p=document.body.getBoundingClientRect(),s=document.body.clientLeft,g=document.body.clientTop,y=[];for(let d of i.values()){if(q(d.reference)){d.hidden||(d.hidden=!0,d.lastBaseEl=null,d.el.style.setProperty("display","none","important"),r&&r(d.record));continue}d.hidden&&(d.hidden=!1,d.el.style.removeProperty("display")),d.refRect=d.reference.getBoundingClientRect(),y.push(d)}if(!m&&y.length){let d=y[0].el.offsetWidth;d>0&&(m=d)}let T=m||Oe,L=y.length!==h;h=y.length;let A=[],$=[];for(let d of y){let P=ee(d.refRect,T,d.placement);$.push({x:P.left+T/2,y:P.top+T/2});let k=d.strategy==="fixed"?{left:P.left,top:P.top}:D(P.left,P.top,p,s,g);A.push(k),(!d.lastBaseEl||d.lastBaseEl.left!==k.left||d.lastBaseEl.top!==k.top)&&(L=!0),d.lastBaseEl=k}if(L&&y.length){let d=pe($),P=!1;for(let k=0;k<y.length;k++){let C=y[k],O=A[k].left+d[k].dx,M=A[k].top+d[k].dy;(C.lastLeft!==O||C.lastTop!==M)&&(C.el.style.left=`${O}px`,C.el.style.top=`${M}px`,C.lastLeft=O,C.lastTop=M,P=!0)}P&&o&&o()}}function v(){a=null,!(c||i.size===0)&&(u(),a=requestAnimationFrame(v))}function w(){a!==null||c||i.size===0||(a=requestAnimationFrame(v))}function E(p){if(i.has(p.id))return;let s=Y(p.title,n);document.body.appendChild(s);let g=()=>t(p,s);s.addEventListener("click",g);let y=Me(p),T=I(y)?"fixed":"absolute";T==="fixed"&&s.style.setProperty("position","fixed","important");let L=p.kind==="element"?p.target:null,A=()=>L&&L.classList.add(ce),$=()=>L&&L.classList.remove(ce);L&&(s.addEventListener("mouseenter",A),s.addEventListener("mouseleave",$),s.addEventListener("focus",A),s.addEventListener("blur",$));let d=!1,P=()=>{d||(d=!0,s.removeEventListener("click",g),L&&(s.removeEventListener("mouseenter",A),s.removeEventListener("mouseleave",$),s.removeEventListener("focus",A),s.removeEventListener("blur",$),$()),s.remove(),i.delete(p.id),w())};i.set(p.id,{record:p,el:s,reference:y,strategy:T,placement:l,cleanup:P,hidden:!1,lastBaseEl:null,lastLeft:void 0,lastTop:void 0}),w()}function b(p){let s=i.get(p);s&&s.cleanup()}function f(p){p.forEach(E),u()}return e.track(()=>{c=!0,a!==null&&(cancelAnimationFrame(a),a=null),[...i.values()].forEach(p=>p.cleanup())}),{mount:E,unmount:b,mountAll:f,has(p){return i.has(p)},findByKey(p){for(let s of i.values())if(s.record.key===p)return s;return null}}}function S(e,t,...o){if(t)try{return t(...o)}catch(r){console.error(`[help-layer] ${e} threw:`,r);return}}var Be=1;function F(e,t,o,r){typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(n=>{o&&n.matches(t)&&o(n),n.shadowRoot&&(r&&r(n.shadowRoot),F(n.shadowRoot,t,o,r))})}function de(e,t){let o=[];return F(e,t,r=>o.push(r)),o}function Ne(e){let t=[];return F(e,"*",null,o=>t.push(o)),t}function fe(e,t){let o=[],r=[];if(e.nodeType!==Be)return{matches:o,shadowRoots:r};let n=e;return typeof n.matches=="function"&&n.matches(t)&&o.push(n),n.shadowRoot&&(r.push(n.shadowRoot),F(n.shadowRoot,t,l=>o.push(l),l=>r.push(l))),F(n,t,l=>o.push(l),l=>r.push(l)),{matches:o,shadowRoots:r}}function he({root:e=document,selector:t,onAdded:o,onRemoved:r}){let n=new Set,l=c=>{for(let m of c)m.addedNodes.forEach(h=>{let{matches:u,shadowRoots:v}=fe(h,t);u.forEach(w=>S("observer onAdded",o,w)),v.forEach(a)}),m.removedNodes.forEach(h=>{fe(h,t).matches.forEach(u=>S("observer onRemoved",r,u))})},i=new MutationObserver(l);function a(c){n.has(c)||(n.add(c),i.observe(c,{childList:!0,subtree:!0}))}return a(e),Ne(e).forEach(a),{disconnect(){i.disconnect(),n.clear()}}}var R="data-help-title",V="data-help-text";function z(e="data-help-id"){return`[${e}], [${R}]`}function Z(e){let t=new Map;for(let o of e)o.kind==="element"&&t.set(o.key,o);return t}function me(e){return e.filter(t=>t.kind==="free").map(t=>({id:t.key,kind:"free",key:t.key,title:t.title,text:t.text,position:t.position}))}function W(e,t,o="data-help-id"){let r=e.getAttribute(o),n=r!=null?t.get(r):void 0,l=n?n.title:e.getAttribute(R),i=n?n.text:e.getAttribute(V);return!l||!i?null:{id:e,kind:"element",key:r,title:l,text:i,target:e}}function ye(e,t=document,{silent:o=!1,attribute:r="data-help-id"}={}){let n=Z(e),l=[];return de(t,z(r)).forEach(i=>{let a=W(i,n,r);if(!a){if(!o){let c=i.getAttribute(r);console.warn(c!=null?`[help-layer] element with ${r}="${c}" has no matching helpConfig entry or inline ${R}/${V}`:`[help-layer] element needs both ${R} and ${V} (or a ${r} matching helpConfig)`)}return}l.push(a)}),l}function ge(e,{onClose:t,render:o,popupPlacement:r="bottom-start"}={}){let{root:n,titleEl:l,textEl:i,closeEl:a}=X();n.style.setProperty("display","none","important"),document.body.appendChild(n),a.addEventListener("click",()=>p());let c=null,m=null,h=null;function u(){h&&(h.cleanup(),h=null)}let v='a[href],button,input,select,textarea,[tabindex]:not([tabindex="-1"])';function w(s){if(s.key!=="Tab")return;let g=[...n.querySelectorAll(v)].filter(A=>A instanceof HTMLElement);if(s.preventDefault(),g.length===0){n.focus({preventScroll:!0});return}let y=g.length,T=g.indexOf(document.activeElement instanceof HTMLElement?document.activeElement:null);(T===-1?s.shiftKey?g[y-1]:g[0]:g[(T+(s.shiftKey?-1:1)+y)%y]).focus({preventScroll:!0})}function E(s,g){l.textContent=s.title;let y=S("render",o,s);i.textContent="",y?i.appendChild(y):i.textContent=s.text,n.style.setProperty("display","block","important"),c=s.id,m=g,u(),h=re(g,n,r),n.addEventListener("keydown",w,!0),n.focus({preventScroll:!0})}function b(){h&&h.update()}function f(){let s=c!==null;u(),n.removeEventListener("keydown",w,!0),c=null,m=null,n.style.setProperty("display","none","important"),s&&S("onClose",t)}function p(s){let g=s??m;f(),g&&g.isConnected&&typeof g.focus=="function"&&g.focus({preventScroll:!0})}return e.track(()=>{f(),n.remove()}),{root:n,isOpen(s){return c===s},getOpenId(){return c},open:E,close:p,reposition:b}}function be(){let e=[];return{track(t){e.push(t)},teardownAll(){for(;e.length>0;){let t=e.pop();try{t()}catch(o){console.error("[help-layer] teardown step threw:",o)}}}}}var Fe="data-help-layer-style",De=`
|
|
5
5
|
.help-layer-blocking-layer {
|
|
6
6
|
/* Structural properties !important so a host can't accidentally un-fix or restack the layer and
|
|
7
7
|
defeat the blocking guarantee. */
|
|
@@ -36,15 +36,15 @@ var HelpLayer=(()=>{var wt=Object.defineProperty;var Fe=Object.getOwnPropertyDes
|
|
|
36
36
|
pointer-events: auto !important;
|
|
37
37
|
top: 0;
|
|
38
38
|
left: 0;
|
|
39
|
-
width: var(--help-layer-marker-size,
|
|
40
|
-
height: var(--help-layer-marker-size,
|
|
39
|
+
width: var(--help-layer-marker-size, 24px) !important;
|
|
40
|
+
height: var(--help-layer-marker-size, 24px) !important;
|
|
41
41
|
border-radius: 50%;
|
|
42
42
|
background: var(--help-layer-marker-bg, #2563eb);
|
|
43
43
|
color: var(--help-layer-marker-color, #fff);
|
|
44
44
|
font-family: sans-serif;
|
|
45
45
|
font-size: 13px;
|
|
46
46
|
font-weight: bold;
|
|
47
|
-
line-height: var(--help-layer-marker-size,
|
|
47
|
+
line-height: var(--help-layer-marker-size, 24px);
|
|
48
48
|
text-align: center;
|
|
49
49
|
cursor: pointer;
|
|
50
50
|
user-select: none;
|
|
@@ -115,8 +115,8 @@ var HelpLayer=(()=>{var wt=Object.defineProperty;var Fe=Object.getOwnPropertyDes
|
|
|
115
115
|
pointer-events: auto !important;
|
|
116
116
|
top: 6px;
|
|
117
117
|
right: 6px;
|
|
118
|
-
width:
|
|
119
|
-
height:
|
|
118
|
+
width: 24px;
|
|
119
|
+
height: 24px;
|
|
120
120
|
padding: 0;
|
|
121
121
|
border: none;
|
|
122
122
|
border-radius: 4px;
|
|
@@ -156,5 +156,5 @@ var HelpLayer=(()=>{var wt=Object.defineProperty;var Fe=Object.getOwnPropertyDes
|
|
|
156
156
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
`;function
|
|
159
|
+
`;function xe(e){let t=document.createElement("style");return t.setAttribute(Fe,""),e&&t.setAttribute("nonce",e),t.textContent=De,document.head.appendChild(t),t}function ve(e){e.remove()}function Ie(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`help-layer: toggle element not found for selector "${e}"`);return t}if(e instanceof HTMLElement)return e;throw new Error("help-layer: toggle must be a CSS selector string or a DOM element")}function ke(e){if(!N(e))throw new Error("help-layer: initHelpLayer requires an options object");let{config:t,toggle:o,onEnable:r,onDisable:n,onOpen:l,onClose:i,silent:a=!1,attribute:c="data-help-id",render:m,markerLabel:h="?",markerPlacement:u="top-end",popupPlacement:v="bottom-start",nonce:w}=e,E=t;K(E);let b=o!=null?Ie(o):null,f=null,p=null,s=null;function g(){if(f)return;f=be(),b&&f.track(()=>{b.isConnected&&typeof b.focus=="function"&&b.focus({preventScroll:!0})});let k=xe(w);f.track(()=>ve(k));let C=ae(E),O=Z(C);p=ge(f,{onClose:i,render:m,popupPlacement:v}),s=ue(f,{markerLabel:h,markerPlacement:u,onMarkerClick:(x,B)=>{if(p.isOpen(x.id)){p.close();return}p.open(x,B),S("onOpen",l,x)},onOverlapResolved:()=>p.reposition(),onMarkerHidden:x=>{p.isOpen(x.id)&&p.close(b??void 0)}}),s.mountAll(me(C)),s.mountAll(ye(C,document,{silent:a,attribute:c}));let M=he({selector:z(c),onAdded:x=>{let B=W(x,O,c);B&&!s.has(B.id)&&s.mount(B)},onRemoved:x=>{p.isOpen(x)&&p.close(b??void 0),s.unmount(x)}});f.track(()=>M.disconnect());let we=le(f,{toggleEl:b,onBackgroundClick:()=>p.close(),isLibraryElement:x=>!!x&&((b?b.contains(x):!1)||p.root.contains(x)||typeof x.closest=="function"&&!!x.closest(".help-layer-marker")),onEscape:()=>{p.getOpenId()!==null?p.close():L()}});G(f,{toggleEl:b,isLibraryNode:x=>x===we||x===p.root||!!x.classList&&x.classList.contains("help-layer-marker")})}function y(){f&&(f.teardownAll(),f=null,p=null,s=null)}function T(){f||(g(),S("onEnable",r))}function L(){f&&(y(),S("onDisable",n))}function A(){f?L():T()}function $(k){if(f||T(),!s||!p)return;let C=s.findByKey(k);if(!C){a||console.warn(`[help-layer] open(): no help marker for key "${k}"`);return}p.open(C.record,C.el),S("onOpen",l,C.record)}function d(){p&&p.close()}function P(k){K(k),E=k,f&&(y(),g())}return b&&b.addEventListener("click",A),{enable:T,disable:L,toggle:A,isActive(){return f!==null},open:$,close:d,update:P,destroy(){L(),b&&b.removeEventListener("click",A)}}}function Re(e){return ke(e)}return Pe(He);})();
|
|
160
160
|
//# sourceMappingURL=help-layer.iife.js.map
|