@frak-labs/components 0.0.22 → 0.0.23-beta.263acd1e

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.
@@ -0,0 +1 @@
1
+ import{a as e,c as t,d as n,f as r,l as i,n as a,o,p as s,r as c,s as l,t as u,u as d}from"./loader.js";var f,p,m,h,g,_,v,y,b,x,S,C={},w=[],T=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,E=Array.isArray;function D(e,t){for(var n in t)e[n]=t[n];return e}function O(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function k(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?f.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return A(e,o,r,i,null)}function A(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++m,__i:-1,__u:0};return i==null&&p.vnode!=null&&p.vnode(a),a}function j(e){return e.children}function M(e,t){this.props=e,this.context=t}function N(e,t){if(t==null)return e.__?N(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?N(e):null}function ee(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ee(e)}}function te(e){(!e.__d&&(e.__d=!0)&&h.push(e)&&!P.__r++||g!=p.debounceRendering)&&((g=p.debounceRendering)||_)(P)}function P(){for(var e,t,n,r,i,a,o,s=1;h.length;)h.length>s&&h.sort(v),e=h.shift(),s=h.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,a=[],o=[],t.__P&&((n=D({},r)).__v=r.__v+1,p.vnode&&p.vnode(n),ce(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,a,i??N(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,ue(a,n,o),r.__e=r.__=null,n.__e!=i&&ee(n)));P.__r=0}function ne(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||w,y=t.length;for(c=re(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i==-1?C:v[p.__i]||C,p.__i=d,g=ce(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&pe(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?c=ie(p,c,e,_):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function re(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=A(null,o,null,null,null):E(o)?o=e.__k[a]=A(j,{children:o},null,null,null):o.constructor==null&&o.__b>0?o=e.__k[a]=A(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,(l=o.__i=ae(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=N(s)),me(s,s));return r}function ie(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=ie(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=N(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ae(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function oe(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||T.test(t)?n:n+`px`}function F(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||oe(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||oe(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(y,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=b,e.addEventListener(t,a?S:x,a)):e.removeEventListener(t,a?S:x,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function se(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=b++;else if(t.t<n.u)return;return n(p.event?p.event(t):t)}}}function ce(e,t,n,r,i,a,o,s,c,l){var u,d,f,m,h,g,_,v,y,b,x,S,C,w,T,k,A,N=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=p.__b)&&u(t);n:if(typeof N==`function`)try{if(v=t.props,y=`prototype`in N&&N.prototype.render,b=(u=N.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new N(v,x):(t.__c=d=new M(v,x),d.constructor=N,d.render=he),b&&b.sub(d),d.state||={},d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),y&&d.__s==null&&(d.__s=d.state),y&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=D({},d.__s)),D(d.__s,N.getDerivedStateFromProps(v,d.__s))),m=d.props,h=d.state,d.__v=t,f)y&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),y&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(y&&N.getDerivedStateFromProps==null&&v!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,x),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&!1===d.shouldComponentUpdate(v,d.__s,x)){for(t.__v!=n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[],d.__h.length&&o.push(d);break n}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,x),y&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,h,g)})}if(d.context=x,d.props=v,d.__P=e,d.__e=!1,C=p.__r,w=0,y){for(d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++w<25);d.state=d.__s,d.getChildContext!=null&&(r=D(D({},r),d.getChildContext())),y&&!f&&d.getSnapshotBeforeUpdate!=null&&(g=d.getSnapshotBeforeUpdate(m,h)),k=u,u!=null&&u.type===j&&u.key==null&&(k=de(u.props.children)),s=ne(e,E(k)?k:[k],t,n,r,i,a,o,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),_&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(A=a.length;A--;)O(a[A]);le(t)}else t.__e=n.__e,t.__k=n.__k,e.then||le(t);p.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=fe(n.__e,t,n,r,i,a,o,c,l);return(u=p.diffed)&&u(t),128&t.__u?void 0:s}function le(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(le)}function ue(e,t,n){for(var r=0;r<n.length;r++)pe(n[r],n[++r],n[++r]);p.__c&&p.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){p.__e(e,t.__v)}})}function de(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:E(e)?e.map(de):D({},e)}function fe(e,t,n,r,i,a,o,s,c){var l,u,d,m,h,g,_,v=n.props||C,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((h=a[l])&&`setAttribute`in h==!!b&&(b?h.localName==b:h.nodeType==3)){e=h,a[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(y);e=document.createElementNS(i,b,y.is&&y),s&&=(p.__m&&p.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=f.call(e.childNodes),!s&&a!=null)for(v={},l=0;l<e.attributes.length;l++)v[(h=e.attributes[l]).name]=h.value;for(l in v)if(h=v[l],l!=`children`){if(l==`dangerouslySetInnerHTML`)d=h;else if(!(l in y)){if(l==`value`&&`defaultValue`in y||l==`checked`&&`defaultChecked`in y)continue;F(e,l,null,h,i)}}for(l in y)h=y[l],l==`children`?m=h:l==`dangerouslySetInnerHTML`?u=h:l==`value`?g=h:l==`checked`?_=h:s&&typeof h!=`function`||v[l]===h||F(e,l,h,v[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),ne(t.type==`template`?e.content:e,E(m)?m:[m],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&N(n,0),s,c),a!=null)for(l=a.length;l--;)O(a[l]);s||(l=`value`,b==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[l]||b==`progress`&&!g||b==`option`&&g!=v[l])&&F(e,l,g,v[l],i),l=`checked`,_!=null&&_!=e[l]&&F(e,l,_,v[l],i))}return e}function pe(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){p.__e(e,n)}}function me(e,t,n){var r,i;if(p.unmount&&p.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){p.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&me(r[i],t,n||typeof e.type!=`function`);n||O(e.__e),e.__c=e.__=e.__e=void 0}function he(e,t,n){return this.constructor(e,n)}function I(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),p.__&&p.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],ce(t,e=(!r&&n||t).__k=k(j,null,[e]),i||C,C,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?f.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ue(a,e,o)}function ge(e,t){I(e,t,ge)}function _e(e,t,n){var r,i,a,o,s=D({},e.props);for(a in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)a==`key`?r=t[a]:a==`ref`?i=t[a]:s[a]=t[a]===void 0&&o!=null?o[a]:t[a];return arguments.length>2&&(s.children=arguments.length>3?f.call(arguments,2):n),A(e.type,s,r||e.key,i||e.ref,null)}f=w.slice,p={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},m=0,M.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=D({},this.state);typeof e==`function`&&(e=e(D({},n),this.props)),e&&D(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),te(this))},M.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),te(this))},M.prototype.render=j,h=[],_=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,v=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0,y=/(PointerCapture)$|Capture$/i,b=0,x=se(!1),S=se(!0);function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(this,arguments)}function ve(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var ye=[`context`,`children`],be=[`useFragment`];function xe(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){Ce.call(this,r)},i.prototype.attributeChangedCallback=Te,i.prototype.disconnectedCallback=Ee,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function Se(e){this.getChildContext=function(){return e.context};var t=e.children;return _e(t,ve(e,ye))}function Ce(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=k(Se,L({},this._props,{context:t.detail.context}),Oe(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ge:I)(this._vdom,this._root)}function we(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function Te(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[we(e)]=n,this._vdom=_e(this._vdom,r),I(this._vdom,this._root)}}function Ee(){I(this._vdom=null,this._root)}function De(e,t){var n=this,r=e.useFragment,i=ve(e,be);return k(r?j:`slot`,L({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function Oe(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[we(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=Oe(s[a],null,n),l=s[a].slot;l?i[l]=k(De,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?k(De,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),k(t||e.nodeName.toLowerCase(),i,d)}function ke(e,t,n=[],r={shadow:!1}){typeof window<`u`&&(s(u),customElements.get(t)||xe(e,t,n,r))}function Ae(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ae(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function je(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ae(e))&&(r&&(r+=` `),r+=t);return r}const R=je;var z,B,V,Me,H=0,Ne=[],U=p,Pe=U.__b,Fe=U.__r,Ie=U.diffed,Le=U.__c,Re=U.unmount,ze=U.__;function W(e,t){U.__h&&U.__h(B,e,H||t),H=0;var n=B.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function G(e){return H=1,Be(Ke,e)}function Be(e,t,n){var r=W(z++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};B.__f=!0;var a=B.shouldComponentUpdate,o=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},B.shouldComponentUpdate=i}return r.__N||r.__}function K(e,t){var n=W(z++,3);!U.__s&&Ge(n.__H,t)&&(n.__=e,n.u=t,B.__H.__h.push(n))}function q(e,t){var n=W(z++,7);return Ge(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function J(e,t){return H=8,q(function(){return e},t)}function Ve(){for(var e;e=Ne.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Y),e.__H.__h.forEach(We),e.__H.__h=[]}catch(t){e.__H.__h=[],U.__e(t,e.__v)}}U.__b=function(e){B=null,Pe&&Pe(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ze&&ze(e,t)},U.__r=function(e){Fe&&Fe(e),z=0;var t=(B=e.__c).__H;t&&(V===B?(t.__h=[],B.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Y),t.__h.forEach(We),t.__h=[],z=0)),V=B},U.diffed=function(e){Ie&&Ie(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ne.push(t)!==1&&Me===U.requestAnimationFrame||((Me=U.requestAnimationFrame)||Ue)(Ve)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),V=B=null},U.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Y),e.__h=e.__h.filter(function(e){return!e.__||We(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],U.__e(n,e.__v)}}),Le&&Le(e,t)},U.unmount=function(e){Re&&Re(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Y(e)}catch(e){t=e}}),n.__H=void 0,t&&U.__e(t,n.__v))};var He=typeof requestAnimationFrame==`function`;function Ue(e){var t,n=function(){clearTimeout(r),He&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);He&&(t=requestAnimationFrame(n))}function Y(e){var t=B,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),B=t}function We(e){var t=B;e.__c=e.__(),B=t}function Ge(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ke(e,t){return typeof t==`function`?t(e):t}const X={spinner:`M4fSKa_spinner`,spinner__leaf:`M4fSKa_spinner__leaf`,"rt-spinner-leaf-fade":`M4fSKa_rt-spinner-leaf-fade`};var Z=X;X.spinner,X.spinner__leaf,X[`rt-spinner-leaf-fade`];var qe=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qe,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return p.vnode&&p.vnode(l),l}const Je=({ref:e,className:t,...n})=>Q(`span`,{...n,ref:e,className:R(Z.spinner),children:[Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf}),Q(`span`,{className:Z.spinner__leaf})]});Je.displayName=`Spinner`;function Ye(){let[e,t]=G(!0),n=J(()=>{t(!1)},[]);return K(()=>(c(`add`,n),()=>c(`remove`,n)),[n]),{isClientReady:!e}}async function Xe({targetInteraction:t}){let n=window.FrakSetup?.client;if(!n){console.warn(`Frak client not ready yet`);return}let{maxReferrer:r,rewards:a}=await e(n);if(!r)return;let o=i(n.config.metadata?.currency),s=Math.round(r[o]);if(t){let e=a.filter(e=>e.interactionTypeKey===t).map(e=>e.referrer[o]).reduce((e,t)=>t>e?t:e,0);e>0&&(s=Math.round(e))}return l(s,n.config.metadata?.currency)}function Ze(e,t){let[n,r]=G(void 0);return K(()=>{e&&Xe({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:n}}const Qe={buttonShare:`nOB7Uq_buttonShare`};var $e=Qe;Qe.buttonShare;function et(e={}){let{successDuration:t=2e3}=e,[n,r]=G(!1);return{copy:J(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),r(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const $={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function tt({debugInfo:e}){let[t,n]=G(!1);return Q(`div`,{children:[Q(`button`,{type:`button`,style:$.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&Q(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function nt({debugInfo:e}){let{copied:t,copy:n}=et();return Q(`div`,{style:$.errorContainer,children:[Q(`div`,{style:$.header,children:Q(`h3`,{style:$.title,children:`Oups ! Nous avons rencontré un petit problème`})}),Q(`p`,{style:$.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,Q(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:$.link,children:`help@frak-labs.com`}),` `,Q(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),Q(`button`,{type:`button`,onClick:()=>n(e??``),style:$.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),Q(tt,{debugInfo:e})]})}function rt(e){let[i,o]=G(void 0),[s,c]=G(!1);return{handleShare:J(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),o(t.empty().formatDebugInfo(`Frak client not found`)),c(!0);return}let i=a();if(!i)throw Error(`modalBuilderSteps not found`);try{await i.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof n&&e.code===r.clientAborted){console.debug(`User aborted the modal`);return}let t=window.FrakSetup.client.debugInfo.formatDebugInfo(e);d(window.FrakSetup.client,`share_modal_error`,{error:e instanceof Object&&`message`in e?e.message:`Unknown error`,debugInfo:t}),o(t),c(!0),console.error(`Error while opening the modal`,e)}},[e]),isError:s,debugInfo:i}}async function it(){if(!window.FrakSetup?.client)throw Error(`Frak client not found`);await o(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function at({text:e=`Share and earn!`,classname:t=``,useReward:n,noRewardText:r,targetInteraction:i,showWallet:a}){let o=q(()=>n!==void 0,[n]),s=q(()=>a!==void 0,[a]),{isClientReady:c}=Ye(),{reward:l}=Ze(o&&c,i),{handleShare:u,isError:f,debugInfo:p}=rt(i),m=q(()=>o?l?e.includes(`{REWARD}`)?e.replace(`{REWARD}`,l):`${e} ${l}`:r??e.replace(`{REWARD}`,``):e,[o,e,r,l]),h=J(async()=>{d(window.FrakSetup.client,`share_button_clicked`),s?await it():await u()},[s,u]);return Q(j,{children:[Q(`button`,{type:`button`,className:R($e.buttonShare,t,`override`),onClick:h,children:[!c&&Q(Je,{}),` `,m]}),f&&Q(nt,{debugInfo:p})]})}ke(at,`frak-button-share`,[`text`],{shadow:!1});export{at as ButtonShare,G as a,ke as c,q as i,Ye as n,K as o,Q as r,R as s,Ze as t};
@@ -0,0 +1 @@
1
+ import{i as e,u as t}from"./loader.js";import{a as n,c as r,i,n as a,o,r as s,s as c,t as l}from"./ButtonShare.B47PURL1.js";function u(e){return s(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[s(`title`,{children:`Gift icon`}),s(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}const d={button:`Kl62ia_button`,button__left:`Kl62ia_button__left`,button__right:`Kl62ia_button__right`,reward:`Kl62ia_reward`};var f=d;d.button,d.button__left,d.button__right,d.reward;function p({classname:r=``,useReward:d,targetInteraction:p}){let m=i(()=>d!==void 0,[d]),{isClientReady:h}=a(),{reward:g}=l(m&&h,p),[_,v]=n(`right`);return o(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;v(e??`right`)},[]),s(`button`,{type:`button`,"aria-label":`Open wallet`,class:c(f.button,_===`left`?f.button__left:f.button__right,r,`override`),disabled:!h,onClick:()=>{t(window.FrakSetup.client,`wallet_button_clicked`),e()},children:[s(u,{}),g&&s(`span`,{className:f.reward,children:g})]})}r(p,`frak-button-wallet`,[],{shadow:!1});export{p as ButtonWallet};
package/cdn/components.js CHANGED
@@ -1 +1 @@
1
- import("https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/loader.js?v=1752070144773");
1
+ import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/loader.js?v=1766163935296`);
package/cdn/loader.css ADDED
@@ -0,0 +1,7 @@
1
+ /* ButtonShare-DFqabzEZ.css */
2
+ .M4fSKa_spinner{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.M4fSKa_spinner__leaf{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:M4fSKa_rt-spinner-leaf-fade var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%;&:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}&:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}&:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}&:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}&:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}&:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}&:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}&:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}&:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}}@keyframes M4fSKa_rt-spinner-leaf-fade{0%{opacity:1}to{opacity:.25}}
3
+ .nOB7Uq_buttonShare{justify-content:center;align-items:center;gap:10px;display:flex}
4
+
5
+
6
+ /* ButtonWallet-B5NeF40U.css */
7
+ .Kl62ia_button{all:unset;z-index:2000000;cursor:pointer;text-align:center;background-color:#3e557e;border-radius:50%;justify-content:center;align-items:center;width:45px;height:45px;font-size:24px;display:flex;position:fixed;bottom:20px}.Kl62ia_button__left{left:20px}.Kl62ia_button__right{right:20px}.Kl62ia_reward{color:#fff;white-space:nowrap;background:#ff3f3f;border-radius:5px;padding:2px 3px;font-size:9px;font-weight:600;line-height:9px;position:absolute;top:-4px;right:27px}