@riadvargas/svelte-algolia-instantsearch
Version:
Svelte wrapper for Algolia InstantSearch
2 lines (1 loc) • 3.73 kB
JavaScript
import{m as C,v as H,w as B,x as W,y as I,z as F,H as P,h as w,A as O,B as R,C as L,D as g,E as T,F as h,G as S,I as A,b as Y,J as q,K as z,L as G,M as $,N as J,O as K,P as Q,p as U,Q as j,a as x,e as X}from"./runtime.CYZ5OpmX.js";import{b as Z}from"./disclose-version.C8ntqSKg.js";const M=new Set,k=new Set;function ee(e,t,a,n){function o(r){if(n.capture||v.call(t,r),!r.cancelBubble)return a.call(this,r)}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?H(()=>{t.addEventListener(e,o,n)}):t.addEventListener(e,o,n),o}function de(e,t,a,n,o){var r={capture:n,passive:o},d=ee(e,t,a,r);(t===document.body||t===window||t===document)&&C(()=>{t.removeEventListener(e,d,r)})}function ce(e){for(var t=0;t<e.length;t++)M.add(e[t]);for(var a of k)a(e)}function v(e){var N;var t=this,a=t.ownerDocument,n=e.type,o=((N=e.composedPath)==null?void 0:N.call(e))||[],r=o[0]||e.target,d=0,_=e.__root;if(_){var l=o.indexOf(_);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var f=o.indexOf(t);if(f===-1)return;l<=f&&(d=l)}if(r=o[d]||e.target,r!==t){B(e,"currentTarget",{configurable:!0,get(){return r||a}});try{for(var p,i=[];r!==null;){var c=r.parentNode||r.host||null;try{var s=r["__"+n];if(s!==void 0&&!r.disabled)if(W(s)){var[E,...m]=s;E.apply(r,[e,...m])}else s.call(r,e)}catch(b){p?i.push(b):p=b}if(e.cancelBubble||c===t||c===null)break;r=c}if(p){for(let b of i)queueMicrotask(()=>{throw b});throw p}}finally{e.__root=t,r=t}}}let u;function te(){u=void 0}function le(e){let t=null,a=w;var n;if(w){for(t=h,u===void 0&&(u=O(document.head));u!==null&&(u.nodeType!==8||u.data!==R);)u=L(u);u===null?g(!1):u=T(L(u))}w||(n=document.head.appendChild(I()));try{F(()=>e(n),P)}finally{a&&(g(!0),u=h,T(t))}}function fe(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const re=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function he(e){return re.includes(e)}const ae={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"};function _e(e){return e=e.toLowerCase(),ae[e]??e}const ne=["wheel","touchstart","touchmove","touchend","touchcancel"];function oe(e){return ne.includes(e)}function pe(e,t){t!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=t,e.nodeValue=t==null?"":t+"")}function ie(e,t){const a=t.anchor??t.target.appendChild(I());return V(e,{...t,anchor:a})}function ye(e,t){S(),t.intro=t.intro??!1;const a=t.target,n=w,o=h;try{for(var r=O(a);r&&(r.nodeType!==8||r.data!==R);)r=L(r);if(!r)throw A;g(!0),T(r),Y();const d=V(e,{...t,anchor:r});if(h===null||h.nodeType!==8||h.data!==q)throw z(),A;return g(!1),d}catch(d){if(d===A)return t.recover===!1&&G(),S(),$(a),g(!1),ie(e,t);throw d}finally{g(n),T(o),te()}}const y=new Map;function V(e,{target:t,anchor:a,props:n={},events:o,context:r,intro:d=!0}){S();var _=new Set,l=i=>{for(var c=0;c<i.length;c++){var s=i[c];if(!_.has(s)){_.add(s);var E=oe(s);t.addEventListener(s,v,{passive:E});var m=y.get(s);m===void 0?(document.addEventListener(s,v,{passive:E}),y.set(s,1)):y.set(s,m+1)}}};l(J(M)),k.add(l);var f=void 0,p=K(()=>(Q(()=>{if(r){U({});var i=X;i.c=r}o&&(n.$$events=o),w&&Z(a,null),f=e(a,n)||{},w&&(j.nodes_end=h),r&&x()}),()=>{for(var i of _){t.removeEventListener(i,v);var c=y.get(i);--c===0?(document.removeEventListener(i,v),y.delete(i)):y.set(i,c)}k.delete(l),D.delete(f)}));return D.set(f,p),f}let D=new WeakMap;function ge(e){const t=D.get(e);t==null||t()}export{he as a,le as b,ee as c,ce as d,de as e,ye as h,fe as i,ie as m,_e as n,pe as s,ge as u};