UNPKG

@carry0987/paginator

Version:
1 lines 59.3 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).paginatorjs={})}(this,function(t){"use strict";var e=Object.freeze({__proto__:null,reportError:function(...t){console.error(...t)},throwError:function(t){throw new Error(t)}});function n(t,e,n){if("string"!=typeof t)return t;let r=document;return null===e&&n?r=n:e&&e instanceof Node&&"querySelector"in e?r=e:n&&n instanceof Node&&"querySelector"in n&&(r=n),"all"===e?r.querySelectorAll(t):r.querySelector(t)}function r(t,e,n=1/0,r=!1){let i=t.parentElement,o=0;for(;i&&o<n;){if(i.matches(e))return!r||i;i=i.parentElement,o++}return!!r&&null}function i(t){return"object"==typeof t&&null!==t&&!a(t)}function o(t){return"function"==typeof t}function s(t){return"string"==typeof t}function a(t){return Array.isArray(t)}function l(t){return"number"!=typeof t&&("string"==typeof t&&0===t.length||(!(!a(t)||0!==t.length)||(!(!i(t)||0!==Object.keys(t).length)||!t)))}function c(t,...e){if(!e.length)return t;const n=e.shift();if(n)for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const r=n[e],o=e;i(r)||a(r)?(t[o]&&"object"==typeof t[o]||(t[o]=a(r)?[]:{}),c(t[o],r)):t[o]=r}return c(t,...e)}function u(t,...e){return e.forEach(e=>{e&&Object.keys(e).forEach(n=>{const r=n;t[r]=e[r]})}),t}function _(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function f(t,e=new FormData){const{data:n,parentKey:r=""}=t;if(n instanceof FormData)n.forEach((t,n)=>{e.append(n,t)});else if(null!==n&&"object"==typeof n)if(n instanceof Blob||n instanceof File){const t=r||"file";e.append(t,n)}else Object.keys(n).forEach(t=>{const i=n[t],o=r?`${r}[${t}]`:t;null!==i&&"object"==typeof i?f({data:i,parentKey:o},e):null!==i&&e.append(o,String(i))});else null!==n&&e.append(r,n);return e}function p(t,e=""){if(t instanceof FormData)return t;return f({data:t,parentKey:e})}async function h(t){const{url:e,method:n="GET",headers:r={},cache:i="no-cache",mode:o="cors",credentials:s="same-origin",body:a=null,beforeSend:l=null,success:c=null,error:u=null}=t;let _=e;const f={method:n,mode:o,headers:r instanceof Headers?r:new Headers(r),cache:i,credentials:s};if(a&&null!==a&&"GET"===n.toUpperCase()){const t=function(t){const e={};return t instanceof FormData?function(t){const e={};return t.forEach((t,n)=>{e[n]="string"==typeof t||"boolean"==typeof t||"number"==typeof t||null===t?t:t.toString()}),e}(t):("object"==typeof t&&Object.entries(t).forEach(([t,n])=>{e[t]="string"==typeof n||"number"==typeof n||"boolean"==typeof n||null===n?n:JSON.stringify(n)}),e)}(a);_=function(t,e,n=!0){let r,i=[];if("object"==typeof t){if(r=t.url,Array.isArray(t.ignore))i=t.ignore.map(t=>t.startsWith("?")||t.startsWith("&")?t.substring(1):t);else if("string"==typeof t.ignore){let e=t.ignore;(e.startsWith("?")||e.startsWith("&"))&&(e=e.substring(1)),i.push(e)}}else r=t;const o=new URL(r);if(null===e)return o.search="",o.toString();let s=o.search.substring(1);const a=s.length>0?s.split("&"):[],l=[],c=[];for(const t of a)i.includes(t)?l.push(t):c.push(t);const u=new URLSearchParams(c.join("&"));for(const[t,r]of Object.entries(e)){const e=null===r?"":String(r);!n&&u.has(t)||u.set(t,e)}const _=l.concat(u.toString().split("&").filter(t=>t)),f=_.join("&");return o.search=f?"?"+f:"",o.toString()}("string"==typeof e?e:e.toString(),t,!0)}else if(a&&null!==a&&["PUT","POST","DELETE"].includes(n.toUpperCase())){let t=a;a instanceof FormData||(t=JSON.stringify(a),f.headers instanceof Headers||(f.headers=new Headers(f.headers)),f.headers.append("Content-Type","application/json")),f.body=t}let p;if("string"==typeof _||_ instanceof URL)p=new Request(_,f);else{if(!(_ instanceof Request))throw new Error("Invalid URL type");p=_}try{const t=await new Promise(t=>{l?.(),t(p)}),e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);if("function"==typeof c){const t=e.clone(),n=await t.json();c?.(n)}return e}catch(t){const e=t instanceof Error?t:new Error(String(t));throw u?.(e),e}}const d=async function(t){const{url:e,data:n,method:r="POST",headers:i,cache:o,mode:s,credentials:a,success:l,error:c,beforeSend:u,encode:_=!0}=t,f={url:e,method:r,headers:i,cache:o,mode:s,credentials:a,body:_&&"GET"!==r.toUpperCase()?p(n):n,beforeSend:u,success:l,error:c};return(await h(f)).json()};class g{static throwError=e.throwError;static getElem=n;static hasParent=r;static deepMerge=c;static shallowMerge=u;static generateUUID=_;static isEmpty=l;static isObject=i;static isArray=a;static isString=s;static isFunction=o;static fetchData=d;static encodeFormData=p;static isNumeric(t){return!isNaN(parseFloat(t))&&isFinite(t)}static composeClassNames(...t){return t=t.filter(t=>!!t),t.length>0?t.join(" "):""}static isPageItem(t){const e=["J-pagination-page","J-pagination-previous","J-pagination-next"],n=t.classList;for(let t=0;t<e.length;t++)if(n.contains(e[t]))return!0;return!1}}class v{_id;constructor(t){this._id=t||g.generateUUID()}get id(){return this._id}}function m(t){if(!t)return"";const e=t.split(" ");return 1===e.length&&/([a-z][A-Z])+/g.test(t)?t:e.map(function(t,e){return 0==e?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join("")}var y;t.PluginPosition=void 0,(y=t.PluginPosition||(t.PluginPosition={}))[y.Header=0]="Header",y[y.Body=1]="Body",y[y.Footer=2]="Footer",y[y.Cell=3]="Cell";var b,w,P,x,S,k,E,C,N,L,A,I,D,U,T,O=new class{format(t,e){return`[Paginator] [${e.toUpperCase()}]: ${t}`}error(t,e=!1){const n=this.format(t,"error");if(e)throw Error(n);console.error(n)}warn(t){console.warn(this.format(t,"warn"))}info(t){console.info(this.format(t,"info"))}},R={},$=[],F=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,H=Array.isArray;function j(t,e){for(var n in e)t[n]=e[n];return t}function B(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function M(t,e,n){var r,i,o,s={};for(o in e)"key"==o?r=e[o]:"ref"==o?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?b.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===s[o]&&(s[o]=t.defaultProps[o]);return W(t,s,r,i,null)}function W(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++P:i,__i:-1,__u:0};return null==i&&null!=w.vnode&&w.vnode(o),o}function V(t){return t.children}function q(t,e){this.props=t,this.context=e}function z(t,e){if(null==e)return t.__?z(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?z(t):null}function G(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return G(t)}}function J(t){(!t.__d&&(t.__d=!0)&&S.push(t)&&!Z.__r++||k!=w.debounceRendering)&&((k=w.debounceRendering)||E)(Z)}function Z(){for(var t,e,n,r,i,o,s,a=1;S.length;)S.length>a&&S.sort(C),t=S.shift(),a=S.length,t.__d&&(n=void 0,r=void 0,i=(r=(e=t).__v).__e,o=[],s=[],e.__P&&((n=j({},r)).__v=r.__v+1,w.vnode&&w.vnode(n),rt(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,o,null==i?z(r):i,!!(32&r.__u),s),n.__v=r.__v,n.__.__k[n.__i]=n,ot(o,n,s),r.__e=r.__=null,n.__e!=i&&G(n)));Z.__r=0}function K(t,e,n,r,i,o,s,a,l,c,u){var _,f,p,h,d,g,v,m=r&&r.__k||$,y=e.length;for(l=function(t,e,n,r,i){var o,s,a,l,c,u=n.length,_=u,f=0;for(t.__k=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(l=o+f,(s=t.__k[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?W(null,s,null,null,null):H(s)?W(V,{children:s},null,null,null):null==s.constructor&&s.__b>0?W(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,-1!=(c=s.__i=Y(s,n,l,_))&&(_--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(i>u?f--:i<u&&f++),"function"!=typeof s.type&&(s.__u|=4)):c!=l&&(c==l-1?f--:c==l+1?f++:(c>l?f--:f++,s.__u|=4))):t.__k[o]=null;if(_)for(o=0;o<u;o++)null!=(a=n[o])&&!(2&a.__u)&&(a.__e==r&&(r=z(a)),ct(a,a));return r}(n,e,m,l,y),_=0;_<y;_++)null!=(p=n.__k[_])&&(f=-1==p.__i?R:m[p.__i]||R,p.__i=_,g=rt(t,p,f,i,o,s,a,l,c,u),h=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&lt(f.ref,null,p),u.push(p.ref,p.__c||h,p)),null==d&&null!=h&&(d=h),(v=!!(4&p.__u))||f.__k===p.__k?l=Q(p,l,t,v):"function"==typeof p.type&&void 0!==g?l=g:h&&(l=h.nextSibling),p.__u&=-7);return n.__e=d,l}function Q(t,e,n,r){var i,o;if("function"==typeof t.type){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=Q(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=z(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function X(t,e){return e=e||[],null==t||"boolean"==typeof t||(H(t)?t.some(function(t){X(t,e)}):e.push(t)),e}function Y(t,e,n,r){var i,o,s,a=t.key,l=t.type,c=e[n],u=null!=c&&!(2&c.__u);if(null===c&&null==t.key||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<e.length;)if(null!=(c=e[s=i>=0?i--:o++])&&!(2&c.__u)&&a==c.key&&l==c.type)return s;return-1}function tt(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||F.test(e)?n:n+"px"}function et(t,e,n,r,i){var o,s;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||tt(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||tt(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(N,"$1")),s=e.toLowerCase(),e=s in t||"onFocusOut"==e||"onFocusIn"==e?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=L,t.addEventListener(e,o?I:A,o)):t.removeEventListener(e,o?I:A,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function nt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(null==e.t)e.t=L++;else if(e.t<n.u)return;return n(w.event?w.event(e):e)}}}function rt(t,e,n,r,i,o,s,a,l,c){var u,_,f,p,h,d,g,v,m,y,b,P,x,S,k,E,C,N=e.type;if(null!=e.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=e.__e=n.__e]),(u=w.__b)&&u(e);t:if("function"==typeof N)try{if(v=e.props,m="prototype"in N&&N.prototype.render,y=(u=N.contextType)&&r[u.__c],b=u?y?y.props.value:u.__:r,n.__c?g=(_=e.__c=n.__c).__=_.__E:(m?e.__c=_=new N(v,b):(e.__c=_=new q(v,b),_.constructor=N,_.render=ut),y&&y.sub(_),_.props=v,_.state||(_.state={}),_.context=b,_.__n=r,f=_.__d=!0,_.__h=[],_._sb=[]),m&&null==_.__s&&(_.__s=_.state),m&&null!=N.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=j({},_.__s)),j(_.__s,N.getDerivedStateFromProps(v,_.__s))),p=_.props,h=_.state,_.__v=e,f)m&&null==N.getDerivedStateFromProps&&null!=_.componentWillMount&&_.componentWillMount(),m&&null!=_.componentDidMount&&_.__h.push(_.componentDidMount);else{if(m&&null==N.getDerivedStateFromProps&&v!==p&&null!=_.componentWillReceiveProps&&_.componentWillReceiveProps(v,b),!_.__e&&null!=_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(v,_.__s,b)||e.__v==n.__v){for(e.__v!=n.__v&&(_.props=v,_.state=_.__s,_.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(t){t&&(t.__=e)}),P=0;P<_._sb.length;P++)_.__h.push(_._sb[P]);_._sb=[],_.__h.length&&s.push(_);break t}null!=_.componentWillUpdate&&_.componentWillUpdate(v,_.__s,b),m&&null!=_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(p,h,d)})}if(_.context=b,_.props=v,_.__P=t,_.__e=!1,x=w.__r,S=0,m){for(_.state=_.__s,_.__d=!1,x&&x(e),u=_.render(_.props,_.state,_.context),k=0;k<_._sb.length;k++)_.__h.push(_._sb[k]);_._sb=[]}else do{_.__d=!1,x&&x(e),u=_.render(_.props,_.state,_.context),_.state=_.__s}while(_.__d&&++S<25);_.state=_.__s,null!=_.getChildContext&&(r=j(j({},r),_.getChildContext())),m&&!f&&null!=_.getSnapshotBeforeUpdate&&(d=_.getSnapshotBeforeUpdate(p,h)),E=u,null!=u&&u.type===V&&null==u.key&&(E=st(u.props.children)),a=K(t,H(E)?E:[E],e,n,r,i,o,s,a,l,c),_.base=e.__e,e.__u&=-161,_.__h.length&&s.push(_),g&&(_.__E=_.__=null)}catch(t){if(e.__v=null,l||null!=o)if(t.then){for(e.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else{for(C=o.length;C--;)B(o[C]);it(e)}else e.__e=n.__e,e.__k=n.__k,t.then||it(e);w.__e(t,e,n)}else null==o&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=at(n.__e,e,n,r,i,o,s,l,c);return(u=w.diffed)&&u(e),128&e.__u?void 0:a}function it(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(it)}function ot(t,e,n){for(var r=0;r<n.length;r++)lt(n[r],n[++r],n[++r]);w.__c&&w.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){w.__e(t,e.__v)}})}function st(t){return"object"!=typeof t||null==t||t.__b&&t.__b>0?t:H(t)?t.map(st):j({},t)}function at(t,e,n,r,i,o,s,a,l){var c,u,_,f,p,h,d,g=n.props,v=e.props,m=e.type;if("svg"==m?i="http://www.w3.org/2000/svg":"math"==m?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=o)for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){t=p,o[c]=null;break}if(null==t){if(null==m)return document.createTextNode(v);t=document.createElementNS(i,m,v.is&&v),a&&(w.__m&&w.__m(e,o),a=!1),o=null}if(null==m)g===v||a&&t.data==v||(t.data=v);else{if(o=o&&b.call(t.childNodes),g=n.props||R,!a&&null!=o)for(g={},c=0;c<t.attributes.length;c++)g[(p=t.attributes[c]).name]=p.value;for(c in g)if(p=g[c],"children"==c);else if("dangerouslySetInnerHTML"==c)_=p;else if(!(c in v)){if("value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v)continue;et(t,c,null,p,i)}for(c in v)p=v[c],"children"==c?f=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?h=p:"checked"==c?d=p:a&&"function"!=typeof p||g[c]===p||et(t,c,p,g[c],i);if(u)a||_&&(u.__html==_.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(_&&(t.innerHTML=""),K("template"==e.type?t.content:t,H(f)?f:[f],e,n,r,"foreignObject"==m?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&z(n,0),a,l),null!=o)for(c=o.length;c--;)B(o[c]);a||(c="value","progress"==m&&null==h?t.removeAttribute("value"):null!=h&&(h!==t[c]||"progress"==m&&!h||"option"==m&&h!=g[c])&&et(t,c,h,g[c],i),c="checked",null!=d&&d!=t[c]&&et(t,c,d,g[c],i))}return t}function lt(t,e,n){try{if("function"==typeof t){var r="function"==typeof t.__u;r&&t.__u(),r&&null==e||(t.__u=t(e))}else t.current=e}catch(t){w.__e(t,n)}}function ct(t,e,n){var r,i;if(w.unmount&&w.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||lt(r,null,e)),null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(t){w.__e(t,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&ct(r[i],e,n||"function"!=typeof t.type);n||B(t.__e),t.__c=t.__=t.__e=void 0}function ut(t,e,n){return this.constructor(t,n)}function _t(t,e,n){var r,i,o;e==document&&(e=document.documentElement),w.__&&w.__(t,e),r=!1?null:e.__k,i=[],o=[],rt(e,t=e.__k=M(V,null,[t]),r||R,R,e.namespaceURI,r?null:e.firstChild?b.call(e.childNodes):null,i,r?r.__e:e.firstChild,false,o),ot(i,t,o)}b=$.slice,w={__e:function(t,e,n,r){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},P=0,x=function(t){return null!=t&&null==t.constructor},q.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=j({},this.state),"function"==typeof t&&(t=t(j({},n),this.props)),t&&j(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),J(this))},q.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),J(this))},q.prototype.render=V,S=[],E="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,C=function(t,e){return t.__v.__b-e.__v.__b},Z.__r=0,N=/(PointerCapture)$|Capture$/i,L=0,A=nt(!1),I=nt(!0),D=0;class ft extends v{_columns;constructor(){super(),this._columns=[]}get columns(){return this._columns}set columns(t){this._columns=t}get visibleColumns(){return this._columns.filter(t=>!t.hidden)}setID(t){const e=t||this.columns||[];for(const t of e)t.id||"string"!=typeof t.name||(t.id=m(t.name)),t.id||O.error('Could not find a valid ID for one of the columns. Make sure a valid "id" is set for all columns.')}populatePlugins(e,n){for(const r of n)void 0!==r.plugin&&e.add({...r.plugin,position:t.PluginPosition.Cell})}static createFromConfig(t){const e=new ft;if(t.options.columns?e.columns=ft.fromColumns(t.options.columns).columns:ft.isJsonPayload(t.options.data)&&(e.columns=Object.keys(t.options.data[0]).map(t=>({name:t}))),e.columns.length)return e.setID(),e.populatePlugins(t.internal.plugin,e.columns),e}static leafColumns(t){let e=[];const n=t||[];if(n&&n.length)for(const t of n)e.push(t);return e}static tabularFormat(t){return t.length?[t]:[]}static isJsonPayload(t){return!!t&&t instanceof Array&&"object"==typeof t[0]&&!(t[0]instanceof Array)}static fromColumns(t){const e=new ft;for(const n of t)if("string"==typeof n||x(n))e.columns.push({name:n});else if("object"==typeof n){const t=n;e.columns.push(t)}return e}}!function(t){t[t.Init=0]="Init",t[t.Loading=1]="Loading",t[t.Loaded=2]="Loaded",t[t.Rendered=3]="Rendered",t[t.Error=4]="Error"}(U||(U={}));class pt{}class ht extends pt{data=()=>[];beforeDataLoad;constructor(t,e){super(),this.set(t),this.beforeDataLoad=e}async get(){g.isFunction(this.beforeDataLoad)&&this.beforeDataLoad();const t=await this.data();return{data:t,total:t.length}}set(t){return t instanceof Array?this.data=()=>t:t instanceof Function&&(this.data=t),this}}class dt extends pt{options;beforeDataLoad;constructor(t,e){super(),this.options=t,this.beforeDataLoad=e}handler(t){return"function"==typeof this.options.handle?this.options.handle(t):Promise.resolve(t)}async get(t){const e={...this.options,...t},n={url:e.url,data:g.encodeFormData(e.body||{}),...e.param};return g.isFunction(e.data)?e.data(e):(!g.isFunction(e.param?.beforeSend)&&g.isFunction(this.beforeDataLoad)&&(n.beforeSend=this.beforeDataLoad),await g.fetchData(n).then(this.handler.bind(this)).then(t=>({data:e.processData?e.processData(t):[],total:"function"==typeof e.total?e.total(t):0})).catch(t=>(O.error(`Error in get method: ${t.message}`,!0),Promise.reject(t))))}}class gt{static createFromConfig(t){let e=null;if(t.options.data&&(e=new ht(t.options.data,t.options.beforeDataLoad)),t.options.server&&(e=new dt(t.options.server,t.options.beforeDataLoad)),!e)throw new Error("Could not determine the storage type");return e}}!function(t){t[t.Initiator=0]="Initiator",t[t.ServerLimit=1]="ServerLimit",t[t.Extractor=2]="Extractor",t[t.Transformer=3]="Transformer",t[t.Limit=4]="Limit"}(T||(T={}));var vt=new class{format(t,e){return`[Pipeline-JS] [${e.toUpperCase()}]: ${t}`}error(t,e=!1){const n=this.format(t,"error");if(e)throw Error(n);console.error(n)}warn(t){console.warn(this.format(t,"warn"))}info(t){console.info(this.format(t,"info"))}};let mt=class{callbacks={};init(t){t&&!this.callbacks[t]&&(this.callbacks[t]=[])}checkListener(t){if("function"!=typeof t)throw new TypeError("The listener must be a function")}hasEvent(t){return void 0!==this.callbacks[t]}listeners(){return this.callbacks}addListener(t,e){return this.on(t,e)}clearListener(t){return t?this.callbacks[t]=[]:this.callbacks={},this}on(t,e){return this.checkListener(e),this.init(t),this.callbacks[t].push(e),this}off(t,e){e&&this.checkListener(e);const n=t;return this.init(),this.callbacks[n]&&0!==this.callbacks[n].length?(this.callbacks[n]=e?this.callbacks[n].filter(t=>t!==e):[],this):this}emit(t,...e){const n=t;if(this.init(n),this.callbacks[n].length<=0)return!1;const r=this.callbacks[n].map(t=>{try{const n=t(...e);return n instanceof Promise?n:Promise.resolve(n)}catch(t){return console.error(`Error in event listener for event: ${n}`,t),Promise.resolve()}});return!r.some(t=>t instanceof Promise)||Promise.all(r).then(()=>!0).catch(t=>(console.error(`Error handling promises for event: ${n}`,t),!1))}once(t,e){this.checkListener(e);const n=(...r)=>{const i=e(...r);return this.off(t,n),i instanceof Promise?i:Promise.resolve(i)};return this.on(t,n)}};class yt extends mt{_steps=new Map;cache=new Map;lastProcessorIndexUpdated=-1;constructor(t){super(),t&&t.forEach(t=>this.register(t))}clearCache(){this.cache=new Map,this.lastProcessorIndexUpdated=-1}register(t,e=-1){if(!t)throw Error("Processor is not defined");if(null===t.type)throw Error("Processor type is not defined");if(this.findProcessorIndexByID(t.id)>-1)throw Error(`Processor ID ${t.id} is already defined`);return t.on("propsUpdated",this.processorPropsUpdated.bind(this,t)),this.addProcessorByPriority(t,e),this.afterRegistered(t),t}tryRegister(t,e=-1){try{return this.register(t,e)}catch(t){return}}unregister(t){if(!t)return;if(-1===this.findProcessorIndexByID(t.id))return;const e=this._steps.get(t.type);e&&e.length&&(this._steps.set(t.type,e.filter(e=>e.id!==t.id)),t.off("propsUpdated",this.processorPropsUpdated.bind(this,t)),this.emit("updated",t))}addProcessorByPriority(t,e=-1){let n=this._steps.get(t.type);if(!n){const e=[];this._steps.set(t.type,e),n=e}e<0||e>=n.length?n.push(t):n.splice(e,0,t)}get steps(){let t=[];for(const e of this.getSortedProcessorTypes()){const n=this._steps.get(e);n&&n.length&&(t=t.concat(n))}return t.filter(t=>t)}getStepsByType(t){return this.steps.filter(e=>e.type===t)}getSortedProcessorTypes(){return Array.from(this._steps.keys()).sort((t,e)=>Number(t)-Number(e))}async process(t){const e=this.lastProcessorIndexUpdated,n=this.steps;let r=t;try{for(const t of n){this.findProcessorIndexByID(t.id)>=e?(r=await t.process(r),this.cache.set(t.id,r)):(r=this.cache.get(t.id),void 0===r&&(r=await t.process(r)))}}catch(t){throw vt.error(t),this.emit("error",r),t}return this.lastProcessorIndexUpdated=n.length,this.emit("afterProcess",r),r}async processInParallel(t){const e=this.steps,n=await Promise.all(e.map(e=>e.process(t)));return n.forEach((t,n)=>this.cache.set(e[n].id,t)),this.lastProcessorIndexUpdated=e.length,this.emit("afterProcess",n),n}clearProcessors(){this._steps.clear(),this.clearCache()}getProcessorByID(t){const e=this.findProcessorIndexByID(t);return e>-1?this.steps[e]:null}findProcessorIndexByID(t){return this.steps.findIndex(e=>e.id==t)}async runProcessorByID(t,e,n=!0){const r=this.findProcessorIndexByID(t);if(-1===r)throw Error(`Processor ID ${t} not found`);let i;return"boolean"==typeof e?n=e:i=e,n?(this.lastProcessorIndexUpdated=r,this.clearCacheAfterProcessorIndex(r)):this.cache.delete(t),i?this.process(i):this.process()}clearCacheAfterProcessorIndex(t){this.steps.slice(t).forEach(t=>{this.cache.delete(t.id)})}setLastProcessorIndex(t){const e=this.findProcessorIndexByID(t.id);this.lastProcessorIndexUpdated>e&&(this.lastProcessorIndexUpdated=e)}processorPropsUpdated(t){this.setLastProcessorIndex(t),this.emit("propsUpdated"),this.emit("updated",t)}afterRegistered(t){this.setLastProcessorIndex(t),this.emit("afterRegister"),this.emit("updated",t)}}function bt(t,e){if(typeof t!=typeof e)return!1;if(null===t||null===e)return t===e;if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return t===e;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((t,n)=>bt(t,e[n]));if(Array.isArray(t)||Array.isArray(e))return!1;if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,r]of t)if(!bt(r,e.get(n)))return!1;return!0}if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;const n=Reflect.ownKeys(t),r=Reflect.ownKeys(e);if(n.length!==r.length)return!1;for(const r of n)if(!bt(t[r],e[r]))return!1;return!0}class wt extends mt{id;name;static _statusTypes=["idle","running","completed"];_props;_status;constructor(t,e){super(),this._props={},this._status="idle",this.id="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}),this.name=e??this.constructor.name,t&&this.setProps(t)}async process(...t){this.validateProps instanceof Function&&this.validateProps(...t),this._status="running",this.emit("beforeProcess",...t);try{const e=await this._process(...t);return this._status="completed",this.emit("afterProcess",...t),e}catch(e){const n=e instanceof Error?e:new Error(String(e));throw this._status="idle",this.emit("error",n,...t),this.emit("afterProcess",...t),n}}setProps(t){const e={...this._props,...t};return bt(e,this._props)||(this._props=e,this.emit("propsUpdated",this)),this}get props(){return this._props}get status(){return this._status}}class Pt extends wt{get type(){return T.Extractor}async _process(t){return await this.props.storage.get(t)}}class xt extends wt{get type(){return T.Initiator}async _process(){return Object.entries(this.props.serverStorageOptions).filter(([t,e])=>"function"!=typeof e).reduce((t,[e,n])=>({...t,[e]:n}),{})}}class St extends wt{get type(){return T.Transformer}castData(t){if(!t||!t.length)return[];if(!this.props.header||!this.props.header.columns)return t;const e=ft.leafColumns(this.props.header.columns);return t[0]instanceof Array?t.map(t=>{let n=0;return e.map((e,r)=>void 0!==e.data?(n++,"function"==typeof e.data?e.data(t):e.data):t[r-n])}):"object"!=typeof t[0]||t[0]instanceof Array?[]:t.map(t=>e.map((e,n)=>void 0!==e.data?"function"==typeof e.data?e.data(t):e.data:e.id?t[e.id]:(O.error(`Could not find the correct cell for column at position ${n}. Make sure either 'id' or 'selector' is defined for all columns.`),null)))}async _process(t){return{data:this.castData(t.data),total:t.total}}}function kt(t){return M(t.parentElement||"span",{dangerouslySetInnerHTML:{__html:t.content}})}function Et(t,e){return M(kt,{content:t,parentElement:e})}class Ct extends v{data;constructor(t){super(),this.update(t)}cast(t){return t instanceof HTMLElement?Et(t.outerHTML):t}update(t){return this.data=this.cast(t),this}}class Nt extends v{_cells=[];constructor(t){super(),this.cells=t||[]}cell(t){return this._cells[t]}get cells(){return this._cells}set cells(t){this._cells=t}toArray(){return this.cells.map(t=>t.data)}static fromCells(t){return new Nt(t.map(t=>new Ct(t.data)))}get length(){return this.cells.length}}class Lt extends v{_rows=[];_length=0;constructor(t){super(),this.data=t instanceof Array?t:t instanceof Nt?[t]:[]}get data(){return this._rows}set data(t){this._rows=t}get length(){return this._length||this.data.length}set length(t){this._length=t}toArray(){return this.data.map(t=>t.toArray())}static fromRows(t){return new Lt(t.map(t=>Nt.fromCells(t.cells)))}static fromArray(t){return t=function(t){return!t[0]||t[0]instanceof Array?t:[t]}(t),new Lt(t.map(t=>new Nt(t.map(t=>new Ct(t)))))}}class At extends wt{get type(){return T.Transformer}async _process(t){const e=Lt.fromArray(t.data);return e.length=t.total,e}}class It{static createFromConfig(t){const e=new yt;return t.internal.storage instanceof dt&&e.register(new xt({serverStorageOptions:t.options.server})),e.register(new Pt({storage:t.internal.storage})),e.register(new St({header:t.internal.header})),e.register(new At),e}}var Dt={pagination:{previous:"Previous",next:"Next",ellipsis:"...",page:t=>`Page ${t}`},loading:"Loading...",noRecordsFound:"No matching records found",error:"An error happened while fetching the data"};class Ut{_language;_defaultLanguage;constructor(t){this._language=t,this._defaultLanguage=Dt}getString(t,e){if(!e||!t)return null;const n=t.split("."),r=n[0];if(e[r]){const t=e[r];return this.isValidElement(t)?t:"string"==typeof t?()=>t:"function"==typeof t?t:this.getString(n.slice(1).join("."),t)}return null}isValidElement(t){return x(t)}translate(t,...e){const n=this.getString(t,this._language);let r;return r=n||this.getString(t,this._defaultLanguage),r?"function"==typeof r?r(...e):r:t}}class Tt{plugins;constructor(){this.plugins=[]}get(t){return this.plugins.find(e=>e.id===t)}add(t){return t.id?this.get(t.id)?(O.error(`Duplicate plugin ID: ${t.id}`),this):(this.plugins.push({...t,props:t.props}),this):(O.error("Plugin ID cannot be empty"),this)}remove(t){const e=this.get(t);return e&&this.plugins.splice(this.plugins.indexOf(e),1),this}list(t){let e;return e=null!=t||null!=t?this.plugins.filter(e=>e.position===t):this.plugins,e.sort((t,e)=>t.order&&e.order?t.order-e.order:1)}}class Ot{state;listeners=[];isDispatching=!1;constructor(t){this.state=t}getState=()=>this.state;getListeners=()=>this.listeners;dispatch=t=>{if("function"!=typeof t)throw new Error("Reducer is not a function");if(this.isDispatching)throw new Error("Reducers may not dispatch actions");this.isDispatching=!0;const e=this.state;try{this.state=t(this.state)}finally{this.isDispatching=!1}for(const t of this.listeners)t(this.state,e);return this.state};subscribe=t=>{if("function"!=typeof t)throw new Error("Listener is not a function");return this.listeners=[...this.listeners,t],()=>this.listeners=this.listeners.filter(e=>e!==t)}}class Rt{internalConfig={};options={};constructor(){this.assign(Rt.defaultOption()),this.assignInteral(Rt.defaultConfig())}assign(t){return g.shallowMerge(this.options,t),this}assignInteral(t){return g.shallowMerge(this.internalConfig,t),this}update(t){return t?(this.assign(Rt.fromPartialOption({...this.options,...t})),this.assignInteral(Rt.fromPartialConfig(this)),this):this}get internal(){return this.internalConfig}static defaultConfig(){return{state:new Ot({status:U.Init,tabular:null,header:null}),plugin:new Tt}}static defaultOption(){return{position:"bottom",resetPageOnUpdate:!1,pageNumber:1,pageSize:10,pageRange:2,display:{showPrevious:!0,showNext:!0,showPageNumbers:!0,hideFirstOnEllipsisShow:!1,hideLastOnEllipsisShow:!1,autoHidePrevious:!1,autoHideNext:!1},className:{container:"",active:"active",disable:"disabled",pageList:"pages",pageButton:"page-item",prevButton:"page-prev",nextButton:"page-next"}}}static fromPartialConfig(t){return t.assignInteral({header:ft.createFromConfig(t)}),t.assignInteral({storage:gt.createFromConfig(t)}),t.assignInteral({pipeline:It.createFromConfig(t)}),t.assignInteral({translator:new Ut(t.options.language)}),t.internal.plugin=new Tt,t.options.plugins&&t.options.plugins.forEach(e=>t.internal.plugin.add(e)),t.internal}static fromPartialOption(t){return(new Rt).assign(t).options}}const $t=function(t){function e(t){var n,r;return this.getChildContext||(n=new Set,(r={})[e.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&n.forEach(function(t){t.__e=!0,J(t)})},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+D++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}(void 0);var Ft=0;function Ht(t,e,n,r,i,o){e||(e={});var s,a,l=e;if("ref"in l)for(a in l={},e)"ref"==a?s=e[a]:l[a]=e[a];var c={type:t,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ft,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return w.vnode&&w.vnode(c),c}function jt(...t){return`paginatorjs${t.reduce((t,e)=>`${t}-${e}`,"")}`}function Bt(...t){return t.map(t=>t?t.toString():"").filter(t=>t).reduce((t,e)=>`${t||""} ${e}`,"").trim()}const Mt=({page:t,isActive:e,onClick:n,option:r,lang:i,text:o})=>{const s=o||i("pagination.page",t),a=g.isString(s)?s:"";return Ht("button",{tabIndex:0,role:"button",type:"button",onClick:n,className:Bt(e?Bt(jt("currentPage"),r.className.active):"",r.className.pageButton),title:a,"aria-label":a,children:i(`${t}`)})},Wt=({option:t,lang:e})=>Ht("button",{tabIndex:-1,disabled:!0,className:Bt(jt("spread"),t.className.pageButton,t.className.disable),children:e("pagination.ellipsis")}),Vt=({act:t,onClick:e,option:n,text:r})=>{const i=g.isString(r)?r:"";return Ht("button",{tabIndex:0,role:"button",type:"button",onClick:e,className:Bt(n.className.pageButton,"prevBtn"===t?n.className.prevButton:n.className.nextButton),title:i,"aria-label":i,children:r})},qt=({act:t,option:e,text:n})=>{const r=g.isString(n)?n:"";return Ht("button",{tabIndex:-1,disabled:!0,className:Bt(jt("disabled"),e.className.pageButton,"prevBtn"===t?e.className.prevButton:e.className.nextButton,e.className.disable),title:r,"aria-label":r,children:n})};var zt,Gt,Jt,Zt,Kt=0,Qt=[],Xt=w,Yt=Xt.__b,te=Xt.__r,ee=Xt.diffed,ne=Xt.__c,re=Xt.unmount,ie=Xt.__;function oe(t,e){Xt.__h&&Xt.__h(Gt,t,Kt||e),Kt=0;var n=Gt.__H||(Gt.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function se(t){return Kt=1,ae(be,t)}function ae(t,e,n){var r=oe(zt++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):be(void 0,e),function(t){var e=r.__N?r.__N[0]:r.__[0],n=r.t(e,t);e!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Gt,!Gt.__f)){var i=function(t,e,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(t){return!!t.__c});if(i.every(function(t){return!t.__N}))return!o||o.call(this,t,e,n);var s=r.__c.props!==t;return i.forEach(function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(s=!0)}}),o&&o.call(this,t,e,n)||s};Gt.__f=!0;var o=Gt.shouldComponentUpdate,s=Gt.componentWillUpdate;Gt.componentWillUpdate=function(t,e,n){if(this.__e){var r=o;o=void 0,i(t,e,n),o=r}s&&s.call(this,t,e,n)},Gt.shouldComponentUpdate=i}return r.__N||r.__}function le(t,e){var n=oe(zt++,3);!Xt.__s&&ye(n.__H,e)&&(n.__=t,n.u=e,Gt.__H.__h.push(n))}function ce(t){return Kt=5,_e(function(){return{current:t}},[])}function ue(t,e,n){Kt=6,function(t,e){var n=oe(zt++,4);!Xt.__s&&ye(n.__H,e)&&(n.__=t,n.u=e,Gt.__h.push(n))}(function(){if("function"==typeof t){var n=t(e());return function(){t(null),n&&"function"==typeof n&&n()}}if(t)return t.current=e(),function(){return t.current=null}},null==n?n:n.concat(t))}function _e(t,e){var n=oe(zt++,7);return ye(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function fe(t,e){return Kt=8,_e(function(){return t},e)}function pe(t){var e=Gt.context[t.__c],n=oe(zt++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(Gt)),e.props.value):t.__}function he(){for(var t;t=Qt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ve),t.__H.__h.forEach(me),t.__H.__h=[]}catch(e){t.__H.__h=[],Xt.__e(e,t.__v)}}Xt.__b=function(t){Gt=null,Yt&&Yt(t)},Xt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ie&&ie(t,e)},Xt.__r=function(t){te&&te(t),zt=0;var e=(Gt=t.__c).__H;e&&(Jt===Gt?(e.__h=[],Gt.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(ve),e.__h.forEach(me),e.__h=[],zt=0)),Jt=Gt},Xt.diffed=function(t){ee&&ee(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Qt.push(e)&&Zt===Xt.requestAnimationFrame||((Zt=Xt.requestAnimationFrame)||ge)(he)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Jt=Gt=null},Xt.__c=function(t,e){e.some(function(t){try{t.__h.forEach(ve),t.__h=t.__h.filter(function(t){return!t.__||me(t)})}catch(n){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Xt.__e(n,t.__v)}}),ne&&ne(t,e)},Xt.unmount=function(t){re&&re(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(t){try{ve(t)}catch(t){e=t}}),n.__H=void 0,e&&Xt.__e(e,n.__v))};var de="function"==typeof requestAnimationFrame;function ge(t){var e,n=function(){clearTimeout(r),de&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);de&&(e=requestAnimationFrame(n))}function ve(t){var e=Gt,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),Gt=e}function me(t){var e=Gt;t.__c=t.__(),Gt=e}function ye(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function be(t,e){return"function"==typeof e?e(t):e}const we=()=>{const t=pe($t);if(void 0===t)throw new Error("useOption must be used within a ConfigProvider");return t.options},Pe=()=>{const t=pe($t);if(void 0===t)throw new Error("useConfig must be used within a ConfigProvider");return t.internal};function xe(){const t=Pe();return function(e,...n){return t.translator.translate(e,...n)}}class Se extends wt{validateProps(){if(isNaN(Number(this.props.limit))||isNaN(Number(this.props.page)))throw Error("Invalid parameters passed")}get type(){return T.Limit}async _process(t){const e=this.props.page,n=this.props.limit,r=t.data.length,i=n*(e-1)+1,o=Math.min(e*n,r);return new Lt(t.data.slice(i-1,o))}}class ke extends wt{get type(){return T.ServerLimit}async _process(t){const e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.page,this.props.limit)),this.props.body&&(e.body=this.props.body(t.body,this.props.page,this.props.limit)),{...t,...e}}}const Ee=Symbol.for("preact-signals");function Ce(){if(Ie>1)return void Ie--;let t,e=!1;for(;void 0!==Le;){let n=Le;for(Le=void 0,De++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&$e(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=r}}if(De=0,Ie--,e)throw t}let Ne,Le;function Ae(t){const e=Ne;Ne=void 0;try{return t()}finally{Ne=e}}let Ie=0,De=0,Ue=0;function Te(t){if(void 0===Ne)return;let e=t.n;return void 0===e||e.t!==Ne?(e={i:0,S:t,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:e},void 0!==Ne.s&&(Ne.s.n=e),Ne.s=e,t.n=e,32&Ne.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=Ne.s,e.n=void 0,Ne.s.n=e,Ne.s=e),e):void 0}function Oe(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function Re(t,e){return new Oe(t,e)}function $e(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Fe(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function He(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t}t.s=e}function je(t,e){Oe.call(this,void 0),this.x=t,this.s=void 0,this.g=Ue-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function Be(t,e){return new je(t,e)}function Me(t){const e=t.u;if(t.u=void 0,"function"==typeof e){Ie++;const n=Ne;Ne=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,We(t),e}finally{Ne=n,Ce()}}}function We(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Me(t)}function Ve(t){if(Ne!==this)throw new Error("Out-of-order effect");He(this),Ne=t,this.f&=-2,8&this.f&&We(this),Ce()}function qe(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==e?void 0:e.name}function ze(t,e){const n=new qe(t,e);try{n.c()}catch(t){throw n.d(),t}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}Oe.prototype.brand=Ee,Oe.prototype.h=function(){return!0},Oe.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:Ae(()=>{var t;null==(t=this.W)||t.call(this)}))},Oe.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&Ae(()=>{var t;null==(t=this.Z)||t.call(this)}))}},Oe.prototype.subscribe=function(t){return ze(()=>{const e=this.value,n=Ne;Ne=void 0;try{t(e)}finally{Ne=n}},{name:"sub"})},Oe.prototype.valueOf=function(){return this.value},Oe.prototype.toString=function(){return this.value+""},Oe.prototype.toJSON=function(){return this.value},Oe.prototype.peek=function(){const t=Ne;Ne=void 0;try{return this.value}finally{Ne=t}},Object.defineProperty(Oe.prototype,"value",{get(){const t=Te(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(De>100)throw new Error("Cycle detected");this.v=t,this.i++,Ue++,Ie++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Ce()}}}}),je.prototype=new Oe,je.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Ue)return!0;if(this.g=Ue,this.f|=1,this.i>0&&!$e(this))return this.f&=-2,!0;const t=Ne;try{Fe(this),Ne=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Ne=t,He(this),this.f&=-2,!0},je.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t)}Oe.prototype.S.call(this,t)},je.prototype.U=function(t){if(void 0!==this.t&&(Oe.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t)}},je.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N()}},Object.defineProperty(je.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=Te(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),qe.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t)}finally{t()}},qe.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Me(this),Fe(this),Ie++;const t=Ne;return Ne=this,Ve.bind(this,t)},qe.prototype.N=function(){2&this.f||(this.f|=2,this.o=Le,Le=this)},qe.prototype.d=function(){this.f|=8,1&this.f||We(this)},qe.prototype.dispose=function(){this.d()};let Ge,Je,Ze=[];function Ke(t,e){w[t]=e.bind(null,w[t]||(()=>{}))}function Qe(t){Je&&Je(),Je=t&&t.S()}function Xe({data:t}){const e=tn(t);e.value=t;const[n,r]=_e(()=>{let t=this,n=this.__v;for(;n=n.__;)if(n.__c){n.__c.__$f|=4;break}const r=Be(()=>{let t=e.value.value;return 0===t?0:!0===t?"":t||""}),i=Be(()=>!Array.isArray(r.value)&&!x(r.value)),o=ze(function(){if(this.N=rn,i.value){const e=r.value;t.__v&&t.__v.__e&&3===t.__v.__e.nodeType&&(t.__v.__e.data=e)}}),s=this.__$u.d;return this.__$u.d=function(){o(),s.call(this)},[i,r]},[]);return n.value?r.peek():r.value}function Ye(t,e,n,r){const i=e in t&&void 0===t.ownerSVGElement,o=Re(n);return{o:(t,e)=>{o.value=t,r=e},d:ze(function(){this.N=rn;const n=o.value.value;r[e]!==n&&(r[e]=n,i?t[e]=n:n?t.setAttribute(e,n):t.removeAttribute(e))})}}function tn(t,e){return se(()=>Re(t,e))[0]}ze(function(){Ge=this.N})(),Xe.displayName="ReactiveTextNode",Object.defineProperties(Oe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Xe},props:{configurable:!0,get(){return{data:this}}},__b:{configurable:!0,value:1}}),Ke("__b",(t,e)=>{if("function"==typeof e.type&&"undefined"!=typeof window&&window.__PREACT_SIGNALS_DEVTOOLS__&&window.__PREACT_SIGNALS_DEVTOOLS__.exitComponent(),"string"==typeof e.type){let t,n=e.props;for(let r in n){if("children"===r)continue;let i=n[r];i instanceof Oe&&(t||(e.__np=t={}),t[r]=i,n[r]=i.peek())}}t(e)}),Ke("__r",(t,e)=>{if("function"==typeof e.type&&"undefined"!=typeof window&&window.__PREACT_SIGNALS_DEVTOOLS__&&window.__PREACT_SIGNALS_DEVTOOLS__.enterComponent(e),e.type!==V){Qe();let t,n=e.__c;n&&(n.__$f&=-2,t=n.__$u,void 0===t&&(n.__$u=t=function(){let t;return ze(function(){t=this}),t.c=()=>{n.__$f|=1,n.setState({})},t}())),Qe(t)}t(e)}),Ke("__e",(t,e,n,r)=>{"undefined"!=typeof window&&window.__PREACT_SIGNALS_DEVTOOLS__&&window.__PREACT_SIGNALS_DEVTOOLS__.exitComponent(),Qe(),t(e,n,r)}),Ke("diffed",(t,e)=>{let n;if("function"==typeof e.type&&"undefined"!=typeof window&&window.__PREACT_SIGNALS_DEVTOOLS__&&window.__PREACT_SIGNALS_DEVTOOLS__.exitComponent(),Qe(),"string"==typeof e.type&&(n=e.__e)){let t=e.__np,r=e.props;if(t){let e=n.U;if(e)for(let n in e){let r=e[n];void 0===r||n in t||(r.d(),e[n]=void 0)}else e={},n.U=e;for(let i in t){let o=e[i],s=t[i];void 0===o?(o=Ye(n,i,s,r),e[i]=o):o.o(s,r)}}}t(e)}),Ke("unmount",(t,e)=>{if("string"==typeof e.type){let t=e.__e;if(t){const e=t.U;if(e){t.U=void 0;for(let t in e){let n=e[t];n&&n.d()}}}}else{let t=e.__c;if(t){const e=t.__$u;e&&(t.__$u=void 0,e.d())}}t(e)}),Ke("__h",(t,e,n,r)=>{(r<3||9===r)&&(e.__$f|=2),t(e,n,r)}),q.prototype.shouldComponentUpdate=function(t,e){const n=this.__$u,r=n&&void 0!==n.s;for(let t in e)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){const t=2&this.__$f;if(!(r||t||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(let e in t)if("__source"!==e&&t[e]!==this.props[e])return!0;for(let e in this.props)if(!(e in t))return!0;return!1};const en=t=>{queueMicrotask(()=>{queueMicrotask(t)})};function nn(){!function(t){if(Ie>0)return t();Ie++;try{return t()}finally{Ce()}}(()=>{let t;for(;t=Ze.shift();)Ge.call(t)})}function rn(){1===Ze.push(this)&&(w.requestAnimationFrame||en)(nn)}function on(t,e){for(var n in e)t[n]=e[n];return t}function sn(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var r in e)if("__source"!==r&&t[r]!==e[r])return!0;return!1}function an(t,e){this.props=t,this.context=e}(an.prototype=new q).isPureReactComponent=!0,an.prototype.shouldComponentUpdate=function(t,e){return sn(this.props,t)||sn(this.state,e)};var ln=w.__b;w.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),ln&&ln(t)};var cn="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var un=w.__e;w.__e=function(t,e,n,r){if(t.then)for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),i.__c(t,e);un(t,e,n,r)};var _n=w.unmount;function fn(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(t){"function"==typeof t.__c&&t.__c()}),t.__c.__H=null),null!=(t=on({},t)).__c&&(t.__c.__P===n&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return fn(t,e,n)})),t}function pn(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return pn(t,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function hn(){this.__u=0,this.o=null,this.__b=null}function dn(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function gn(){this.i=null,this.l=null}w.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),_n&&_n(t)},(hn.prototype=new q).__c=function(t,e){var n=e.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=dn(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var t=r.state.__a;r.__v.__k[0]=pn(t,t.__c.__P,t.__c.__O)}var e;for(r.setState({__a:r.__b=null});e=r.o.pop();)e.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(s,s)},hn.prototype.componentWillUnmount=function(){this.o=[]},hn.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=fn(this.__b,n,r.__O=r.__P)}this.__b=null}var i=e.__a&&M(V,null,t.fallback);return i&&(i.__u&=-33),[M(V,null,e.__a?null:t.children),i]};var vn=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};(gn.prototype=new q).__a=function(t){var e=this,n=dn(e.__v),r=e.l.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),vn(e,t,r)):i()};n?n(o):o()}},gn.prototype.render=function(t){this.i=null,this.l=new Map;var e=X(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},gn.prototype.componentDidUpdate=gn.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){vn(t,n,e)})};var mn="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,yn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,bn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wn=/[A-Z0-9]/g,Pn="undefined"!=typeof document,xn=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(t)};q.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(q.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Sn=w.event;function kn(){}function En(){return this.cancelBubble}function Cn(){return this.defaultPrevented}w.event=function(t){return Sn&&(t=Sn(t)),t.persist=kn,t.isPropagationStopped=En,t.isDefaultPrevented=Cn,t.nativeEvent=t};var Nn={enumerable:!1,configurable:!0,get:function(){return this.class}},Ln=w.vnode;w.vnode=function(t){"string"==typeof t.type&&function(t){var e=t.props,n=t.type,r={},i=-1===n.indexOf("-");for(var o in e){var s=e[o];if(!("value"===o&&"defaultValue"in e&&null==s||Pn&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var a=o.toLowerCase();"defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===s?s="":"translate"===a&&"no"===s?s=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?o="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||xn(e.type)?"onfocus"===a?o="onfocusin":"onblur"===a?o="onfocusout":bn.test(o)&&(o=a):a=o="oninput":i&&yn.test(o)?o=o.replace(wn,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===a&&r[o=a]&&(o="oninputCapture"),r[o]=s}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=X(e.children).forEach(function(t){t.props.selected=-1!=r.value.indexOf(t.props.value)})),"select"==n&&null!=r.defaultValue&&(r.value=X(e.children).forEach(function(t){t.props.selected=r.multiple?-1!=r.defaultValue.indexOf(t.props.value):r.defaultValue==t.props.value})),e.class&&!e.className?(r.class=e.class,Object.defineProperty(r,"className",Nn)):(e.className&&!e.class||e.class&&e.className)&&(r.class=r.className=e.className),t.props=r}(t),t.$$typeof=mn,Ln&&Ln(t)};var An