UNPKG

react-kofi

Version:

Ko-fi buttons, modals, and react components built with Radix for React.js projects (unofficial)

2 lines (1 loc) 35.9 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var a=o(e),i=r(e),c=o(n),u=r(n);function s(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function l(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function d(...e){return a.useCallback(l(...e),e)}function f(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return a.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}var p=Boolean(globalThis?.document)?a.useLayoutEffect:()=>{},m=a["useId".toString()]||(()=>{}),v=0;function h(e){const[t,n]=a.useState(m());return p((()=>{e||n((e=>e??String(v++)))}),[e]),e||(t?`radix-${t}`:"")}function g(e){const t=a.useRef(e);return a.useEffect((()=>{t.current=e})),a.useMemo((()=>(...e)=>t.current?.(...e)),[])}function y({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=function({defaultProp:e,onChange:t}){const n=a.useState(e),[r]=n,o=a.useRef(r),i=g(t);return a.useEffect((()=>{o.current!==r&&(i(r),o.current=r)}),[r,o,i]),n}({defaultProp:t,onChange:n}),i=void 0!==e,c=i?e:r,u=g(n);return[c,a.useCallback((t=>{if(i){const n="function"==typeof t?t(e):t;n!==e&&u(n)}else o(t)}),[i,e,o,u])]}var b=a.forwardRef(((e,n)=>{const{children:r,...o}=e,i=a.Children.toArray(r),c=i.find(x);if(c){const e=c.props.children,r=i.map((t=>t===c?a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null:t));return t.jsx(E,{...o,ref:n,children:a.isValidElement(e)?a.cloneElement(e,void 0,r):null})}return t.jsx(E,{...o,ref:n,children:r})}));b.displayName="Slot";var E=a.forwardRef(((e,t)=>{const{children:n,...r}=e;if(a.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n);return a.cloneElement(n,{...C(r,n.props),ref:t?l(t,e):e})}return a.Children.count(n)>1?a.Children.only(null):null}));E.displayName="SlotClone";var w=({children:e})=>t.jsx(t.Fragment,{children:e});function x(e){return a.isValidElement(e)&&e.type===w}function C(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{a(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}var O=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=a.forwardRef(((e,r)=>{const{asChild:o,...a}=e,i=o?b:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(i,{...a,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{});var N,R="dismissableLayer.update",k="dismissableLayer.pointerDownOutside",P="dismissableLayer.focusOutside",S=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),j=a.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:l,...f}=e,p=a.useContext(S),[m,v]=a.useState(null),h=m?.ownerDocument??globalThis?.document,[,y]=a.useState({}),b=d(n,(e=>v(e))),E=Array.from(p.layers),[w]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),x=E.indexOf(w),C=m?E.indexOf(m):-1,j=p.layersWithOutsidePointerEventsDisabled.size>0,_=C>=x,M=function(e,t=globalThis?.document){const n=g(e),r=a.useRef(!1),o=a.useRef((()=>{}));return a.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){L(k,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...p.branches].some((e=>e.contains(t)));_&&!n&&(i?.(e),u?.(e),e.defaultPrevented||l?.())}),h),T=function(e,t=globalThis?.document){const n=g(e),r=a.useRef(!1);return a.useEffect((()=>{const e=e=>{if(e.target&&!r.current){L(P,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...p.branches].some((e=>e.contains(t)))||(c?.(e),u?.(e),e.defaultPrevented||l?.())}),h);return function(e,t=globalThis?.document){const n=g(e);a.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{C===p.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))}),h),a.useEffect((()=>{if(m)return r&&(0===p.layersWithOutsidePointerEventsDisabled.size&&(N=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),D(),()=>{r&&1===p.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=N)}}),[m,h,r,p]),a.useEffect((()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),D())}),[m,p]),a.useEffect((()=>{const e=()=>y({});return document.addEventListener(R,e),()=>document.removeEventListener(R,e)}),[]),t.jsx(O.div,{...f,ref:b,style:{pointerEvents:j?_?"auto":"none":void 0,...e.style},onFocusCapture:s(e.onFocusCapture,T.onFocusCapture),onBlurCapture:s(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:s(e.onPointerDownCapture,M.onPointerDownCapture)})}));j.displayName="DismissableLayer";function D(){const e=new CustomEvent(R);document.dispatchEvent(e)}function L(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&c.flushSync((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}a.forwardRef(((e,n)=>{const r=a.useContext(S),o=a.useRef(null),i=d(n,o);return a.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(O.div,{...e,ref:i})})).displayName="DismissableLayerBranch";var _="focusScope.autoFocusOnMount",M="focusScope.autoFocusOnUnmount",T={bubbles:!1,cancelable:!0},I=a.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...u}=e,[s,l]=a.useState(null),f=g(i),p=g(c),m=a.useRef(null),v=d(n,(e=>l(e))),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect((()=>{if(o){let e=function(e){if(h.paused||!s)return;const t=e.target;s.contains(t)?m.current=t:B(m.current,{select:!0})},t=function(e){if(h.paused||!s)return;const t=e.relatedTarget;null!==t&&(s.contains(t)||B(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&B(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,s,h.paused]),a.useEffect((()=>{if(s){$.add(h);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent(_,T);s.addEventListener(_,f),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(B(r,{select:t}),document.activeElement!==n)return}((e=A(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&B(s))}return()=>{s.removeEventListener(_,f),setTimeout((()=>{const e=new CustomEvent(M,T);s.addEventListener(M,p),s.dispatchEvent(e),e.defaultPrevented||B(t??document.body,{select:!0}),s.removeEventListener(M,p),$.remove(h)}),0)}}var e}),[s,f,p,h]);const y=a.useCallback((e=>{if(!r&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[o,a]=function(e){const t=A(e),n=F(t,e),r=F(t.reverse(),e);return[n,r]}(t);o&&a?e.shiftKey||n!==a?e.shiftKey&&n===o&&(e.preventDefault(),r&&B(a,{select:!0})):(e.preventDefault(),r&&B(o,{select:!0})):n===t&&e.preventDefault()}}),[r,o,h.paused]);return t.jsx(O.div,{tabIndex:-1,...u,ref:v,onKeyDown:y})}));function A(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function F(e,t){for(const n of e)if(!W(n,{upTo:t}))return n}function W(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function B(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}I.displayName="FocusScope";var $=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=K(e,t),e.unshift(t)},remove(t){e=K(e,t),e[0]?.resume()}}}();function K(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var U=a.forwardRef(((e,n)=>{const{container:r,...o}=e,[i,c]=a.useState(!1);p((()=>c(!0)),[]);const s=r||i&&globalThis?.document?.body;return s?u.default.createPortal(t.jsx(O.div,{...o,ref:n}),s):null}));U.displayName="Portal";var z=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=a.useState(),r=a.useRef({}),o=a.useRef(e),i=a.useRef("none"),u=e?"mounted":"unmounted",[s,l]=function(e,t){return a.useReducer(((e,n)=>t[e][n]??e),e)}(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect((()=>{const e=H(r.current);i.current="mounted"===s?e:"none"}),[s]),p((()=>{const t=r.current,n=o.current;if(n!==e){const r=i.current,a=H(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,l]),p((()=>{if(t){const e=e=>{const n=H(r.current).includes(e.animationName);e.target===t&&n&&c.flushSync((()=>l("ANIMATION_END")))},n=e=>{e.target===t&&(i.current=H(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}l("ANIMATION_END")}),[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:a.useCallback((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.Children.only(n),i=d(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?a.cloneElement(o,{ref:i}):null};function H(e){return e?.animationName||"none"}z.displayName="Presence";var Y=0;function X(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Z=function(){return Z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Z.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var q="right-scroll-bar-position",V="width-before-scroll-bar";function G(t,n){return r=n||null,o=function(e){return t.forEach((function(t){return function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}(t,e)}))},(a=e.useState((function(){return{value:r,callback:o,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}}))[0]).callback=o,a.facade;var r,o,a}var J=function(){return J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},J.apply(this,arguments)};function Q(e){return e}var ee=function(e){var t=e.sideCar,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return a.createElement(r,J({},n))};ee.isSideCarExport=!0;var te=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Q);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=J({async:!0,ssr:!1},e),t}(),ne=function(){},re=a.forwardRef((function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:ne,onWheelCapture:ne,onTouchMoveCapture:ne}),o=r[0],i=r[1],c=e.forwardProps,u=e.children,s=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noIsolation,v=e.inert,h=e.allowPinchZoom,g=e.as,y=void 0===g?"div":g,b=e.gapMode,E=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,x=G([n,t]),C=Z(Z({},E),o);return a.createElement(a.Fragment,null,d&&a.createElement(w,{sideCar:te,removeScrollBar:l,shards:f,noIsolation:m,inert:v,setCallbacks:i,allowPinchZoom:!!h,lockRef:n,gapMode:b}),c?a.cloneElement(a.Children.only(u),Z(Z({},C),{ref:x})):a.createElement(y,Z({},C,{className:s,ref:x}),u))}));re.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},re.classNames={fullWidth:V,zeroRight:q};function oe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var ae=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=oe())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ie=function(){var e,t=(e=ae(),function(t,n){a.useEffect((function(){return e.add(t),function(){e.remove()}}),[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},ce={left:0,top:0,right:0,gap:0},ue=function(e){return parseInt(e||"",10)||0},se=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return ce;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[ue(n),ue(r),ue(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},le=ie(),de=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,c=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(c,"px ").concat(r,";\n }\n body {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(c,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(q," {\n right: ").concat(c,"px ").concat(r,";\n }\n \n .").concat(V," {\n margin-right: ").concat(c,"px ").concat(r,";\n }\n \n .").concat(q," .").concat(q," {\n right: 0 ").concat(r,";\n }\n \n .").concat(V," .").concat(V," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(c,"px;\n }\n")},fe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r,i=a.useMemo((function(){return se(o)}),[o]);return a.createElement(le,{styles:de(i,!t,o,n?"":"!important")})},pe=!1;if("undefined"!=typeof window)try{var me=Object.defineProperty({},"passive",{get:function(){return pe=!0,!0}});window.addEventListener("test",me,me),window.removeEventListener("test",me,me)}catch(e){pe=!1}var ve=!!pe&&{passive:!1},he=function(e,t){var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},ge=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),ye(e,r)){var o=be(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ye=function(e,t){return"v"===e?function(e){return he(e,"overflowY")}(t):function(e){return he(e,"overflowX")}(t)},be=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Ee=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},we=function(e){return[e.deltaX,e.deltaY]},xe=function(e){return e&&"current"in e?e.current:e},Ce=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Oe=0,Ne=[];function Re(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ke,Pe=(ke=function(e){var t=a.useRef([]),n=a.useRef([0,0]),r=a.useRef(),o=a.useState(Oe++)[0],i=a.useState(ie)[0],c=a.useRef(e);a.useEffect((function(){c.current=e}),[e]),a.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(xe),!0).filter(Boolean);return t.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[e.inert,e.lockRef.current,e.shards]);var u=a.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!c.current.allowPinchZoom;var o,a=Ee(e),i=n.current,u="deltaX"in e?e.deltaX:i[0]-a[0],s="deltaY"in e?e.deltaY:i[1]-a[1],l=e.target,d=Math.abs(u)>Math.abs(s)?"h":"v";if("touches"in e&&"h"===d&&"range"===l.type)return!1;var f=ge(d,l);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=ge(d,l)),!f)return!1;if(!r.current&&"changedTouches"in e&&(u||s)&&(r.current=o),!o)return!0;var p=r.current||o;return function(e,t,n,r,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,u=t.contains(c),s=!1,l=i>0,d=0,f=0;do{var p=be(e,c),m=p[0],v=p[1]-p[2]-a*m;(m||v)&&ye(e,c)&&(d+=v,f+=m),c=c instanceof ShadowRoot?c.host:c.parentNode}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(l&&(o&&Math.abs(d)<1||!o&&i>d)||!l&&(o&&Math.abs(f)<1||!o&&-i>f))&&(s=!0),s}(p,t,e,"h"===p?u:s,!0)}),[]),s=a.useCallback((function(e){var n=e;if(Ne.length&&Ne[Ne.length-1]===i){var r="deltaY"in n?we(n):Ee(n),o=t.current.filter((function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o}))[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var a=(c.current.shards||[]).map(xe).filter(Boolean).filter((function(e){return e.contains(n.target)}));(a.length>0?u(n,a[0]):!c.current.noIsolation)&&n.cancelable&&n.preventDefault()}}}),[]),l=a.useCallback((function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:Re(r)};t.current.push(a),setTimeout((function(){t.current=t.current.filter((function(e){return e!==a}))}),1)}),[]),d=a.useCallback((function(e){n.current=Ee(e),r.current=void 0}),[]),f=a.useCallback((function(t){l(t.type,we(t),t.target,u(t,e.lockRef.current))}),[]),p=a.useCallback((function(t){l(t.type,Ee(t),t.target,u(t,e.lockRef.current))}),[]);a.useEffect((function(){return Ne.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",s,ve),document.addEventListener("touchmove",s,ve),document.addEventListener("touchstart",d,ve),function(){Ne=Ne.filter((function(e){return e!==i})),document.removeEventListener("wheel",s,ve),document.removeEventListener("touchmove",s,ve),document.removeEventListener("touchstart",d,ve)}}),[]);var m=e.removeScrollBar,v=e.inert;return a.createElement(a.Fragment,null,v?a.createElement(i,{styles:Ce(o)}):null,m?a.createElement(fe,{gapMode:e.gapMode}):null)},te.useMedium(ke),ee),Se=a.forwardRef((function(e,t){return a.createElement(re,Z({},e,{ref:t,sideCar:Pe}))}));Se.classNames=re.classNames;var je=Se,De=new WeakMap,Le=new WeakMap,_e={},Me=0,Te=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];_e[n]||(_e[n]=new WeakMap);var o=_e[n],a=[],i=new Set,c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};r.forEach(c);var u=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(i.has(e))u(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,c=(De.get(e)||0)+1,s=(o.get(e)||0)+1;De.set(e,c),o.set(e,s),a.push(e),1===c&&r&&Le.set(e,!0),1===s&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return u(t),i.clear(),Me++,function(){a.forEach((function(e){var t=De.get(e)-1,r=o.get(e)-1;De.set(e,t),o.set(e,r),t||(Le.has(e)||e.removeAttribute("aria-hidden"),Le.delete(e)),r||e.removeAttribute(n)})),--Me||(De=new WeakMap,De=new WeakMap,Le=new WeakMap,_e={})}},Ie="Dialog",[Ae,Fe]=function(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>a.createContext(e)));return function(n){const r=n?.[e]||t;return a.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const i=a.createContext(o),c=r.length;function u(n){const{scope:r,children:o,...u}=n,s=r?.[e][c]||i,l=a.useMemo((()=>u),Object.values(u));return t.jsx(s.Provider,{value:l,children:o})}return r=[...r,o],u.displayName=n+"Provider",[u,function(t,r){const u=r?.[e][c]||i,s=a.useContext(u);if(s)return s;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},f(o,...n)]}(Ie),[We,Be]=Ae(Ie),$e=e=>{const{__scopeDialog:n,children:r,open:o,defaultOpen:i,onOpenChange:c,modal:u=!0}=e,s=a.useRef(null),l=a.useRef(null),[d=!1,f]=y({prop:o,defaultProp:i,onChange:c});return t.jsx(We,{scope:n,triggerRef:s,contentRef:l,contentId:h(),titleId:h(),descriptionId:h(),open:d,onOpenChange:f,onOpenToggle:a.useCallback((()=>f((e=>!e))),[f]),modal:u,children:r})};$e.displayName=Ie;var Ke="DialogTrigger",Ue=a.forwardRef(((e,n)=>{const{__scopeDialog:r,...o}=e,a=Be(Ke,r),i=d(n,a.triggerRef);return t.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":it(a.open),...o,ref:i,onClick:s(e.onClick,a.onOpenToggle)})}));Ue.displayName=Ke;var ze="DialogPortal",[He,Ye]=Ae(ze,{forceMount:void 0}),Xe=e=>{const{__scopeDialog:n,forceMount:r,children:o,container:i}=e,c=Be(ze,n);return t.jsx(He,{scope:n,forceMount:r,children:a.Children.map(o,(e=>t.jsx(z,{present:r||c.open,children:t.jsx(U,{asChild:!0,container:i,children:e})})))})};Xe.displayName=ze;var Ze="DialogOverlay",qe=a.forwardRef(((e,n)=>{const r=Ye(Ze,e.__scopeDialog),{forceMount:o=r.forceMount,...a}=e,i=Be(Ze,e.__scopeDialog);return i.modal?t.jsx(z,{present:o||i.open,children:t.jsx(Ve,{...a,ref:n})}):null}));qe.displayName=Ze;var Ve=a.forwardRef(((e,n)=>{const{__scopeDialog:r,...o}=e,a=Be(Ze,r);return t.jsx(je,{as:b,allowPinchZoom:!0,shards:[a.contentRef],children:t.jsx(O.div,{"data-state":it(a.open),...o,ref:n,style:{pointerEvents:"auto",...o.style}})})})),Ge="DialogContent",Je=a.forwardRef(((e,n)=>{const r=Ye(Ge,e.__scopeDialog),{forceMount:o=r.forceMount,...a}=e,i=Be(Ge,e.__scopeDialog);return t.jsx(z,{present:o||i.open,children:i.modal?t.jsx(Qe,{...a,ref:n}):t.jsx(et,{...a,ref:n})})}));Je.displayName=Ge;var Qe=a.forwardRef(((e,n)=>{const r=Be(Ge,e.__scopeDialog),o=a.useRef(null),i=d(n,r.contentRef,o);return a.useEffect((()=>{const e=o.current;if(e)return Te(e)}),[]),t.jsx(tt,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:s(e.onCloseAutoFocus,(e=>{e.preventDefault(),r.triggerRef.current?.focus()})),onPointerDownOutside:s(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:s(e.onFocusOutside,(e=>e.preventDefault()))})})),et=a.forwardRef(((e,n)=>{const r=Be(Ge,e.__scopeDialog),o=a.useRef(!1),i=a.useRef(!1);return t.jsx(tt,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||r.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const n=t.target,a=r.triggerRef.current?.contains(n);a&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})})),tt=a.forwardRef(((e,n)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:c,...u}=e,s=Be(Ge,r),l=a.useRef(null),f=d(n,l);return a.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??X()),document.body.insertAdjacentElement("beforeend",e[1]??X()),Y++,()=>{1===Y&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Y--}}),[]),t.jsxs(t.Fragment,{children:[t.jsx(I,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:c,children:t.jsx(j,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":it(s.open),...u,ref:f,onDismiss:()=>s.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(lt,{titleId:s.titleId}),t.jsx(dt,{contentRef:l,descriptionId:s.descriptionId})]})]})})),nt="DialogTitle";a.forwardRef(((e,n)=>{const{__scopeDialog:r,...o}=e,a=Be(nt,r);return t.jsx(O.h2,{id:a.titleId,...o,ref:n})})).displayName=nt;var rt="DialogDescription";a.forwardRef(((e,n)=>{const{__scopeDialog:r,...o}=e,a=Be(rt,r);return t.jsx(O.p,{id:a.descriptionId,...o,ref:n})})).displayName=rt;var ot="DialogClose",at=a.forwardRef(((e,n)=>{const{__scopeDialog:r,...o}=e,a=Be(ot,r);return t.jsx(O.button,{type:"button",...o,ref:n,onClick:s(e.onClick,(()=>a.onOpenChange(!1)))})}));function it(e){return e?"open":"closed"}at.displayName=ot;var ct="DialogTitleWarning",[ut,st]=function(e,n){const r=a.createContext(n);function o(e){const{children:n,...o}=e,i=a.useMemo((()=>o),Object.values(o));return t.jsx(r.Provider,{value:i,children:n})}return o.displayName=e+"Provider",[o,function(t){const o=a.useContext(r);if(o)return o;if(void 0!==n)return n;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(ct,{contentName:Ge,titleName:nt,docsSlug:"dialog"}),lt=({titleId:e})=>{const t=st(ct),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect((()=>{if(e){document.getElementById(e)||console.error(n)}}),[n,e]),null},dt=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${st("DialogDescriptionWarning").contentName}}.`;return a.useEffect((()=>{const r=e.current?.getAttribute("aria-describedby");if(t&&r){document.getElementById(t)||console.warn(n)}}),[n,e,t]),null},ft=$e,pt=Ue,mt=Xe,vt=qe,ht=Je,gt=at;var yt=["color"],bt=e.forwardRef((function(t,n){var r=t.color,o=void 0===r?"currentColor":r,a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,yt);return e.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:n}),e.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}));exports.KoFiButton=function({color:e="#00b4f7",id:t="prototypr",label:n="Support me on Ko-Fi",size:r="w-10 h-10",radius:o="12px"}){return i.default.createElement("div",{className:"flex justify-start"},i.default.createElement("div",{class:"btn-container"},i.default.createElement("a",{title:n,className:(n?"kofi-button ":`rounded-full ${r||"w-10 h-10"} block flex justify-center`)+" rounded-full",style:{backgroundColor:e,borderRadius:o},href:"https://ko-fi.com/"+t,target:"_blank",rel:"noopener noreferrer"},i.default.createElement("span",{class:"kofitext"},i.default.createElement("img",{src:"https://ko-fi.com/img/cup-border.png",class:"kofiimg",alt:"Ko-Fi button"}),n||null))))},exports.KoFiDialog=({color:t="#00b4f7",textColor:n="#fff",id:r="prototypr",label:o="Support me",padding:a=0,width:c=400,backgroundColor:u="#fff",iframe:s,buttonRadius:l="8px"})=>{const[d,f]=e.useState(!1);return i.default.createElement(ft,{open:d,onOpenChange:f},i.default.createElement(pt,{asChild:!0},i.default.createElement("div",{title:o,className:"kofi-button w-fit text-sm hover:shadow-md transition transition-all duration-400 cursor-pointer px-3 h-[28px] flex flex-col justify-center",style:{backgroundColor:t,borderRadius:l},onClick:()=>f(!d)},i.default.createElement("div",{className:"kofitext gap-1 flex my-auto items-center"},i.default.createElement("img",{src:"https://ko-fi.com/img/cup-border.png",className:"kofiimg",alt:"Ko-Fi button"}),i.default.createElement("div",{className:"flex my-auto text-xs items-center",style:{color:n}},o)))),i.default.createElement(mt,null,i.default.createElement(vt,{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999]"}),i.default.createElement(ht,{style:{padding:a,width:c,backgroundColor:u},className:"fixed h-[712px] overflow-hidden top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 rounded-xl shadow-lg z-[9999]"},i.default.createElement("div",{className:"relative w-full h-full"},i.default.createElement("div",{className:"flex flex-col h-full z-10 justify-center items-center kofi-button"},i.default.createElement("div",{className:"gap-1 flex my-auto items-center"},i.default.createElement("div",{className:"flex flex-col gap-2"},i.default.createElement("img",{src:"https://ko-fi.com/img/cup-border.png",className:"kofiimg !h-[auto] !w-[32px] !mx-auto animate-[kofi-wiggle_3s_infinite]",alt:"Ko-Fi button"}),i.default.createElement("div",{className:"mx-auto text-sm text-gray-600"},"Loading...")))),i.default.createElement("div",{className:"z-20 absolute top-0 left-0 w-full h-full"},s?i.default.createElement("div",{style:{width:"100%",height:"100%",background:"transparent"},dangerouslySetInnerHTML:{__html:s}}):i.default.createElement("iframe",{id:"kofiframe",src:`https://ko-fi.com/${r}/?hidefeed=true&widget=true&embed=true&preview=true`,style:{border:"none",width:"100%",background:"transparent"},height:"712",title:"prototypr"}))),i.default.createElement(gt,{asChild:!0},i.default.createElement("button",{className:"absolute z-30 top-2 bg-gray-200 right-2 p-1 rounded-full hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200"},i.default.createElement(bt,{className:"w-4 h-4 text-gray-500"}))))))},exports.KoFiPanel=function({id:e="prototypr"}){return i.default.createElement("iframe",{id:"kofiframe",src:`https://ko-fi.com/${e}/?hidefeed=true&widget=true&embed=true&preview=true`,style:{border:"none",width:"100%",padding:"4px",background:"#f9f9f9"},height:"712",title:e})},exports.KoFiWidget=function({attachOnScroll:t=!1,id:n="prototypr",label:r="Support me",color:o="#00b9fe",textColor:a="#fff"}){function i(){window.innerHeight+window.scrollY>=document.body.scrollHeight/2&&c()}function c(){t&&window.removeEventListener("scroll",i,!1);var e=document.createElement("script");e.setAttribute("src","https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"),e.setAttribute("type","text/javascript"),document.head.appendChild(e),e.onload=()=>{var e=document.createElement("script");e.setAttribute("type","text/javascript"),e.innerHTML=`\n window.kofiWidgetOverlay = kofiWidgetOverlay\n kofiWidgetOverlay.draw('${n}', {\n 'type': 'floating-chat',\n 'floating-chat.donateButton.text': '${r}',\n 'floating-chat.donateButton.background-color': '${o}',\n 'floating-chat.donateButton.text-color': '${a}'\n });\n `,document.head.appendChild(e)}}return e.useEffect((()=>{if("undefined"!=typeof window&&!window.kofiWidgetOverlay){if(t)return window.addEventListener("scroll",i,!1),()=>{window.removeEventListener("scroll",i,!1)};c()}}),[]),null};