@plank-cms/plank 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ Error generating stack: `+e.message+`
9
9
  `).replace(Fd,``)}function Ld(e,t){return t=Id(t),Id(e)===t}function Rd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Gt(e,r,o);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Rd(e,t,`name`,a.name,a,null),Rd(e,t,`formEncType`,a.formEncType,a,null),Rd(e,t,`formMethod`,a.formMethod,a,null),Rd(e,t,`formTarget`,a.formTarget,a,null)):(Rd(e,t,`encType`,a.encType,a,null),Rd(e,t,`method`,a.method,a,null),Rd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Yt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:wd(`beforetoggle`,e),wd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=qt.get(n)||n,Tt(e,n,r))}}function zd(e,t,n,r,a,o){switch(n){case`style`:Gt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[it]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Bd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:wd(`error`,e),wd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,o,s,n,null)}}a&&Rd(e,t,`srcSet`,n.srcSet,n,null),r&&Rd(e,t,`src`,n.src,n,null);return;case`input`:wd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Rd(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in wd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Rd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in wd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Rd(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Rd(e,t,l,r,n,null)}return;case`dialog`:wd(`beforetoggle`,e),wd(`toggle`,e),wd(`cancel`,e),wd(`close`,e);break;case`iframe`:case`object`:wd(`load`,e);break;case`video`:case`audio`:for(r=0;r<xd.length;r++)wd(xd[r],e);break;case`image`:wd(`error`,e),wd(`load`,e);break;case`details`:wd(`toggle`,e);break;case`embed`:case`source`:case`link`:wd(`error`,e),wd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&zd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Rd(e,t,c,r,n,null))}function Vd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Rd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Rd(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Rd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Rd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Rd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Rd(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Rd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Rd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Rd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Rd(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&zd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||zd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Rd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Rd(e,t,f,p,r,m)}function Hd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ud(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Hd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Wd=null,Gd=null;function Kd(e){return e.nodeType===9?e:e.ownerDocument}function qd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Jd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Yd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xd=null;function Zd(){var e=window.event;return e&&e.type===`popstate`?e===Xd?!1:(Xd=e,!0):(Xd=null,!1)}var Qd=typeof setTimeout==`function`?setTimeout:void 0,$d=typeof clearTimeout==`function`?clearTimeout:void 0,ef=typeof Promise==`function`?Promise:void 0,tf=typeof queueMicrotask==`function`?queueMicrotask:ef===void 0?Qd:function(e){return ef.resolve(null).then(e).catch(nf)};function nf(e){setTimeout(function(){throw e})}function rf(e){return e===`head`}function af(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),zp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)yf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,yf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&yf(e.ownerDocument.body);n=i}while(n);zp(t)}function of(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:sf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ut])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=mf(e.nextSibling),e===null)break}return null}function lf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mf(e.nextSibling),e===null))return null;return e}function uf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mf(e.nextSibling),e===null))return null;return e}function df(e){return e.data===`$?`||e.data===`$~`}function ff(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function mf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var hf=null;function gf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _f(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function vf(e,t,n){switch(t=Kd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function yf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var bf=new Map,xf=new Set;function Sf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Cf=L.d;L.d={f:wf,r:Tf,D:Of,C:kf,L:Af,m:jf,X:Nf,S:Mf,M:Pf};function wf(){var e=Cf.f(),t=Cu();return e||t}function Tf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Cf.r(e)}var Ef=typeof document>`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}bf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!bf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=ht(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);gt(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ie.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Ft(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),gt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Ft(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Bd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=Rf(n),(a=bf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,gt(a),a):(r=n,(a=bf.get(o))&&(r=m({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Kf=null;function qf(e,t,n){if(Kf===null){var r=new Map,i=Kf=new Map;i.set(n,r)}else i=Kf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ut]||a[rt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Wf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&np(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Qf===0&&(Qf=62500*Ud());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&np(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ep.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ip={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ap(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function op(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ap(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ai(3,null,null,t),e.current=a,a.stateNode=e,t=aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function sp(e){return e?(e=ri,e):ri}function cp(e,t,n,r,i,a){i=sp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ba(e,r,t),n!==null&&(vu(n,e,t),Va(n,e,t))}function lp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function up(e,t){lp(e,t),(e=e.alternate)&&lp(e,t)}function dp(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&vu(t,e,67108864),up(e,67108864)}}function fp(e){if(e.tag===13||e.tag===31){var t=gu();t=Qe(t);var n=ei(e,t);n!==null&&vu(n,e,t),up(e,t)}}var pp=!0;function mp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function hp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function gp(e,t,n,r){if(pp){var i=_p(r);if(i===null)kd(e,t,r,vp,n),kp(e,r);else if(jp(i,e,t,n,r))r.stopPropagation();else if(kp(e,r),t&4&&-1<Op.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ve(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Pe(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Ll&6)&&(iu=Se()+500,cd(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&vu(s,a,2),Cu(),up(a,2)}if(a=_p(r),a===null&&kd(e,t,r,vp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else kd(e,t,r,null,n)}}function _p(e){return e=Qt(e),yp(e)}var vp=null;function yp(e){if(vp=null,e=ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vp=e,null}function bp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ce()){case we:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var xp=!1,Sp=null,Cp=null,wp=null,Tp=new Map,Ep=new Map,Dp=[],Op=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function kp(e,t){switch(e){case`focusin`:case`focusout`:Sp=null;break;case`dragenter`:case`dragleave`:Cp=null;break;case`mouseover`:case`mouseout`:wp=null;break;case`pointerover`:case`pointerout`:Tp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ep.delete(t.pointerId)}}function Ap(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=pt(t),t!==null&&dp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function jp(e,t,n,r,i){switch(t){case`focusin`:return Sp=Ap(Sp,e,t,n,r,i),!0;case`dragenter`:return Cp=Ap(Cp,e,t,n,r,i),!0;case`mouseover`:return wp=Ap(wp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Tp.set(a,Ap(Tp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ep.set(a,Ap(Ep.get(a)||null,e,t,n,r,i)),!0}return!1}function Mp(e){var t=ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Np(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_p(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zt=r,n.target.dispatchEvent(r),Zt=null}else return t=pt(n),t!==null&&dp(t),e.blockedOn=n,!1;t.shift()}return!0}function Pp(e,t,n){Np(e)&&n.delete(t)}function Fp(){xp=!1,Sp!==null&&Np(Sp)&&(Sp=null),Cp!==null&&Np(Cp)&&(Cp=null),wp!==null&&Np(wp)&&(wp=null),Tp.forEach(Pp),Ep.forEach(Pp)}function Ip(e,n){e.blockedOn===n&&(e.blockedOn=null,xp||(xp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fp)))}var Lp=null;function Rp(e){Lp!==e&&(Lp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Lp===e&&(Lp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(yp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function zp(e){function t(t){return Ip(t,e)}Sp!==null&&Ip(Sp,e),Cp!==null&&Ip(Cp,e),wp!==null&&Ip(wp,e),Tp.forEach(t),Ep.forEach(t);for(var n=0;n<Dp.length;n++){var r=Dp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Dp.length&&(n=Dp[0],n.blockedOn===null);)Mp(n),n.blockedOn===null&&Dp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[it]||null;if(typeof a==`function`)o||Rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(yp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Rp(n)}}}function Bp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Vp(e){this._internalRoot=e}Hp.prototype.render=Vp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;cp(n,gu(),e,t,null,null)},Hp.prototype.unmount=Vp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cp(e.current,2,null,e,null,null),Cu(),t[at]=null}};function Hp(e){this._internalRoot=e}Hp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dp.length&&t!==0&&t<Dp[n].priority;n++);Dp.splice(n,0,e),n===0&&Mp(e)}};var Up=n.version;if(Up!==`19.2.5`)throw Error(i(527,Up,`19.2.5`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Wp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gp.isDisabled&&Gp.supportsFiber)try{je=Gp.inject(Wp),Me=Gp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=op(e,1,!1,null,null,n,r,null,o,s,c,Bp),e[at]=t.current,Dd(e),new Vp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=l(h(),1),x=`modulepreload`,S=function(e){return`/admin/`+e},C={},w=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=S(t,n),t in C)return;C[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:x,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},T=e=>{throw TypeError(e)},E=(e,t,n)=>t.has(e)||T(`Cannot `+n),D=(e,t,n)=>(E(e,t,`read from private field`),n?n.call(e):t.get(e)),O=(e,t,n)=>t.has(e)?T(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),k=`popstate`;function A(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function j(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return I(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:L(t)}return ee(t,n,null,e)}function M(e,t){if(e===!1||e==null)throw Error(t)}function N(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function P(){return Math.random().toString(36).substring(2,10)}function F(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function I(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?R(t):t,state:n,key:t&&t.key||r||P(),unstable_mask:i}}function L({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function R(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ee(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=A(e)?e:I(h.location,e,t);n&&n(r,e),l=u()+1;let d=F(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=A(e)?e:I(h.location,e,t);n&&n(r,e),l=u();let i=F(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return te(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(k,d),c=e,()=>{i.removeEventListener(k,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function te(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),M(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:L(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var ne,z=class{constructor(e){if(O(this,ne,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(D(this,ne).has(e))return D(this,ne).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){D(this,ne).set(e,t)}};ne=new WeakMap;var B=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function re(e){return B.has(e)}var V=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function ie(e){return V.has(e)}function ae(e){return e.index===!0}function oe(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(M(e.index!==!0||!e.children,`Cannot specify children on an index route`),M(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),ae(e)){let n={...e,id:s};return r[s]=se(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=se(n,t(n)),e.children&&(n.children=oe(e.children,t,o,r,i)),n}})}function se(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ce(e,t,n=`/`){return le(e,t,n,!1)}function le(e,t,n,r){let i=De((typeof t==`string`?R(t):t).pathname||`/`,n);if(i==null)return null;let a=de(e);pe(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Ee(i);o=Ce(a[e],t,r)}return o}function ue(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function de(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;M(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Re([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(M(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),de(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:xe(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of fe(e.path))a(e,t,!0,n)}),t}function fe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=fe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function pe(e){e.sort((e,t)=>e.score===t.score?Se(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var me=/^:[\w-]+$/,he=3,ge=2,_e=1,ve=10,ye=-2,be=e=>e===`*`;function xe(e,t){let n=e.split(`/`),r=n.length;return n.some(be)&&(r+=ye),t&&(r+=ge),n.filter(e=>!be(e)).reduce((e,t)=>e+(me.test(t)?he:t===``?_e:ve),r)}function Se(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ce(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=we({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=we({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Re([a,u.pathname]),pathnameBase:Be(Re([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Re([a,u.pathnameBase]))}return o}function we(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Te(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Te(e,t=!1,n=!0){N(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ee(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return N(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function De(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Oe({basename:e,pathname:t}){return t===`/`?e:Re([e,t])}var ke=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ae=e=>ke.test(e);function je(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?R(e):e,a;return n?(n=Le(n),a=n.startsWith(`/`)?Me(n.substring(1),`/`):Me(n,t)):a=t,{pathname:a,search:Ve(r),hash:He(i)}}function Me(e,t){let n=ze(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ne(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Pe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Fe(e){let t=Pe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ie(e,t,n,r=!1){let i;typeof e==`string`?i=R(e):(i={...e},M(!i.pathname||!i.pathname.includes(`?`),Ne(`?`,`pathname`,`search`,i)),M(!i.pathname||!i.pathname.includes(`#`),Ne(`#`,`pathname`,`hash`,i)),M(!i.search||!i.search.includes(`#`),Ne(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=je(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Le=e=>e.replace(/\/\/+/g,`/`),Re=e=>Le(e.join(`/`)),ze=e=>e.replace(/\/+$/,``),Be=e=>ze(e).replace(/^\/*/,`/`),Ve=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,He=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ue=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function We(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ge(e){return Re(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function qe(e,t){let n=e;if(typeof n!=`string`||!ke.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=De(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{N(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var Je=Symbol(`Uninstrumented`);function Ye(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Ze(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Ze(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[Je]??i,a=Ze(n[e],t,(...e)=>$e(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[Je]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[Je]??e,r=Ze(n.middleware,t,(...e)=>$e(e[0]));return r?(r[Je]=t,r):e})),r}function Xe(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[Je]??e.navigate,r=Ze(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?L(n):`.`,...et(e,r??{})}});r&&(r[Je]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[Je]??e.fetch,r=Ze(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...et(e,i??{})}});r&&(r[Je]=t,e.fetch=r)}return e}function Ze(e,t,n){return e.length===0?null:async(...r)=>{let i=await Qe(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function Qe(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=Qe(e,t,n,r-1),a=await o,M(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function $e(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:tt(t),params:{...r},unstable_pattern:i,context:nt(n)}}function et(e,t){return{currentUrl:L(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function tt(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function nt(e){if(it(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var rt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function it(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===rt}var at=[`POST`,`PUT`,`PATCH`,`DELETE`],ot=new Set(at),st=[`GET`,...at],ct=new Set(st),lt=new Set([301,302,303,307,308]),ut=new Set([307,308]),dt={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ft={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},pt={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},mt=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ht=`remix-router-transitions`,gt=Symbol(`ResetLoaderData`);function _t(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;M(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||mt,a=i;if(e.unstable_instrumentations){let t=e.unstable_instrumentations;a=e=>({...i(e),...Ye(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=oe(e.routes,a,void 0,o),c,l=e.basename||`/`;l.startsWith(`/`)||(l=`/${l}`);let u=e.dataStrategy||Pt,d={unstable_passThroughRequests:!1,...e.future},f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=ce(s,e.history.location,l),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=an(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=rn(s);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&rt(v,s,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=rt(null,s,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>St(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=Ct(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:dt,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,P=!1,F=!1,L=new Set,ee=new Map,ne=0,B=-1,re=new Map,V=new Set,ie=new Map,ae=new Map,se=new Set,de=new Map,fe,pe=null;function me(){if(f=e.history.listen(({action:t,location:n,delta:r})=>{if(fe){fe(),fe=void 0;return}N(de.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ze({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{fe=e});e.history.go(r*-1),Je(i,{state:`blocked`,location:n,proceed(){Je(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,pt),_e({blockers:e})}}),E?.resolve(),E=null;return}return xe(t,n)}),n){kn(t,A);let e=()=>An(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||xe(`POP`,w.location,{initialHydration:!0}),C}function he(){f&&f(),j&&j(),p.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>ze(t)),w.blockers.forEach((e,t)=>qe(t))}function ge(e){return p.add(e),()=>p.delete(e)}function _e(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(se.has(t)?n.push(t):r.push(t))}),se.forEach(e=>{!w.fetchers.has(e)&&!ee.has(e)&&n.push(e)}),[...p].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>ze(e)),r.forEach(e=>w.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&bn(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?en(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,l=w.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,pt)));let u=P?!1:nt(t,n.matches||w.matches),d=D===!0||w.navigation.formMethod!=null&&bn(w.navigation.formMethod)&&t.state?._isRedirect!==!0;c&&=(s=c,void 0),P||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let f;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?f={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(f={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),f={currentLocation:w.location,nextLocation:t}}_e({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:dt,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),T=`POP`,D=!1,k=!1,P=!1,F=!1,E?.resolve(),E=null,pe?.resolve(),pe=null}async function ye(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=jn();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=bt(!1,yt(w.location,w.matches,l,t,n?.fromRouteId,n?.relative),n),o;n?.unstable_mask&&(o={pathname:``,search:``,hash:``,...typeof n.unstable_mask==`string`?R(n.unstable_mask):{...w.location.unstable_mask,...n.unstable_mask}});let s=w.location,c=I(s,r,n&&n.state,void 0,o);c={...c,...e.history.encodeLocation(c)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&bn(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ze({currentLocation:s,nextLocation:c,historyAction:d});if(m){Je(m,{state:`blocked`,location:c,proceed(){Je(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:c}),ye(t,n)},reset(){let e=new Map(w.blockers);e.set(m,pt),_e({blockers:e})}});return}await xe(d,c,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.unstable_defaultShouldRevalidate})}function be(){pe||=jn(),Pe(),_e({revalidation:`loading`});let e=pe.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(xe(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(xe(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function xe(t,n,r){O&&O.abort(),O=null,T=t,P=(r&&r.startUninterruptedRevalidation)===!0,tt(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=c||s,a=r&&r.overrideNavigation,o=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:ce(i,n,l),u=(r&&r.flushSync)===!0;if(o&&w.initialized&&!F&&cn(w.location,n)&&!(r&&r.submission&&bn(r.submission.formMethod))){ve(n,{matches:o},{flushSync:u});return}let d=rt(o,i,n.pathname);if(d.active&&d.matches&&(o=d.matches),!o){let{error:e,notFoundMatches:t,route:r}=Qe(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}O=new AbortController;let f=Jt(e.history,n,O.signal,r&&r.submission),p=e.getContext?await e.getContext():new z,m;if(r&&r.pendingError)m=[nn(o).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&bn(r.submission.formMethod)){let t=await Se(f,n,r.submission,o,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(pn(r)&&We(r.error)&&r.error.status===404){O=null,ve(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}o=t.matches||o,m=t.pendingActionResult,a=wn(n,r.submission),u=!1,d.active=!1,f=Jt(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:v}=await Ce(f,n,o,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m,r&&r.callSiteDefaultShouldRevalidate);h||(O=null,ve(n,{matches:g||o,...tn(m),loaderData:_,errors:v}))}async function Se(t,n,i,c,u,d,f,p={}){if(Pe(),_e({navigation:Tn(n,i)},{flushSync:p.flushSync===!0}),d){let e=await it(c,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=rn(s);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=nn(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)c=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Qe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let m,h=Sn(c,n);if(!h.route.action&&!h.route.lazy)m={type:`error`,error:an(405,{method:t.method,pathname:n.pathname,routeId:h.route.id})};else{let e=await Me(t,n,Bt(a,o,t,n,c,h,f?[]:r,u),u,null);if(m=e[h.route.id],!m){for(let t of c)if(e[t.route.id]){m=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(mn(m)){let n;return n=p&&p.replace!=null?p.replace:qt(m.response.headers.get(`Location`),new URL(t.url),l,e.history)===w.location.pathname+w.location.search,await je(t,m,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(pn(m)){let e=nn(c,h.route.id);return(p&&p.replace)!==!0&&(T=`PUSH`),{matches:c,pendingActionResult:[e.route.id,m,h.route.id]}}return{matches:c,pendingActionResult:[h.route.id,m]}}async function Ce(t,n,i,u,d,f,p,m,h,g,_,v,y){let b=f||wn(n,p),x=p||m||Cn(b),S=!P&&!g;if(d){if(S){let e=we(v);_e({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await it(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=rn(s);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=nn(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Qe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=c||s,{dsMatches:T,revalidatingFetchers:E}=xt(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,F,L,se,ie,V,C,l,e.patchRoutesOnNavigation!=null,v,y);if(B=++ne,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=Ue();return ve(n,{matches:i,loaderData:{},errors:v&&pn(v[1])?{[v[0]]:v[1].error}:null,...tn(v),...e?{fetchers:new Map(w.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=we(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=Te(E)),_e(e,{flushSync:_})}E.forEach(e=>{Ve(e.key),e.controller&&ee.set(e.key,e.controller)});let D=()=>E.forEach(e=>Ve(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await Ne(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>ee.delete(e.key));let j=on(k);if(j)return await je(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=on(A),j)return V.add(j.key),await je(t,j.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:M,errors:N}=$t(w,i,k,v,E,A);g&&w.errors&&(N={...w.errors,...N});let I=Ue(),R=Ge(B),te=I||R||E.length>0;return{matches:i,loaderData:M,errors:N,...te?{fetchers:new Map(w.fetchers)}:{}}}function we(e){if(e&&!pn(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function Te(e){return e.forEach(e=>{let t=w.fetchers.get(e.key),n=En(void 0,t?t.data:void 0);w.fetchers.set(e.key,n)}),new Map(w.fetchers)}async function Ee(t,n,r,i){Ve(t);let a=(i&&i.flushSync)===!0,o=c||s,u=yt(w.location,w.matches,l,r,n,i?.relative),d=ce(o,u,l),f=rt(d,o,u);if(f.active&&f.matches&&(d=f.matches),!d){Ie(t,n,an(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=bt(!0,u,i);if(h){Ie(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new z,_=(i&&i.preventScrollReset)===!0;if(m&&bn(m.formMethod)){await Oe(t,n,p,d,g,f.active,a,_,m,i&&i.unstable_defaultShouldRevalidate);return}ie.set(t,{routeId:n,path:p}),await ke(t,n,p,d,g,f.active,a,_,m)}async function Oe(t,n,i,u,d,f,p,m,h,g){Pe(),ie.delete(t),Fe(t,Dn(h,w.fetchers.get(t)),{flushSync:p});let _=new AbortController,v=Jt(e.history,i,_.signal,h);if(f){let e=await it(u,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ie(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{Ie(t,n,an(404,{pathname:i}),{flushSync:p});return}}let y=Sn(u,i);if(!y.route.action&&!y.route.lazy){Ie(t,n,an(405,{method:h.formMethod,pathname:i,routeId:n}),{flushSync:p});return}ee.set(t,_);let b=ne,x=Bt(a,o,v,i,u,y,r,d),S=await Me(v,i,x,d,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){ee.get(t)===_&&ee.delete(t);return}if(se.has(t)){if(mn(C)||pn(C)){Fe(t,On(void 0));return}}else{if(mn(C))if(ee.delete(t),B>b){Fe(t,On(void 0));return}else return V.add(t),Fe(t,En(h)),je(v,C,!1,{fetcherSubmission:h,preventScrollReset:m});if(pn(C)){Ie(t,n,C.error);return}}let E=w.navigation.location||w.location,D=Jt(e.history,E,_.signal),k=c||s,A=w.navigation.state===`idle`?w.matches:ce(k,w.navigation.location,l);M(A,`Didn't find any matches after fetcher action`);let j=++ne;re.set(t,j);let N=En(h,C.data);w.fetchers.set(t,N);let{dsMatches:P,revalidatingFetchers:I}=xt(D,d,a,o,e.history,w,A,h,E,r,!1,F,L,se,ie,V,k,l,e.patchRoutesOnNavigation!=null,[y.route.id,C],g);I.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=w.fetchers.get(t),r=En(void 0,n?n.data:void 0);w.fetchers.set(t,r),Ve(t),e.controller&&ee.set(t,e.controller)}),_e({fetchers:new Map(w.fetchers)});let R=()=>I.forEach(e=>Ve(e.key));_.signal.addEventListener(`abort`,R);let{loaderResults:te,fetcherResults:z}=await Ne(P,I,D,E,d);if(_.signal.aborted)return;if(_.signal.removeEventListener(`abort`,R),re.delete(t),ee.delete(t),I.forEach(e=>ee.delete(e.key)),w.fetchers.has(t)){let e=On(C.data);w.fetchers.set(t,e)}let ae=on(te);if(ae)return je(D,ae.result,!1,{preventScrollReset:m});if(ae=on(z),ae)return V.add(ae.key),je(D,ae.result,!1,{preventScrollReset:m});let{loaderData:oe,errors:le}=$t(w,A,te,void 0,I,z);Ge(j),w.navigation.state===`loading`&&j>B?(M(T,`Expected pending action`),O&&O.abort(),ve(w.navigation.location,{matches:A,loaderData:oe,errors:le,fetchers:new Map(w.fetchers)})):(_e({errors:le,loaderData:en(w.loaderData,oe,A,le),fetchers:new Map(w.fetchers)}),F=!1)}async function ke(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);Fe(t,En(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Jt(e.history,i,m.signal);if(l){let e=await it(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ie(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ie(t,n,an(404,{pathname:i}),{flushSync:u});return}}let g=Sn(s,i);ee.set(t,m);let _=ne,v=(await Me(h,i,Bt(a,o,h,i,s,g,r,c),c,t))[g.route.id];if(ee.get(t)===m&&ee.delete(t),!h.signal.aborted){if(se.has(t)){Fe(t,On(void 0));return}if(mn(v))if(B>_){Fe(t,On(void 0));return}else{V.add(t),await je(h,v,!1,{preventScrollReset:d});return}if(pn(v)){Ie(t,n,v.error);return}Fe(t,On(v.data))}}async function je(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:c,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(F=!0);let d=i.response.headers.get(`Location`);M(d,`Expected a Location header on the redirect Response`),d=qt(d,new URL(r.url),l,e.history);let f=I(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Ae(d)){let n=te(d,!0);e=n.origin!==t.location.origin||De(n.pathname,l)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=Cn(w.navigation));let _=o||s;ut.has(i.response.status)&&_&&bn(_.formMethod)?await xe(p,f,{submission:{..._,formAction:d},preventScrollReset:c||D,enableViewTransition:a?k:void 0}):await xe(p,f,{overrideNavigation:wn(f,o),fetcherSubmission:s,preventScrollReset:c||D,enableViewTransition:a?k:void 0})}async function Me(e,t,n,r,i){let a,o={};try{a=await Vt(u,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!bn(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(fn(r)){let i=r.result;o[t]={type:`redirect`,response:Gt(i,e,t,n,l)}}else o[t]=await Wt(r);return o}async function Ne(e,t,n,r,i){let a=Me(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Me(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:an(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Pe(){F=!0,ie.forEach((e,t)=>{ee.has(t)&&L.add(t),Ve(t)})}function Fe(e,t,n={}){w.fetchers.set(e,t),_e({fetchers:new Map(w.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function Ie(e,t,n,r={}){let i=nn(w.matches,t);ze(e),_e({errors:{[i.route.id]:n},fetchers:new Map(w.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Le(e){return ae.set(e,(ae.get(e)||0)+1),se.has(e)&&se.delete(e),w.fetchers.get(e)||ft}function Re(e,t){Ve(e,t?.reason),Fe(e,On(null))}function ze(e){let t=w.fetchers.get(e);ee.has(e)&&!(t&&t.state===`loading`&&re.has(e))&&Ve(e),ie.delete(e),re.delete(e),V.delete(e),se.delete(e),L.delete(e),w.fetchers.delete(e)}function Be(e){let t=(ae.get(e)||0)-1;t<=0?(ae.delete(e),se.add(e)):ae.set(e,t),_e({fetchers:new Map(w.fetchers)})}function Ve(e,t){let n=ee.get(e);n&&(n.abort(t),ee.delete(e))}function He(e){for(let t of e){let e=On(Le(t).data);w.fetchers.set(t,e)}}function Ue(){let e=[],t=!1;for(let n of V){let r=w.fetchers.get(n);M(r,`Expected fetcher: ${n}`),r.state===`loading`&&(V.delete(n),e.push(n),t=!0)}return He(e),t}function Ge(e){let t=[];for(let[n,r]of re)if(r<e){let e=w.fetchers.get(n);M(e,`Expected fetcher: ${n}`),e.state===`loading`&&(Ve(n),re.delete(n),t.push(n))}return He(t),t.length>0}function Ke(e,t){let n=w.blockers.get(e)||pt;return de.get(e)!==t&&de.set(e,t),n}function qe(e){w.blockers.delete(e),de.delete(e)}function Je(e,t){let n=w.blockers.get(e)||pt;M(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),_e({blockers:r})}function Ze({currentLocation:e,nextLocation:t,historyAction:n}){if(de.size===0)return;de.size>1&&N(!1,`A router only supports one blocker at a time`);let r=Array.from(de.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Qe(e){let t=an(404,{pathname:e}),{matches:n,route:r}=rn(c||s);return{notFoundMatches:n,route:r,error:t}}function $e(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===dt){_=!0;let e=nt(w.location,w.matches);e!=null&&_e({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function et(e,t){return h&&h(e,t.map(e=>ue(e,w.loaderData)))||e.key}function tt(e,t){if(m&&g){let n=et(e,t);m[n]=g()}}function nt(e,t){if(m){let n=et(e,t),r=m[n];if(typeof r==`number`)return r}return null}function rt(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:le(n,r,l,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:le(n,r,l,!0)}}return{active:!1,matches:null}}async function it(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=c==null,d=c||s,f=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:i,patch:(e,t)=>{r.aborted||Dt(e,t,d,f,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(s=[...s])}if(r.aborted)return{type:`aborted`};let p=ce(d,n,l),m=null;if(p&&(Object.keys(p[0].params).length===0||(m=le(d,n,l,!0),!(m&&u.length<m.length&&at(u,m.slice(0,u.length))))))return{type:`success`,matches:p};if(m||=le(d,n,l,!0),!m||at(u,m))return{type:`success`,matches:null};u=m}}function at(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function ot(e){o={},c=oe(e,a,void 0,o)}function st(e,t,n=!1){let r=c==null;Dt(e,t,c||s,o,a,n),r&&(s=[...s],_e({}))}return C={get basename(){return l},get future(){return d},get state(){return w},get routes(){return s},get window(){return t},initialize:me,subscribe:ge,enableScrollRestoration:$e,navigate:ye,fetch:Ee,revalidate:be,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Le,resetFetcher:Re,deleteFetcher:Be,dispose:he,getBlocker:Ke,deleteBlocker:qe,patchRoutes:st,_internalFetchControllers:ee,_internalSetRoutes:ot,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){_e(e)}},e.unstable_instrumentations&&(C=Xe(C,e.unstable_instrumentations.map(e=>e.router).filter(Boolean))),C}function vt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function yt(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=Ie(r||`.`,Fe(o),De(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=xn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=Oe({basename:n,pathname:c.pathname})),L(c)}function bt(e,t,n){if(!n||!vt(n))return{path:t};if(n.formMethod&&!yn(n.formMethod))return{path:t,error:an(405,{method:n.formMethod})};let r=()=>({path:t,error:an(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=sn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!bn(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
10
10
  `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!bn(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}M(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Xt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Xt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Zt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Zt(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(bn(c.formMethod))return{path:t,submission:c};let l=R(t);return e&&l.search&&xn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:L(l),submission:c}}function xt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){let x=y?pn(y[1])?y[1].error:y[1].data:void 0,S=i.createURL(a.location),C=i.createURL(c),w;if(u&&a.errors){let e=Object.keys(a.errors)[0];w=o.findIndex(t=>t.route.id===e)}else if(y&&pn(y[1])){let e=y[0];w=o.findIndex(t=>t.route.id===e)-1}let T=y?y[1].statusCode:void 0,E=T&&T>=400,D={currentUrl:S,currentParams:a.matches[0]?.params||{},nextUrl:C,nextParams:o[0].params,...s,actionResult:x,actionStatus:T},O=Ge(o),k=o.map((i,o)=>{let{route:s}=i,f=null;if(w!=null&&o>w)f=!1;else if(s.lazy)f=!0;else if(!St(s))f=!1;else if(u){let{shouldLoad:e}=Ct(s,a.loaderData,a.errors);f=e}else wt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return zt(n,r,e,c,O,i,l,t,f);let p=!1;typeof b==`boolean`?p=b:E?p=!1:d||S.pathname+S.search===C.pathname+C.search?p=!0:S.search===C.search?Tt(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return zt(n,r,e,c,O,i,l,t,Et(i,m),m,b)}),A=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,y=ce(g,e.path,_);if(!y){if(v&&m)return;A.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let x=Sn(y,e.path),S=new AbortController,C=Jt(i,e.path,S.signal),w=null;if(f.has(s))f.delete(s),w=Bt(n,r,C,e.path,y,x,l,t);else if(m)d&&(w=Bt(n,r,C,e.path,y,x,l,t));else{let i;i=typeof b==`boolean`?b:E?!1:d;let a={...D,defaultShouldRevalidate:i};Et(x,a)&&(w=Bt(n,r,C,e.path,y,x,l,t,a))}w&&A.push({key:s,routeId:e.routeId,path:e.path,matches:w,match:x,request:C,controller:S})}),{dsMatches:k,revalidatingFetchers:A}}function St(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Ct(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!St(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function wt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Tt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Et(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Dt(e,t,n,r,i,a){let o;if(e){let t=r[e];M(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Ot(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=oe(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=oe([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}}function Ot(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>Ot(e,t)))??!1:!1}var kt=new WeakMap,At=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(M(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=kt.get(i);o||(o={},kt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=re(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)N(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)N(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},jt=new WeakMap;function Mt(e,t,n,r,i){let a=n[e.id];if(M(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=jt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{M(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=ie(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?N(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?N(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return jt.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=At({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Nt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Pt(e){return e.matches.some(e=>e.route.middleware)?Ft(e,()=>Nt(e)):Nt(e)}function Ft(e,t){return It(e,t,e=>{if(vn(e))throw e;return e},un,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=nn(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function It(e,t,n,r,i){let{matches:a,...o}=e;return await Lt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Lt(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Lt(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Rt(e,t,n,r,i){let a=At({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Mt(r.route,bn(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function zt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Rt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?Et(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?Et(a,{...l,defaultShouldRevalidate:e}):Et(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!bn(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(bn(n.method)||!p)?Ht({request:n,path:r,unstable_pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Bt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?zt(e,t,n,r,Ge(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Rt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Vt(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,unstable_url:Yt(t,n),unstable_pattern:Ge(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return Ft(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Ht({request:e,path:t,unstable_pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=bn(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,unstable_url:Yt(e,t),unstable_pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw an(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw an(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Ut(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Wt(e){let{result:t,type:n}=e;if(gn(t)){let e;try{e=await Ut(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Ue(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?hn(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:ln(t),statusCode:We(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:We(t)?t.status:void 0}:hn(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Gt(e,t,n,r,i){let a=e.headers.get(`Location`);if(M(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!Ae(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=yt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Kt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function qt(e,t,n,r){if(Ae(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(Kt.includes(i.protocol))throw Error(`Invalid redirect location`);let a=De(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Le(i.pathname)+i.search+i.hash}try{let t=r.createURL(e);if(Kt.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function Jt(e,t,n,r){let i=e.createURL(sn(t)).toString(),a={signal:n};if(r&&bn(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=Xt(r.formData):a.body=r.formData}return new Request(i,a)}function Yt(e,t){let n=new URL(e.url),r=typeof t==`string`?R(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function Xt(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Zt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Qt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&pn(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(M(!mn(f),`Cannot handle redirect results in processLoaderData`),pn(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=nn(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=gt),c||(c=!0,s=We(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function $t(e,t,n,r,i,a){let{loaderData:o,errors:s}=Qt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let o=a[n];if(M(o,`Did not find corresponding fetcher result`),pn(o)){let t=nn(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(mn(o))M(!1,`Unhandled fetcher revalidation redirect`);else{let t=On(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function en(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==gt).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function tn(e){return e?pn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function nn(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function rn(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function an(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Ue(e||500,o,Error(s),!0)}function on(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(mn(r))return{key:n,result:r}}}function sn(e){return L({...typeof e==`string`?R(e):e,hash:``})}function cn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function ln(e){return new Ue(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function un(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&dn(t))}function dn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function fn(e){return gn(e.result)&&lt.has(e.result.status)}function pn(e){return e.type===`error`}function mn(e){return(e&&e.type)===`redirect`}function hn(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function gn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function _n(e){return lt.has(e)}function vn(e){return gn(e)&&_n(e.status)&&e.headers.has(`Location`)}function yn(e){return ct.has(e.toUpperCase())}function bn(e){return ot.has(e.toUpperCase())}function xn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Sn(e,t){let n=typeof t==`string`?R(t).search:t.search;if(e[e.length-1].route.index&&xn(n||``))return e[e.length-1];let r=Pe(e);return r[r.length-1]}function Cn(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function wn(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Tn(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function En(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Dn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function On(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function kn(e,t){try{let n=e.sessionStorage.getItem(ht);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function An(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ht,JSON.stringify(n))}catch(e){N(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function jn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Mn=v.createContext(null);Mn.displayName=`DataRouter`;var Nn=v.createContext(null);Nn.displayName=`DataRouterState`;var Pn=v.createContext(!1);function Fn(){return v.useContext(Pn)}var In=v.createContext({isTransitioning:!1});In.displayName=`ViewTransition`;var Ln=v.createContext(new Map);Ln.displayName=`Fetchers`;var Rn=v.createContext(null);Rn.displayName=`Await`;var zn=v.createContext(null);zn.displayName=`Navigation`;var Bn=v.createContext(null);Bn.displayName=`Location`;var Vn=v.createContext({outlet:null,matches:[],isDataRoute:!1});Vn.displayName=`Route`;var Hn=v.createContext(null);Hn.displayName=`RouteError`;var Un=`REACT_ROUTER_ERROR`,Wn=`REDIRECT`,Gn=`ROUTE_ERROR_RESPONSE`;function Kn(e){if(e.startsWith(`${Un}:${Wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function qn(e){if(e.startsWith(`${Un}:${Gn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ue(t.status,t.statusText,t.data)}catch{}}function Jn(e,{relative:t}={}){M(Yn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(zn),{hash:i,pathname:a,search:o}=ir(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Re([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Yn(){return v.useContext(Bn)!=null}function Xn(){return M(Yn(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext(Bn).location}var Zn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Qn(e){v.useContext(zn).static||v.useLayoutEffect(e)}function $n(){let{isDataRoute:e}=v.useContext(Vn);return e?wr():er()}function er(){M(Yn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(Mn),{basename:t,navigator:n}=v.useContext(zn),{matches:r}=v.useContext(Vn),{pathname:i}=Xn(),a=JSON.stringify(Fe(r)),o=v.useRef(!1);return Qn(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(N(o.current,Zn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ie(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Re([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var tr=v.createContext(null);function nr(e){let t=v.useContext(Vn).outlet;return v.useMemo(()=>t&&v.createElement(tr.Provider,{value:e},t),[t,e])}function rr(){let{matches:e}=v.useContext(Vn),t=e[e.length-1];return t?t.params:{}}function ir(e,{relative:t}={}){let{matches:n}=v.useContext(Vn),{pathname:r}=Xn(),i=JSON.stringify(Fe(n));return v.useMemo(()=>Ie(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ar(e,t,n){M(Yn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(zn),{matches:i}=v.useContext(Vn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Er(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
11
11
 
12
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Xn(),d;if(t){let e=typeof t==`string`?R(t):t;M(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=ce(e,{pathname:p});N(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),N(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=fr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Re([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Re([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(Bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function or(){let e=xr(),t=We(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var sr=v.createElement(or,null),cr=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=qn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(Vn.Provider,{value:this.props.routeContext},v.createElement(Hn.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(ur,{error:e},t):t}};cr.contextType=Pn;var lr=new WeakMap;function ur({children:e,error:t}){let{basename:n}=v.useContext(zn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Kn(t.digest);if(e){let r=lr.get(t);if(r)throw r;let i=qe(e.location,n);if(Ke&&!lr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw lr.set(t,n),n}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function dr({routeContext:e,match:t,children:n}){let r=v.useContext(Mn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Vn.Provider,{value:e},n)}function fr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);M(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Ge(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||sr,o&&(s<0&&c===0?(Er(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(dr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(cr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function pr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mr(e){let t=v.useContext(Mn);return M(t,pr(e)),t}function hr(e){let t=v.useContext(Nn);return M(t,pr(e)),t}function gr(e){let t=v.useContext(Vn);return M(t,pr(e)),t}function _r(e){let t=gr(e),n=t.matches[t.matches.length-1];return M(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vr(){return _r(`useRouteId`)}function yr(){return hr(`useNavigation`).navigation}function br(){let{matches:e,loaderData:t}=hr(`useMatches`);return v.useMemo(()=>e.map(e=>ue(e,t)),[e,t])}function xr(){let e=v.useContext(Hn),t=hr(`useRouteError`),n=_r(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Sr=0;function Cr(e){let{router:t,basename:n}=mr(`useBlocker`),r=hr(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:De(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:De(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Sr);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):pt}function wr(){let{router:e}=mr(`useNavigate`),t=_r(`useNavigate`),n=v.useRef(!1);return Qn(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{N(n.current,Zn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Tr={};function Er(e,t,n){!t&&!Tr[e]&&(Tr[e]=!0,N(!1,n))}var Dr={};function Or(e,t){!e&&!Dr[t]&&(Dr[t]=!0,console.warn(t))}var kr=v.useOptimistic,Ar=()=>void 0;function jr(e){return kr?kr(e):[e,Ar]}function Mr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&N(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&N(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&N(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Nr=[`HydrateFallback`,`hydrateFallbackElement`],Pr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Fr({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Fn()||r;let[i,a]=v.useState(e.state),[o,s]=jr(i),[c,l]=v.useState(),[u,d]=v.useState({isTransitioning:!1}),[f,p]=v.useState(),[m,h]=v.useState(),[g,_]=v.useState(),y=v.useRef(new Map),b=v.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},unstable_pattern:Ge(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),Or(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Or(g==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!b){t&&u?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>Ir(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);v.useLayoutEffect(()=>e.subscribe(b),[e,b]);let x=o.initialized;v.useLayoutEffect(()=>{!x&&e.state.initialized&&b(e.state,{deletedFetchers:[],flushSync:!1,newErrors:null})},[x,b,e.state]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Pr)},[u]),v.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>Ir(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),v.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),v.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let S=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),C=e.basename||`/`,w=v.useMemo(()=>({router:e,navigator:S,static:!1,basename:C,onError:n}),[e,S,C,n]);return v.createElement(v.Fragment,null,v.createElement(Mn.Provider,{value:w},v.createElement(Nn.Provider,{value:o},v.createElement(Ln.Provider,{value:y.current},v.createElement(In.Provider,{value:u},v.createElement(Vr,{basename:C,location:o.location,navigationType:o.historyAction,navigator:S,unstable_useTransitions:r},v.createElement(Lr,{routes:e.routes,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Ir(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Lr=v.memo(Rr);function Rr({routes:e,future:t,state:n,isStatic:r,onError:i}){return ar(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function zr({to:e,replace:t,state:n,relative:r}){M(Yn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v.useContext(zn);N(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(Vn),{pathname:o}=Xn(),s=$n(),c=Ie(e,Fe(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Br(e){return nr(e.context)}function Vr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){M(!Yn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=R(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=v.useMemo(()=>{let e=De(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return N(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(zn.Provider,{value:c},v.createElement(Bn.Provider,{children:t,value:h}))}v.Component;var Hr=`get`,Ur=`application/x-www-form-urlencoded`;function Wr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Gr(e){return Wr(e)&&e.tagName.toLowerCase()===`button`}function Kr(e){return Wr(e)&&e.tagName.toLowerCase()===`form`}function qr(e){return Wr(e)&&e.tagName.toLowerCase()===`input`}function Jr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Yr(e,t){return e.button===0&&(!t||t===`_self`)&&!Jr(e)}function Xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Zr(e,t){let n=Xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Qr=null;function $r(){if(Qr===null)try{new FormData(document.createElement(`form`),0),Qr=!1}catch{Qr=!0}return Qr}var ei=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ti(e){return e!=null&&!ei.has(e)?(N(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ur}"`),null):e}function ni(e,t){let n,r,i,a,o;if(Kr(e)){let o=e.getAttribute(`action`);r=o?De(o,t):null,n=e.getAttribute(`method`)||Hr,i=ti(e.getAttribute(`enctype`))||Ur,a=new FormData(e)}else if(Gr(e)||qr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?De(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Hr,i=ti(e.getAttribute(`formenctype`))||ti(o.getAttribute(`enctype`))||Ur,a=new FormData(o,e),!$r()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Wr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Hr,r=null,i=Ur,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ri={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ii=/[&><\u2028\u2029]/g;function ai(e){return e.replace(ii,e=>ri[e])}function oi(e,t){if(e===!1||e==null)throw Error(t)}function si(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&De(i.pathname,t)===`/`?i.pathname=`${ze(t)}/_root.${r}`:i.pathname=`${ze(i.pathname)}.${r}`,i}async function ci(e,t){if(e.id in t)return t[e.id];try{let n=await w(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function li(e){return e!=null&&typeof e.page==`string`}function ui(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function di(e,t,n){return gi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await ci(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ui).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function fi(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function pi(e,t,{includeHydrateFallback:n}={}){return mi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function mi(e){return[...new Set(e)]}function hi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function gi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!li(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(hi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function _i(){let e=v.useContext(Mn);return oi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function vi(){let e=v.useContext(Nn);return oi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var yi=v.createContext(void 0);yi.displayName=`FrameworkContext`;function bi(){let e=v.useContext(yi);return oi(e,`You must render this element inside a <HydratedRouter> element`),e}function xi(e,t){let n=v.useContext(yi),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Si(s,p),onBlur:Si(c,m),onMouseEnter:Si(l,p),onMouseLeave:Si(u,m),onTouchStart:Si(d,p)}]:[a,f,{}]:[!1,f,{}]}function Si(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ci({page:e,...t}){let n=Fn(),{router:r}=_i(),i=v.useMemo(()=>ce(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?v.createElement(Ti,{page:e,matches:i,...t}):v.createElement(Ei,{page:e,matches:i,...t}):null}function wi(e){let{manifest:t,routeModules:n}=bi(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return di(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ti({page:e,matches:t,...n}){let r=Xn(),{future:i}=bi(),{basename:a}=_i(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=si(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Ei({page:e,matches:t,...n}){let r=Xn(),{future:i,manifest:a,routeModules:o}=bi(),{basename:s}=_i(),{loaderData:c,matches:l}=vi(),u=v.useMemo(()=>fi(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>fi(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=si(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>pi(d,a),[d,a]),m=wi(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Di(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var Oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Oi&&(window.__reactRouterVersion=`7.14.1`)}catch{}function ki(e,t){return _t({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:j({window:t?.window}),hydrationData:t?.hydrationData||Ai(),routes:e,mapRouteProperties:Mr,hydrationRouteProperties:Nr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function Ai(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ji(e.errors)}),e}function ji(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Ue(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function Mi({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=v.useState({action:n.action,location:n.location}),o=v.useCallback(e=>{r===!1?a(e):v.startTransition(()=>a(e))},[r]);return v.useLayoutEffect(()=>n.listen(o),[n,o]),v.createElement(Vr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Mi.displayName=`unstable_HistoryRouter`;var Ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pi=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=v.useContext(zn),y=typeof l==`string`&&Ni.test(l),b=qe(l,h);l=b.to;let x=Jn(l,{relative:r}),S=Xn(),C=null;if(o){let e=Ie(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Re([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=xi(n,p),D=Vi(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=v.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:Di(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(Ci,{page:x})):A});Pi.displayName=`Link`;var Fi=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ir(a,{relative:c.relative}),d=Xn(),f=v.useContext(Nn),{navigator:p,basename:m}=v.useContext(zn),h=f!=null&&Qi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=De(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(Pi,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Fi.displayName=`NavLink`;var Ii=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Hr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=v.useContext(zn),g=Gi(),_=Ki(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&Ni.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Ii.displayName=`Form`;function Li({getKey:e,storageKey:t,...n}){let r=v.useContext(yi),{basename:i}=v.useContext(zn),a=Xn(),o=br();Xi({getKey:e,storageKey:t});let s=v.useMemo(()=>{if(!r||!e)return null;let t=Yi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return v.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${ai(JSON.stringify(t||qi))}, ${ai(JSON.stringify(s))})`}})}Li.displayName=`ScrollRestoration`;function Ri(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zi(e){let t=v.useContext(Mn);return M(t,Ri(e)),t}function Bi(e){let t=v.useContext(Nn);return M(t,Ri(e)),t}function Vi(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=$n(),d=Xn(),f=ir(e,{relative:o});return v.useCallback(p=>{if(Yr(p,t)){p.preventDefault();let t=n===void 0?L(d)===L(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Hi(e){N(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Xr(e)),n=v.useRef(!1),r=Xn(),i=v.useMemo(()=>Zr(r.search,n.current?null:t.current),[r.search]),a=$n();return[i,v.useCallback((e,t)=>{let r=Xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Ui=0,Wi=()=>`__${String(++Ui)}__`;function Gi(){let{router:e}=zi(`useSubmit`),{basename:t}=v.useContext(zn),n=vr(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ni(e,t);a.navigate===!1?await r(a.fetcherKey||Wi(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ki(e,{relative:t}={}){let{basename:n}=v.useContext(zn),r=v.useContext(Vn);M(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ir(e||`.`,{relative:t})},o=Xn();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Re([n,a.pathname])),L(a)}var qi=`react-router-scroll-positions`,Ji={};function Yi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:De(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Xi({getKey:e,storageKey:t}={}){let{router:n}=zi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Bi(`useScrollRestoration`),{basename:a}=v.useContext(zn),o=Xn(),s=br(),c=yr();v.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Zi(v.useCallback(()=>{if(c.state===`idle`){let t=Yi(o,s,a,e);Ji[t]=window.scrollY}try{sessionStorage.setItem(t||qi,JSON.stringify(Ji))}catch(e){N(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(v.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||qi);e&&(Ji=JSON.parse(e))}catch{}},[t]),v.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ji,()=>window.scrollY,e?(t,n)=>Yi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),v.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{N(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Zi(e,t){let{capture:n}=t||{};v.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Qi(e,{relative:t}={}){let n=v.useContext(In);M(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=zi(`useViewTransitionState`),i=ir(e,{relative:t});if(!n.isTransitioning)return!1;let a=De(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=De(n.nextLocation.pathname,r)||n.nextLocation.pathname;return we(i.pathname,o)!=null||we(i.pathname,a)!=null}function $i(e){return v.createElement(Fr,{flushSync:b.flushSync,...e})}var ea=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=ea()}))();function ta(e,t){switch(t.type){case`LOGIN`:return{user:t.payload.user,status:`authenticated`};case`LOGOUT`:return{user:null,status:`unauthenticated`};case`UPDATE_USER`:return{...e,user:e.user?{...e.user,...t.payload}:null}}}var na=(0,v.createContext)(null);function ra({children:e}){let[t,n]=(0,v.useReducer)(ta,{user:null,status:`idle`});(0,v.useEffect)(()=>{localStorage.removeItem(`plank_token`),localStorage.removeItem(`plank_user`),fetch(`/cms/admin/users/me`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!e){n({type:`LOGOUT`});return}n({type:`LOGIN`,payload:{user:{id:e.id,email:e.email,role:`unknown`,permissions:e.permissions??[],firstName:e.first_name??null,lastName:e.last_name??null,avatarUrl:e.avatar_url??null,jobTitle:e.job_title??null,organization:e.organization??null,country:e.country??null,twoFactorEnabled:e.two_factor_enabled??!1}}})}).catch(()=>n({type:`LOGOUT`}))},[]);function r(e){n({type:`LOGIN`,payload:{user:e}})}function i(){fetch(`/cms/auth/logout`,{method:`POST`,credentials:`include`}).catch(()=>{}),n({type:`LOGOUT`})}function a(e){n({type:`UPDATE_USER`,payload:e})}return(0,H.jsx)(na.Provider,{value:{...t,login:r,logout:i,updateUser:a},children:e})}function ia(){let e=(0,v.useContext)(na);if(!e)throw Error(`useAuth must be used inside AuthProvider`);return e}var aa=(0,v.createContext)({timezone:`UTC`,locales:[`en`],defaultLocale:`en`,refreshSettings:()=>{}});function oa({children:e}){let[t,n]=(0,v.useState)(`UTC`),[r,i]=(0,v.useState)([`en`]),[a,o]=(0,v.useState)(`en`),s=(0,v.useCallback)(()=>{fetch(`/cms/admin/settings/general`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e?.timezone&&n(e.timezone);try{if(e?.locales){let t=[];try{t=JSON.parse(e.locales)}catch{t=(e.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean)}t.length&&i(t)}}catch{}e?.default_locale&&o(e.default_locale)}).catch(()=>{})},[]);return(0,v.useEffect)(()=>{s()},[s]),(0,H.jsx)(aa.Provider,{value:{timezone:t,locales:r,defaultLocale:a,refreshSettings:s},children:e})}function sa(){return(0,v.useContext)(aa)}var ca=(0,v.createContext)({shortcuts:[],register:()=>()=>{}});function la({children:e}){let[t,n]=(0,v.useState)([]),r=(0,v.useCallback)((e,t)=>{let r={combo:e,label:t};return n(e=>[...e,r]),()=>n(e=>e.filter(e=>e!==r))},[]);return(0,H.jsx)(ca.Provider,{value:{shortcuts:t,register:r},children:e})}function ua(e,t){return e.includes(`*`)||e.includes(t)}function da({children:e,roles:t,permission:n}){let{status:r,user:i}=ia();return r===`idle`?null:r===`unauthenticated`?(0,H.jsx)(zr,{to:`/login`,replace:!0}):t&&i&&!t.map(e=>e.toLowerCase()).includes(i.role.toLowerCase())||n&&i&&!ua(i.permissions,n)?(0,H.jsx)(zr,{to:`/`,replace:!0}):(0,H.jsx)(H.Fragment,{children:e})}function fa(e,t){let[n,r]=(0,v.useState)({data:null,loading:!!e,error:null}),i=(0,v.useCallback)(()=>{if(!e){r({data:null,loading:!1,error:null});return}r({data:null,loading:!0,error:null});let n={"Content-Type":`application/json`,...t?.headers};fetch(e,{...t,credentials:`include`,headers:n}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>r({data:e,loading:!1,error:null})).catch(e=>{r({data:null,loading:!1,error:e instanceof Error?e.message:`Unknown error`})})},[e,t]);return(0,v.useEffect)(()=>{i()},[i]),{...n,refetch:i}}var pa=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ma=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ha=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ga=e=>{let t=ha(e);return t.charAt(0).toUpperCase()+t.slice(1)},_a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},va=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ya=(0,v.createContext)({}),ba=()=>(0,v.useContext)(ya),xa=(0,v.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=ba()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,..._a,width:t??l??_a.width,height:t??l??_a.height,stroke:e??f,strokeWidth:m,className:pa(`lucide`,p,i),...!a&&!va(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(xa,{ref:i,iconNode:t,className:pa(`lucide-${ma(ga(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ga(e),n},Sa=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ca=U(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),wa=U(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ta=U(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ea=U(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Da=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Oa=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ka=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Aa=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ja=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ma=U(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Na=U(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Pa=U(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Fa=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ia=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),La=U(`columns-3-cog`,[[`path`,{d:`M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5`,key:`1g2yzs`}],[`path`,{d:`m14.3 19.6 1-.4`,key:`11sv9r`}],[`path`,{d:`M15 3v7.5`,key:`7lm50a`}],[`path`,{d:`m15.2 16.9-.9-.3`,key:`1t7mvx`}],[`path`,{d:`m16.6 21.7.3-.9`,key:`1j67ps`}],[`path`,{d:`m16.8 15.3-.4-1`,key:`1ei7r6`}],[`path`,{d:`m19.1 15.2.3-.9`,key:`18r7jp`}],[`path`,{d:`m19.6 21.7-.4-1`,key:`z2vh2`}],[`path`,{d:`m20.7 16.8 1-.4`,key:`19m87a`}],[`path`,{d:`m21.7 19.4-.9-.3`,key:`1qgwi9`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ra=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=U(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ba=U(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Va=U(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ha=U(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ua=U(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),Wa=U(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),Ga=U(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=U(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),qa=U(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Ja=U(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ya=U(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xa=U(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Za=U(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Qa=U(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),$a=U(`heading-1`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]),eo=U(`heading-2`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]),to=U(`heading-3`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2`,key:`68ncm8`}],[`path`,{d:`M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2`,key:`1ejuhz`}]]),no=U(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),ro=U(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),io=U(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),ao=U(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),oo=U(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),so=U(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),co=U(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),lo=U(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]),uo=U(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),fo=U(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),po=U(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),mo=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ho=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),go=U(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),_o=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),vo=U(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),yo=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),bo=U(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),xo=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),So=U(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Co=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),wo=U(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),To=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Eo=U(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Do=U(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Oo=U(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ko=U(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Ao=U(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),jo=U(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),Mo=U(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),No=U(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Po=U(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Fo=U(`unlink-2`,[[`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2`,key:`1re2ne`}]]),Io=U(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Lo=U(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Ro=U(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),zo=U(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),Bo=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Vo=(0,v.createContext)(null);function Ho({children:e}){let[t,n]=(0,v.useState)(null);return(0,H.jsx)(Vo.Provider,{value:{content:t,setContent:n},children:e})}function Uo(){let e=(0,v.useContext)(Vo);if(!e)throw Error(`useSecondaryPanelContext must be used within SecondaryPanelProvider`);return e}function Wo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Go(...e){return t=>{let n=!1,r=e.map(e=>{let r=Wo(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Wo(e[t],null)}}}}function Ko(...e){return v.useCallback(Go(...e),e)}var qo=Symbol.for(`react.lazy`),Jo=v.use;function Yo(e){return typeof e==`object`&&!!e&&`then`in e}function Xo(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===qo&&`_payload`in e&&Yo(e._payload)}function Zo(e){let t=$o(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e;Xo(r)&&typeof Jo==`function`&&(r=Jo(r._payload));let a=v.Children.toArray(r),o=a.find(ts);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Qo=Zo(`Slot`);function $o(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(Xo(n)&&typeof Jo==`function`&&(n=Jo(n._payload)),v.isValidElement(n)){let e=rs(n),i=ns(r,n.props);return n.type!==v.Fragment&&(i.ref=t?Go(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var es=Symbol(`radix.slottable`);function ts(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===es}function ns(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function rs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function is(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=is(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function as(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=is(e))&&(r&&(r+=` `),r+=t);return r}var ss=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,cs=as,ls=(e,t)=>n=>{if(t?.variants==null)return cs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ss(t)||ss(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return cs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},us=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ds=(e,t)=>({classGroupId:e,validator:t}),fs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ps=`-`,ms=[],hs=`arbitrary..`,gs=e=>{let t=ys(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return vs(e);let n=e.split(ps);return _s(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?us(i,t):t:i||ms}return n[e]||ms}}},_s=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=_s(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ps):e.slice(t).join(ps),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},vs=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?hs+r:void 0})(),ys=e=>{let{theme:t,classGroups:n}=e;return bs(n,t)},bs=(e,t)=>{let n=fs();for(let r in e){let i=e[r];xs(i,n,r,t)}return n},xs=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Ss(i,t,n,r)}},Ss=(e,t,n,r)=>{if(typeof e==`string`){Cs(e,t,n);return}if(typeof e==`function`){ws(e,t,n,r);return}Ts(e,t,n,r)},Cs=(e,t,n)=>{let r=e===``?t:Es(t,e);r.classGroupId=n},ws=(e,t,n,r)=>{if(Ds(e)){xs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ds(n,e))},Ts=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];xs(o,Es(t,a),n,r)}},Es=(e,t)=>{let n=e,r=t.split(ps),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=fs(),n.nextPart.set(t,i)),n=i}return n},Ds=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Os=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ks=`!`,As=`:`,js=[],Ms=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ns=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===As){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ks)?(c=s.slice(0,-1),l=!0):s.startsWith(ks)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Ms(t,l,c,u)};if(t){let e=t+As,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ms(js,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ps=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Fs=e=>({cache:Os(e.cacheSize),parseClassName:Ns(e),sortModifiers:Ps(e),...gs(e)}),Is=/\s+/,Ls=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Is),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+ks:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Rs=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=zs(n))&&(i&&(i+=` `),i+=r);return i},zs=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=zs(e[r]))&&(n&&(n+=` `),n+=t);return n},Bs=(e,...t)=>{let n,r,i,a,o=o=>(n=Fs(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ls(e,n);return i(e,a),a};return a=o,(...e)=>a(Rs(...e))},Vs=[],Hs=e=>{let t=t=>t[e]||Vs;return t.isThemeGetter=!0,t},Us=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gs=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ks=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Js=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ys=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zs=e=>Gs.test(e),Qs=e=>!!e&&!Number.isNaN(Number(e)),$s=e=>!!e&&Number.isInteger(Number(e)),ec=e=>e.endsWith(`%`)&&Qs(e.slice(0,-1)),tc=e=>Ks.test(e),nc=()=>!0,rc=e=>qs.test(e)&&!Js.test(e),ic=()=>!1,ac=e=>Ys.test(e),oc=e=>Xs.test(e),sc=e=>!W(e)&&!G(e),cc=e=>Cc(e,Dc,ic),W=e=>Us.test(e),lc=e=>Cc(e,Oc,rc),uc=e=>Cc(e,kc,Qs),dc=e=>Cc(e,jc,nc),fc=e=>Cc(e,Ac,ic),pc=e=>Cc(e,Tc,ic),mc=e=>Cc(e,Ec,oc),hc=e=>Cc(e,Mc,ac),G=e=>Ws.test(e),gc=e=>wc(e,Oc),_c=e=>wc(e,Ac),vc=e=>wc(e,Tc),yc=e=>wc(e,Dc),bc=e=>wc(e,Ec),xc=e=>wc(e,Mc,!0),Sc=e=>wc(e,jc,!0),Cc=(e,t,n)=>{let r=Us.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},wc=(e,t,n=!1)=>{let r=Ws.exec(e);return r?r[1]?t(r[1]):n:!1},Tc=e=>e===`position`||e===`percentage`,Ec=e=>e===`image`||e===`url`,Dc=e=>e===`length`||e===`size`||e===`bg-size`,Oc=e=>e===`length`,kc=e=>e===`number`,Ac=e=>e===`family-name`,jc=e=>e===`number`||e===`weight`,Mc=e=>e===`shadow`,Nc=Bs(()=>{let e=Hs(`color`),t=Hs(`font`),n=Hs(`text`),r=Hs(`font-weight`),i=Hs(`tracking`),a=Hs(`leading`),o=Hs(`breakpoint`),s=Hs(`container`),c=Hs(`spacing`),l=Hs(`radius`),u=Hs(`shadow`),d=Hs(`inset-shadow`),f=Hs(`text-shadow`),p=Hs(`drop-shadow`),m=Hs(`blur`),h=Hs(`perspective`),g=Hs(`aspect`),_=Hs(`ease`),v=Hs(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[Zs,`full`,`auto`,...w()],E=()=>[$s,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,$s,G,W]},$s,G,W],O=()=>[$s,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Zs,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Zs,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Zs,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,G,W],L=()=>[...b(),vc,pc,{position:[G,W]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,yc,cc,{size:[G,W]}],te=()=>[ec,gc,lc],ne=()=>[``,`none`,`full`,l,G,W],z=()=>[``,Qs,gc,lc],B=()=>[`solid`,`dashed`,`dotted`,`double`],re=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[Qs,ec,vc,pc],ie=()=>[``,`none`,m,G,W],ae=()=>[`none`,Qs,G,W],oe=()=>[`none`,Qs,G,W],se=()=>[Qs,G,W],ce=()=>[Zs,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[tc],breakpoint:[tc],color:[nc],container:[tc],"drop-shadow":[tc],ease:[`in`,`out`,`in-out`],font:[sc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[tc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[tc],shadow:[tc],spacing:[`px`,Qs],text:[tc],"text-shadow":[tc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Zs,W,G,g]}],container:[`container`],columns:[{columns:[Qs,W,G,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[$s,`auto`,G,W]}],basis:[{basis:[Zs,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Qs,Zs,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,Qs,G,W]}],shrink:[{shrink:[``,Qs,G,W]}],order:[{order:[$s,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,gc,lc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Sc,dc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ec,W]}],"font-family":[{font:[_c,fc,t]}],"font-features":[{"font-features":[W]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,G,W]}],"line-clamp":[{"line-clamp":[Qs,`none`,G,uc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Qs,`from-font`,`auto`,G,lc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Qs,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},$s,G,W],radial:[``,G,W],conic:[$s,G,W]},bc,mc]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Qs,G,W]}],"outline-w":[{outline:[``,Qs,gc,lc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,xc,hc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,xc,hc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Qs,lc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,xc,hc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Qs,G,W]}],"mix-blend":[{"mix-blend":[...re(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Qs]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Qs]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:ie()}],brightness:[{brightness:[Qs,G,W]}],contrast:[{contrast:[Qs,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,xc,hc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Qs,G,W]}],"hue-rotate":[{"hue-rotate":[Qs,G,W]}],invert:[{invert:[``,Qs,G,W]}],saturate:[{saturate:[Qs,G,W]}],sepia:[{sepia:[``,Qs,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Qs,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[Qs,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Qs,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qs,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,Qs,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[Qs,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[Qs,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,Qs,G,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Qs,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[Qs,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":[`scale-3d`],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,G,W]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Qs,gc,lc,uc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return Nc(as(e))}var Pc=ls(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),q=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?Qo:`button`,{className:K(Pc({variant:t,size:n,className:e})),ref:a,...i}));q.displayName=`Button`;function Fc(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ic(i,...t)]}function Ic(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Lc(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...e)=>t.current?.(...e),[])}var Rc=globalThis?.document?v.useLayoutEffect:()=>{},zc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Zo(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Bc=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Vc=o(((e,t)=>{t.exports=Bc()})),Hc=Vc();function Uc(){return(0,Hc.useSyncExternalStore)(Wc,()=>!0,()=>!1)}function Wc(){return()=>{}}var Gc=`Avatar`,[Kc,qc]=Fc(Gc),[Jc,Yc]=Kc(Gc),Xc=v.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=v.useState(`idle`);return(0,H.jsx)(Jc,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,H.jsx)(zc.span,{...r,ref:t})})});Xc.displayName=Gc;var Zc=`AvatarImage`,Qc=v.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Yc(Zc,n),s=nl(r,a),c=Lc(e=>{i(e),o.onImageLoadingStatusChange(e)});return Rc(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,H.jsx)(zc.img,{...a,ref:t,src:r}):null});Qc.displayName=Zc;var $c=`AvatarFallback`,el=v.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Yc($c,n),[o,s]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,H.jsx)(zc.span,{...i,ref:t}):null});el.displayName=$c;function tl(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function nl(e,{referrerPolicy:t,crossOrigin:n}){let r=Uc(),i=v.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=v.useState(()=>tl(a,e));return Rc(()=>{s(tl(a,e))},[a,e]),Rc(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var rl=Xc,il=Qc,al=el,ol=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(rl,{ref:n,className:K(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));ol.displayName=rl.displayName;var sl=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(il,{ref:n,className:K(`aspect-square h-full w-full`,e),...t}));sl.displayName=il.displayName;var cl=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(al,{ref:n,className:K(`flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium`,e),...t}));cl.displayName=al.displayName;function ll(e,t,n){return e&&t?`${e[0]}${t[0]}`.toUpperCase():e?e.slice(0,2).toUpperCase():n?n.slice(0,2).toUpperCase():`?`}var ul=(0,v.forwardRef)(({avatarUrl:e,firstName:t,lastName:n,email:r,className:i,fallbackClassName:a,...o},s)=>(0,H.jsxs)(ol,{ref:s,className:K(`size-8`,i),...o,children:[e&&(0,H.jsx)(sl,{src:e,alt:``,className:`object-cover`}),(0,H.jsx)(cl,{className:K(`text-[11px]`,a),children:ll(t,n,r)})]},e??`fallback`));ul.displayName=`UserAvatar`,typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function dl(e,t){let n=v.createContext(t),r=e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,H.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function fl(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,pl(i,...t)]}function pl(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var ml=v.useInsertionEffect||Rc;function hl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=gl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=v.useRef(e!==void 0);v.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,v.useCallback(t=>{if(s){let n=_l(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function gl({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return ml(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function _l(e){return typeof e==`function`}function vl(e){let t=bl(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e,a=v.Children.toArray(r),o=a.find(Cl);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var yl=vl(`Slot`);function bl(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(v.isValidElement(n)){let e=Tl(n),i=wl(r,n.props);return n.type!==v.Fragment&&(i.ref=t?Go(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xl=Symbol(`radix.slottable`);function Sl(e){let t=({children:e})=>(0,H.jsx)(H.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=xl,t}function Cl(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===xl}function wl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Tl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var El=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=vl(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dl(e,t){e&&b.flushSync(()=>e.dispatchEvent(t))}function Ol(e){let t=e+`CollectionProvider`,[n,r]=fl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=v.useRef(null),a=v.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=vl(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,H.jsx)(c,{ref:Ko(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=vl(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=Ko(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return v.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var kl=v.createContext(void 0);function Al(e){let t=v.useContext(kl);return e||t||`ltr`}function jl(e,t=globalThis?.document){let n=Lc(e);v.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Ml=`DismissableLayer`,Nl=`dismissableLayer.update`,Pl=`dismissableLayer.pointerDownOutside`,Fl=`dismissableLayer.focusOutside`,Il,Ll=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rl=v.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=v.useContext(Ll),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=v.useState({}),m=Ko(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=_,S=Vl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Hl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return jl(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),v.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Il=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Ul(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Il)}},[u,f,n,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Ul())},[u,l]),v.useEffect(()=>{let e=()=>p({});return document.addEventListener(Nl,e),()=>document.removeEventListener(Nl,e)},[]),(0,H.jsx)(El.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,C.onFocusCapture),onBlurCapture:J(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,S.onPointerDownCapture)})});Rl.displayName=Ml;var zl=`DismissableLayerBranch`,Bl=v.forwardRef((e,t)=>{let n=v.useContext(Ll),r=v.useRef(null),i=Ko(t,r);return v.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(El.div,{...e,ref:i})});Bl.displayName=zl;function Vl(e,t=globalThis?.document){let n=Lc(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Wl(Pl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hl(e,t=globalThis?.document){let n=Lc(e),r=v.useRef(!1);return v.useEffect(()=>{let e=e=>{e.target&&!r.current&&Wl(Fl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ul(){let e=new CustomEvent(Nl);document.dispatchEvent(e)}function Wl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dl(i,a):i.dispatchEvent(a)}var Gl=0;function Kl(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ql()),document.body.insertAdjacentElement(`beforeend`,e[1]??ql()),Gl++,()=>{Gl===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Gl--}},[])}function ql(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Jl=`focusScope.autoFocusOnMount`,Yl=`focusScope.autoFocusOnUnmount`,Xl={bubbles:!1,cancelable:!0},Zl=`FocusScope`,Ql=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=Lc(i),u=Lc(a),d=v.useRef(null),f=Ko(t,e=>c(e)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:au(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||au(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&au(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),v.useEffect(()=>{if(s){ou.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Jl,Xl);s.addEventListener(Jl,l),s.dispatchEvent(t),t.defaultPrevented||($l(lu(tu(s)),{select:!0}),document.activeElement===e&&au(s))}return()=>{s.removeEventListener(Jl,l),setTimeout(()=>{let t=new CustomEvent(Yl,Xl);s.addEventListener(Yl,u),s.dispatchEvent(t),t.defaultPrevented||au(e??document.body,{select:!0}),s.removeEventListener(Yl,u),ou.remove(p)},0)}}},[s,l,u,p]);let m=v.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=eu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&au(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&au(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(El.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ql.displayName=Zl;function $l(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(au(r,{select:t}),document.activeElement!==n)return}function eu(e){let t=tu(e);return[nu(t,e),nu(t.reverse(),e)]}function tu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;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 nu(e,t){for(let n of e)if(!ru(n,{upTo:t}))return n}function ru(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function iu(e){return e instanceof HTMLInputElement&&`select`in e}function au(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iu(e)&&t&&e.select()}}var ou=su();function su(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=cu(e,t),e.unshift(t)},remove(t){e=cu(e,t),e[0]?.resume()}}}function cu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lu(e){return e.filter(e=>e.tagName!==`A`)}var uu=v.useId||(()=>void 0),du=0;function fu(e){let[t,n]=v.useState(uu());return Rc(()=>{e||n(e=>e??String(du++))},[e]),e||(t?`radix-${t}`:``)}var pu=[`top`,`right`,`bottom`,`left`],mu=Math.min,hu=Math.max,gu=Math.round,_u=Math.floor,vu=e=>({x:e,y:e}),yu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function bu(e,t,n){return hu(e,mu(t,n))}function xu(e,t){return typeof e==`function`?e(t):e}function Su(e){return e.split(`-`)[0]}function Cu(e){return e.split(`-`)[1]}function wu(e){return e===`x`?`y`:`x`}function Tu(e){return e===`y`?`height`:`width`}function Eu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Du(e){return wu(Eu(e))}function Ou(e,t,n){n===void 0&&(n=!1);let r=Cu(e),i=Du(e),a=Tu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Lu(o)),[o,Lu(o)]}function ku(e){let t=Lu(e);return[Au(e),t,Au(t)]}function Au(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ju=[`left`,`right`],Mu=[`right`,`left`],Nu=[`top`,`bottom`],Pu=[`bottom`,`top`];function Fu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Mu:ju:t?ju:Mu;case`left`:case`right`:return t?Nu:Pu;default:return[]}}function Iu(e,t,n,r){let i=Cu(e),a=Fu(Su(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Au)))),a}function Lu(e){let t=Su(e);return yu[t]+e.slice(t.length)}function Ru(e){return{top:0,right:0,bottom:0,left:0,...e}}function zu(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ru(e)}function Bu(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Vu(e,t,n){let{reference:r,floating:i}=e,a=Eu(t),o=Du(t),s=Tu(o),c=Su(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Cu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Hu(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=xu(t,e),p=zu(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Bu(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Bu(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Uu=50,Wu=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Hu},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Vu(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Uu&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Vu(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Gu=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=xu(e,t)||{};if(l==null)return{};let d=zu(u),f={x:n,y:r},p=Du(i),m=Tu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=mu(d[_],T),D=mu(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=bu(O,A,k),M=!c.arrow&&Cu(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ku=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=xu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Su(r),_=Eu(o),v=Su(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Lu(o)]:ku(o)),x=p!==`none`;!d&&x&&b.push(...Iu(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ou(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Eu(t))||T.every(e=>Eu(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Eu(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function qu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ju(e){return pu.some(t=>e[t]>=0)}var Yu=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=xu(e,t);switch(i){case`referenceHidden`:{let e=qu(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ju(e)}}}case`escaped`:{let e=qu(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ju(e)}}}default:return{}}}}},Xu=new Set([`left`,`top`]);async function Zu(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Su(n),s=Cu(n),c=Eu(n)===`y`,l=Xu.has(o)?-1:1,u=a&&c?-1:1,d=xu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Qu=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Zu(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},$u=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=xu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Eu(Su(i)),p=wu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=bu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=bu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ed=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=xu(e,t),u={x:n,y:r},d=Eu(i),f=wu(d),p=u[f],m=u[d],h=xu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Xu.has(Su(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},td=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=xu(e,t),u=await o.detectOverflow(t,l),d=Su(i),f=Cu(i),p=Eu(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=mu(h-u[g],v),x=mu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=hu(u.left,0),t=hu(u.right,0),n=hu(u.top,0),r=hu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:hu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:hu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function nd(){return typeof window<`u`}function rd(e){return od(e)?(e.nodeName||``).toLowerCase():`#document`}function id(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ad(e){return((od(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function od(e){return nd()?e instanceof Node||e instanceof id(e).Node:!1}function sd(e){return nd()?e instanceof Element||e instanceof id(e).Element:!1}function cd(e){return nd()?e instanceof HTMLElement||e instanceof id(e).HTMLElement:!1}function ld(e){return!nd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof id(e).ShadowRoot}function ud(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dd(e){return/^(table|td|th)$/.test(rd(e))}function fd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pd=/transform|translate|scale|rotate|perspective|filter/,md=/paint|layout|strict|content/,hd=e=>!!e&&e!==`none`,gd;function _d(e){let t=sd(e)?xd(e):e;return hd(t.transform)||hd(t.translate)||hd(t.scale)||hd(t.rotate)||hd(t.perspective)||!yd()&&(hd(t.backdropFilter)||hd(t.filter))||pd.test(t.willChange||``)||md.test(t.contain||``)}function vd(e){let t=Cd(e);for(;cd(t)&&!bd(t);){if(_d(t))return t;if(fd(t))return null;t=Cd(t)}return null}function yd(){return gd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gd}function bd(e){return/^(html|body|#document)$/.test(rd(e))}function xd(e){return id(e).getComputedStyle(e)}function Sd(e){return sd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cd(e){if(rd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ld(e)&&e.host||ad(e);return ld(t)?t.host:t}function wd(e){let t=Cd(e);return bd(t)?e.ownerDocument?e.ownerDocument.body:e.body:cd(t)&&ud(t)?t:wd(t)}function Td(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wd(e),i=r===e.ownerDocument?.body,a=id(r);if(i){let e=Ed(a);return t.concat(a,a.visualViewport||[],ud(r)?r:[],e&&n?Td(e):[])}else return t.concat(r,Td(r,[],n))}function Ed(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dd(e){let t=xd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=gu(n)!==a||gu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Od(e){return sd(e)?e:e.contextElement}function kd(e){let t=Od(e);if(!cd(t))return vu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Dd(t),o=(a?gu(n.width):n.width)/r,s=(a?gu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ad=vu(0);function jd(e){let t=id(e);return!yd()||!t.visualViewport?Ad:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Md(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==id(e)?!1:t}function Nd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Od(e),o=vu(1);t&&(r?sd(r)&&(o=kd(r)):o=kd(e));let s=Md(a,n,r)?jd(a):vu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=id(a),t=r&&sd(r)?id(r):r,n=e,i=Ed(n);for(;i&&r&&t!==n;){let e=kd(i),t=i.getBoundingClientRect(),r=xd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=id(i),i=Ed(n)}}return Bu({width:u,height:d,x:c,y:l})}function Pd(e,t){let n=Sd(e).scrollLeft;return t?t.left+n:Nd(ad(e)).left+n}function Fd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pd(e,n),y:n.top+t.scrollTop}}function Id(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ad(r),s=t?fd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=vu(1),u=vu(0),d=cd(r);if((d||!d&&!a)&&((rd(r)!==`body`||ud(o))&&(c=Sd(r)),d)){let e=Nd(r);l=kd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fd(o,c):vu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ld(e){return Array.from(e.getClientRects())}function Rd(e){let t=ad(e),n=Sd(e),r=e.ownerDocument.body,i=hu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=hu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Pd(e),s=-n.scrollTop;return xd(r).direction===`rtl`&&(o+=hu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var zd=25;function Bd(e,t){let n=id(e),r=ad(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=yd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Pd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=zd&&(a-=o)}else l<=zd&&(a+=l);return{width:a,height:o,x:s,y:c}}function Vd(e,t){let n=Nd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cd(e)?kd(e):vu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Hd(e,t,n){let r;if(t===`viewport`)r=Bd(e,n);else if(t===`document`)r=Rd(ad(e));else if(sd(t))r=Vd(t,n);else{let n=jd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Bu(r)}function Ud(e,t){let n=Cd(e);return n===t||!sd(n)||bd(n)?!1:xd(n).position===`fixed`||Ud(n,t)}function Wd(e,t){let n=t.get(e);if(n)return n;let r=Td(e,[],!1).filter(e=>sd(e)&&rd(e)!==`body`),i=null,a=xd(e).position===`fixed`,o=a?Cd(e):e;for(;sd(o)&&!bd(o);){let t=xd(o),n=_d(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ud(o)&&!n&&Ud(e,o))?r=r.filter(e=>e!==o):i=t,o=Cd(o)}return t.set(e,r),r}function Gd(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fd(t)?[]:Wd(t,this._c):[].concat(n),r],o=Hd(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Hd(t,a[e],i);s=hu(n.top,s),c=mu(n.right,c),l=mu(n.bottom,l),u=hu(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Kd(e){let{width:t,height:n}=Dd(e);return{width:t,height:n}}function qd(e,t,n){let r=cd(t),i=ad(t),a=n===`fixed`,o=Nd(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=vu(0);function l(){c.x=Pd(i)}if(r||!r&&!a)if((rd(t)!==`body`||ud(i))&&(s=Sd(t)),r){let e=Nd(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Fd(i,s):vu(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Jd(e){return xd(e).position===`static`}function Yd(e,t){if(!cd(e)||xd(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ad(e)===n&&(n=n.ownerDocument.body),n}function Xd(e,t){let n=id(e);if(fd(e))return n;if(!cd(e)){let t=Cd(e);for(;t&&!bd(t);){if(sd(t)&&!Jd(t))return t;t=Cd(t)}return n}let r=Yd(e,t);for(;r&&dd(r)&&Jd(r);)r=Yd(r,t);return r&&bd(r)&&Jd(r)&&!_d(r)?n:r||vd(e)||n}var Zd=async function(e){let t=this.getOffsetParent||Xd,n=this.getDimensions,r=await n(e.floating);return{reference:qd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qd(e){return xd(e).direction===`rtl`}var $d={convertOffsetParentRelativeRectToViewportRelativeRect:Id,getDocumentElement:ad,getClippingRect:Gd,getOffsetParent:Xd,getElementRects:Zd,getClientRects:Ld,getDimensions:Kd,getScale:kd,isElement:sd,isRTL:Qd};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tf(e,t){let n=null,r,i=ad(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_u(d),h=_u(i.clientWidth-(u+f)),g=_u(i.clientHeight-(d+p)),_=_u(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:hu(0,mu(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ef(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function nf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Od(e),u=i||a?[...l?Td(l):[],...t?Td(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?tf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Nd(e):null;c&&g();function g(){let t=Nd(e);h&&!ef(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rf=Qu,af=$u,of=Ku,sf=td,cf=Yu,lf=Gu,uf=ed,df=(e,t,n)=>{let r=new Map,i={platform:$d,...n},a={...i.platform,_c:r};return Wu(e,t,{...i,platform:a})},ff=typeof document<`u`?v.useLayoutEffect:function(){};function pf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function mf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hf(e,t){let n=mf(e);return Math.round(t*n)/n}function gf(e){let t=v.useRef(e);return ff(()=>{t.current=e}),t}function _f(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);pf(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=gf(c),k=gf(i),A=gf(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),df(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!pf(E.current,t)&&(E.current=t,b.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);ff(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);ff(()=>(M.current=!0,()=>{M.current=!1}),[]),ff(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:y,setFloating:x}),[y,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=hf(P.floating,u.x),r=hf(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...mf(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var vf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:lf({element:r.current,padding:i}).fn(n):r?lf({element:r,padding:i}).fn(n):{}}}},yf=(e,t)=>{let n=rf(e);return{name:n.name,fn:n.fn,options:[e,t]}},bf=(e,t)=>{let n=af(e);return{name:n.name,fn:n.fn,options:[e,t]}},xf=(e,t)=>({fn:uf(e).fn,options:[e,t]}),Sf=(e,t)=>{let n=of(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cf=(e,t)=>{let n=sf(e);return{name:n.name,fn:n.fn,options:[e,t]}},wf=(e,t)=>{let n=cf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tf=(e,t)=>{let n=vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ef=`Arrow`,Df=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,H.jsx)(El.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,H.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Df.displayName=Ef;var Of=Df;function kf(e){let[t,n]=v.useState(void 0);return Rc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Af=`Popper`,[jf,Mf]=fl(Af),[Nf,Pf]=jf(Af),Ff=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return(0,H.jsx)(Nf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ff.displayName=Af;var If=`PopperAnchor`,Lf=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Pf(If,n),o=v.useRef(null),s=Ko(t,o),c=v.useRef(null);return v.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,H.jsx)(El.div,{...i,ref:s})});Lf.displayName=If;var Rf=`PopperContent`,[zf,Bf]=jf(Rf),Vf=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Pf(Rf,n),[_,y]=v.useState(null),b=Ko(t,e=>y(e)),[x,S]=v.useState(null),C=kf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Gf),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=_f({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>nf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[yf({mainAxis:i+T,alignmentAxis:o}),c&&bf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?xf():void 0,...A}),c&&Sf({...A}),Cf({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Tf({element:x,padding:s}),Kf({arrowWidth:w,arrowHeight:T}),f&&wf({strategy:`referenceHidden`,...A})]}),[I,L]=qf(N),R=Lc(m);Rc(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,ne=F.arrow?.centerOffset!==0,[z,B]=v.useState();return Rc(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,H.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:z,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,H.jsx)(zf,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:ne,children:(0,H.jsx)(El.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Vf.displayName=Rf;var Hf=`PopperArrow`,Uf={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Wf=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Bf(Hf,n),a=Uf[i.placedSide];return(0,H.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,H.jsx)(Of,{...r,ref:t,style:{...r.style,display:`block`}})})});Wf.displayName=Hf;function Gf(e){return e!==null}var Kf=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=qf(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function qf(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Jf=Ff,Yf=Lf,Xf=Vf,Zf=Wf,Qf=`Portal`,$f=v.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=v.useState(!1);Rc(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?b.createPortal((0,H.jsx)(El.div,{...r,ref:t}),o):null});$f.displayName=Qf;function ep(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}var tp=e=>{let{present:t,children:n}=e,r=np(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=Ko(r.ref,ip(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null};tp.displayName=`Presence`;function np(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),[o,s]=ep(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{let e=rp(r.current);a.current=o===`mounted`?e:`none`},[o]),Rc(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=rp(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Rc(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=rp(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=rp(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:v.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function rp(e){return e?.animationName||`none`}function ip(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ap=`rovingFocusGroup.onEntryFocus`,op={bubbles:!1,cancelable:!0},sp=`RovingFocusGroup`,[cp,lp,up]=Ol(sp),[dp,fp]=fl(sp,[up]),[pp,mp]=dp(sp),hp=v.forwardRef((e,t)=>(0,H.jsx)(cp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(cp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(gp,{...e,ref:t})})}));hp.displayName=sp;var gp=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=Ko(t,f),m=Al(a),[h,g]=hl({prop:o,defaultProp:s??null,onChange:c,caller:sp}),[_,y]=v.useState(!1),b=Lc(l),x=lp(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ap,b),()=>e.removeEventListener(ap,b)},[b]),(0,H.jsx)(pp,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,H.jsx)(El.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{S.current=!0}),onFocus:J(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ap,op);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Sp([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:J(e.onBlur,()=>y(!1))})})}),_p=`RovingFocusGroupItem`,vp=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=fu(),l=a||c,u=mp(_p,n),d=u.currentTabStopId===l,f=lp(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return v.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,H.jsx)(cp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(El.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=xp(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Cp(n,r+1):n.slice(r+1)}setTimeout(()=>Sp(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});vp.displayName=_p;var yp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function bp(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function xp(e,t,n){let r=bp(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return yp[r]}function Sp(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Cp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wp=hp,Tp=vp,Ep=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Dp=new WeakMap,Op=new WeakMap,kp={},Ap=0,jp=function(e){return e&&(e.host||jp(e.parentNode))},Mp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=jp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Np=function(e,t,n,r){var i=Mp(t,Array.isArray(e)?e:[e]);kp[n]||(kp[n]=new WeakMap);var a=kp[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Dp.get(e)||0)+1,l=(a.get(e)||0)+1;Dp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Op.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ap++,function(){o.forEach(function(e){var t=Dp.get(e)-1,i=a.get(e)-1;Dp.set(e,t),a.set(e,i),t||(Op.has(e)||e.removeAttribute(r),Op.delete(e)),i||e.removeAttribute(n)}),Ap--,Ap||(Dp=new WeakMap,Dp=new WeakMap,Op=new WeakMap,kp={})}},Pp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ep(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Np(r,i,n,`aria-hidden`)):function(){return null}},Fp=function(){return Fp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Fp.apply(this,arguments)};function Ip(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Lp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Rp=`right-scroll-bar-position`,zp=`width-before-scroll-bar`,Bp=`with-scroll-bars-hidden`,Vp=`--removed-body-scroll-bar-size`;function Hp(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Up(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Wp=typeof window<`u`?v.useLayoutEffect:v.useEffect,Gp=new WeakMap;function Kp(e,t){var n=Up(t||null,function(t){return e.forEach(function(e){return Hp(e,t)})});return Wp(function(){var t=Gp.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Hp(e,null)}),i.forEach(function(e){r.has(e)||Hp(e,a)})}Gp.set(n,e)},[e]),n}function qp(e){return e}function Jp(e,t){t===void 0&&(t=qp);var n=[],r=!1;return{read:function(){if(r)throw 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 i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},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 i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Yp(e){e===void 0&&(e={});var t=Jp(null);return t.options=Fp({async:!0,ssr:!1},e),t}var Xp=function(e){var t=e.sideCar,n=Ip(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,Fp({},n))};Xp.isSideCarExport=!0;function Zp(e,t){return e.useMedium(t),Xp}var Qp=Yp(),$p=function(){},em=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:$p,onWheelCapture:$p,onTouchMoveCapture:$p}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,y=_===void 0?`div`:_,b=e.gapMode,x=Ip(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Kp([n,t]),w=Fp(Fp({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:Qp,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?v.cloneElement(v.Children.only(s),Fp(Fp({},w),{ref:C})):v.createElement(y,Fp({},w,{className:c,ref:C}),s))});em.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},em.classNames={fullWidth:zp,zeroRight:Rp};var tm,nm=function(){if(tm)return tm;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rm(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nm();return t&&e.setAttribute(`nonce`,t),e}function im(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function am(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var om=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rm())&&(im(t,n),am(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sm=function(){var e=om();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},cm=function(){var e=sm();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},lm={left:0,top:0,right:0,gap:0},um=function(e){return parseInt(e||``,10)||0},dm=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[um(n),um(r),um(i)]},fm=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return lm;var t=dm(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])}},pm=cm(),mm=`data-scroll-locked`,hm=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
12
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Xn(),d;if(t){let e=typeof t==`string`?R(t):t;M(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=ce(e,{pathname:p});N(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),N(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=fr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Re([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Re([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(Bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function or(){let e=xr(),t=We(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var sr=v.createElement(or,null),cr=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=qn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(Vn.Provider,{value:this.props.routeContext},v.createElement(Hn.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(ur,{error:e},t):t}};cr.contextType=Pn;var lr=new WeakMap;function ur({children:e,error:t}){let{basename:n}=v.useContext(zn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Kn(t.digest);if(e){let r=lr.get(t);if(r)throw r;let i=qe(e.location,n);if(Ke&&!lr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw lr.set(t,n),n}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function dr({routeContext:e,match:t,children:n}){let r=v.useContext(Mn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Vn.Provider,{value:e},n)}function fr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);M(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Ge(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||sr,o&&(s<0&&c===0?(Er(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(dr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(cr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function pr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mr(e){let t=v.useContext(Mn);return M(t,pr(e)),t}function hr(e){let t=v.useContext(Nn);return M(t,pr(e)),t}function gr(e){let t=v.useContext(Vn);return M(t,pr(e)),t}function _r(e){let t=gr(e),n=t.matches[t.matches.length-1];return M(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vr(){return _r(`useRouteId`)}function yr(){return hr(`useNavigation`).navigation}function br(){let{matches:e,loaderData:t}=hr(`useMatches`);return v.useMemo(()=>e.map(e=>ue(e,t)),[e,t])}function xr(){let e=v.useContext(Hn),t=hr(`useRouteError`),n=_r(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Sr=0;function Cr(e){let{router:t,basename:n}=mr(`useBlocker`),r=hr(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:De(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:De(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Sr);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):pt}function wr(){let{router:e}=mr(`useNavigate`),t=_r(`useNavigate`),n=v.useRef(!1);return Qn(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{N(n.current,Zn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Tr={};function Er(e,t,n){!t&&!Tr[e]&&(Tr[e]=!0,N(!1,n))}var Dr={};function Or(e,t){!e&&!Dr[t]&&(Dr[t]=!0,console.warn(t))}var kr=v.useOptimistic,Ar=()=>void 0;function jr(e){return kr?kr(e):[e,Ar]}function Mr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&N(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&N(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&N(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Nr=[`HydrateFallback`,`hydrateFallbackElement`],Pr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Fr({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Fn()||r;let[i,a]=v.useState(e.state),[o,s]=jr(i),[c,l]=v.useState(),[u,d]=v.useState({isTransitioning:!1}),[f,p]=v.useState(),[m,h]=v.useState(),[g,_]=v.useState(),y=v.useRef(new Map),b=v.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},unstable_pattern:Ge(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),Or(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Or(g==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!b){t&&u?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>Ir(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);v.useLayoutEffect(()=>e.subscribe(b),[e,b]);let x=o.initialized;v.useLayoutEffect(()=>{!x&&e.state.initialized&&b(e.state,{deletedFetchers:[],flushSync:!1,newErrors:null})},[x,b,e.state]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Pr)},[u]),v.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>Ir(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),v.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),v.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let S=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),C=e.basename||`/`,w=v.useMemo(()=>({router:e,navigator:S,static:!1,basename:C,onError:n}),[e,S,C,n]);return v.createElement(v.Fragment,null,v.createElement(Mn.Provider,{value:w},v.createElement(Nn.Provider,{value:o},v.createElement(Ln.Provider,{value:y.current},v.createElement(In.Provider,{value:u},v.createElement(Vr,{basename:C,location:o.location,navigationType:o.historyAction,navigator:S,unstable_useTransitions:r},v.createElement(Lr,{routes:e.routes,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Ir(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Lr=v.memo(Rr);function Rr({routes:e,future:t,state:n,isStatic:r,onError:i}){return ar(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function zr({to:e,replace:t,state:n,relative:r}){M(Yn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v.useContext(zn);N(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(Vn),{pathname:o}=Xn(),s=$n(),c=Ie(e,Fe(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Br(e){return nr(e.context)}function Vr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){M(!Yn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=R(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=v.useMemo(()=>{let e=De(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return N(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(zn.Provider,{value:c},v.createElement(Bn.Provider,{children:t,value:h}))}v.Component;var Hr=`get`,Ur=`application/x-www-form-urlencoded`;function Wr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Gr(e){return Wr(e)&&e.tagName.toLowerCase()===`button`}function Kr(e){return Wr(e)&&e.tagName.toLowerCase()===`form`}function qr(e){return Wr(e)&&e.tagName.toLowerCase()===`input`}function Jr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Yr(e,t){return e.button===0&&(!t||t===`_self`)&&!Jr(e)}function Xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Zr(e,t){let n=Xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Qr=null;function $r(){if(Qr===null)try{new FormData(document.createElement(`form`),0),Qr=!1}catch{Qr=!0}return Qr}var ei=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ti(e){return e!=null&&!ei.has(e)?(N(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ur}"`),null):e}function ni(e,t){let n,r,i,a,o;if(Kr(e)){let o=e.getAttribute(`action`);r=o?De(o,t):null,n=e.getAttribute(`method`)||Hr,i=ti(e.getAttribute(`enctype`))||Ur,a=new FormData(e)}else if(Gr(e)||qr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?De(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Hr,i=ti(e.getAttribute(`formenctype`))||ti(o.getAttribute(`enctype`))||Ur,a=new FormData(o,e),!$r()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Wr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Hr,r=null,i=Ur,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ri={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ii=/[&><\u2028\u2029]/g;function ai(e){return e.replace(ii,e=>ri[e])}function oi(e,t){if(e===!1||e==null)throw Error(t)}function si(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&De(i.pathname,t)===`/`?i.pathname=`${ze(t)}/_root.${r}`:i.pathname=`${ze(i.pathname)}.${r}`,i}async function ci(e,t){if(e.id in t)return t[e.id];try{let n=await w(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function li(e){return e!=null&&typeof e.page==`string`}function ui(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function di(e,t,n){return gi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await ci(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ui).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function fi(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function pi(e,t,{includeHydrateFallback:n}={}){return mi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function mi(e){return[...new Set(e)]}function hi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function gi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!li(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(hi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function _i(){let e=v.useContext(Mn);return oi(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function vi(){let e=v.useContext(Nn);return oi(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var yi=v.createContext(void 0);yi.displayName=`FrameworkContext`;function bi(){let e=v.useContext(yi);return oi(e,`You must render this element inside a <HydratedRouter> element`),e}function xi(e,t){let n=v.useContext(yi),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Si(s,p),onBlur:Si(c,m),onMouseEnter:Si(l,p),onMouseLeave:Si(u,m),onTouchStart:Si(d,p)}]:[a,f,{}]:[!1,f,{}]}function Si(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ci({page:e,...t}){let n=Fn(),{router:r}=_i(),i=v.useMemo(()=>ce(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?v.createElement(Ti,{page:e,matches:i,...t}):v.createElement(Ei,{page:e,matches:i,...t}):null}function wi(e){let{manifest:t,routeModules:n}=bi(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return di(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ti({page:e,matches:t,...n}){let r=Xn(),{future:i}=bi(),{basename:a}=_i(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=si(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Ei({page:e,matches:t,...n}){let r=Xn(),{future:i,manifest:a,routeModules:o}=bi(),{basename:s}=_i(),{loaderData:c,matches:l}=vi(),u=v.useMemo(()=>fi(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>fi(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=si(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>pi(d,a),[d,a]),m=wi(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Di(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var Oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Oi&&(window.__reactRouterVersion=`7.14.1`)}catch{}function ki(e,t){return _t({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:j({window:t?.window}),hydrationData:t?.hydrationData||Ai(),routes:e,mapRouteProperties:Mr,hydrationRouteProperties:Nr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function Ai(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ji(e.errors)}),e}function ji(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Ue(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function Mi({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=v.useState({action:n.action,location:n.location}),o=v.useCallback(e=>{r===!1?a(e):v.startTransition(()=>a(e))},[r]);return v.useLayoutEffect(()=>n.listen(o),[n,o]),v.createElement(Vr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Mi.displayName=`unstable_HistoryRouter`;var Ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pi=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=v.useContext(zn),y=typeof l==`string`&&Ni.test(l),b=qe(l,h);l=b.to;let x=Jn(l,{relative:r}),S=Xn(),C=null;if(o){let e=Ie(o,[],S.unstable_mask?S.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Re([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=xi(n,p),D=Vi(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=v.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:Di(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(Ci,{page:x})):A});Pi.displayName=`Link`;var Fi=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ir(a,{relative:c.relative}),d=Xn(),f=v.useContext(Nn),{navigator:p,basename:m}=v.useContext(zn),h=f!=null&&Qi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=De(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(Pi,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Fi.displayName=`NavLink`;var Ii=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Hr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=v.useContext(zn),g=Gi(),_=Ki(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&Ni.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Ii.displayName=`Form`;function Li({getKey:e,storageKey:t,...n}){let r=v.useContext(yi),{basename:i}=v.useContext(zn),a=Xn(),o=br();Xi({getKey:e,storageKey:t});let s=v.useMemo(()=>{if(!r||!e)return null;let t=Yi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return v.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${ai(JSON.stringify(t||qi))}, ${ai(JSON.stringify(s))})`}})}Li.displayName=`ScrollRestoration`;function Ri(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zi(e){let t=v.useContext(Mn);return M(t,Ri(e)),t}function Bi(e){let t=v.useContext(Nn);return M(t,Ri(e)),t}function Vi(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=$n(),d=Xn(),f=ir(e,{relative:o});return v.useCallback(p=>{if(Yr(p,t)){p.preventDefault();let t=n===void 0?L(d)===L(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Hi(e){N(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Xr(e)),n=v.useRef(!1),r=Xn(),i=v.useMemo(()=>Zr(r.search,n.current?null:t.current),[r.search]),a=$n();return[i,v.useCallback((e,t)=>{let r=Xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Ui=0,Wi=()=>`__${String(++Ui)}__`;function Gi(){let{router:e}=zi(`useSubmit`),{basename:t}=v.useContext(zn),n=vr(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ni(e,t);a.navigate===!1?await r(a.fetcherKey||Wi(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ki(e,{relative:t}={}){let{basename:n}=v.useContext(zn),r=v.useContext(Vn);M(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ir(e||`.`,{relative:t})},o=Xn();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Re([n,a.pathname])),L(a)}var qi=`react-router-scroll-positions`,Ji={};function Yi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:De(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Xi({getKey:e,storageKey:t}={}){let{router:n}=zi(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Bi(`useScrollRestoration`),{basename:a}=v.useContext(zn),o=Xn(),s=br(),c=yr();v.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Zi(v.useCallback(()=>{if(c.state===`idle`){let t=Yi(o,s,a,e);Ji[t]=window.scrollY}try{sessionStorage.setItem(t||qi,JSON.stringify(Ji))}catch(e){N(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(v.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||qi);e&&(Ji=JSON.parse(e))}catch{}},[t]),v.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ji,()=>window.scrollY,e?(t,n)=>Yi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),v.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{N(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Zi(e,t){let{capture:n}=t||{};v.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Qi(e,{relative:t}={}){let n=v.useContext(In);M(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=zi(`useViewTransitionState`),i=ir(e,{relative:t});if(!n.isTransitioning)return!1;let a=De(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=De(n.nextLocation.pathname,r)||n.nextLocation.pathname;return we(i.pathname,o)!=null||we(i.pathname,a)!=null}function $i(e){return v.createElement(Fr,{flushSync:b.flushSync,...e})}var ea=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=ea()}))();function ta(e,t){switch(t.type){case`LOGIN`:return{user:t.payload.user,status:`authenticated`};case`LOGOUT`:return{user:null,status:`unauthenticated`};case`UPDATE_USER`:return{...e,user:e.user?{...e.user,...t.payload}:null}}}var na=(0,v.createContext)(null);function ra({children:e}){let[t,n]=(0,v.useReducer)(ta,{user:null,status:`idle`});(0,v.useEffect)(()=>{localStorage.removeItem(`plank_token`),localStorage.removeItem(`plank_user`),fetch(`/cms/admin/users/me`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!e){n({type:`LOGOUT`});return}n({type:`LOGIN`,payload:{user:{id:e.id,email:e.email,role:e.role??e.role_name??`unknown`,permissions:e.permissions??[],firstName:e.first_name??null,lastName:e.last_name??null,avatarUrl:e.avatar_url??null,jobTitle:e.job_title??null,organization:e.organization??null,country:e.country??null,twoFactorEnabled:e.two_factor_enabled??!1}}})}).catch(()=>n({type:`LOGOUT`}))},[]);function r(e){n({type:`LOGIN`,payload:{user:e}})}function i(){fetch(`/cms/auth/logout`,{method:`POST`,credentials:`include`}).catch(()=>{}),n({type:`LOGOUT`})}function a(e){n({type:`UPDATE_USER`,payload:e})}return(0,H.jsx)(na.Provider,{value:{...t,login:r,logout:i,updateUser:a},children:e})}function ia(){let e=(0,v.useContext)(na);if(!e)throw Error(`useAuth must be used inside AuthProvider`);return e}var aa=(0,v.createContext)({timezone:`UTC`,locales:[`en`],defaultLocale:`en`,refreshSettings:()=>{}});function oa({children:e}){let[t,n]=(0,v.useState)(`UTC`),[r,i]=(0,v.useState)([`en`]),[a,o]=(0,v.useState)(`en`),s=(0,v.useCallback)(()=>{fetch(`/cms/admin/settings/general`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{e?.timezone&&n(e.timezone);try{if(e?.locales){let t=[];try{t=JSON.parse(e.locales)}catch{t=(e.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean)}t.length&&i(t)}}catch{}e?.default_locale&&o(e.default_locale)}).catch(()=>{})},[]);return(0,v.useEffect)(()=>{s()},[s]),(0,H.jsx)(aa.Provider,{value:{timezone:t,locales:r,defaultLocale:a,refreshSettings:s},children:e})}function sa(){return(0,v.useContext)(aa)}var ca=(0,v.createContext)({shortcuts:[],register:()=>()=>{}});function la({children:e}){let[t,n]=(0,v.useState)([]),r=(0,v.useCallback)((e,t)=>{let r={combo:e,label:t};return n(e=>[...e,r]),()=>n(e=>e.filter(e=>e!==r))},[]);return(0,H.jsx)(ca.Provider,{value:{shortcuts:t,register:r},children:e})}function ua(e,t){return e.includes(`*`)||e.includes(t)}function da({children:e,roles:t,permission:n}){let{status:r,user:i}=ia();return r===`idle`?null:r===`unauthenticated`?(0,H.jsx)(zr,{to:`/login`,replace:!0}):t&&i&&!t.map(e=>e.toLowerCase()).includes(i.role.toLowerCase())||n&&i&&!ua(i.permissions,n)?(0,H.jsx)(zr,{to:`/`,replace:!0}):(0,H.jsx)(H.Fragment,{children:e})}function fa(e,t){let[n,r]=(0,v.useState)({data:null,loading:!!e,error:null}),i=(0,v.useCallback)(()=>{if(!e){r({data:null,loading:!1,error:null});return}r({data:null,loading:!0,error:null});let n={"Content-Type":`application/json`,...t?.headers};fetch(e,{...t,credentials:`include`,headers:n}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>r({data:e,loading:!1,error:null})).catch(e=>{r({data:null,loading:!1,error:e instanceof Error?e.message:`Unknown error`})})},[e,t]);return(0,v.useEffect)(()=>{i()},[i]),{...n,refetch:i}}var pa=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ma=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ha=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ga=e=>{let t=ha(e);return t.charAt(0).toUpperCase()+t.slice(1)},_a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},va=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ya=(0,v.createContext)({}),ba=()=>(0,v.useContext)(ya),xa=(0,v.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=ba()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,v.createElement)(`svg`,{ref:c,..._a,width:t??l??_a.width,height:t??l??_a.height,stroke:e??f,strokeWidth:m,className:pa(`lucide`,p,i),...!a&&!va(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(xa,{ref:i,iconNode:t,className:pa(`lucide-${ma(ga(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ga(e),n},Sa=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ca=U(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),wa=U(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ta=U(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ea=U(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Da=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Oa=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ka=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Aa=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ja=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ma=U(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Na=U(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Pa=U(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Fa=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ia=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),La=U(`columns-3-cog`,[[`path`,{d:`M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5`,key:`1g2yzs`}],[`path`,{d:`m14.3 19.6 1-.4`,key:`11sv9r`}],[`path`,{d:`M15 3v7.5`,key:`7lm50a`}],[`path`,{d:`m15.2 16.9-.9-.3`,key:`1t7mvx`}],[`path`,{d:`m16.6 21.7.3-.9`,key:`1j67ps`}],[`path`,{d:`m16.8 15.3-.4-1`,key:`1ei7r6`}],[`path`,{d:`m19.1 15.2.3-.9`,key:`18r7jp`}],[`path`,{d:`m19.6 21.7-.4-1`,key:`z2vh2`}],[`path`,{d:`m20.7 16.8 1-.4`,key:`19m87a`}],[`path`,{d:`m21.7 19.4-.9-.3`,key:`1qgwi9`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ra=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=U(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ba=U(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Va=U(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ha=U(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ua=U(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),Wa=U(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),Ga=U(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=U(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),qa=U(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Ja=U(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ya=U(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xa=U(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Za=U(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Qa=U(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),$a=U(`heading-1`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]),eo=U(`heading-2`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]),to=U(`heading-3`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2`,key:`68ncm8`}],[`path`,{d:`M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2`,key:`1ejuhz`}]]),no=U(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),ro=U(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),io=U(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),ao=U(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),oo=U(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),so=U(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),co=U(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),lo=U(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]),uo=U(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),fo=U(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),po=U(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),mo=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ho=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),go=U(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),_o=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),vo=U(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),yo=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),bo=U(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),xo=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),So=U(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Co=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),wo=U(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),To=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Eo=U(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Do=U(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Oo=U(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ko=U(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Ao=U(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),jo=U(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),Mo=U(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),No=U(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Po=U(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Fo=U(`unlink-2`,[[`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2`,key:`1re2ne`}]]),Io=U(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Lo=U(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Ro=U(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),zo=U(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),Bo=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Vo=(0,v.createContext)(null);function Ho({children:e}){let[t,n]=(0,v.useState)(null);return(0,H.jsx)(Vo.Provider,{value:{content:t,setContent:n},children:e})}function Uo(){let e=(0,v.useContext)(Vo);if(!e)throw Error(`useSecondaryPanelContext must be used within SecondaryPanelProvider`);return e}function Wo(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Go(...e){return t=>{let n=!1,r=e.map(e=>{let r=Wo(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Wo(e[t],null)}}}}function Ko(...e){return v.useCallback(Go(...e),e)}var qo=Symbol.for(`react.lazy`),Jo=v.use;function Yo(e){return typeof e==`object`&&!!e&&`then`in e}function Xo(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===qo&&`_payload`in e&&Yo(e._payload)}function Zo(e){let t=$o(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e;Xo(r)&&typeof Jo==`function`&&(r=Jo(r._payload));let a=v.Children.toArray(r),o=a.find(ts);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Qo=Zo(`Slot`);function $o(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(Xo(n)&&typeof Jo==`function`&&(n=Jo(n._payload)),v.isValidElement(n)){let e=rs(n),i=ns(r,n.props);return n.type!==v.Fragment&&(i.ref=t?Go(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var es=Symbol(`radix.slottable`);function ts(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===es}function ns(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function rs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function is(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=is(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function as(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=is(e))&&(r&&(r+=` `),r+=t);return r}var ss=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,cs=as,ls=(e,t)=>n=>{if(t?.variants==null)return cs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ss(t)||ss(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return cs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},us=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ds=(e,t)=>({classGroupId:e,validator:t}),fs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ps=`-`,ms=[],hs=`arbitrary..`,gs=e=>{let t=ys(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return vs(e);let n=e.split(ps);return _s(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?us(i,t):t:i||ms}return n[e]||ms}}},_s=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=_s(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ps):e.slice(t).join(ps),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},vs=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?hs+r:void 0})(),ys=e=>{let{theme:t,classGroups:n}=e;return bs(n,t)},bs=(e,t)=>{let n=fs();for(let r in e){let i=e[r];xs(i,n,r,t)}return n},xs=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Ss(i,t,n,r)}},Ss=(e,t,n,r)=>{if(typeof e==`string`){Cs(e,t,n);return}if(typeof e==`function`){ws(e,t,n,r);return}Ts(e,t,n,r)},Cs=(e,t,n)=>{let r=e===``?t:Es(t,e);r.classGroupId=n},ws=(e,t,n,r)=>{if(Ds(e)){xs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ds(n,e))},Ts=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];xs(o,Es(t,a),n,r)}},Es=(e,t)=>{let n=e,r=t.split(ps),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=fs(),n.nextPart.set(t,i)),n=i}return n},Ds=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Os=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ks=`!`,As=`:`,js=[],Ms=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ns=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===As){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ks)?(c=s.slice(0,-1),l=!0):s.startsWith(ks)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Ms(t,l,c,u)};if(t){let e=t+As,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ms(js,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ps=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Fs=e=>({cache:Os(e.cacheSize),parseClassName:Ns(e),sortModifiers:Ps(e),...gs(e)}),Is=/\s+/,Ls=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Is),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+ks:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Rs=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=zs(n))&&(i&&(i+=` `),i+=r);return i},zs=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=zs(e[r]))&&(n&&(n+=` `),n+=t);return n},Bs=(e,...t)=>{let n,r,i,a,o=o=>(n=Fs(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ls(e,n);return i(e,a),a};return a=o,(...e)=>a(Rs(...e))},Vs=[],Hs=e=>{let t=t=>t[e]||Vs;return t.isThemeGetter=!0,t},Us=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gs=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ks=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Js=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ys=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zs=e=>Gs.test(e),Qs=e=>!!e&&!Number.isNaN(Number(e)),$s=e=>!!e&&Number.isInteger(Number(e)),ec=e=>e.endsWith(`%`)&&Qs(e.slice(0,-1)),tc=e=>Ks.test(e),nc=()=>!0,rc=e=>qs.test(e)&&!Js.test(e),ic=()=>!1,ac=e=>Ys.test(e),oc=e=>Xs.test(e),sc=e=>!W(e)&&!G(e),cc=e=>Cc(e,Dc,ic),W=e=>Us.test(e),lc=e=>Cc(e,Oc,rc),uc=e=>Cc(e,kc,Qs),dc=e=>Cc(e,jc,nc),fc=e=>Cc(e,Ac,ic),pc=e=>Cc(e,Tc,ic),mc=e=>Cc(e,Ec,oc),hc=e=>Cc(e,Mc,ac),G=e=>Ws.test(e),gc=e=>wc(e,Oc),_c=e=>wc(e,Ac),vc=e=>wc(e,Tc),yc=e=>wc(e,Dc),bc=e=>wc(e,Ec),xc=e=>wc(e,Mc,!0),Sc=e=>wc(e,jc,!0),Cc=(e,t,n)=>{let r=Us.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},wc=(e,t,n=!1)=>{let r=Ws.exec(e);return r?r[1]?t(r[1]):n:!1},Tc=e=>e===`position`||e===`percentage`,Ec=e=>e===`image`||e===`url`,Dc=e=>e===`length`||e===`size`||e===`bg-size`,Oc=e=>e===`length`,kc=e=>e===`number`,Ac=e=>e===`family-name`,jc=e=>e===`number`||e===`weight`,Mc=e=>e===`shadow`,Nc=Bs(()=>{let e=Hs(`color`),t=Hs(`font`),n=Hs(`text`),r=Hs(`font-weight`),i=Hs(`tracking`),a=Hs(`leading`),o=Hs(`breakpoint`),s=Hs(`container`),c=Hs(`spacing`),l=Hs(`radius`),u=Hs(`shadow`),d=Hs(`inset-shadow`),f=Hs(`text-shadow`),p=Hs(`drop-shadow`),m=Hs(`blur`),h=Hs(`perspective`),g=Hs(`aspect`),_=Hs(`ease`),v=Hs(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[Zs,`full`,`auto`,...w()],E=()=>[$s,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,$s,G,W]},$s,G,W],O=()=>[$s,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Zs,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Zs,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Zs,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,G,W],L=()=>[...b(),vc,pc,{position:[G,W]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,yc,cc,{size:[G,W]}],te=()=>[ec,gc,lc],ne=()=>[``,`none`,`full`,l,G,W],z=()=>[``,Qs,gc,lc],B=()=>[`solid`,`dashed`,`dotted`,`double`],re=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[Qs,ec,vc,pc],ie=()=>[``,`none`,m,G,W],ae=()=>[`none`,Qs,G,W],oe=()=>[`none`,Qs,G,W],se=()=>[Qs,G,W],ce=()=>[Zs,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[tc],breakpoint:[tc],color:[nc],container:[tc],"drop-shadow":[tc],ease:[`in`,`out`,`in-out`],font:[sc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[tc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[tc],shadow:[tc],spacing:[`px`,Qs],text:[tc],"text-shadow":[tc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Zs,W,G,g]}],container:[`container`],columns:[{columns:[Qs,W,G,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[$s,`auto`,G,W]}],basis:[{basis:[Zs,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Qs,Zs,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,Qs,G,W]}],shrink:[{shrink:[``,Qs,G,W]}],order:[{order:[$s,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,gc,lc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Sc,dc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ec,W]}],"font-family":[{font:[_c,fc,t]}],"font-features":[{"font-features":[W]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,G,W]}],"line-clamp":[{"line-clamp":[Qs,`none`,G,uc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Qs,`from-font`,`auto`,G,lc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Qs,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},$s,G,W],radial:[``,G,W],conic:[$s,G,W]},bc,mc]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Qs,G,W]}],"outline-w":[{outline:[``,Qs,gc,lc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,xc,hc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,xc,hc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Qs,lc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,xc,hc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Qs,G,W]}],"mix-blend":[{"mix-blend":[...re(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Qs]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Qs]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:ie()}],brightness:[{brightness:[Qs,G,W]}],contrast:[{contrast:[Qs,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,xc,hc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Qs,G,W]}],"hue-rotate":[{"hue-rotate":[Qs,G,W]}],invert:[{invert:[``,Qs,G,W]}],saturate:[{saturate:[Qs,G,W]}],sepia:[{sepia:[``,Qs,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Qs,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[Qs,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Qs,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qs,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,Qs,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[Qs,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[Qs,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,Qs,G,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Qs,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[Qs,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":[`scale-3d`],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,G,W]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Qs,gc,lc,uc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return Nc(as(e))}var Pc=ls(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),q=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?Qo:`button`,{className:K(Pc({variant:t,size:n,className:e})),ref:a,...i}));q.displayName=`Button`;function Fc(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ic(i,...t)]}function Ic(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function Lc(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...e)=>t.current?.(...e),[])}var Rc=globalThis?.document?v.useLayoutEffect:()=>{},zc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Zo(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Bc=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Vc=o(((e,t)=>{t.exports=Bc()})),Hc=Vc();function Uc(){return(0,Hc.useSyncExternalStore)(Wc,()=>!0,()=>!1)}function Wc(){return()=>{}}var Gc=`Avatar`,[Kc,qc]=Fc(Gc),[Jc,Yc]=Kc(Gc),Xc=v.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=v.useState(`idle`);return(0,H.jsx)(Jc,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,H.jsx)(zc.span,{...r,ref:t})})});Xc.displayName=Gc;var Zc=`AvatarImage`,Qc=v.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Yc(Zc,n),s=nl(r,a),c=Lc(e=>{i(e),o.onImageLoadingStatusChange(e)});return Rc(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,H.jsx)(zc.img,{...a,ref:t,src:r}):null});Qc.displayName=Zc;var $c=`AvatarFallback`,el=v.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Yc($c,n),[o,s]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,H.jsx)(zc.span,{...i,ref:t}):null});el.displayName=$c;function tl(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function nl(e,{referrerPolicy:t,crossOrigin:n}){let r=Uc(),i=v.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=v.useState(()=>tl(a,e));return Rc(()=>{s(tl(a,e))},[a,e]),Rc(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var rl=Xc,il=Qc,al=el,ol=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(rl,{ref:n,className:K(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));ol.displayName=rl.displayName;var sl=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(il,{ref:n,className:K(`aspect-square h-full w-full`,e),...t}));sl.displayName=il.displayName;var cl=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(al,{ref:n,className:K(`flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium`,e),...t}));cl.displayName=al.displayName;function ll(e,t,n){return e&&t?`${e[0]}${t[0]}`.toUpperCase():e?e.slice(0,2).toUpperCase():n?n.slice(0,2).toUpperCase():`?`}var ul=(0,v.forwardRef)(({avatarUrl:e,firstName:t,lastName:n,email:r,className:i,fallbackClassName:a,...o},s)=>(0,H.jsxs)(ol,{ref:s,className:K(`size-8`,i),...o,children:[e&&(0,H.jsx)(sl,{src:e,alt:``,className:`object-cover`}),(0,H.jsx)(cl,{className:K(`text-[11px]`,a),children:ll(t,n,r)})]},e??`fallback`));ul.displayName=`UserAvatar`,typeof window<`u`&&window.document&&window.document.createElement;function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function dl(e,t){let n=v.createContext(t),r=e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,H.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function fl(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=v.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>v.createContext(e));return function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,pl(i,...t)]}function pl(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var ml=v.useInsertionEffect||Rc;function hl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=gl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=v.useRef(e!==void 0);v.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,v.useCallback(t=>{if(s){let n=_l(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function gl({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return ml(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function _l(e){return typeof e==`function`}function vl(e){let t=bl(e),n=v.forwardRef((e,n)=>{let{children:r,...i}=e,a=v.Children.toArray(r),o=a.find(Cl);if(o){let e=o.props.children,r=a.map(t=>t===o?v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:v.isValidElement(e)?v.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var yl=vl(`Slot`);function bl(e){let t=v.forwardRef((e,t)=>{let{children:n,...r}=e;if(v.isValidElement(n)){let e=Tl(n),i=wl(r,n.props);return n.type!==v.Fragment&&(i.ref=t?Go(t,e):e),v.cloneElement(n,i)}return v.Children.count(n)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xl=Symbol(`radix.slottable`);function Sl(e){let t=({children:e})=>(0,H.jsx)(H.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=xl,t}function Cl(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===xl}function wl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Tl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var El=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=vl(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dl(e,t){e&&b.flushSync(()=>e.dispatchEvent(t))}function Ol(e){let t=e+`CollectionProvider`,[n,r]=fl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=v.useRef(null),a=v.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=vl(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,H.jsx)(c,{ref:Ko(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=vl(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=Ko(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return v.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var kl=v.createContext(void 0);function Al(e){let t=v.useContext(kl);return e||t||`ltr`}function jl(e,t=globalThis?.document){let n=Lc(e);v.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Ml=`DismissableLayer`,Nl=`dismissableLayer.update`,Pl=`dismissableLayer.pointerDownOutside`,Fl=`dismissableLayer.focusOutside`,Il,Ll=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rl=v.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=v.useContext(Ll),[u,d]=v.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=v.useState({}),m=Ko(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=_,S=Vl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Hl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return jl(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),v.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Il=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Ul(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Il)}},[u,f,n,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Ul())},[u,l]),v.useEffect(()=>{let e=()=>p({});return document.addEventListener(Nl,e),()=>document.removeEventListener(Nl,e)},[]),(0,H.jsx)(El.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:J(e.onFocusCapture,C.onFocusCapture),onBlurCapture:J(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,S.onPointerDownCapture)})});Rl.displayName=Ml;var zl=`DismissableLayerBranch`,Bl=v.forwardRef((e,t)=>{let n=v.useContext(Ll),r=v.useRef(null),i=Ko(t,r);return v.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(El.div,{...e,ref:i})});Bl.displayName=zl;function Vl(e,t=globalThis?.document){let n=Lc(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Wl(Pl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hl(e,t=globalThis?.document){let n=Lc(e),r=v.useRef(!1);return v.useEffect(()=>{let e=e=>{e.target&&!r.current&&Wl(Fl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ul(){let e=new CustomEvent(Nl);document.dispatchEvent(e)}function Wl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Dl(i,a):i.dispatchEvent(a)}var Gl=0;function Kl(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ql()),document.body.insertAdjacentElement(`beforeend`,e[1]??ql()),Gl++,()=>{Gl===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Gl--}},[])}function ql(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Jl=`focusScope.autoFocusOnMount`,Yl=`focusScope.autoFocusOnUnmount`,Xl={bubbles:!1,cancelable:!0},Zl=`FocusScope`,Ql=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=Lc(i),u=Lc(a),d=v.useRef(null),f=Ko(t,e=>c(e)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:au(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||au(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&au(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),v.useEffect(()=>{if(s){ou.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Jl,Xl);s.addEventListener(Jl,l),s.dispatchEvent(t),t.defaultPrevented||($l(lu(tu(s)),{select:!0}),document.activeElement===e&&au(s))}return()=>{s.removeEventListener(Jl,l),setTimeout(()=>{let t=new CustomEvent(Yl,Xl);s.addEventListener(Yl,u),s.dispatchEvent(t),t.defaultPrevented||au(e??document.body,{select:!0}),s.removeEventListener(Yl,u),ou.remove(p)},0)}}},[s,l,u,p]);let m=v.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=eu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&au(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&au(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(El.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ql.displayName=Zl;function $l(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(au(r,{select:t}),document.activeElement!==n)return}function eu(e){let t=tu(e);return[nu(t,e),nu(t.reverse(),e)]}function tu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;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 nu(e,t){for(let n of e)if(!ru(n,{upTo:t}))return n}function ru(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function iu(e){return e instanceof HTMLInputElement&&`select`in e}function au(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iu(e)&&t&&e.select()}}var ou=su();function su(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=cu(e,t),e.unshift(t)},remove(t){e=cu(e,t),e[0]?.resume()}}}function cu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lu(e){return e.filter(e=>e.tagName!==`A`)}var uu=v.useId||(()=>void 0),du=0;function fu(e){let[t,n]=v.useState(uu());return Rc(()=>{e||n(e=>e??String(du++))},[e]),e||(t?`radix-${t}`:``)}var pu=[`top`,`right`,`bottom`,`left`],mu=Math.min,hu=Math.max,gu=Math.round,_u=Math.floor,vu=e=>({x:e,y:e}),yu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function bu(e,t,n){return hu(e,mu(t,n))}function xu(e,t){return typeof e==`function`?e(t):e}function Su(e){return e.split(`-`)[0]}function Cu(e){return e.split(`-`)[1]}function wu(e){return e===`x`?`y`:`x`}function Tu(e){return e===`y`?`height`:`width`}function Eu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Du(e){return wu(Eu(e))}function Ou(e,t,n){n===void 0&&(n=!1);let r=Cu(e),i=Du(e),a=Tu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Lu(o)),[o,Lu(o)]}function ku(e){let t=Lu(e);return[Au(e),t,Au(t)]}function Au(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ju=[`left`,`right`],Mu=[`right`,`left`],Nu=[`top`,`bottom`],Pu=[`bottom`,`top`];function Fu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Mu:ju:t?ju:Mu;case`left`:case`right`:return t?Nu:Pu;default:return[]}}function Iu(e,t,n,r){let i=Cu(e),a=Fu(Su(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Au)))),a}function Lu(e){let t=Su(e);return yu[t]+e.slice(t.length)}function Ru(e){return{top:0,right:0,bottom:0,left:0,...e}}function zu(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ru(e)}function Bu(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Vu(e,t,n){let{reference:r,floating:i}=e,a=Eu(t),o=Du(t),s=Tu(o),c=Su(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Cu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Hu(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=xu(t,e),p=zu(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Bu(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Bu(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Uu=50,Wu=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Hu},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Vu(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Uu&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Vu(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Gu=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=xu(e,t)||{};if(l==null)return{};let d=zu(u),f={x:n,y:r},p=Du(i),m=Tu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=mu(d[_],T),D=mu(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=bu(O,A,k),M=!c.arrow&&Cu(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ku=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=xu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Su(r),_=Eu(o),v=Su(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Lu(o)]:ku(o)),x=p!==`none`;!d&&x&&b.push(...Iu(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ou(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Eu(t))||T.every(e=>Eu(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Eu(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function qu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ju(e){return pu.some(t=>e[t]>=0)}var Yu=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=xu(e,t);switch(i){case`referenceHidden`:{let e=qu(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ju(e)}}}case`escaped`:{let e=qu(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ju(e)}}}default:return{}}}}},Xu=new Set([`left`,`top`]);async function Zu(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Su(n),s=Cu(n),c=Eu(n)===`y`,l=Xu.has(o)?-1:1,u=a&&c?-1:1,d=xu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Qu=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Zu(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},$u=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=xu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Eu(Su(i)),p=wu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=bu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=bu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ed=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=xu(e,t),u={x:n,y:r},d=Eu(i),f=wu(d),p=u[f],m=u[d],h=xu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Xu.has(Su(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},td=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=xu(e,t),u=await o.detectOverflow(t,l),d=Su(i),f=Cu(i),p=Eu(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=mu(h-u[g],v),x=mu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=hu(u.left,0),t=hu(u.right,0),n=hu(u.top,0),r=hu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:hu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:hu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function nd(){return typeof window<`u`}function rd(e){return od(e)?(e.nodeName||``).toLowerCase():`#document`}function id(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ad(e){return((od(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function od(e){return nd()?e instanceof Node||e instanceof id(e).Node:!1}function sd(e){return nd()?e instanceof Element||e instanceof id(e).Element:!1}function cd(e){return nd()?e instanceof HTMLElement||e instanceof id(e).HTMLElement:!1}function ld(e){return!nd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof id(e).ShadowRoot}function ud(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dd(e){return/^(table|td|th)$/.test(rd(e))}function fd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pd=/transform|translate|scale|rotate|perspective|filter/,md=/paint|layout|strict|content/,hd=e=>!!e&&e!==`none`,gd;function _d(e){let t=sd(e)?xd(e):e;return hd(t.transform)||hd(t.translate)||hd(t.scale)||hd(t.rotate)||hd(t.perspective)||!yd()&&(hd(t.backdropFilter)||hd(t.filter))||pd.test(t.willChange||``)||md.test(t.contain||``)}function vd(e){let t=Cd(e);for(;cd(t)&&!bd(t);){if(_d(t))return t;if(fd(t))return null;t=Cd(t)}return null}function yd(){return gd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gd}function bd(e){return/^(html|body|#document)$/.test(rd(e))}function xd(e){return id(e).getComputedStyle(e)}function Sd(e){return sd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cd(e){if(rd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ld(e)&&e.host||ad(e);return ld(t)?t.host:t}function wd(e){let t=Cd(e);return bd(t)?e.ownerDocument?e.ownerDocument.body:e.body:cd(t)&&ud(t)?t:wd(t)}function Td(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wd(e),i=r===e.ownerDocument?.body,a=id(r);if(i){let e=Ed(a);return t.concat(a,a.visualViewport||[],ud(r)?r:[],e&&n?Td(e):[])}else return t.concat(r,Td(r,[],n))}function Ed(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dd(e){let t=xd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=gu(n)!==a||gu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Od(e){return sd(e)?e:e.contextElement}function kd(e){let t=Od(e);if(!cd(t))return vu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Dd(t),o=(a?gu(n.width):n.width)/r,s=(a?gu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ad=vu(0);function jd(e){let t=id(e);return!yd()||!t.visualViewport?Ad:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Md(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==id(e)?!1:t}function Nd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Od(e),o=vu(1);t&&(r?sd(r)&&(o=kd(r)):o=kd(e));let s=Md(a,n,r)?jd(a):vu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=id(a),t=r&&sd(r)?id(r):r,n=e,i=Ed(n);for(;i&&r&&t!==n;){let e=kd(i),t=i.getBoundingClientRect(),r=xd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=id(i),i=Ed(n)}}return Bu({width:u,height:d,x:c,y:l})}function Pd(e,t){let n=Sd(e).scrollLeft;return t?t.left+n:Nd(ad(e)).left+n}function Fd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pd(e,n),y:n.top+t.scrollTop}}function Id(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ad(r),s=t?fd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=vu(1),u=vu(0),d=cd(r);if((d||!d&&!a)&&((rd(r)!==`body`||ud(o))&&(c=Sd(r)),d)){let e=Nd(r);l=kd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fd(o,c):vu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ld(e){return Array.from(e.getClientRects())}function Rd(e){let t=ad(e),n=Sd(e),r=e.ownerDocument.body,i=hu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=hu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Pd(e),s=-n.scrollTop;return xd(r).direction===`rtl`&&(o+=hu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var zd=25;function Bd(e,t){let n=id(e),r=ad(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=yd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Pd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=zd&&(a-=o)}else l<=zd&&(a+=l);return{width:a,height:o,x:s,y:c}}function Vd(e,t){let n=Nd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cd(e)?kd(e):vu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Hd(e,t,n){let r;if(t===`viewport`)r=Bd(e,n);else if(t===`document`)r=Rd(ad(e));else if(sd(t))r=Vd(t,n);else{let n=jd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Bu(r)}function Ud(e,t){let n=Cd(e);return n===t||!sd(n)||bd(n)?!1:xd(n).position===`fixed`||Ud(n,t)}function Wd(e,t){let n=t.get(e);if(n)return n;let r=Td(e,[],!1).filter(e=>sd(e)&&rd(e)!==`body`),i=null,a=xd(e).position===`fixed`,o=a?Cd(e):e;for(;sd(o)&&!bd(o);){let t=xd(o),n=_d(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ud(o)&&!n&&Ud(e,o))?r=r.filter(e=>e!==o):i=t,o=Cd(o)}return t.set(e,r),r}function Gd(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fd(t)?[]:Wd(t,this._c):[].concat(n),r],o=Hd(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Hd(t,a[e],i);s=hu(n.top,s),c=mu(n.right,c),l=mu(n.bottom,l),u=hu(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Kd(e){let{width:t,height:n}=Dd(e);return{width:t,height:n}}function qd(e,t,n){let r=cd(t),i=ad(t),a=n===`fixed`,o=Nd(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=vu(0);function l(){c.x=Pd(i)}if(r||!r&&!a)if((rd(t)!==`body`||ud(i))&&(s=Sd(t)),r){let e=Nd(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Fd(i,s):vu(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Jd(e){return xd(e).position===`static`}function Yd(e,t){if(!cd(e)||xd(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ad(e)===n&&(n=n.ownerDocument.body),n}function Xd(e,t){let n=id(e);if(fd(e))return n;if(!cd(e)){let t=Cd(e);for(;t&&!bd(t);){if(sd(t)&&!Jd(t))return t;t=Cd(t)}return n}let r=Yd(e,t);for(;r&&dd(r)&&Jd(r);)r=Yd(r,t);return r&&bd(r)&&Jd(r)&&!_d(r)?n:r||vd(e)||n}var Zd=async function(e){let t=this.getOffsetParent||Xd,n=this.getDimensions,r=await n(e.floating);return{reference:qd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qd(e){return xd(e).direction===`rtl`}var $d={convertOffsetParentRelativeRectToViewportRelativeRect:Id,getDocumentElement:ad,getClippingRect:Gd,getOffsetParent:Xd,getElementRects:Zd,getClientRects:Ld,getDimensions:Kd,getScale:kd,isElement:sd,isRTL:Qd};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tf(e,t){let n=null,r,i=ad(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_u(d),h=_u(i.clientWidth-(u+f)),g=_u(i.clientHeight-(d+p)),_=_u(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:hu(0,mu(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ef(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function nf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Od(e),u=i||a?[...l?Td(l):[],...t?Td(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?tf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Nd(e):null;c&&g();function g(){let t=Nd(e);h&&!ef(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rf=Qu,af=$u,of=Ku,sf=td,cf=Yu,lf=Gu,uf=ed,df=(e,t,n)=>{let r=new Map,i={platform:$d,...n},a={...i.platform,_c:r};return Wu(e,t,{...i,platform:a})},ff=typeof document<`u`?v.useLayoutEffect:function(){};function pf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function mf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hf(e,t){let n=mf(e);return Math.round(t*n)/n}function gf(e){let t=v.useRef(e);return ff(()=>{t.current=e}),t}function _f(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);pf(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=gf(c),k=gf(i),A=gf(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),df(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!pf(E.current,t)&&(E.current=t,b.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);ff(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);ff(()=>(M.current=!0,()=>{M.current=!1}),[]),ff(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:y,setFloating:x}),[y,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=hf(P.floating,u.x),r=hf(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...mf(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var vf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:lf({element:r.current,padding:i}).fn(n):r?lf({element:r,padding:i}).fn(n):{}}}},yf=(e,t)=>{let n=rf(e);return{name:n.name,fn:n.fn,options:[e,t]}},bf=(e,t)=>{let n=af(e);return{name:n.name,fn:n.fn,options:[e,t]}},xf=(e,t)=>({fn:uf(e).fn,options:[e,t]}),Sf=(e,t)=>{let n=of(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cf=(e,t)=>{let n=sf(e);return{name:n.name,fn:n.fn,options:[e,t]}},wf=(e,t)=>{let n=cf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tf=(e,t)=>{let n=vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ef=`Arrow`,Df=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,H.jsx)(El.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,H.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Df.displayName=Ef;var Of=Df;function kf(e){let[t,n]=v.useState(void 0);return Rc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Af=`Popper`,[jf,Mf]=fl(Af),[Nf,Pf]=jf(Af),Ff=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return(0,H.jsx)(Nf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ff.displayName=Af;var If=`PopperAnchor`,Lf=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Pf(If,n),o=v.useRef(null),s=Ko(t,o),c=v.useRef(null);return v.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,H.jsx)(El.div,{...i,ref:s})});Lf.displayName=If;var Rf=`PopperContent`,[zf,Bf]=jf(Rf),Vf=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Pf(Rf,n),[_,y]=v.useState(null),b=Ko(t,e=>y(e)),[x,S]=v.useState(null),C=kf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Gf),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=_f({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>nf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[yf({mainAxis:i+T,alignmentAxis:o}),c&&bf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?xf():void 0,...A}),c&&Sf({...A}),Cf({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Tf({element:x,padding:s}),Kf({arrowWidth:w,arrowHeight:T}),f&&wf({strategy:`referenceHidden`,...A})]}),[I,L]=qf(N),R=Lc(m);Rc(()=>{P&&R?.()},[P,R]);let ee=F.arrow?.x,te=F.arrow?.y,ne=F.arrow?.centerOffset!==0,[z,B]=v.useState();return Rc(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,H.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:z,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,H.jsx)(zf,{scope:n,placedSide:I,onArrowChange:S,arrowX:ee,arrowY:te,shouldHideArrow:ne,children:(0,H.jsx)(El.div,{"data-side":I,"data-align":L,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Vf.displayName=Rf;var Hf=`PopperArrow`,Uf={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Wf=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Bf(Hf,n),a=Uf[i.placedSide];return(0,H.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,H.jsx)(Of,{...r,ref:t,style:{...r.style,display:`block`}})})});Wf.displayName=Hf;function Gf(e){return e!==null}var Kf=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=qf(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function qf(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Jf=Ff,Yf=Lf,Xf=Vf,Zf=Wf,Qf=`Portal`,$f=v.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=v.useState(!1);Rc(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?b.createPortal((0,H.jsx)(El.div,{...r,ref:t}),o):null});$f.displayName=Qf;function ep(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}var tp=e=>{let{present:t,children:n}=e,r=np(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=Ko(r.ref,ip(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null};tp.displayName=`Presence`;function np(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),[o,s]=ep(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{let e=rp(r.current);a.current=o===`mounted`?e:`none`},[o]),Rc(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=rp(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Rc(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=rp(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=rp(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:v.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function rp(e){return e?.animationName||`none`}function ip(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ap=`rovingFocusGroup.onEntryFocus`,op={bubbles:!1,cancelable:!0},sp=`RovingFocusGroup`,[cp,lp,up]=Ol(sp),[dp,fp]=fl(sp,[up]),[pp,mp]=dp(sp),hp=v.forwardRef((e,t)=>(0,H.jsx)(cp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(cp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(gp,{...e,ref:t})})}));hp.displayName=sp;var gp=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=Ko(t,f),m=Al(a),[h,g]=hl({prop:o,defaultProp:s??null,onChange:c,caller:sp}),[_,y]=v.useState(!1),b=Lc(l),x=lp(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ap,b),()=>e.removeEventListener(ap,b)},[b]),(0,H.jsx)(pp,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,H.jsx)(El.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{S.current=!0}),onFocus:J(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ap,op);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Sp([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:J(e.onBlur,()=>y(!1))})})}),_p=`RovingFocusGroupItem`,vp=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=fu(),l=a||c,u=mp(_p,n),d=u.currentTabStopId===l,f=lp(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return v.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,H.jsx)(cp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(El.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=xp(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Cp(n,r+1):n.slice(r+1)}setTimeout(()=>Sp(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});vp.displayName=_p;var yp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function bp(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function xp(e,t,n){let r=bp(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return yp[r]}function Sp(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Cp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wp=hp,Tp=vp,Ep=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Dp=new WeakMap,Op=new WeakMap,kp={},Ap=0,jp=function(e){return e&&(e.host||jp(e.parentNode))},Mp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=jp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Np=function(e,t,n,r){var i=Mp(t,Array.isArray(e)?e:[e]);kp[n]||(kp[n]=new WeakMap);var a=kp[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Dp.get(e)||0)+1,l=(a.get(e)||0)+1;Dp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Op.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ap++,function(){o.forEach(function(e){var t=Dp.get(e)-1,i=a.get(e)-1;Dp.set(e,t),a.set(e,i),t||(Op.has(e)||e.removeAttribute(r),Op.delete(e)),i||e.removeAttribute(n)}),Ap--,Ap||(Dp=new WeakMap,Dp=new WeakMap,Op=new WeakMap,kp={})}},Pp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ep(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Np(r,i,n,`aria-hidden`)):function(){return null}},Fp=function(){return Fp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Fp.apply(this,arguments)};function Ip(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Lp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Rp=`right-scroll-bar-position`,zp=`width-before-scroll-bar`,Bp=`with-scroll-bars-hidden`,Vp=`--removed-body-scroll-bar-size`;function Hp(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Up(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Wp=typeof window<`u`?v.useLayoutEffect:v.useEffect,Gp=new WeakMap;function Kp(e,t){var n=Up(t||null,function(t){return e.forEach(function(e){return Hp(e,t)})});return Wp(function(){var t=Gp.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Hp(e,null)}),i.forEach(function(e){r.has(e)||Hp(e,a)})}Gp.set(n,e)},[e]),n}function qp(e){return e}function Jp(e,t){t===void 0&&(t=qp);var n=[],r=!1;return{read:function(){if(r)throw 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 i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},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 i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Yp(e){e===void 0&&(e={});var t=Jp(null);return t.options=Fp({async:!0,ssr:!1},e),t}var Xp=function(e){var t=e.sideCar,n=Ip(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,Fp({},n))};Xp.isSideCarExport=!0;function Zp(e,t){return e.useMedium(t),Xp}var Qp=Yp(),$p=function(){},em=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:$p,onWheelCapture:$p,onTouchMoveCapture:$p}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,y=_===void 0?`div`:_,b=e.gapMode,x=Ip(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Kp([n,t]),w=Fp(Fp({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:Qp,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?v.cloneElement(v.Children.only(s),Fp(Fp({},w),{ref:C})):v.createElement(y,Fp({},w,{className:c,ref:C}),s))});em.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},em.classNames={fullWidth:zp,zeroRight:Rp};var tm,nm=function(){if(tm)return tm;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rm(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nm();return t&&e.setAttribute(`nonce`,t),e}function im(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function am(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var om=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rm())&&(im(t,n),am(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sm=function(){var e=om();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},cm=function(){var e=sm();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},lm={left:0,top:0,right:0,gap:0},um=function(e){return parseInt(e||``,10)||0},dm=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[um(n),um(r),um(i)]},fm=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return lm;var t=dm(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])}},pm=cm(),mm=`data-scroll-locked`,hm=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
13
13
  .${Bp} {
14
14
  overflow: hidden ${r};
15
15
  padding-right: ${s}px ${r};
@@ -72,11 +72,11 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
72
72
 
73
73
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
74
74
 
75
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Bb=`DialogDescriptionWarning`,Vb=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rb(Bb).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Hb=pb,Ub=yb,Wb=xb,Gb=Tb,Kb=Ab,qb=Mb,Jb=Pb;function Yb(e){let t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xb=`Checkbox`,[Zb,Qb]=fl(Xb),[$b,ex]=Zb(Xb);function tx(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=hl({prop:n,defaultProp:i??!1,onChange:c,caller:Xb}),[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:ux(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,H.jsx)($b,{scope:t,...x,children:lx(d)?d(x):r})}var nx=`CheckboxTrigger`,rx=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=ex(nx,e),h=Ko(i,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,H.jsx)(El.button,{type:`button`,role:`checkbox`,"aria-checked":ux(c)?`mixed`:c,"aria-required":l,"data-state":dx(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:J(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:J(n,e=>{d(e=>ux(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});rx.displayName=nx;var ix=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(tx,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rx,{...d,ref:t,__scopeCheckbox:n}),e&&(0,H.jsx)(cx,{__scopeCheckbox:n})]})})});ix.displayName=Xb;var ax=`CheckboxIndicator`,ox=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ex(ax,n);return(0,H.jsx)(tp,{present:r||ux(a.checked)||a.checked===!0,children:(0,H.jsx)(El.span,{"data-state":dx(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ox.displayName=ax;var sx=`CheckboxBubbleInput`,cx=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=ex(sx,e),m=Ko(n,p),h=Yb(a),g=kf(r);v.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=ux(a),n.call(e,ux(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=v.useRef(ux(a)?!1:a);return(0,H.jsx)(El.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});cx.displayName=sx;function lx(e){return typeof e==`function`}function ux(e){return e===`indeterminate`}function dx(e){return ux(e)?`indeterminate`:e?`checked`:`unchecked`}function fx(e,[t,n]){return Math.min(n,Math.max(t,e))}var px=`Popover`,[mx,hx]=fl(px,[Mf]),gx=Mf(),[_x,vx]=mx(px),yx=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=gx(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=hl({prop:r,defaultProp:i??!1,onChange:a,caller:px});return(0,H.jsx)(Jf,{...s,children:(0,H.jsx)(_x,{scope:t,contentId:fu(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})};yx.displayName=px;var bx=`PopoverAnchor`,xx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(bx,n),a=gx(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,H.jsx)(Yf,{...a,...r,ref:t})});xx.displayName=bx;var Sx=`PopoverTrigger`,Cx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(Sx,n),a=gx(n),o=Ko(t,i.triggerRef),s=(0,H.jsx)(El.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Rx(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(Yf,{asChild:!0,...a,children:s})});Cx.displayName=Sx;var wx=`PopoverPortal`,[Tx,Ex]=mx(wx,{forceMount:void 0}),Dx=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=vx(wx,t);return(0,H.jsx)(Tx,{scope:t,forceMount:n,children:(0,H.jsx)(tp,{present:n||a.open,children:(0,H.jsx)($f,{asChild:!0,container:i,children:r})})})};Dx.displayName=wx;var Ox=`PopoverContent`,kx=v.forwardRef((e,t)=>{let n=Ex(Ox,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=vx(Ox,e.__scopePopover);return(0,H.jsx)(tp,{present:r||a.open,children:a.modal?(0,H.jsx)(jx,{...i,ref:t}):(0,H.jsx)(Mx,{...i,ref:t})})});kx.displayName=Ox;var Ax=vl(`PopoverContent.RemoveScroll`),jx=v.forwardRef((e,t)=>{let n=vx(Ox,e.__scopePopover),r=v.useRef(null),i=Ko(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return Pp(e)},[]),(0,H.jsx)(Um,{as:Ax,allowPinchZoom:!0,children:(0,H.jsx)(Nx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Mx=v.forwardRef((e,t)=>{let n=vx(Ox,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,H.jsx)(Nx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Nx=v.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=vx(Ox,n),p=gx(n);return Kl(),(0,H.jsx)(Ql,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,H.jsx)(Xf,{"data-state":Rx(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Px=`PopoverClose`,Fx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(Px,n);return(0,H.jsx)(El.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});Fx.displayName=Px;var Ix=`PopoverArrow`,Lx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=gx(n);return(0,H.jsx)(Zf,{...i,...r,ref:t})});Lx.displayName=Ix;function Rx(e){return e?`open`:`closed`}var zx=yx,Bx=Cx,Vx=Dx,Hx=kx,Ux=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Wx=[` `,`Enter`],Gx=`Select`,[Kx,qx,Jx]=Ol(Gx),[Yx,Xx]=fl(Gx,[Jx,Mf]),Zx=Mf(),[Qx,$x]=Yx(Gx),[eS,tS]=Yx(Gx),nS=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Zx(t),[g,_]=v.useState(null),[y,b]=v.useState(null),[x,S]=v.useState(!1),C=Al(l),[w,T]=hl({prop:r,defaultProp:i??!1,onChange:a,caller:Gx}),[E,D]=hl({prop:o,defaultProp:s,onChange:c,caller:Gx}),O=v.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=v.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,H.jsx)(Jf,{...h,children:(0,H.jsxs)(Qx,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:fu(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,H.jsx)(Kx.Provider,{scope:t,children:(0,H.jsx)(eS,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:v.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,H.jsxs)(ZS,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,H.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};nS.displayName=Gx;var rS=`SelectTrigger`,iS=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Zx(n),o=$x(rS,n),s=o.disabled||r,c=Ko(t,o.onTriggerChange),l=qx(n),u=v.useRef(`touch`),[d,f,p]=$S(e=>{let t=l().filter(e=>!e.disabled),n=eC(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(Yf,{asChild:!0,...a,children:(0,H.jsx)(El.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":QS(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ux.includes(e.key)&&(m(),e.preventDefault())})})})});iS.displayName=rS;var aS=`SelectValue`,oS=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=$x(aS,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Ko(t,c.onValueNodeChange);return Rc(()=>{l(u)},[l,u]),(0,H.jsx)(El.span,{...s,ref:d,style:{pointerEvents:`none`},children:QS(c.value)?(0,H.jsx)(H.Fragment,{children:o}):a})});oS.displayName=aS;var sS=`SelectIcon`,cS=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(El.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});cS.displayName=sS;var lS=`SelectPortal`,uS=e=>(0,H.jsx)($f,{asChild:!0,...e});uS.displayName=lS;var dS=`SelectContent`,fS=v.forwardRef((e,t)=>{let n=$x(dS,e.__scopeSelect),[r,i]=v.useState();if(Rc(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?b.createPortal((0,H.jsx)(mS,{scope:e.__scopeSelect,children:(0,H.jsx)(Kx.Slot,{scope:e.__scopeSelect,children:(0,H.jsx)(`div`,{children:e.children})})}),t):null}return(0,H.jsx)(vS,{...e,ref:t})});fS.displayName=dS;var pS=10,[mS,hS]=Yx(dS),gS=`SelectContentImpl`,_S=vl(`SelectContent.RemoveScroll`),vS=v.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=$x(dS,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=Ko(t,e=>x(e)),[T,E]=v.useState(null),[D,O]=v.useState(null),k=qx(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return Pp(b)},[b]),Kl();let N=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=v.useCallback(()=>N([T,b]),[N,T,b]);v.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),v.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,R]=$S(e=>{let t=k().filter(e=>!e.disabled),n=eC(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ee=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),te=v.useCallback(()=>b?.focus(),[b]),ne=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),z=r===`popper`?SS:bS,B=z===SS?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)(mS,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ee,selectedItem:T,onItemLeave:te,itemTextRefCallback:ne,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,H.jsx)(Um,{as:_S,allowPinchZoom:!0,children:(0,H.jsx)(Ql,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,H.jsx)(z,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...B,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&R(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});vS.displayName=gS;var yS=`SelectItemAlignedPosition`,bS=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=$x(dS,n),o=hS(dS,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=Ko(t,e=>u(e)),f=qx(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-pS,d=fx(a,[pS,Math.max(pS,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-pS,d=fx(a,[pS,Math.max(pS,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-pS*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-pS,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${pS}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Rc(()=>b(),[b]);let[x,S]=v.useState();return Rc(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,H.jsx)(CS,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,H.jsx)(El.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});bS.displayName=yS;var xS=`SelectPopperPosition`,SS=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=pS,...a}=e,o=Zx(n);return(0,H.jsx)(Xf,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});SS.displayName=xS;var[CS,wS]=Yx(dS,{}),TS=`SelectViewport`,ES=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=hS(TS,n),o=wS(TS,n),s=Ko(t,a.onViewportChange),c=v.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(Kx.Slot,{scope:n,children:(0,H.jsx)(El.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-pS*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ES.displayName=TS;var DS=`SelectGroup`,[OS,kS]=Yx(DS),AS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=fu();return(0,H.jsx)(OS,{scope:n,id:i,children:(0,H.jsx)(El.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});AS.displayName=DS;var jS=`SelectLabel`,MS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kS(jS,n);return(0,H.jsx)(El.div,{id:i.id,...r,ref:t})});MS.displayName=jS;var NS=`SelectItem`,[PS,FS]=Yx(NS),IS=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=$x(NS,n),c=hS(NS,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=Ko(t,e=>c.itemRefCallback?.(e,r,i)),h=fu(),g=v.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,H.jsx)(PS,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(Kx.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,H.jsx)(El.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Wx.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});IS.displayName=NS;var LS=`SelectItemText`,RS=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=$x(LS,n),s=hS(LS,n),c=FS(LS,n),l=tS(LS,n),[u,d]=v.useState(null),f=Ko(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=v.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Rc(()=>(h(m),()=>g(m)),[h,g,m]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(El.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?b.createPortal(a.children,o.valueNode):null]})});RS.displayName=LS;var zS=`SelectItemIndicator`,BS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return FS(zS,n).isSelected?(0,H.jsx)(El.span,{"aria-hidden":!0,...r,ref:t}):null});BS.displayName=zS;var VS=`SelectScrollUpButton`,HS=v.forwardRef((e,t)=>{let n=hS(VS,e.__scopeSelect),r=wS(VS,e.__scopeSelect),[i,a]=v.useState(!1),o=Ko(t,r.onScrollButtonChange);return Rc(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(GS,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});HS.displayName=VS;var US=`SelectScrollDownButton`,WS=v.forwardRef((e,t)=>{let n=hS(US,e.__scopeSelect),r=wS(US,e.__scopeSelect),[i,a]=v.useState(!1),o=Ko(t,r.onScrollButtonChange);return Rc(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(GS,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});WS.displayName=US;var GS=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=hS(`SelectScrollButton`,n),o=v.useRef(null),s=qx(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Rc(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(El.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),KS=`SelectSeparator`,qS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(El.div,{"aria-hidden":!0,...r,ref:t})});qS.displayName=KS;var JS=`SelectArrow`,YS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Zx(n),a=$x(JS,n),o=hS(JS,n);return a.open&&o.position===`popper`?(0,H.jsx)(Zf,{...i,...r,ref:t}):null});YS.displayName=JS;var XS=`SelectBubbleInput`,ZS=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=v.useRef(null),a=Ko(r,i),o=Yb(t);return v.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,H.jsx)(El.select,{...n,style:{...k_,...n.style},ref:a,defaultValue:t})});ZS.displayName=XS;function QS(e){return e===``||e===void 0}function $S(e){let t=Lc(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function eC(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tC(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var nC=nS,rC=iS,iC=oS,aC=cS,oC=uS,sC=fS,cC=ES,lC=AS,uC=MS,dC=IS,fC=RS,pC=BS,mC=HS,hC=WS,gC=qS,_C=`Switch`,[vC,yC]=fl(_C),[bC,xC]=vC(_C),SC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=v.useState(null),m=Ko(t,e=>p(e)),h=v.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,y]=hl({prop:i,defaultProp:a??!1,onChange:l,caller:_C});return(0,H.jsxs)(bC,{scope:n,checked:_,disabled:s,children:[(0,H.jsx)(El.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":DC(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:J(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,H.jsx)(EC,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});SC.displayName=_C;var CC=`SwitchThumb`,wC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=xC(CC,n);return(0,H.jsx)(El.span,{"data-state":DC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});wC.displayName=CC;var TC=`SwitchBubbleInput`,EC=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=v.useRef(null),s=Ko(o,a),c=Yb(n),l=kf(t);return v.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,H.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});EC.displayName=TC;function DC(e){return e?`checked`:`unchecked`}var OC=SC,kC=wC,AC=`Tabs`,[jC,MC]=fl(AC,[fp]),NC=fp(),[PC,FC]=jC(AC),IC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Al(s),[d,f]=hl({prop:r,onChange:i,defaultProp:a??``,caller:AC});return(0,H.jsx)(PC,{scope:n,baseId:fu(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,H.jsx)(El.div,{dir:u,"data-orientation":o,...l,ref:t})})});IC.displayName=AC;var LC=`TabsList`,RC=v.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=FC(LC,n),o=NC(n);return(0,H.jsx)(wp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,H.jsx)(El.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});RC.displayName=LC;var zC=`TabsTrigger`,BC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=FC(zC,n),s=NC(n),c=UC(o.baseId,r),l=WC(o.baseId,r),u=r===o.value;return(0,H.jsx)(Tp,{asChild:!0,...s,focusable:!i,active:u,children:(0,H.jsx)(El.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:J(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:J(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});BC.displayName=zC;var VC=`TabsContent`,HC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=FC(VC,n),c=UC(s.baseId,r),l=WC(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,H.jsx)(tp,{present:i||u,children:({present:n})=>(0,H.jsx)(El.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});HC.displayName=VC;function UC(e,t){return`${e}-trigger-${t}`}function WC(e,t){return`${e}-content-${t}`}var GC=IC,KC=RC,qC=BC,JC=HC,YC=ls(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function XC({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,H.jsx)(n?yl:`span`,{"data-slot":`badge`,"data-variant":t,className:K(YC({variant:t}),e),...r})}var ZC=Hb,QC=Ub,$C=Jb,ew=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Wb,{ref:n,className:K(`fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));ew.displayName=Wb.displayName;var tw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(QC,{children:[(0,H.jsx)(ew,{}),(0,H.jsxs)(Gb,{ref:r,className:K(`fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg`,e),...n,children:[(0,H.jsxs)($C,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,H.jsx)(Bo,{className:`size-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t]})]}));tw.displayName=Gb.displayName;var nw=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});nw.displayName=`DialogHeader`;var rw=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});rw.displayName=`DialogFooter`;var iw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Kb,{ref:n,className:K(`text-lg font-semibold leading-none tracking-tight`,e),...t}));iw.displayName=Kb.displayName;var aw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(qb,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));aw.displayName=qb.displayName;var ow=nC,sw=lC,cw=iC,lw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(rC,{ref:r,className:K(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,H.jsx)(aC,{asChild:!0,children:(0,H.jsx)(Oa,{className:`size-4 opacity-50`})})]}));lw.displayName=rC.displayName;var uw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(mC,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(ja,{className:`size-4`})}));uw.displayName=mC.displayName;var dw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(hC,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(Oa,{className:`size-4`})}));dw.displayName=hC.displayName;var fw=v.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,H.jsx)(oC,{children:(0,H.jsxs)(sC,{ref:i,className:K(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,H.jsx)(uw,{}),(0,H.jsx)(cC,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,H.jsx)(dw,{})]})}));fw.displayName=sC.displayName;var pw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(uC,{ref:n,className:K(`px-2 py-1.5 text-sm font-semibold`,e),...t}));pw.displayName=uC.displayName;var mw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(dC,{ref:r,className:K(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(pC,{children:(0,H.jsx)(Da,{className:`size-4`})})}),(0,H.jsx)(fC,{children:t})]}));mw.displayName=dC.displayName;var hw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(gC,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));hw.displayName=gC.displayName;var gw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,H.jsx)(`table`,{ref:n,className:K(`w-full caption-bottom text-sm`,e),...t})}));gw.displayName=`Table`;var _w=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`thead`,{ref:n,className:K(`[&_tr]:border-b`,e),...t}));_w.displayName=`TableHeader`;var vw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tbody`,{ref:n,className:K(`[&_tr:last-child]:border-0`,e),...t}));vw.displayName=`TableBody`;var yw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tr`,{ref:n,className:K(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));yw.displayName=`TableRow`;var bw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`th`,{ref:n,className:K(`h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));bw.displayName=`TableHead`;var xw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`td`,{ref:n,className:K(`p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));xw.displayName=`TableCell`;var Sw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`caption`,{ref:n,className:K(`mt-4 text-sm text-muted-foreground`,e),...t}));Sw.displayName=`TableCaption`;var Cw=`plank_dashboard_recent_entry_fields`;function ww(){let e=$n(),{timezone:t}=sa(),{user:n}=ia(),{data:r}=fa(`/cms/admin/content-types`),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)({}),f=n?.permissions??[],p=f.includes(`*`)||f.includes(`entries:write`),m=f.includes(`*`)||f.includes(`entries:read`),h=(0,v.useMemo)(()=>(r??[]).filter(e=>e.kind===`collection`),[r]);function g(e){for(let t of[`title`,`name`,`entry`])if(e.fields.some(e=>e.name===t))return t;return e.fields.find(e=>[`string`,`text`,`uid`].includes(e.type))?.name??`id`}function _(e){return e==null||e===``?`Untitled`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}(0,v.useEffect)(()=>{try{let e=localStorage.getItem(Cw);if(!e)return;d(JSON.parse(e))}catch{}},[]),(0,v.useEffect)(()=>{h.length!==0&&d(e=>{let t={...e},n=!1;for(let e of h)t[e.slug]||(t[e.slug]=g(e),n=!0);return n?t:e})},[h]),(0,v.useEffect)(()=>{localStorage.setItem(Cw,JSON.stringify(u))},[u]);function y(){!r||r.length===0||e(`/content/${(r.find(e=>e.isDefault)??r[0]).slug}/new`)}(0,v.useEffect)(()=>{if(!m||h.length===0){a([]);return}let e=new AbortController,t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};return s(!0),Promise.all(h.map(async t=>{let r=await fetch(`/cms/admin/content-types/${t.slug}/entries?page=1&limit=50&sort=published_at&order=desc`,{headers:n,signal:e.signal});return r.ok?((await r.json()).data??[]).filter(e=>e.status===`published`&&!!e.published_at).map(e=>({...e,slug:t.slug,contentTypeName:t.name})):[]})).then(e=>{a(e.flat().sort((e,t)=>new Date(t.published_at??0).getTime()-new Date(e.published_at??0).getTime()).slice(0,7))}).catch(()=>{a([])}).finally(()=>s(!1)),()=>e.abort()},[m,h]);function b({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(ul,{avatarUrl:e._author_avatar_url,firstName:e._author_first_name,lastName:e._author_last_name,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(yv,{children:[(0,H.jsx)(bv,{asChild:!0,children:i}),(0,H.jsx)(xv,{children:r})]}):i}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Dashboard`}),p&&(0,H.jsxs)(q,{onClick:y,disabled:!r||r.length===0,children:[(0,H.jsx)(yo,{className:`size-4`}),`New entry`]})]})}),(0,H.jsx)(`section`,{className:`mt-24`,children:(0,H.jsx)(vv,{children:(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:(0,H.jsxs)(gw,{className:`w-full text-sm`,children:[(0,H.jsxs)(_w,{className:`border-b border-border font-bold uppercase`,children:[(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:(0,H.jsx)(bw,{colSpan:4,className:`px-4 py-3 h-auto`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Recent content`}),(0,H.jsxs)(ZC,{open:c,onOpenChange:l,children:[(0,H.jsx)(q,{size:`icon`,variant:`outline`,onClick:()=>l(!0),children:(0,H.jsx)(La,{className:`size-4`})}),(0,H.jsxs)(tw,{className:`max-w-lg`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Recent content fields`})}),(0,H.jsx)(`div`,{className:`space-y-4`,children:h.map(e=>(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`recent-field-${e.slug}`,children:e.name}),(0,H.jsxs)(ow,{value:u[e.slug]??g(e),onValueChange:t=>d(n=>({...n,[e.slug]:t})),children:[(0,H.jsx)(lw,{id:`recent-field-${e.slug}`,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`id`,children:`id`}),e.fields.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))]})]})]},e.slug))})]})]})]})})}),(0,H.jsxs)(yw,{className:`border-t border-border hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Entry`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Collection Type`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Published`})]})]}),(0,H.jsx)(vw,{children:o?(0,H.jsx)(yw,{className:`border-b`,children:(0,H.jsx)(xw,{colSpan:4,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):i.length===0?(0,H.jsx)(yw,{className:`border-b`,children:(0,H.jsx)(xw,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:`No recent entries found.`})}):i.map(n=>(0,H.jsxs)(yw,{className:`border-b last:border-b-0 transition-colors hover:bg-muted/50`,children:[(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>e(`/content/${n.slug}/${n.id}`),className:`text-left hover:underline`,children:(0,H.jsx)(`div`,{className:`font-medium`,children:_(n[u[n.slug]??g(h.find(e=>e.slug===n.slug)??{slug:n.slug,name:n.contentTypeName,kind:`collection`,isDefault:!1,fields:[]})])})})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(XC,{variant:`outline`,children:n.contentTypeName})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(b,{entry:n})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:n.published_at?sy(n.published_at,t):`—`})]},`${n.slug}-${n.id}`))})]})})})})]})}function Tw(e){let{setContent:t}=Uo();(0,v.useEffect)(()=>(t(e),()=>t(null)),[])}function Ew(){let e=$n(),{pathname:t}=Xn(),{data:n,loading:r,error:i,refetch:a}=fa(`/cms/admin/content-types`);(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,a),()=>window.removeEventListener(`plank:content-types-changed`,a)),[a]);function o(e){let n=`/content-types/${e}`;return t===n||t.startsWith(n+`/`)}return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Content Types`})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}),i&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(n??[]).length===0&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No content types yet.`}),!r&&!i&&(n??[]).length>0&&(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:(n??[]).map(e=>(0,H.jsxs)(Fi,{to:`/content-types/${e.slug}`,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,o(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`single`&&(0,H.jsx)(Ka,{className:`size-3.5 shrink-0 text-violet-500 dark:text-violet-400`})]},e.slug))})]}),(0,H.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-full justify-start gap-2`,onClick:()=>e(`/content-types/new`),children:[(0,H.jsx)(yo,{className:`size-3.5`}),`New Content Type`]})})]})}function Dw(){return Tw((0,H.jsx)(Ew,{})),(0,H.jsx)(Br,{})}function Ow({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty`,className:K(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12`,e),...t})}function kw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var Aw=ls(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6`}},defaultVariants:{variant:`default`}});function jw({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K(Aw({variant:t,className:e})),...n})}function Mw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-title`,className:K(`text-lg font-medium tracking-tight`,e),...t})}function Nw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Pw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}function Fw(){let e=$n(),{data:t,loading:n}=fa(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{t&&t.length>0&&e(`/content-types/${t[0].slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No content types yet`}),(0,H.jsx)(Nw,{children:`Content types define the structure of your data. Create your first one to start managing content.`})]}),(0,H.jsx)(Pw,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Create content type`})})]})}function Iw(){var e=[...arguments];return(0,v.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Lw=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Rw(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function zw(e){return`nodeType`in e}function Bw(e){return e?Rw(e)?e:zw(e)?e.ownerDocument?.defaultView??window:window:window}function Vw(e){let{Document:t}=Bw(e);return e instanceof t}function Hw(e){return Rw(e)?!1:e instanceof Bw(e).HTMLElement}function Uw(e){return e instanceof Bw(e).SVGElement}function Ww(e){return e?Rw(e)?e.document:zw(e)?Vw(e)?e:Hw(e)||Uw(e)?e.ownerDocument:document:document:document}var Gw=Lw?v.useLayoutEffect:v.useEffect;function Kw(e){let t=(0,v.useRef)(e);return Gw(()=>{t.current=e}),(0,v.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function qw(){let e=(0,v.useRef)(null);return[(0,v.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,v.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Jw(e,t){t===void 0&&(t=[e]);let n=(0,v.useRef)(e);return Gw(()=>{n.current!==e&&(n.current=e)},t),n}function Yw(e,t){let n=(0,v.useRef)();return(0,v.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Xw(e){let t=Kw(e),n=(0,v.useRef)(null);return[n,(0,v.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Zw(e){let t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e},[e]),t.current}var Qw={};function $w(e,t){return(0,v.useMemo)(()=>{if(t)return t;let n=Qw[e]==null?0:Qw[e]+1;return Qw[e]=n,e+`-`+n},[e,t])}function eT(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var tT=eT(1),nT=eT(-1);function rT(e){return`clientX`in e&&`clientY`in e}function iT(e){if(!e)return!1;let{KeyboardEvent:t}=Bw(e.target);return t&&e instanceof t}function aT(e){if(!e)return!1;let{TouchEvent:t}=Bw(e.target);return t&&e instanceof t}function oT(e){if(aT(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return rT(e)?{x:e.clientX,y:e.clientY}:null}var sT=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[sT.Translate.toString(e),sT.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),cT=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function lT(e){return e.matches(cT)?e:e.querySelector(cT)}var uT={display:`none`};function dT(e){let{id:t,value:n}=e;return v.createElement(`div`,{id:t,style:uT},n)}function fT(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return v.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function pT(){let[e,t]=(0,v.useState)(``);return{announce:(0,v.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var mT=(0,v.createContext)(null);function hT(e){let t=(0,v.useContext)(mT);(0,v.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function gT(){let[e]=(0,v.useState)(()=>new Set),t=(0,v.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,v.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var _T={draggable:`
75
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Bb=`DialogDescriptionWarning`,Vb=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rb(Bb).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Hb=pb,Ub=yb,Wb=xb,Gb=Tb,Kb=Ab,qb=Mb,Jb=Pb;function Yb(e){let t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xb=`Checkbox`,[Zb,Qb]=fl(Xb),[$b,ex]=Zb(Xb);function tx(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=hl({prop:n,defaultProp:i??!1,onChange:c,caller:Xb}),[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:ux(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,H.jsx)($b,{scope:t,...x,children:lx(d)?d(x):r})}var nx=`CheckboxTrigger`,rx=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=ex(nx,e),h=Ko(i,u),g=v.useRef(c);return v.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,H.jsx)(El.button,{type:`button`,role:`checkbox`,"aria-checked":ux(c)?`mixed`:c,"aria-required":l,"data-state":dx(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:J(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:J(n,e=>{d(e=>ux(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});rx.displayName=nx;var ix=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(tx,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rx,{...d,ref:t,__scopeCheckbox:n}),e&&(0,H.jsx)(cx,{__scopeCheckbox:n})]})})});ix.displayName=Xb;var ax=`CheckboxIndicator`,ox=v.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ex(ax,n);return(0,H.jsx)(tp,{present:r||ux(a.checked)||a.checked===!0,children:(0,H.jsx)(El.span,{"data-state":dx(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ox.displayName=ax;var sx=`CheckboxBubbleInput`,cx=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=ex(sx,e),m=Ko(n,p),h=Yb(a),g=kf(r);v.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=ux(a),n.call(e,ux(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=v.useRef(ux(a)?!1:a);return(0,H.jsx)(El.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});cx.displayName=sx;function lx(e){return typeof e==`function`}function ux(e){return e===`indeterminate`}function dx(e){return ux(e)?`indeterminate`:e?`checked`:`unchecked`}function fx(e,[t,n]){return Math.min(n,Math.max(t,e))}var px=`Popover`,[mx,hx]=fl(px,[Mf]),gx=Mf(),[_x,vx]=mx(px),yx=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=gx(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=hl({prop:r,defaultProp:i??!1,onChange:a,caller:px});return(0,H.jsx)(Jf,{...s,children:(0,H.jsx)(_x,{scope:t,contentId:fu(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})};yx.displayName=px;var bx=`PopoverAnchor`,xx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(bx,n),a=gx(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return v.useEffect(()=>(o(),()=>s()),[o,s]),(0,H.jsx)(Yf,{...a,...r,ref:t})});xx.displayName=bx;var Sx=`PopoverTrigger`,Cx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(Sx,n),a=gx(n),o=Ko(t,i.triggerRef),s=(0,H.jsx)(El.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Rx(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(Yf,{asChild:!0,...a,children:s})});Cx.displayName=Sx;var wx=`PopoverPortal`,[Tx,Ex]=mx(wx,{forceMount:void 0}),Dx=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=vx(wx,t);return(0,H.jsx)(Tx,{scope:t,forceMount:n,children:(0,H.jsx)(tp,{present:n||a.open,children:(0,H.jsx)($f,{asChild:!0,container:i,children:r})})})};Dx.displayName=wx;var Ox=`PopoverContent`,kx=v.forwardRef((e,t)=>{let n=Ex(Ox,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=vx(Ox,e.__scopePopover);return(0,H.jsx)(tp,{present:r||a.open,children:a.modal?(0,H.jsx)(jx,{...i,ref:t}):(0,H.jsx)(Mx,{...i,ref:t})})});kx.displayName=Ox;var Ax=vl(`PopoverContent.RemoveScroll`),jx=v.forwardRef((e,t)=>{let n=vx(Ox,e.__scopePopover),r=v.useRef(null),i=Ko(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return Pp(e)},[]),(0,H.jsx)(Um,{as:Ax,allowPinchZoom:!0,children:(0,H.jsx)(Nx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Mx=v.forwardRef((e,t)=>{let n=vx(Ox,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,H.jsx)(Nx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Nx=v.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=vx(Ox,n),p=gx(n);return Kl(),(0,H.jsx)(Ql,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,H.jsx)(Xf,{"data-state":Rx(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Px=`PopoverClose`,Fx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=vx(Px,n);return(0,H.jsx)(El.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})});Fx.displayName=Px;var Ix=`PopoverArrow`,Lx=v.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=gx(n);return(0,H.jsx)(Zf,{...i,...r,ref:t})});Lx.displayName=Ix;function Rx(e){return e?`open`:`closed`}var zx=yx,Bx=Cx,Vx=Dx,Hx=kx,Ux=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Wx=[` `,`Enter`],Gx=`Select`,[Kx,qx,Jx]=Ol(Gx),[Yx,Xx]=fl(Gx,[Jx,Mf]),Zx=Mf(),[Qx,$x]=Yx(Gx),[eS,tS]=Yx(Gx),nS=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Zx(t),[g,_]=v.useState(null),[y,b]=v.useState(null),[x,S]=v.useState(!1),C=Al(l),[w,T]=hl({prop:r,defaultProp:i??!1,onChange:a,caller:Gx}),[E,D]=hl({prop:o,defaultProp:s,onChange:c,caller:Gx}),O=v.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=v.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,H.jsx)(Jf,{...h,children:(0,H.jsxs)(Qx,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:fu(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,H.jsx)(Kx.Provider,{scope:t,children:(0,H.jsx)(eS,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:v.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,H.jsxs)(ZS,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,H.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};nS.displayName=Gx;var rS=`SelectTrigger`,iS=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Zx(n),o=$x(rS,n),s=o.disabled||r,c=Ko(t,o.onTriggerChange),l=qx(n),u=v.useRef(`touch`),[d,f,p]=$S(e=>{let t=l().filter(e=>!e.disabled),n=eC(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,H.jsx)(Yf,{asChild:!0,...a,children:(0,H.jsx)(El.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":QS(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Ux.includes(e.key)&&(m(),e.preventDefault())})})})});iS.displayName=rS;var aS=`SelectValue`,oS=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=$x(aS,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Ko(t,c.onValueNodeChange);return Rc(()=>{l(u)},[l,u]),(0,H.jsx)(El.span,{...s,ref:d,style:{pointerEvents:`none`},children:QS(c.value)?(0,H.jsx)(H.Fragment,{children:o}):a})});oS.displayName=aS;var sS=`SelectIcon`,cS=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(El.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});cS.displayName=sS;var lS=`SelectPortal`,uS=e=>(0,H.jsx)($f,{asChild:!0,...e});uS.displayName=lS;var dS=`SelectContent`,fS=v.forwardRef((e,t)=>{let n=$x(dS,e.__scopeSelect),[r,i]=v.useState();if(Rc(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?b.createPortal((0,H.jsx)(mS,{scope:e.__scopeSelect,children:(0,H.jsx)(Kx.Slot,{scope:e.__scopeSelect,children:(0,H.jsx)(`div`,{children:e.children})})}),t):null}return(0,H.jsx)(vS,{...e,ref:t})});fS.displayName=dS;var pS=10,[mS,hS]=Yx(dS),gS=`SelectContentImpl`,_S=vl(`SelectContent.RemoveScroll`),vS=v.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=$x(dS,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=Ko(t,e=>x(e)),[T,E]=v.useState(null),[D,O]=v.useState(null),k=qx(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return Pp(b)},[b]),Kl();let N=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=v.useCallback(()=>N([T,b]),[N,T,b]);v.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),v.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,R]=$S(e=>{let t=k().filter(e=>!e.disabled),n=eC(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ee=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),te=v.useCallback(()=>b?.focus(),[b]),ne=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),z=r===`popper`?SS:bS,B=z===SS?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)(mS,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ee,selectedItem:T,onItemLeave:te,itemTextRefCallback:ne,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,H.jsx)(Um,{as:_S,allowPinchZoom:!0,children:(0,H.jsx)(Ql,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,H.jsx)(z,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...B,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&R(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});vS.displayName=gS;var yS=`SelectItemAlignedPosition`,bS=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=$x(dS,n),o=hS(dS,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=Ko(t,e=>u(e)),f=qx(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-pS,d=fx(a,[pS,Math.max(pS,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-pS,d=fx(a,[pS,Math.max(pS,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-pS*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-pS,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${pS}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Rc(()=>b(),[b]);let[x,S]=v.useState();return Rc(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,H.jsx)(CS,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,H.jsx)(El.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});bS.displayName=yS;var xS=`SelectPopperPosition`,SS=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=pS,...a}=e,o=Zx(n);return(0,H.jsx)(Xf,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});SS.displayName=xS;var[CS,wS]=Yx(dS,{}),TS=`SelectViewport`,ES=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=hS(TS,n),o=wS(TS,n),s=Ko(t,a.onViewportChange),c=v.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(Kx.Slot,{scope:n,children:(0,H.jsx)(El.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-pS*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ES.displayName=TS;var DS=`SelectGroup`,[OS,kS]=Yx(DS),AS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=fu();return(0,H.jsx)(OS,{scope:n,id:i,children:(0,H.jsx)(El.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});AS.displayName=DS;var jS=`SelectLabel`,MS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kS(jS,n);return(0,H.jsx)(El.div,{id:i.id,...r,ref:t})});MS.displayName=jS;var NS=`SelectItem`,[PS,FS]=Yx(NS),IS=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=$x(NS,n),c=hS(NS,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=Ko(t,e=>c.itemRefCallback?.(e,r,i)),h=fu(),g=v.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,H.jsx)(PS,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(Kx.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,H.jsx)(El.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Wx.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});IS.displayName=NS;var LS=`SelectItemText`,RS=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=$x(LS,n),s=hS(LS,n),c=FS(LS,n),l=tS(LS,n),[u,d]=v.useState(null),f=Ko(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=v.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Rc(()=>(h(m),()=>g(m)),[h,g,m]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(El.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?b.createPortal(a.children,o.valueNode):null]})});RS.displayName=LS;var zS=`SelectItemIndicator`,BS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return FS(zS,n).isSelected?(0,H.jsx)(El.span,{"aria-hidden":!0,...r,ref:t}):null});BS.displayName=zS;var VS=`SelectScrollUpButton`,HS=v.forwardRef((e,t)=>{let n=hS(VS,e.__scopeSelect),r=wS(VS,e.__scopeSelect),[i,a]=v.useState(!1),o=Ko(t,r.onScrollButtonChange);return Rc(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(GS,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});HS.displayName=VS;var US=`SelectScrollDownButton`,WS=v.forwardRef((e,t)=>{let n=hS(US,e.__scopeSelect),r=wS(US,e.__scopeSelect),[i,a]=v.useState(!1),o=Ko(t,r.onScrollButtonChange);return Rc(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(GS,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});WS.displayName=US;var GS=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=hS(`SelectScrollButton`,n),o=v.useRef(null),s=qx(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Rc(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(El.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),KS=`SelectSeparator`,qS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,H.jsx)(El.div,{"aria-hidden":!0,...r,ref:t})});qS.displayName=KS;var JS=`SelectArrow`,YS=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Zx(n),a=$x(JS,n),o=hS(JS,n);return a.open&&o.position===`popper`?(0,H.jsx)(Zf,{...i,...r,ref:t}):null});YS.displayName=JS;var XS=`SelectBubbleInput`,ZS=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=v.useRef(null),a=Ko(r,i),o=Yb(t);return v.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,H.jsx)(El.select,{...n,style:{...k_,...n.style},ref:a,defaultValue:t})});ZS.displayName=XS;function QS(e){return e===``||e===void 0}function $S(e){let t=Lc(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function eC(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tC(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var nC=nS,rC=iS,iC=oS,aC=cS,oC=uS,sC=fS,cC=ES,lC=AS,uC=MS,dC=IS,fC=RS,pC=BS,mC=HS,hC=WS,gC=qS,_C=`Switch`,[vC,yC]=fl(_C),[bC,xC]=vC(_C),SC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=v.useState(null),m=Ko(t,e=>p(e)),h=v.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,y]=hl({prop:i,defaultProp:a??!1,onChange:l,caller:_C});return(0,H.jsxs)(bC,{scope:n,checked:_,disabled:s,children:[(0,H.jsx)(El.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":DC(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:J(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,H.jsx)(EC,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});SC.displayName=_C;var CC=`SwitchThumb`,wC=v.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=xC(CC,n);return(0,H.jsx)(El.span,{"data-state":DC(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});wC.displayName=CC;var TC=`SwitchBubbleInput`,EC=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=v.useRef(null),s=Ko(o,a),c=Yb(n),l=kf(t);return v.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,H.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});EC.displayName=TC;function DC(e){return e?`checked`:`unchecked`}var OC=SC,kC=wC,AC=`Tabs`,[jC,MC]=fl(AC,[fp]),NC=fp(),[PC,FC]=jC(AC),IC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Al(s),[d,f]=hl({prop:r,onChange:i,defaultProp:a??``,caller:AC});return(0,H.jsx)(PC,{scope:n,baseId:fu(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,H.jsx)(El.div,{dir:u,"data-orientation":o,...l,ref:t})})});IC.displayName=AC;var LC=`TabsList`,RC=v.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=FC(LC,n),o=NC(n);return(0,H.jsx)(wp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,H.jsx)(El.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});RC.displayName=LC;var zC=`TabsTrigger`,BC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=FC(zC,n),s=NC(n),c=UC(o.baseId,r),l=WC(o.baseId,r),u=r===o.value;return(0,H.jsx)(Tp,{asChild:!0,...s,focusable:!i,active:u,children:(0,H.jsx)(El.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:J(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:J(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});BC.displayName=zC;var VC=`TabsContent`,HC=v.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=FC(VC,n),c=UC(s.baseId,r),l=WC(s.baseId,r),u=r===s.value,d=v.useRef(u);return v.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,H.jsx)(tp,{present:i||u,children:({present:n})=>(0,H.jsx)(El.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});HC.displayName=VC;function UC(e,t){return`${e}-trigger-${t}`}function WC(e,t){return`${e}-content-${t}`}var GC=IC,KC=RC,qC=BC,JC=HC,YC=ls(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function XC({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,H.jsx)(n?yl:`span`,{"data-slot":`badge`,"data-variant":t,className:K(YC({variant:t}),e),...r})}var ZC=Hb,QC=Ub,$C=Jb,ew=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Wb,{ref:n,className:K(`fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));ew.displayName=Wb.displayName;var tw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(QC,{children:[(0,H.jsx)(ew,{}),(0,H.jsxs)(Gb,{ref:r,className:K(`fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg`,e),...n,children:[(0,H.jsxs)($C,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,H.jsx)(Bo,{className:`size-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t]})]}));tw.displayName=Gb.displayName;var nw=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});nw.displayName=`DialogHeader`;var rw=({className:e,...t})=>(0,H.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});rw.displayName=`DialogFooter`;var iw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Kb,{ref:n,className:K(`text-lg font-semibold leading-none tracking-tight`,e),...t}));iw.displayName=Kb.displayName;var aw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(qb,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));aw.displayName=qb.displayName;var ow=nC,sw=lC,cw=iC,lw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(rC,{ref:r,className:K(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,H.jsx)(aC,{asChild:!0,children:(0,H.jsx)(Oa,{className:`size-4 opacity-50`})})]}));lw.displayName=rC.displayName;var uw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(mC,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(ja,{className:`size-4`})}));uw.displayName=mC.displayName;var dw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(hC,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(Oa,{className:`size-4`})}));dw.displayName=hC.displayName;var fw=v.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,H.jsx)(oC,{children:(0,H.jsxs)(sC,{ref:i,className:K(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,H.jsx)(uw,{}),(0,H.jsx)(cC,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,H.jsx)(dw,{})]})}));fw.displayName=sC.displayName;var pw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(uC,{ref:n,className:K(`px-2 py-1.5 text-sm font-semibold`,e),...t}));pw.displayName=uC.displayName;var mw=v.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(dC,{ref:r,className:K(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(pC,{children:(0,H.jsx)(Da,{className:`size-4`})})}),(0,H.jsx)(fC,{children:t})]}));mw.displayName=dC.displayName;var hw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(gC,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));hw.displayName=gC.displayName;var gw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,H.jsx)(`table`,{ref:n,className:K(`w-full caption-bottom text-sm`,e),...t})}));gw.displayName=`Table`;var _w=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`thead`,{ref:n,className:K(`[&_tr]:border-b`,e),...t}));_w.displayName=`TableHeader`;var vw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tbody`,{ref:n,className:K(`[&_tr:last-child]:border-0`,e),...t}));vw.displayName=`TableBody`;var yw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tr`,{ref:n,className:K(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));yw.displayName=`TableRow`;var bw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`th`,{ref:n,className:K(`h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));bw.displayName=`TableHead`;var xw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`td`,{ref:n,className:K(`p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t}));xw.displayName=`TableCell`;var Sw=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`caption`,{ref:n,className:K(`mt-4 text-sm text-muted-foreground`,e),...t}));Sw.displayName=`TableCaption`;var Cw=`plank_dashboard_recent_entry_fields`;function ww(){let e=$n(),{timezone:t}=sa(),{user:n}=ia(),{data:r}=fa(`/cms/admin/content-types`),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)({}),f=n?.permissions??[],p=f.includes(`*`)||f.includes(`entries:write`),m=f.includes(`*`)||f.includes(`entries:read`),h=(0,v.useMemo)(()=>(r??[]).filter(e=>e.kind===`collection`),[r]);function g(e){for(let t of[`title`,`name`,`entry`])if(e.fields.some(e=>e.name===t))return t;return e.fields.find(e=>[`string`,`text`,`uid`].includes(e.type))?.name??`id`}function _(e){return e==null||e===``?`Untitled`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}(0,v.useEffect)(()=>{try{let e=localStorage.getItem(Cw);if(!e)return;d(JSON.parse(e))}catch{}},[]),(0,v.useEffect)(()=>{h.length!==0&&d(e=>{let t={...e},n=!1;for(let e of h)t[e.slug]||(t[e.slug]=g(e),n=!0);return n?t:e})},[h]),(0,v.useEffect)(()=>{localStorage.setItem(Cw,JSON.stringify(u))},[u]);function y(){!r||r.length===0||e(`/content/${(r.find(e=>e.isDefault)??r[0]).slug}/new`)}(0,v.useEffect)(()=>{if(!m||h.length===0){a([]);return}let e=new AbortController,t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};return s(!0),Promise.all(h.map(async t=>{let r=await fetch(`/cms/admin/content-types/${t.slug}/entries?page=1&limit=50&sort=published_at&order=desc`,{headers:n,signal:e.signal});return r.ok?((await r.json()).data??[]).filter(e=>e.status===`published`&&!!e.published_at).map(e=>({...e,slug:t.slug,contentTypeName:t.name})):[]})).then(e=>{a(e.flat().sort((e,t)=>new Date(t.published_at??0).getTime()-new Date(e.published_at??0).getTime()).slice(0,7))}).catch(()=>{a([])}).finally(()=>s(!1)),()=>e.abort()},[m,h]);function b({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(ul,{avatarUrl:e._author_avatar_url,firstName:e._author_first_name,lastName:e._author_last_name,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(yv,{children:[(0,H.jsx)(bv,{asChild:!0,children:i}),(0,H.jsx)(xv,{children:r})]}):i}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Plank Forge`}),p&&(0,H.jsxs)(q,{onClick:y,disabled:!r||r.length===0,children:[(0,H.jsx)(yo,{className:`size-4`}),`New entry`]})]})}),(0,H.jsx)(`section`,{className:`mt-24`,children:(0,H.jsx)(vv,{children:(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:(0,H.jsxs)(gw,{className:`w-full text-sm`,children:[(0,H.jsxs)(_w,{className:`border-b border-border font-bold uppercase`,children:[(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:(0,H.jsx)(bw,{colSpan:4,className:`px-4 py-3 h-auto`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Recent content`}),(0,H.jsxs)(ZC,{open:c,onOpenChange:l,children:[(0,H.jsx)(q,{size:`icon`,variant:`outline`,onClick:()=>l(!0),children:(0,H.jsx)(La,{className:`size-4`})}),(0,H.jsxs)(tw,{className:`max-w-lg`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Recent content fields`})}),(0,H.jsx)(`div`,{className:`space-y-4`,children:h.map(e=>(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`recent-field-${e.slug}`,children:e.name}),(0,H.jsxs)(ow,{value:u[e.slug]??g(e),onValueChange:t=>d(n=>({...n,[e.slug]:t})),children:[(0,H.jsx)(lw,{id:`recent-field-${e.slug}`,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`id`,children:`id`}),e.fields.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))]})]})]},e.slug))})]})]})]})})}),(0,H.jsxs)(yw,{className:`border-t border-border hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Entry`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Collection Type`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Published`})]})]}),(0,H.jsx)(vw,{children:o?(0,H.jsx)(yw,{className:`border-b`,children:(0,H.jsx)(xw,{colSpan:4,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):i.length===0?(0,H.jsx)(yw,{className:`border-b`,children:(0,H.jsx)(xw,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:`No recent entries found.`})}):i.map(n=>(0,H.jsxs)(yw,{className:`border-b last:border-b-0 transition-colors hover:bg-muted/50`,children:[(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>e(`/content/${n.slug}/${n.id}`),className:`text-left hover:underline`,children:(0,H.jsx)(`div`,{className:`font-medium`,children:_(n[u[n.slug]??g(h.find(e=>e.slug===n.slug)??{slug:n.slug,name:n.contentTypeName,kind:`collection`,isDefault:!1,fields:[]})])})})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(XC,{variant:`outline`,children:n.contentTypeName})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:(0,H.jsx)(b,{entry:n})}),(0,H.jsx)(xw,{className:`px-4 py-3 align-middle`,children:n.published_at?sy(n.published_at,t):`—`})]},`${n.slug}-${n.id}`))})]})})})})]})}function Tw(e){let{setContent:t}=Uo();(0,v.useEffect)(()=>(t(e),()=>t(null)),[])}function Ew(){let e=$n(),{pathname:t}=Xn(),{data:n,loading:r,error:i,refetch:a}=fa(`/cms/admin/content-types`);(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,a),()=>window.removeEventListener(`plank:content-types-changed`,a)),[a]);function o(e){let n=`/content-types/${e}`;return t===n||t.startsWith(n+`/`)}return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Content Types`})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}),i&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:i}),!r&&!i&&(n??[]).length===0&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No content types yet.`}),!r&&!i&&(n??[]).length>0&&(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:(n??[]).map(e=>(0,H.jsxs)(Fi,{to:`/content-types/${e.slug}`,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,o(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`single`&&(0,H.jsx)(Ka,{className:`size-3.5 shrink-0 text-violet-500 dark:text-violet-400`})]},e.slug))})]}),(0,H.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-full justify-start gap-2`,onClick:()=>e(`/content-types/new`),children:[(0,H.jsx)(yo,{className:`size-3.5`}),`New Content Type`]})})]})}function Dw(){return Tw((0,H.jsx)(Ew,{})),(0,H.jsx)(Br,{})}function Ow({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty`,className:K(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12`,e),...t})}function kw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var Aw=ls(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6`}},defaultVariants:{variant:`default`}});function jw({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K(Aw({variant:t,className:e})),...n})}function Mw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-title`,className:K(`text-lg font-medium tracking-tight`,e),...t})}function Nw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Pw({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}function Fw(){let e=$n(),{data:t,loading:n}=fa(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{t&&t.length>0&&e(`/content-types/${t[0].slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No content types yet`}),(0,H.jsx)(Nw,{children:`Content types define the structure of your data. Create your first one to start managing content.`})]}),(0,H.jsx)(Pw,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Create content type`})})]})}function Iw(){var e=[...arguments];return(0,v.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Lw=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Rw(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function zw(e){return`nodeType`in e}function Bw(e){return e?Rw(e)?e:zw(e)?e.ownerDocument?.defaultView??window:window:window}function Vw(e){let{Document:t}=Bw(e);return e instanceof t}function Hw(e){return Rw(e)?!1:e instanceof Bw(e).HTMLElement}function Uw(e){return e instanceof Bw(e).SVGElement}function Ww(e){return e?Rw(e)?e.document:zw(e)?Vw(e)?e:Hw(e)||Uw(e)?e.ownerDocument:document:document:document}var Gw=Lw?v.useLayoutEffect:v.useEffect;function Kw(e){let t=(0,v.useRef)(e);return Gw(()=>{t.current=e}),(0,v.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function qw(){let e=(0,v.useRef)(null);return[(0,v.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,v.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Jw(e,t){t===void 0&&(t=[e]);let n=(0,v.useRef)(e);return Gw(()=>{n.current!==e&&(n.current=e)},t),n}function Yw(e,t){let n=(0,v.useRef)();return(0,v.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Xw(e){let t=Kw(e),n=(0,v.useRef)(null);return[n,(0,v.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Zw(e){let t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e},[e]),t.current}var Qw={};function $w(e,t){return(0,v.useMemo)(()=>{if(t)return t;let n=Qw[e]==null?0:Qw[e]+1;return Qw[e]=n,e+`-`+n},[e,t])}function eT(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var tT=eT(1),nT=eT(-1);function rT(e){return`clientX`in e&&`clientY`in e}function iT(e){if(!e)return!1;let{KeyboardEvent:t}=Bw(e.target);return t&&e instanceof t}function aT(e){if(!e)return!1;let{TouchEvent:t}=Bw(e.target);return t&&e instanceof t}function oT(e){if(aT(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return rT(e)?{x:e.clientX,y:e.clientY}:null}var sT=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[sT.Translate.toString(e),sT.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),cT=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function lT(e){return e.matches(cT)?e:e.querySelector(cT)}var uT={display:`none`};function dT(e){let{id:t,value:n}=e;return v.createElement(`div`,{id:t,style:uT},n)}function fT(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return v.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function pT(){let[e,t]=(0,v.useState)(``);return{announce:(0,v.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var mT=(0,v.createContext)(null);function hT(e){let t=(0,v.useContext)(mT);(0,v.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function gT(){let[e]=(0,v.useState)(()=>new Set),t=(0,v.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,v.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var _T={draggable:`
76
76
  To pick up a draggable item, press the space bar.
77
77
  While dragging, use the arrow keys to move the item.
78
78
  Press space again to drop the item in its new position, or press escape to cancel.
79
- `},vT={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function yT(e){let{announcements:t=vT,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=_T}=e,{announce:a,announcement:o}=pT(),s=$w(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),hT((0,v.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=v.createElement(v.Fragment,null,v.createElement(dT,{id:r,value:i.draggable}),v.createElement(fT,{id:s,announcement:o}));return n?(0,b.createPortal)(u,n):u}var bT;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(bT||={});function xT(){}function ST(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function CT(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var wT=Object.freeze({x:0,y:0});function TT(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ET(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function DT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function OT(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function kT(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var AT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=kT(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=TT(kT(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ET)};function jT(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var MT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=jT(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(DT)};function NT(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function PT(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wT}function FT(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var IT=FT(1);function LT(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function RT(e,t,n){let r=LT(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var zT={ignoreTransform:!1};function BT(e,t){t===void 0&&(t=zT);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Bw(e).getComputedStyle(e);t&&(n=RT(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function VT(e){return BT(e,{ignoreTransform:!0})}function HT(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UT(e,t){return t===void 0&&(t=Bw(e).getComputedStyle(e)),t.position===`fixed`}function WT(e,t){t===void 0&&(t=Bw(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function GT(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Vw(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Hw(i)||Uw(i)||n.includes(i))return n;let a=Bw(e).getComputedStyle(i);return i!==e&&WT(i,a)&&n.push(i),UT(i,a)?n:r(i.parentNode)}return e?r(e):n}function KT(e){let[t]=GT(e,1);return t??null}function qT(e){return!Lw||!e?null:Rw(e)?e:zw(e)?Vw(e)||e===Ww(e).scrollingElement?window:Hw(e)?e:null:null}function JT(e){return Rw(e)?e.scrollX:e.scrollLeft}function YT(e){return Rw(e)?e.scrollY:e.scrollTop}function XT(e){return{x:JT(e),y:YT(e)}}var ZT;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(ZT||={});function QT(e){return!Lw||!e?!1:e===document.scrollingElement}function $T(e){let t={x:0,y:0},n=QT(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var eE={x:.2,y:.2};function tE(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=eE);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=$T(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=ZT.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=ZT.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=ZT.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=ZT.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function nE(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function rE(e){return e.reduce((e,t)=>tT(e,XT(t)),wT)}function iE(e){return e.reduce((e,t)=>e+JT(t),0)}function aE(e){return e.reduce((e,t)=>e+YT(t),0)}function oE(e,t){if(t===void 0&&(t=BT),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);KT(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var sE=[[`x`,[`left`,`right`],iE],[`y`,[`top`,`bottom`],aE]],cE=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=GT(t),r=rE(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of sE)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},lE=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function uE(e){let{EventTarget:t}=Bw(e);return e instanceof t?e:Ww(e)}function dE(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var fE;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(fE||={});function pE(e){e.preventDefault()}function mE(e){e.stopPropagation()}var hE;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(hE||={});var gE={start:[hE.Space,hE.Enter],cancel:[hE.Esc],end:[hE.Space,hE.Enter,hE.Tab]},_E=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case hE.Right:return{...n,x:n.x+25};case hE.Left:return{...n,x:n.x-25};case hE.Down:return{...n,y:n.y+25};case hE.Up:return{...n,y:n.y-25}}},vE=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new lE(Ww(t)),this.windowListeners=new lE(Bw(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fE.Resize,this.handleCancel),this.windowListeners.add(fE.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fE.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&oE(n),t(wT)}handleKeyDown(e){if(iT(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=gE,coordinateGetter:a=_E,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:wT;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=nT(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=$T(n),p=nE(n),m={x:Math.min(i===hE.Right?p.right-p.width/2:p.right,Math.max(i===hE.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===hE.Down?p.bottom-p.height/2:p.bottom,Math.max(i===hE.Down?p.top:p.top+p.height/2,u.y))},h=i===hE.Right&&!s||i===hE.Left&&!c,g=i===hE.Down&&!l||i===hE.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===hE.Right&&e<=d.x||i===hE.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===hE.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===hE.Down&&e<=d.y||i===hE.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===hE.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,tT(nT(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};vE.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=gE,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function yE(e){return!!(e&&`distance`in e)}function bE(e){return!!(e&&`delay`in e)}var xE=class{constructor(e,t,n){n===void 0&&(n=uE(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Ww(i),this.documentListeners=new lE(this.document),this.listeners=new lE(n),this.windowListeners=new lE(Bw(i)),this.initialCoordinates=oT(r)??wT,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(fE.Resize,this.handleCancel),this.windowListeners.add(fE.DragStart,pE),this.windowListeners.add(fE.VisibilityChange,this.handleCancel),this.windowListeners.add(fE.ContextMenu,pE),this.documentListeners.add(fE.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bE(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(yE(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(fE.Click,mE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fE.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=oT(e)??wT,s=nT(n,o);if(!t&&a){if(yE(a)){if(a.tolerance!=null&&dE(s,a.tolerance))return this.handleCancel();if(dE(s,a.distance))return this.handleStart()}if(bE(a)&&dE(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===hE.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},SE={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},CE=class extends xE{constructor(e){let{event:t}=e,n=Ww(t.target);super(e,SE,n)}};CE.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var wE={move:{name:`mousemove`},end:{name:`mouseup`}},TE;(function(e){e[e.RightClick=2]=`RightClick`})(TE||={});var EE=class extends xE{constructor(e){super(e,wE,Ww(e.event.target))}};EE.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===TE.RightClick?!1:(r?.({event:n}),!0)}}];var DE={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},OE=class extends xE{constructor(e){super(e,DE)}static setup(){return window.addEventListener(DE.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(DE.move.name,e)};function e(){}}};OE.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var kE;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(kE||={});var AE;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(AE||={});function jE(e){let{acceleration:t,activator:n=kE.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=AE.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=NE({delta:d,disabled:!a}),[m,h]=qw(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case kE.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case kE.DraggableRect:return i}},[n,i,c]),b=(0,v.useRef)(null),x=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,v.useMemo)(()=>s===AE.TreeOrder?[...l].reverse():l,[s,l]);(0,v.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=tE(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var ME={x:{[ZT.Backward]:!1,[ZT.Forward]:!1},y:{[ZT.Backward]:!1,[ZT.Forward]:!1}};function NE(e){let{delta:t,disabled:n}=e,r=Zw(t);return Yw(e=>{if(n||!r||!e)return ME;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ZT.Backward]:e.x[ZT.Backward]||i.x===-1,[ZT.Forward]:e.x[ZT.Forward]||i.x===1},y:{[ZT.Backward]:e.y[ZT.Backward]||i.y===-1,[ZT.Forward]:e.y[ZT.Forward]||i.y===1}}},[n,t,r])}function PE(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Yw(e=>t==null?null:r??e??null,[r,t])}function FE(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var IE;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(IE||={});var LE;(function(e){e.Optimized=`optimized`})(LE||={});var RE=new Map;function zE(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,v.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,v.useRef)(e),d=g(),f=Jw(d),p=(0,v.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,v.useRef)(null),h=Yw(t=>{if(d&&!n)return RE;if(!t||t===RE||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new cE(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,v.useEffect)(()=>{u.current=e},[e]),(0,v.useEffect)(()=>{d||p()},[n,d]),(0,v.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,v.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case IE.Always:return!1;case IE.BeforeDragging:return n;default:return!n}}}function BE(e,t){return Yw(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function VE(e,t){return BE(e,t)}function HE(e){let{callback:t,disabled:n}=e,r=Kw(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function UE(e){let{callback:t,disabled:n}=e,r=Kw(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function WE(e){return new cE(BT(e),e)}function GE(e,t,n){t===void 0&&(t=WE);let[r,i]=(0,v.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=HE({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=UE({callback:a});return Gw(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function KE(e){return PT(e,BE(e))}var qE=[];function JE(e){let t=(0,v.useRef)(e),n=Yw(n=>e?n&&n!==qE&&e&&t.current&&e.parentNode===t.current.parentNode?n:GT(e):qE,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function YE(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=qT(e.target);t&&n(e=>e?(e.set(t,XT(t)),new Map(e)):null)},[]);return(0,v.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=qT(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,XT(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{qT(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>tT(e,t),wT):rE(e):wT,[e,t])}function XE(e,t){t===void 0&&(t=[]);let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{n.current=null},t),(0,v.useEffect)(()=>{let t=e!==wT;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?nT(e,n.current):wT}function ZE(e){(0,v.useEffect)(()=>{if(!Lw)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function QE(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function $E(e){return(0,v.useMemo)(()=>e?HT(e):null,[e])}var eD=[];function tD(e,t){t===void 0&&(t=BT);let[n]=e,r=$E(n?Bw(n):null),[i,a]=(0,v.useState)(eD);function o(){a(()=>e.length?e.map(e=>QT(e)?r:new cE(t(e),e)):eD)}let s=UE({callback:o});return Gw(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function nD(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Hw(t)?t:e}function rD(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=UE({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(Hw(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Xw((0,v.useCallback)(e=>{let n=nD(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,v.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var iD=[{sensor:CE,options:{}},{sensor:vE,options:{}}],aD={current:{}},oD={draggable:{measure:VT},droppable:{measure:VT,strategy:IE.WhileDragging,frequency:LE.Optimized},dragOverlay:{measure:BT}},sD=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},cD={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sD,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xT},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oD,measureDroppableContainers:xT,windowRect:null,measuringScheduled:!1},lD={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:xT,draggableNodes:new Map,over:null,measureDroppableContainers:xT},uD=(0,v.createContext)(lD),dD=(0,v.createContext)(cD);function fD(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sD}}}function pD(e,t){switch(t.type){case bT.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bT.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case bT.DragEnd:case bT.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bT.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new sD(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case bT.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new sD(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case bT.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new sD(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function mD(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(uD),a=Zw(r),o=Zw(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!iT(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=lT(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function hD(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function gD(e){return(0,v.useMemo)(()=>({draggable:{...oD.draggable,...e?.draggable},droppable:{...oD.droppable,...e?.droppable},dragOverlay:{...oD.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _D(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,v.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Gw(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=PT(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=KT(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var vD=(0,v.createContext)({...wT,scaleX:1,scaleY:1}),yD;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(yD||={});var bD=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=iD,collisionDetection:o=MT,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(pD,void 0,fD),[f,p]=gT(),[m,h]=(0,v.useState)(yD.Uninitialized),g=m===yD.Initialized,{draggable:{active:_,nodes:y,translate:x},droppable:{containers:S}}=u,C=_==null?null:y.get(_),w=(0,v.useRef)({initial:null,translated:null}),T=(0,v.useMemo)(()=>_==null?null:{id:_,data:C?.data??aD,rect:w},[_,C]),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),j=Jw(l,Object.values(l)),M=$w(`DndDescribedBy`,t),N=(0,v.useMemo)(()=>S.getEnabled(),[S]),P=gD(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=zE(N,{dragging:g,dependencies:[x.x,x.y],config:P.droppable}),R=PE(y,_),ee=(0,v.useMemo)(()=>k?oT(k):null,[k]),te=ke(),ne=VE(R,P.draggable.measure);_D({activeNode:_==null?null:y.get(_),config:te.layoutShiftCompensation,initialRect:ne,measure:P.draggable.measure});let z=GE(R,P.draggable.measure,ne),B=GE(R?R.parentElement:null),re=(0,v.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),V=S.getNodeFor(re.current.over?.id),ie=rD({measure:P.dragOverlay.measure}),ae=ie.nodeRef.current??R,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=KE(se?null:z),le=$E(ae?Bw(ae):null),ue=JE(g?V??R:null),de=tD(ue),fe=hD(c,{transform:{x:x.x-ce.x,y:x.y-ce.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ee?tT(ee,x):null,me=YE(ue),he=XE(me),ge=XE(me,[z]),_e=tT(fe,he),ve=oe?IT(oe,fe):null,ye=T&&ve?o({active:T,collisionRect:ve,droppableRects:F,droppableContainers:N,pointerCoordinates:pe}):null,be=OT(ye,`id`),[xe,Se]=(0,v.useState)(null),Ce=NT(se?fe:tT(fe,ge),xe?.rect??null,z),we=(0,v.useRef)(null),Te=(0,v.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=y.get(E.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:E.current,activeNode:i,event:a,options:r,context:re,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,b.unstable_batchedUpdates)(()=>{r?.(i),h(yD.Initializing),d({type:bT.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(we.current),A(a)})},onMove(e){d({type:bT.DragMove,coordinates:e})},onEnd:o(bT.DragEnd),onCancel:o(bT.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=re.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===bT.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=bT.DragCancel)}E.current=null,(0,b.unstable_batchedUpdates)(()=>{d({type:e}),h(yD.Uninitialized),Se(null),O(null),A(null),we.current=null;let t=e===bT.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ee=FE(a,(0,v.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Te(n,t))},[y,Te]));ZE(a),Gw(()=>{z&&m===yD.Initializing&&h(yD.Initialized)},[z,m]),(0,v.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=re.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:_e.x,y:_e.y},over:i};(0,b.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,v.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=re.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,b.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),Gw(()=>{re.current={activatorEvent:k,active:T,activeNode:R,collisionRect:ve,collisions:ye,droppableRects:F,draggableNodes:y,draggingNode:ae,draggingNodeRect:oe,droppableContainers:S,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},w.current={initial:oe,translated:ve}},[T,R,ye,ve,y,ae,oe,F,S,xe,ue,_e]),jE({...te,delta:x,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,v.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:z,activatorEvent:k,collisions:ye,containerNodeRect:B,dragOverlay:ie,draggableNodes:y,droppableContainers:S,droppableRects:F,over:xe,measureDroppableContainers:I,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:P,measuringScheduled:L,windowRect:le}),[T,R,z,k,ye,B,ie,y,S,F,xe,I,ue,de,P,L,le]),Oe=(0,v.useMemo)(()=>({activatorEvent:k,activators:Ee,active:T,activeNodeRect:z,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:y,over:xe,measureDroppableContainers:I}),[k,Ee,T,z,d,M,y,xe,I]);return v.createElement(mT.Provider,{value:p},v.createElement(uD.Provider,{value:Oe},v.createElement(dD.Provider,{value:De},v.createElement(vD.Provider,{value:Ce},i)),v.createElement(mD,{disabled:n?.restoreFocus===!1})),v.createElement(yT,{...n,hiddenTextDescribedById:M}));function ke(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),xD=(0,v.createContext)(null),SD=`button`,CD=`Draggable`;function wD(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=$w(CD),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(uD),{role:p=SD,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?vD:xD),[y,b]=Xw(),[x,S]=Xw(),C=QE(o,t),w=Jw(n);return Gw(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,v.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===SD?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function TD(){return(0,v.useContext)(dD)}var ED=`Droppable`,DD={timeout:25};function OD(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=$w(ED),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(uD),u=(0,v.useRef)({disabled:n}),d=(0,v.useRef)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...DD,...i},_=Jw(h??r),y=UE({callback:(0,v.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=Xw((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Jw(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:bT.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:bT.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:bT.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function kD(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AD(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function jD(e){return e!==null&&e>=0}function MD(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ND(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var PD=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=kD(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},FD={scaleX:1,scaleY:1},ID=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...FD}:null}let s=LD(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...FD}:r<t&&r>=a?{x:0,y:o.height+s,...FD}:{x:0,y:0,...FD}};function LD(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var RD=`Sortable`,zD=v.createContext({activeIndex:-1,containerId:RD,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:PD,disabled:{draggable:!1,droppable:!1}});function BD(e){let{children:t,id:n,items:r,strategy:i=PD,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=TD(),d=$w(RD,n),f=s.rect!==null,p=(0,v.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,v.useRef)(p),y=!MD(p,_.current),b=g!==-1&&h===-1||y,x=ND(a);Gw(()=>{y&&m&&u(p)},[y,p,m,u]),(0,v.useEffect)(()=>{_.current=p},[p]);let S=(0,v.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:AD(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(zD.Provider,{value:S},t)}var VD=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return kD(n,r,i).indexOf(t)},HD=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},UD={duration:200,easing:`ease`},WD=`transform`,GD=sT.Transition.toString({property:WD,duration:0,easing:`linear`}),KD={roleDescription:`sortable`};function qD(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return Gw(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=BT(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,v.useEffect)(()=>{a&&o(null)},[a]),a}function JD(e){let{animateLayoutChanges:t=HD,attributes:n,disabled:r,data:i,getNewIndex:a=VD,id:o,strategy:s,resizeObserverConfig:c,transition:l=UD}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(zD),b=YD(r,p),x=u.indexOf(o),S=(0,v.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,v.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=OD({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=wD({id:o,data:S,attributes:{...KD,...n},disabled:b.draggable}),R=Iw(D,M),ee=!!O,te=ee&&!m&&jD(f)&&jD(g),ne=!_&&P,z=te?(ne&&te?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,B=jD(f)&&jD(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,re=O?.id,V=(0,v.useRef)({activeId:re,items:u,newIndex:B,containerId:d}),ie=u!==V.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:x,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),oe=qD({disabled:!ae,index:x,node:T,rect:w});return(0,v.useEffect)(()=>{ee&&V.current.newIndex!==B&&(V.current.newIndex=B),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[ee,B,d,u]),(0,v.useEffect)(()=>{if(re===V.current.activeId)return;if(re!=null&&V.current.activeId==null){V.current.activeId=re;return}let e=setTimeout(()=>{V.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:B,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??z,transition:se()};function se(){if(oe||ie&&V.current.newIndex===x)return GD;if(!(ne&&!iT(k)||!l)&&(ee||ae))return sT.Transition.toString({...l,property:WD})}}function YD(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}hE.Down,hE.Right,hE.Up,hE.Left;function XD(e,t){let n=t.toLowerCase().split(`+`),r=n.includes(`mod`),i=n.includes(`shift`),a=n[n.length-1];return(r?e.metaKey||e.ctrlKey:!e.metaKey&&!e.ctrlKey)&&i===e.shiftKey&&!e.altKey&&e.key.toLowerCase()===a}function ZD(e,t,n){let r=n?.enabled??!0,{register:i}=(0,v.useContext)(ca),a=(0,v.useRef)(t);(0,v.useEffect)(()=>{a.current=t}),(0,v.useEffect)(()=>{if(n?.label)return i(e,n.label)},[e,n?.label,i]),(0,v.useEffect)(()=>{function t(t){XD(t,e)&&(t.preventDefault(),r&&a.current())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r])}function QD(e,t){switch(e){case`string`:return{icon:No,label:`Text (string)`,color:`text-blue-600`,bg:`bg-blue-50`};case`text`:return{icon:ko,label:`Long text (string)`,color:`text-sky-600`,bg:`bg-sky-50`};case`richtext`:return{icon:Ga,label:`Rich text (blocks)`,color:`text-violet-600`,bg:`bg-violet-50`};case`number`:return{icon:Qa,label:t===`float`?`Decimal (number)`:`Integer (number)`,color:`text-orange-600`,bg:`bg-orange-50`};case`boolean`:return{icon:jo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`};case`datetime`:return{icon:Ta,label:`Date & time`,color:`text-amber-600`,bg:`bg-amber-50`};case`media`:return{icon:ro,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`};case`media-gallery`:return{icon:co,label:`Media Gallery`,color:`text-pink-600`,bg:`bg-pink-50`};case`relation`:return{icon:uo,label:`Relation`,color:`text-indigo-600`,bg:`bg-indigo-50`};case`uid`:return{icon:qa,label:`UID`,color:`text-teal-600`,bg:`bg-teal-50`};case`array`:return{icon:lo,label:`Array`,color:`text-cyan-600`,bg:`bg-cyan-50`};case`navigation`:return{icon:po,label:`Navigation`,color:`text-cyan-600`,bg:`bg-cyan-50`}}}var $D={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`},eO={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,"media-gallery":`full`,relation:`half`,uid:`half`,array:`full`,navigation:`full`};function tO({width:e}){let t=`rounded-sm bg-current`;return e===`full`?(0,H.jsx)(`div`,{className:`flex w-4 gap-px`,children:(0,H.jsx)(`div`,{className:`${t} h-2 w-full`})}):e===`two-thirds`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]}):e===`half`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`})]}):(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]})}var nO=[{value:`full`,label:`Full width`},{value:`half`,label:`Half`},{value:`third`,label:`1/3`},{value:`two-thirds`,label:`2/3`}];function rO({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i,dragListeners:a,dragAttributes:o}){let{icon:s,label:c,color:l,bg:u}=QD(e.type,e.subtype),d=e.width??`full`,f=!!a,p=e.type===`array`;return(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-card shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3`,children:[f&&(0,H.jsx)(`button`,{type:`button`,className:`flex shrink-0 cursor-grab items-center text-muted-foreground/40 hover:text-muted-foreground active:cursor-grabbing`,...a,...o,children:(0,H.jsx)(Za,{className:`size-4`})}),(0,H.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md ${u}`,children:(0,H.jsx)(s,{className:`size-4 ${l}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsxs)(`p`,{className:`truncate text-sm font-medium leading-tight`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),e.relationType===`one-to-many`&&(0,H.jsx)(`span`,{className:`shrink-0 rounded border border-indigo-200 bg-indigo-50 px-1 py-px text-[10px] font-medium text-indigo-600`,children:`Auto`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.relationType===`one-to-many`?`Inverse relation · read-only`:c})]}),t&&!p&&(0,H.jsx)(`div`,{className:`flex shrink-0 items-center gap-px rounded-md border border-border p-0.5`,children:nO.map(({value:e,label:n})=>(0,H.jsx)(`button`,{type:`button`,title:n,onClick:()=>t(e),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,d===e?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(tO,{width:e})},e))}),(r||i)&&(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[r&&(0,H.jsx)(`button`,{type:`button`,title:`Edit field`,onClick:r,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(vo,{className:`size-3.5`})}),i&&(0,H.jsx)(`button`,{type:`button`,title:`Delete field`,onClick:i,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),p&&e.arrayFields&&e.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-2 px-3 pb-3`,children:e.arrayFields.map(e=>{let t=QD(e.type,e.subtype),r=t.icon;return(0,H.jsxs)(`div`,{className:`${$D[e.width??`full`]} rounded-md border border-dashed border-border p-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${t.bg}`,children:(0,H.jsx)(r,{className:`size-3 ${t.color}`})}),(0,H.jsxs)(`span`,{className:`truncate text-xs font-medium`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})]}),(0,H.jsx)(`p`,{className:`mt-0.5 truncate pl-6 text-[10px] text-muted-foreground`,children:t.label}),n&&(0,H.jsx)(`div`,{className:`mt-1 flex items-center gap-px rounded-md border border-border p-0.5`,children:nO.map(({value:t,label:r})=>(0,H.jsx)(`button`,{type:`button`,title:r,onClick:()=>n(e.name,t),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,(e.width??`full`)===t?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(tO,{width:t})},t))})]},e.name)})})]})}var iO=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(ix,{ref:n,className:K(`peer size-4 shrink-0 rounded-sm border border-input shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary`,e),...t,children:(0,H.jsx)(ox,{className:`flex items-center justify-center text-current`,children:(0,H.jsx)(Da,{className:`size-3`})})}));iO.displayName=ix.displayName;var aO=[{type:`string`,icon:No,label:`Text`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:ko,label:`Long Text`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:Ga,label:`Rich Text`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`number`,subtype:`integer`,icon:Qa,label:`Integer`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:Qa,label:`Decimal`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`boolean`,icon:jo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ta,label:`Date & Time`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:ro,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`}],oO={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`},sO={type:`string`,subtype:void 0,name:``,required:!1,allowedTypes:[],width:`half`},cO=[{type:`string`,icon:No,label:`Text (string)`,description:`Titles, names, labels`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:ko,label:`Long text (string)`,description:`Plain text, paragraphs`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:Ga,label:`Rich text (blocks)`,description:`Formatted HTML content`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`uid`,icon:qa,label:`UID`,description:`Unique slug from a field`,color:`text-teal-600`,bg:`bg-teal-50`},{type:`boolean`,icon:jo,label:`Boolean`,description:`True or false`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ta,label:`Date & time`,description:`Timestamps and dates`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:ro,label:`Media`,description:`Images, videos or files`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`media-gallery`,icon:co,label:`Media Gallery`,description:`Multiple images for galleries`,color:`text-pink-600`,bg:`bg-pink-50`},{type:`array`,icon:lo,label:`Array`,description:`Repeatable list of items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`navigation`,icon:po,label:`Navigation`,description:`Nested navigation items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`number`,subtype:`integer`,icon:Qa,label:`Integer (number)`,description:`Whole numbers`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:Qa,label:`Decimal (number)`,description:`Numbers with decimals`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`relation`,icon:uo,label:`Relation`,description:`Link to another content type`,color:`text-indigo-600`,bg:`bg-indigo-50`}],lO=[{value:`image`,label:`Images`},{value:`video`,label:`Videos`},{value:`audio`,label:`Audio`},{value:`document`,label:`Documents`}],uO=[{value:`many-to-one`,label:`Many-to-One`,description:`Many of these → one of the other`},{value:`one-to-one`,label:`One-to-One`,description:`One of these ↔ one of the other`},{value:`many-to-many`,label:`Many-to-Many`,description:`Many of these ↔ many of the other`}],dO=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.authorization.between.binary.both.case.cast.check.collate.column.constraint.create.cross.current_catalog.current_date.current_role.current_schema.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`));function fO(e){return dO.has(e.toLowerCase())}var pO={name:``,required:!1,relationType:`many-to-one`,relatedTable:``,relatedSlug:``,targetField:``,allowedTypes:[],arrayFields:[]};function mO({open:e,onOpenChange:t,existingNames:n,availableContentTypes:r,stringFields:i,initialField:a,onConfirm:o}){let[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(pO),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),b=!!a;(0,v.useEffect)(()=>{e?a&&(c(cO.find(e=>e.type===a.type&&(e.subtype??void 0)===(a.subtype??void 0))??null),u({name:a.name,required:a.required??!1,relationType:a.relationType??`many-to-one`,relatedTable:a.relatedTable??``,relatedSlug:a.relatedSlug??``,targetField:a.targetField??``,allowedTypes:a.allowedTypes??[],arrayFields:a.arrayFields??[]})):(c(null),u(pO),f(``),m(null),g(``),y(``))},[e,a]);function x(e){t(e)}function S(e){c(e),u(pO),f(``),m(null),g(``),y(``)}function C(){b||(c(null),u(pO),f(``),m(null),g(``),y(``))}function w(){m({...sO}),g(``)}function T(e){m(t=>t?{...t,type:e.type,subtype:e.subtype,width:oO[e.type]}:{...sO,type:e.type,subtype:e.subtype,width:oO[e.type]})}function E(){if(!p)return;let e=p.name.trim();if(!e){g(`Name is required`);return}if(!/^[a-z][a-z0-9_]*$/.test(e)){g(`Lowercase letters, digits and underscores only`);return}if(fO(e)){g(`This name is reserved by SQL. Choose another one.`);return}if(l.arrayFields.some(t=>t.name===e)){g(`A sub-field with this name already exists`);return}let t={name:e,type:p.type,subtype:p.subtype,required:p.required||void 0,allowedTypes:p.type===`media`&&p.allowedTypes.length>0?p.allowedTypes:void 0,width:p.width};u(e=>({...e,arrayFields:[...e.arrayFields,t]})),m(null),g(``)}function D(e){u(t=>({...t,arrayFields:t.arrayFields.filter(t=>t.name!==e)}))}function O(e,t){u(n=>({...n,arrayFields:n.arrayFields.map((n,r)=>r===e?{...n,name:t}:n)})),y(``)}function k(){let e=l.arrayFields.map(e=>e.name.trim());return e.some(e=>!e)?(y(`All sub-fields must have a name.`),!1):e.some(e=>!/^[a-z][a-z0-9_]*$/.test(e))?(y(`Sub-field names must use lowercase letters, digits and underscores.`),!1):e.some(e=>fO(e))?(y(`One or more sub-field names are reserved by SQL.`),!1):new Set(e).size===e.length?!0:(y(`Sub-field names must be unique.`),!1)}function A(){let e=l.name.trim();return e?/^[a-z][a-z0-9_]*$/.test(e)?fO(e)?(f(`This name is reserved by SQL. Choose another one.`),!1):n.includes(e)&&e!==a?.name?(f(`A field with this name already exists`),!1):!0:(f(`Lowercase letters, digits and underscores only`),!1):(f(`Name is required`),!1)}function j(){!s||!A()||s.type===`array`&&!k()||(o({name:l.name.trim(),type:s.type,subtype:s.subtype,required:l.required||void 0,relationType:s.type===`relation`?l.relationType:void 0,relatedTable:s.type===`relation`?l.relatedTable:void 0,relatedSlug:s.type===`relation`?l.relatedSlug:void 0,targetField:s.type===`uid`?l.targetField:void 0,allowedTypes:s.type===`media`&&l.allowedTypes.length>0?l.allowedTypes:s.type===`media-gallery`?[`image`]:void 0,arrayFields:s.type===`array`?l.arrayFields.map(e=>({...e,name:e.name.trim()})):void 0,width:a?.width??eO[s.type]}),x(!1))}let M=!!s,N=s?.label.replace(/\s*\(.*?\)/,``)??``,P=b?`Edit field`:M?`${N} field`:`Add a field`;return(0,H.jsx)(ZC,{open:e,onOpenChange:x,children:(0,H.jsxs)(tw,{className:M?s?.type===`array`?`max-w-lg`:`max-w-md`:`max-w-3xl`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M&&!b&&(0,H.jsx)(`button`,{type:`button`,onClick:C,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Sa,{className:`size-4`})}),(0,H.jsx)(iw,{children:P})]})}),!M&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 pt-1`,children:cO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>!e.disabled&&S(e),className:`flex flex-col items-start gap-2 rounded-lg border border-border p-3 text-left transition-colors hover:border-primary hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,H.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md ${e.bg}`,children:(0,H.jsx)(t,{className:`size-4 ${e.color}`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Coming soon`:e.description})]})]},n)})}),M&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 pt-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`field-name`,children:`Field name`}),(0,H.jsx)(Ev,{id:`field-name`,placeholder:`e.g. article_title`,value:l.name,autoFocus:!0,onChange:e=>{u(t=>({...t,name:e.target.value})),f(``)},onKeyDown:e=>{e.key===`Enter`&&j()}}),d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:d}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits and underscores. Must start with a letter.`})]}),s?.type===`media`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Allowed file types`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground -mt-1`,children:`Leave all unchecked to allow any file type.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:lO.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`media-type-${e}`,checked:l.allowedTypes.includes(e),onCheckedChange:t=>u(n=>({...n,allowedTypes:t?[...n.allowedTypes,e]:n.allowedTypes.filter(t=>t!==e)}))}),(0,H.jsx)(Y,{htmlFor:`media-type-${e}`,className:`cursor-pointer font-normal`,children:t})]},e))})]}),s?.type===`array`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(Y,{children:`Sub-fields`}),!p&&(0,H.jsxs)(`button`,{type:`button`,onClick:w,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,H.jsx)(yo,{className:`size-3`}),`Add sub-field`]})]}),l.arrayFields.length===0&&!p&&(0,H.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-xs text-muted-foreground`,children:`No sub-fields yet. Add at least one to make this field useful.`}),l.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-1.5`,children:l.arrayFields.map((e,t)=>{let n=aO.find(t=>t.type===e.type&&(t.subtype??void 0)===(e.subtype??void 0)),r=n?.icon??No;return(0,H.jsxs)(`div`,{className:`${$D[e.width??`full`]} flex items-center gap-1.5 rounded-md border border-dashed border-border p-2`,children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${n?.bg??`bg-muted`}`,children:(0,H.jsx)(r,{className:`size-3 ${n?.color??`text-muted-foreground`}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(Ev,{value:e.name,onChange:e=>O(t,e.target.value),className:`h-6 px-1.5 text-xs`}),(0,H.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:n?.label})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(e.name),className:`flex shrink-0 size-5 items-center justify-center rounded text-muted-foreground hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3`})})]},`${e.name}-${t}`)})}),_&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:_}),p&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:aO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>T(e),className:[`flex items-center gap-1.5 rounded-md border px-2 py-1.5 text-left transition-colors`,p.type===e.type&&(p.subtype??void 0)===(e.subtype??void 0)?`border-primary bg-accent`:`border-border hover:border-primary hover:bg-accent`].join(` `),children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${e.bg}`,children:(0,H.jsx)(t,{className:`size-3 ${e.color}`})}),(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label})]},n)})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(Ev,{placeholder:`sub_field_name`,autoFocus:!0,value:p.name,onChange:e=>{m(t=>t&&{...t,name:e.target.value}),g(``)},onKeyDown:e=>{e.key===`Enter`&&E()}}),h&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:h})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(iO,{id:`subfield-required`,checked:p.required,onCheckedChange:e=>m(t=>t&&{...t,required:!!e})}),(0,H.jsx)(Y,{htmlFor:`subfield-required`,className:`cursor-pointer font-normal text-sm`,children:`Required`})]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>{m(null),g(``)},children:`Cancel`}),(0,H.jsx)(q,{size:`sm`,onClick:E,children:`Add`})]})]})]})]}),s?.type===`uid`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Source field`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The slug will be auto-generated from this field's value.`}),i.length>0?(0,H.jsxs)(ow,{value:l.targetField,onValueChange:e=>u(t=>({...t,targetField:e})),children:[(0,H.jsx)(lw,{children:(0,H.jsx)(cw,{placeholder:`Select a text field`})}),(0,H.jsx)(fw,{children:i.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))})]}):(0,H.jsx)(`p`,{className:`rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground`,children:`No short text fields available. Add a string field first.`})]}),s?.type===`relation`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Relation type`}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:uO.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(t=>({...t,relationType:e.value})),className:`flex items-start gap-3 rounded-md border px-3 py-2 text-left transition-colors hover:border-primary ${l.relationType===e.value?`border-primary bg-accent`:`border-border`}`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium leading-none`,children:e.label}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description})]})},e.value))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Related content type`}),r.length>0?(0,H.jsxs)(ow,{value:l.relatedTable,onValueChange:e=>{let t=r.find(t=>t.tableName===e);u(n=>({...n,relatedTable:e,relatedSlug:t?.slug??``}))},children:[(0,H.jsx)(lw,{children:(0,H.jsx)(cw,{placeholder:`Select a content type`})}),(0,H.jsx)(fw,{children:r.map(e=>(0,H.jsx)(mw,{value:e.tableName,children:e.name},e.tableName))})]}):(0,H.jsx)(Ev,{placeholder:`table_name`,value:l.relatedTable,onChange:e=>u(t=>({...t,relatedTable:e.target.value}))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`field-required`,checked:l.required,onCheckedChange:e=>u(t=>({...t,required:!!e}))}),(0,H.jsx)(Y,{htmlFor:`field-required`,className:`cursor-pointer font-normal`,children:`Required field`})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border pt-3`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>x(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:j,children:b?`Save changes`:`Add field`})]})]})]})})}function hO(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function gO(e){return e.replace(/-/g,`_`)}function _O({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=JD({id:e.name});return(0,H.jsx)(`div`,{ref:s,style:{transform:sT.Transform.toString(c),transition:l,opacity:u?.5:1},className:$D[e.width??`full`],children:(0,H.jsx)(rO,{field:e,dragListeners:o,dragAttributes:a,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i})})}function vO(){let{slug:e}=rr(),t=$n(),n=!e,{user:r}=ia(),i=r?.permissions??[],a=i.includes(`*`)||i.includes(`content-types:delete`),{data:o,loading:s}=fa(n?``:`/cms/admin/content-types/${e}`),{data:c,refetch:l}=fa(`/cms/admin/content-types`),{loading:u,request:d}=Tv(),{loading:f,request:p}=Tv(),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`collection`),[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(!1),k=(0,v.useRef)({name:``,slug:``,fields:`[]`});(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,l),()=>window.removeEventListener(`plank:content-types-changed`,l)),[l]),(0,v.useEffect)(()=>{if(n){h(``),_(``),b(`collection`),S([]),k.current={name:``,slug:``,fields:`[]`};return}o&&(h(o.name),_(o.slug),b(o.kind??`collection`),S(o.fields),k.current={name:o.name,slug:o.slug,fields:JSON.stringify(o.fields)})},[o,n]),(0,v.useEffect)(()=>{n&&m&&_(hO(m))},[n,m]);let A=m!==k.current.name||JSON.stringify(x)!==k.current.fields,j=(0,v.useRef)(!1),M=Cr((0,v.useCallback)(()=>j.current?!1:A,[A])),N=CT(ST(CE,{activationConstraint:{distance:5}}));function P(e){let{active:t,over:n}=e;!n||t.id===n.id||S(e=>kD(e,e.findIndex(e=>e.name===t.id),e.findIndex(e=>e.name===n.id)))}function F(e){S(t=>[...t,e])}function I(e){S(t=>t.map(t=>t.name===T?.name?e:t)),E(null)}function L(e){S(t=>t.filter(t=>t.name!==e))}function R(e,t){S(n=>n.map(n=>n.name===e?{...n,width:t}:n))}function ee(e,t,n){S(r=>r.map(r=>r.name!==e||r.type!==`array`||!r.arrayFields?r:{...r,arrayFields:r.arrayFields.map(e=>e.name===t?{...e,width:n}:e)}))}async function te(){if(!m.trim()||!g.trim())return;let r=n?{name:m.trim(),slug:g,kind:y,tableName:gO(g),fields:x}:{name:m.trim(),slug:g,tableName:gO(g),fields:x};try{let i=await d(n?`/cms/admin/content-types`:`/cms/admin/content-types/${e}`,n?`POST`:`PUT`,r);h(i.name),_(i.slug),S(i.fields),k.current={name:i.name,slug:i.slug,fields:JSON.stringify(i.fields)},window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),(n||i.slug!==e)&&(j.current=!0,t(`/content-types/${i.slug}`,{replace:!0}))}catch{}}async function ne(){if(a)try{await p(`/cms/admin/content-types/${e}`,`DELETE`),window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),t(`/content-types`,{replace:!0})}catch{}}let z=(c??[]).filter(t=>t.slug!==e).map(e=>({tableName:e.tableName,slug:e.slug,name:e.name})),B=x.filter(e=>e.type===`string`),re=x.map(e=>e.name);return ZD(`mod+s`,te,{enabled:A&&!u&&!!m.trim(),label:`Save content type`}),ZD(`mod+k`,()=>w(!0),{label:`Add field`}),!n&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Content type name`,className:`bg-transparent text-2xl font-bold outline-none placeholder:text-muted-foreground/40 -mt-2`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`API ID:`}),(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g||`—`})]}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>b(`collection`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`collection`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(mo,{className:`size-3`}),`Collection`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>b(`single`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`single`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(Ka,{className:`size-3`}),`Single`]})]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-muted-foreground ${y===`single`?`border-violet-500/30 bg-violet-500/10 text-violet-600 dark:text-violet-400`:``}`,children:[y===`single`?(0,H.jsx)(Ka,{className:`size-3`}):(0,H.jsx)(mo,{className:`size-3`}),y===`single`?`Single`:`Collection`]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!n&&a&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>O(!0),disabled:f,children:(0,H.jsx)(Mo,{className:`size-4`})}),(0,H.jsxs)(q,{onClick:te,disabled:!A||u||!m.trim(),children:[u?(0,H.jsx)(iy,{className:`size-4`}):null,`Save`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[x.length>0?(()=>{let e=x.filter(e=>e.relationType!==`one-to-many`),t=x.filter(e=>e.relationType===`one-to-many`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.length>0&&(0,H.jsx)(bD,{sensors:N,collisionDetection:AT,onDragEnd:P,children:(0,H.jsx)(BD,{items:e.map(e=>e.name),strategy:ID,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:e.map(e=>(0,H.jsx)(_O,{field:e,onWidthChange:t=>R(e.name,t),onArraySubFieldWidthChange:(t,n)=>ee(e.name,t,n),onEdit:()=>E(e),onDelete:()=>L(e.name)},e.name))})})}),t.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:t.map(e=>(0,H.jsx)(`div`,{className:`col-span-6`,children:(0,H.jsx)(rO,{field:e})},e.name))})]})})():(0,H.jsx)(Ow,{className:`border`,children:(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No fields yet`}),(0,H.jsx)(Nw,{children:`Add your first field to define this content type's structure.`})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(q,{variant:`outline`,onClick:()=>w(!0),className:`gap-2`,children:[(0,H.jsx)(yo,{className:`size-4`}),`Add field`]})}),(0,H.jsx)(mO,{open:C,onOpenChange:w,existingNames:re,availableContentTypes:z,stringFields:B,onConfirm:F}),(0,H.jsx)(mO,{open:!!T,onOpenChange:e=>{e||E(null)},existingNames:re,availableContentTypes:z,stringFields:B,initialField:T??void 0,onConfirm:I}),(0,H.jsx)(ZC,{open:D,onOpenChange:O,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete "`,m,`"?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will permanently delete the content type and all its entries. This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>O(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:ne,disabled:f,children:[f?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:M.state===`blocked`,onOpenChange:()=>M.reset?.(),children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You have unsaved changes. Leave without saving?`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>M.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>M.proceed?.(),children:`Leave`})]})]})})]})]})}function yO(){let{pathname:e}=Xn(),{data:t,loading:n,error:r,refetch:i}=fa(`/cms/admin/content-types`),{request:a}=Tv();async function o(e,t){e.preventDefault(),e.stopPropagation(),await a(`/cms/admin/content-types/${t}/default`,`PUT`),i()}function s(t){return e===`/content/${t}`||e.startsWith(`/content/${t}/`)}let c=(t??[]).filter(e=>e.kind===`collection`),l=(t??[]).filter(e=>e.kind===`single`);return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Content`})}),n&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}),r&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:r}),!n&&!r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Collection Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:c.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No collection types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:c.map(e=>(0,H.jsxs)(Fi,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,s(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,H.jsx)(`button`,{type:`button`,title:e.isDefault?`Default content type`:`Set as default`,onClick:t=>o(t,e.slug),className:[`shrink-0 rounded transition-colors`,e.isDefault?`text-amber-400`:`text-transparent group-hover:text-muted-foreground/40 hover:!text-amber-400`].join(` `),children:(0,H.jsx)(Do,{className:`size-3.5 ${e.isDefault?`fill-amber-400`:``}`})})]},e.slug))})})]}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-sidebar-border`}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Single Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:l.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No single types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:l.map(e=>(0,H.jsx)(Fi,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,s(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})},e.slug))})})]})]})]})}function bO(){return Tw((0,H.jsx)(yO,{})),(0,H.jsx)(Br,{})}function xO(){let e=$n(),{data:t,loading:n}=fa(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{!t||t.length===0||e(`/content/${(t.find(e=>e.isDefault)??t[0]).slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No content types yet`}),(0,H.jsx)(Nw,{children:`Create a content type in the Builder before managing content.`})]}),(0,H.jsx)(Pw,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Go to Builder`})})]})}var SO=ls(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`[&>[data-slot=field-label]]:flex-auto`,`has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto`,`@md/field-group:[&>[data-slot=field-label]]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}});function CO({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(SO({orientation:t}),e),...n})}function wO({className:e,...t}){return(0,H.jsx)(Y,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4`,`has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10`,e),...t})}function TO({className:e,...t}){return(0,H.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,"data-slot":`pagination`,className:K(`mx-auto flex w-full justify-center`,e),...t})}function EO({className:e,...t}){return(0,H.jsx)(`ul`,{"data-slot":`pagination-content`,className:K(`flex flex-row items-center gap-1`,e),...t})}function DO({...e}){return(0,H.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function OO({className:e,isActive:t,size:n=`icon`,...r}){return(0,H.jsx)(`a`,{"aria-current":t?`page`:void 0,"data-slot":`pagination-link`,"data-active":t,className:K(Pc({variant:t?`outline`:`ghost`,size:n}),e),...r})}function kO({className:e,...t}){return(0,H.jsxs)(OO,{"aria-label":`Go to previous page`,size:`default`,className:K(`gap-1 px-2.5 sm:pl-2.5`,e),...t,children:[(0,H.jsx)(ka,{}),(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Previous`})]})}function AO({className:e,...t}){return(0,H.jsxs)(OO,{"aria-label":`Go to next page`,size:`default`,className:K(`gap-1 px-2.5 sm:pr-2.5`,e),...t,children:[(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Next`}),(0,H.jsx)(Aa,{})]})}function jO({page:e,totalPages:t,limit:n,onPageChange:r,onLimitChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsxs)(CO,{orientation:`horizontal`,className:`w-fit`,children:[(0,H.jsx)(wO,{htmlFor:`select-rows-per-page`,children:`Rows per page`}),(0,H.jsxs)(ow,{value:String(n),onValueChange:e=>i(Number(e)),children:[(0,H.jsx)(lw,{className:`w-20`,id:`select-rows-per-page`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{align:`start`,children:(0,H.jsxs)(sw,{children:[(0,H.jsx)(mw,{value:`10`,children:`10`}),(0,H.jsx)(mw,{value:`30`,children:`30`}),(0,H.jsx)(mw,{value:`50`,children:`50`}),(0,H.jsx)(mw,{value:`70`,children:`70`}),(0,H.jsx)(mw,{value:`100`,children:`100`})]})})]})]}),(0,H.jsx)(TO,{className:`mx-0 w-auto`,children:(0,H.jsxs)(EO,{children:[(0,H.jsx)(DO,{children:(0,H.jsx)(kO,{href:`#`,onClick:t=>{t.preventDefault(),e>1&&r(e-1)},"aria-disabled":e===1,className:e===1?`pointer-events-none opacity-50`:``})}),(0,H.jsx)(DO,{children:(0,H.jsx)(AO,{href:`#`,onClick:n=>{n.preventDefault(),e<t&&r(e+1)},"aria-disabled":e===t,className:e===t?`pointer-events-none opacity-50`:``})})]})})]})}var MO=4,NO={field:`created_at`,dir:`desc`},PO=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`published_at`,label:`Published`}];function FO(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function IO(e){return e.find(e=>e.name===`title`)?.name??e.find(e=>e.name===`name`)?.name??e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}function LO(e){if(Array.isArray(e))return e.map(e=>String(e??``).trim()).filter(Boolean);let t=String(e??``).trim();return t?[t]:[]}function RO({relatedSlug:e,value:t,displayField:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),s=LO(t);return(0,v.useEffect)(()=>{let r=LO(t);if(!e||r.length===0){i([]);return}let a=!1;o(!0);let s=localStorage.getItem(`plank_token`),c=s?{Authorization:`Bearer ${s}`}:{};return(n?Promise.resolve(n):fetch(`/cms/admin/content-types/${e}`,{headers:c}).then(e=>e.ok?e.json():null).then(e=>IO(e?.fields??[])).catch(()=>null)).then(t=>Promise.all(r.map(n=>fetch(`/cms/admin/entries/${e}/${n}`,{headers:c}).then(e=>e.ok?e.json():null).then(e=>e?String((t&&e[t])??e.title??e.name??n):n).catch(()=>n)))).then(e=>{a||i(e.filter(Boolean))}).catch(()=>{a||i(r)}).finally(()=>{a||o(!1)}),()=>{a=!0}},[e,n,t]),s.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a&&r.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`…`}):(0,H.jsx)(`span`,{className:`font-medium truncate max-w-50 block`,children:r.join(`, `)})}function zO(e){return{visibleFields:e.slice(0,MO).map(e=>e.name),sort:NO}}function BO(e,t){if(!e)return zO(t);let n=(e.visibleFields??[]).filter(e=>{let n=String(e).split(`.`)[0];return t.some(e=>e.name===n)});return{visibleFields:n.length>0?n:t.slice(0,MO).map(e=>e.name),sort:e.sort??NO}}async function VO(e){let t=localStorage.getItem(`plank_token`),n=await fetch(`/cms/admin/users/me/prefs/view_${e}`,{headers:t?{Authorization:`Bearer ${t}`}:{}});if(!n.ok)return null;let{value:r}=await n.json();return r}async function HO(e,t){let n=localStorage.getItem(`plank_token`);await fetch(`/cms/admin/users/me/prefs/view_${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`,...n?{Authorization:`Bearer ${n}`}:{}},body:JSON.stringify({value:t})})}function UO({value:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e.startsWith(`http`)){n(e);return}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(e=>n(e?.url??null)).catch(()=>{})},[e]),t?/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(t)?(0,H.jsx)(`img`,{src:t,alt:``,className:`size-8 object-cover`}):(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,H.jsx)(Ka,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate max-w-30`,children:`File`})]}):(0,H.jsx)(ro,{className:`size-4 text-muted-foreground`})}function WO({field:e,value:t,displayField:n}){let{timezone:r}=sa();if(t==null||t===``)return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`boolean`)return t?(0,H.jsx)(Da,{className:`size-4 text-primary`}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`datetime`)return(0,H.jsx)(`span`,{children:cy(String(t),r)});if(e.type===`number`)return(0,H.jsx)(`span`,{children:String(t)});if(e.type===`media`)return(0,H.jsx)(UO,{value:String(t)});if(e.type===`relation`)return(0,H.jsx)(RO,{relatedSlug:e.relatedSlug,value:t,displayField:n});if(e.type===`text`||e.type===`richtext`){let e=String(t);return(0,H.jsx)(`span`,{className:`text-muted-foreground truncate max-w-50 block`,children:e.length>60?e.slice(0,60)+`…`:e})}let i=String(t);return(0,H.jsx)(`span`,{className:e.type===`uid`?`font-mono text-xs text-muted-foreground truncate max-w-40 block`:`font-medium truncate max-w-50 block`,children:i.length>60?i.slice(0,60)+`…`:i})}function GO({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(ul,{avatarUrl:e._author_avatar_url,firstName:t,lastName:n,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(yv,{children:[(0,H.jsx)(bv,{asChild:!0,children:i}),(0,H.jsx)(xv,{children:r})]}):i}function KO({entry:e,fields:t}){let{timezone:n}=sa();if(e.status===`scheduled`)return(0,H.jsxs)(XC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(wa,{className:`size-3 mr-1`}),e.scheduled_for?sy(e.scheduled_for,n):`Scheduled`]});if(e.status===`draft`)return(0,H.jsx)(XC,{variant:`outline`,children:`Draft`});let r=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=new Date(e);return isNaN(t.getTime())?e:t.toISOString()}return e};return(0,H.jsx)(XC,{variant:e.published_data!=null&&t.some(t=>JSON.stringify(r(e[t.name],t.type))!==JSON.stringify(r(e.published_data[t.name],t.type)))?`secondary`:`default`,children:`Published`})}function qO({open:e,onOpenChange:t,allFields:n,config:r,onApply:i}){let[a,o]=(0,v.useState)(r.visibleFields),[s,c]=(0,v.useState)(r.sort);(0,v.useEffect)(()=>{e&&(o(r.visibleFields),c(r.sort))},[e,r]);let l=n.filter(e=>!a.some(t=>t.split(`.`)[0]===e.name));function u({fieldName:e}){let t=e.split(`.`)[0],r=n.find(e=>e.name===t)?.relatedSlug,{data:i}=fa(r?`/cms/admin/content-types/${r}`:null),s=a.find(e=>e.split(`.`)[0]===t),c=s&&s.includes(`.`)?s.split(`.`)[1]:void 0;function l(e,t){o(n=>n.map(n=>n.split(`.`)[0]===e?t?`${e}.${t}`:e:n))}return(0,v.useEffect)(()=>{if(!i?.fields||c)return;let e=[`title`,`name`],n=i.fields.find(t=>e.includes(t.name))||i.fields[0];n&&l(t,n.name)},[i,c,t]),i?.fields?(0,H.jsxs)(ow,{value:c,onValueChange:e=>l(t,e),children:[(0,H.jsx)(lw,{className:`h-8 text-sm w-32`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{children:i.fields.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))})]}):null}function d(e,t){o(n=>{let r=n.indexOf(e);if(r===-1)return n;let i=[...n],a=r+t;return a<0||a>=i.length?n:([i[r],i[a]]=[i[a],i[r]],i)})}function f(e){o(t=>[...t,e])}function p(e){o(t=>t.filter(t=>t!==e))}let m=[...PO,...n.filter(e=>![`media`,`text`,`richtext`,`relation`].includes(e.type)).map(e=>({name:e.name,label:FO(e.name)}))];return(0,H.jsx)(ZC,{open:e,onOpenChange:t,children:(0,H.jsxs)(tw,{className:`max-w-md h-[80vh] flex flex-col`,children:[(0,H.jsx)(nw,{className:`flex-none`,children:(0,H.jsx)(iw,{children:`Configure the view`})}),(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 gap-5 py-1`,children:[(0,H.jsxs)(`div`,{className:`flex-none`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Displayed fields`}),a.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-2`,children:`No fields selected.`}):(0,H.jsx)(`ul`,{className:`space-y-1`,children:a.map((e,t)=>{let r=String(e).split(`.`)[0],i=n.find(e=>e.name===r);return(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`flex-1 font-medium`,children:FO(r)}),i&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.type}),i&&i.type===`relation`&&(0,H.jsx)(`div`,{className:`ml-2`,children:(0,H.jsx)(u,{fieldName:e})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===0,onClick:()=>d(e,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===a.length-1,onClick:()=>d(e,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>p(e),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Na,{className:`size-3.5`})})]},e)})})]}),l.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide flex-none`,children:`Available fields`}),(0,H.jsx)(`ul`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0`,children:l.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`flex-1`,children:FO(e.name)}),(0,H.jsx)(`span`,{className:`text-xs`,children:e.type}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(e.name),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Pa,{className:`size-3.5`})})]},e.name))})]}),(0,H.jsxs)(`div`,{className:`flex-none`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Sort entries`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(ow,{value:s.field,onValueChange:e=>c(t=>({...t,field:e})),children:[(0,H.jsx)(lw,{className:`h-8 text-sm`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{children:m.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.label},e.name))})]}),(0,H.jsxs)(ow,{value:s.dir,onValueChange:e=>c(t=>({...t,dir:e})),children:[(0,H.jsx)(lw,{className:`h-8 text-sm`,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`asc`,children:`Ascending`}),(0,H.jsx)(mw,{value:`desc`,children:`Descending`})]})]})]})]})]}),(0,H.jsxs)(rw,{className:`flex-none`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:()=>{i({visibleFields:a,sort:s}),t(!1)},children:`Apply`})]})]})})}function JO(){let{slug:e}=rr(),t=$n(),{timezone:n}=sa(),{user:r}=ia(),[i,a]=Hi(),o=Math.max(1,Number(i.get(`page`)??1)),s=[10,30,50,70,100].includes(Number(i.get(`limit`)))?Number(i.get(`limit`)):10;function c(e){a(t=>(t.set(`page`,String(e)),t),{replace:!0})}function l(e){a(t=>(t.set(`limit`,String(e)),t.set(`page`,`1`),t),{replace:!0})}let[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),{loading:C,request:w}=Tv(),{data:T,loading:E}=fa(e?`/cms/admin/content-types/${e}`:null);(0,v.useEffect)(()=>{!T||!e||VO(e).then(e=>h(BO(e,T.fields))).catch(()=>h(zO(T.fields)))},[T?.slug]),(0,v.useEffect)(()=>{_(new Set)},[o,s]);let D=m??{visibleFields:T?.fields.slice(0,MO).map(e=>e.name)??[],sort:NO},{sort:O}=D,k=(D.visibleFields??[]).map(e=>{let t=String(e).split(`.`),n=t[0],r=t[1],i=T?.fields.find(e=>e.name===n);return i?{field:i,displayField:r}:null}).filter(Boolean),{data:A,loading:j,refetch:M}=fa(e&&m?`/cms/admin/content-types/${e}/entries?page=${o}&limit=${s}&sort=${O.field}&order=${O.dir}`:null);async function N(){!u||!e||(await w(`/cms/admin/entries/${e}/${u}`,`DELETE`),d(null),M())}let P=r?.permissions??[],F=P.includes(`*`)||P.includes(`entries:write`),I=P.includes(`*`)||P.includes(`entries:delete`),L=(A?.data??[]).map(e=>e.id),R=L.length>0&&L.every(e=>g.has(e)),ee=!R&&L.some(e=>g.has(e));function te(){_(e=>{let t=new Set(e);return R?L.forEach(e=>t.delete(e)):L.forEach(e=>t.add(e)),t})}function ne(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function z(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all([...g].map(t=>fetch(`/cms/admin/entries/${e}/${t}/status`,{method:`PATCH`,headers:n,body:JSON.stringify({status:`draft`})}))),_(new Set),M()}finally{b(!1)}}}async function B(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all([...g].map(t=>fetch(`/cms/admin/entries/${e}/${t}`,{method:`DELETE`,headers:n}))),S(!1),_(new Set),M()}finally{b(!1)}}}function re(t){h(t),e&&HO(e,t).catch(()=>{}),c(1)}if(E||!m)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!T)return null;k.map(e=>e.field);let V=Math.ceil((A?.total??0)/(A?.limit??20));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-6`,children:T.name}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>p(!0),className:`gap-1.5`,children:[(0,H.jsx)(wo,{className:`size-3.5`}),`Configure the view`]}),F&&(0,H.jsxs)(q,{onClick:()=>t(`/content/${e}/new`),className:`gap-2`,children:[(0,H.jsx)(yo,{className:`size-4`}),`New entry`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[j&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading entries…`})]}),!j&&(A?.data??[]).length===0&&(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(Ga,{})}),(0,H.jsx)(Mw,{children:`No entries yet`}),(0,H.jsxs)(Nw,{children:[`Create your first entry for `,T.name,`.`]})]}),(0,H.jsx)(Pw,{children:F&&(0,H.jsx)(q,{onClick:()=>t(`/content/${e}/new`),children:`New entry`})})]}),!j&&(A?.data??[]).length>0&&(0,H.jsxs)(vv,{children:[g.size>0&&(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-4 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[g.size,` selected`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,H.jsxs)(q,{variant:`outline`,size:`sm`,disabled:y,onClick:z,children:[y?(0,H.jsx)(iy,{className:`size-3.5`}):null,`Unpublish`]}),I&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:y,onClick:()=>S(!0),children:[(0,H.jsx)(Mo,{className:`size-3.5`}),`Delete`]})]})]}),(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,H.jsxs)(gw,{className:`w-full`,children:[(0,H.jsx)(_w,{className:`border-b border-border font-bold uppercase`,children:(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`w-10 px-4 py-3`,children:(0,H.jsx)(iO,{checked:R?!0:ee?`indeterminate`:!1,onCheckedChange:te,"aria-label":`Select all`})}),k.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:FO(e.field.name)},e.field.name)),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Created`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Updated`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Pub / Sch`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Status`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,H.jsx)(bw,{className:`px-4 py-3`})]})}),(0,H.jsx)(vw,{className:`divide-y divide-border`,children:(A?.data??[]).map(r=>(0,H.jsxs)(yw,{className:`group transition-colors ${g.has(r.id)?`bg-muted/40`:`hover:bg-muted/30`}`,children:[(0,H.jsx)(xw,{className:`w-10 px-4 py-3`,children:(0,H.jsx)(iO,{checked:g.has(r.id),onCheckedChange:()=>ne(r.id),"aria-label":`Select row`})}),k.map(e=>{let t=r[e.field.name],n=t;return e.field.type===`relation`?n=t:e.displayField&&(n=t&&typeof t==`object`?t[e.displayField]:t?.title??t),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(WO,{field:e.field,value:n,displayField:e.displayField})},e.field.name)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sy(r.created_at,n)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sy(r.updated_at,n)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:r.status===`scheduled`&&r.scheduled_for?sy(r.scheduled_for,n):r.published_at?sy(r.published_at,n):`—`}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(KO,{entry:r,fields:T.fields})}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(GO,{entry:r})}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>t(`/content/${e}/${r.id}`),className:`flex size-8 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(vo,{className:`size-3.5`})}),I&&(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>d(r.id),className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})})]},r.id))})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(jO,{page:o,totalPages:V,limit:s,onPageChange:c,onLimitChange:l})})]}),m&&(0,H.jsx)(qO,{open:f,onOpenChange:p,allFields:T.fields,config:m,onApply:re}),(0,H.jsx)(ZC,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>d(null),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:N,disabled:C,children:[C?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:x,onOpenChange:e=>{e||S(!1)},children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete `,g.size,` `,g.size===1?`entry`:`entries`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>S(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:B,disabled:y,children:[y?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function YO(){let{slug:e}=rr(),t=$n(),{user:n}=ia(),{data:r,loading:i}=fa(e?`/cms/admin/content-types/${e}`:null),a=r?.kind===`single`,{data:o,loading:s,error:c}=fa(a&&e?`/cms/admin/content-types/${e}/single`:null);return(0,v.useEffect)(()=>{if(!a||s)return;let r=n?.role?.toLowerCase()===`user`;o?t(`/content/${e}/${o.id}`,{replace:!0}):c&&!r&&t(`/content/${e}/new`,{replace:!0})},[a,s,o,c,e,t,n?.role]),i||a&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):a?o?null:(0,H.jsx)(`div`,{className:`py-12 text-sm text-muted-foreground`,children:`No entry is available for this Single Type.`}):(0,H.jsx)(JO,{})}var XO=365.2425,ZO=6048e5,QO=864e5,$O=3600*24;$O*7,$O*XO/12*3;var ek=Symbol.for(`constructDateFrom`);function tk(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ek in e?e[ek](t):e instanceof Date?new e.constructor(t):new Date(t)}function nk(e,t){return tk(t||e,e)}function rk(e,t,n){let r=nk(e,n?.in);return isNaN(t)?tk(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function ik(e,t,n){let r=nk(e,n?.in);if(isNaN(t))return tk(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=tk(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var ak={};function ok(){return ak}function sk(e,t){let n=ok(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=nk(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function ck(e,t){return sk(e,{...t,weekStartsOn:1})}function lk(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=tk(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=ck(i),o=tk(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=ck(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function uk(e){let t=nk(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function dk(e,...t){let n=tk.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function fk(e,t){let n=nk(e,t?.in);return n.setHours(0,0,0,0),n}function pk(e,t,n){let[r,i]=dk(n?.in,e,t),a=fk(r),o=fk(i),s=+a-uk(a),c=+o-uk(o);return Math.round((s-c)/QO)}function mk(e,t){let n=lk(e,t),r=tk(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),ck(r)}function hk(e,t,n){return rk(e,t*7,n)}function gk(e,t,n){return ik(e,t*12,n)}function _k(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=tk.bind(null,e));let t=nk(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),tk(r,n||NaN)}function vk(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=tk.bind(null,e));let t=nk(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),tk(r,n||NaN)}function yk(e,t,n){let[r,i]=dk(n?.in,e,t);return+fk(r)==+fk(i)}function bk(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function xk(e){return!(!bk(e)&&typeof e!=`number`||isNaN(+nk(e)))}function Sk(e,t,n){let[r,i]=dk(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ck(e,t){let n=nk(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function wk(e,t){let[n,r]=dk(e,t.start,t.end);return{start:n,end:r}}function Tk(e,t){let{start:n,end:r}=wk(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(tk(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Ek(e,t){let n=nk(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Dk(e,t){let n=nk(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Ok(e,t){let n=nk(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function kk(e,t){let{start:n,end:r}=wk(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(tk(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Ak(e,t){let n=ok(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=nk(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function jk(e,t){return Ak(e,{...t,weekStartsOn:1})}var Mk={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Nk=(e,t,n)=>{let r,i=Mk[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Pk(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Fk={date:Pk({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Pk({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Pk({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Ik={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Lk=(e,t,n,r)=>Ik[e];function Rk(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var zk={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Rk({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Rk({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Rk({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Rk({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Rk({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Bk(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Hk(s,e=>e.test(o)):Vk(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Vk(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Hk(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Uk(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Wk={code:`en-US`,formatDistance:Nk,formatLong:Fk,formatRelative:Lk,localize:zk,match:{ordinalNumber:Uk({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Bk({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Bk({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Bk({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Bk({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Bk({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gk(e,t){let n=nk(e,t?.in);return pk(n,Ok(n))+1}function Kk(e,t){let n=nk(e,t?.in),r=ck(n)-+mk(n);return Math.round(r/ZO)+1}function qk(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=ok(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=tk(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=sk(o,t),c=tk(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=sk(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Jk(e,t){let n=ok(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=qk(e,t),a=tk(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),sk(a,t)}function Yk(e,t){let n=nk(e,t?.in),r=sk(n,t)-+Jk(n,t);return Math.round(r/ZO)+1}function Xk(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var Zk={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Xk(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Xk(n+1,2)},d(e,t){return Xk(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Xk(e.getHours()%12||12,t.length)},H(e,t){return Xk(e.getHours(),t.length)},m(e,t){return Xk(e.getMinutes(),t.length)},s(e,t){return Xk(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Xk(Math.trunc(r*10**(n-3)),t.length)}},Qk={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},$k={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return Zk.y(e,t)},Y:function(e,t,n,r){let i=qk(e,r),a=i>0?i:1-i;return t===`YY`?Xk(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Xk(a,t.length)},R:function(e,t){return Xk(lk(e),t.length)},u:function(e,t){return Xk(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Xk(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Xk(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return Zk.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Xk(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Yk(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Xk(i,t.length)},I:function(e,t,n){let r=Kk(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Xk(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):Zk.d(e,t)},D:function(e,t,n){let r=Gk(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Xk(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Xk(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Xk(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Xk(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Qk.noon:r===0?Qk.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Qk.evening:r>=12?Qk.afternoon:r>=4?Qk.morning:Qk.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return Zk.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):Zk.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Xk(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Xk(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):Zk.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):Zk.s(e,t)},S:function(e,t){return Zk.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return tA(r);case`XXXX`:case`XX`:return nA(r);default:return nA(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return tA(r);case`xxxx`:case`xx`:return nA(r);default:return nA(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+eA(r,`:`);default:return`GMT`+nA(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+eA(r,`:`);default:return`GMT`+nA(r,`:`)}},t:function(e,t,n){return Xk(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Xk(+e,t.length)}};function eA(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Xk(a,2)}function tA(e,t){return e%60==0?(e>0?`-`:`+`)+Xk(Math.abs(e)/60,2):nA(e,t)}function nA(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Xk(Math.trunc(r/60),2),a=Xk(r%60,2);return n+i+t+a}var rA=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},iA=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},aA={p:iA,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return rA(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,rA(r,t)).replace(`{{time}}`,iA(i,t))}},oA=/^D+$/,sA=/^Y+$/,cA=[`D`,`DD`,`YY`,`YYYY`];function lA(e){return oA.test(e)}function uA(e){return sA.test(e)}function dA(e,t,n){let r=fA(e,t,n);if(console.warn(r),cA.includes(e))throw RangeError(r)}function fA(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var pA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,mA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,hA=/^'([^]*?)'?$/,gA=/''/g,_A=/[a-zA-Z]/;function vA(e,t,n){let r=ok(),i=n?.locale??r.locale??Wk,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=nk(e,n?.in);if(!xk(s))throw RangeError(`Invalid time value`);let c=t.match(mA).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=aA[t];return n(e,i.formatLong)}return e}).join(``).match(pA).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:yA(e)};if($k[t])return{isToken:!0,value:e};if(t.match(_A))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&uA(a)||!n?.useAdditionalDayOfYearTokens&&lA(a))&&dA(a,t,String(e));let o=$k[a[0]];return o(s,a,i.localize,l)}).join(``)}function yA(e){let t=e.match(hA);return t?t[1].replace(gA,`'`):e}function bA(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=tk(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function xA(e,t){return nk(e,t?.in).getMonth()}function SA(e,t){return nk(e,t?.in).getFullYear()}function CA(e,t){return+nk(e)>+nk(t)}function wA(e,t){return+nk(e)<+nk(t)}function TA(e,t,n){let[r,i]=dk(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function EA(e,t,n){let[r,i]=dk(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function DA(e,t,n){let r=nk(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=tk(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=bA(o);return r.setMonth(t,Math.min(a,s)),r}function OA(e,t,n){let r=nk(e,n?.in);return isNaN(+r)?tk(n?.in||e,NaN):(r.setFullYear(t),r)}function kA({className:e,...t}){return(0,H.jsx)(GC,{"data-slot":`tabs`,className:K(`flex flex-col gap-2`,e),...t})}function AA({className:e,...t}){return(0,H.jsx)(KC,{"data-slot":`tabs-list`,className:K(`inline-flex h-9 items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground w-full`,e),...t})}function jA({className:e,...t}){return(0,H.jsx)(qC,{"data-slot":`tabs-trigger`,className:K(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow`,e),...t})}function MA({className:e,...t}){return(0,H.jsx)(JC,{"data-slot":`tabs-content`,className:K(`flex-1 outline-none`,e),...t})}function NA({className:e,...t}){return(0,H.jsx)(OC,{"data-slot":`switch`,className:K(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,children:(0,H.jsx)(kC,{className:K(`pointer-events-none block size-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})})}function PA(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var FA={},IA={};function LA(e,t){try{let n=(FA[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in IA?IA[n]:zA(n,n.split(`:`))}catch{if(e in IA)return IA[e];let t=e?.match(RA);return t?zA(e,t.slice(1)):NaN}}var RA=/([+-]\d\d):?(\d\d)?/;function zA(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return IA[e]=n*60+r>0?n*60+r+i:n*60-r-i}var BA=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(LA(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),WA(this,NaN),HA(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-LA(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),HA(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},VA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!VA.test(e))return;let t=e.replace(VA,`$1UTC`);BA.prototype[t]&&(e.startsWith(`get`)?BA.prototype[e]=function(){return this.internal[t]()}:(BA.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),UA(this),+this},BA.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),HA(this),+this}))});function HA(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-LA(e.timeZone,e)*60))}function UA(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),WA(e)}function WA(e){let t=LA(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(LA(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=LA(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=LA(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var GA=class e extends BA{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${PA(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},KA=5,qA=4;function JA(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,KA*7-1);return t.getMonth(e)===t.getMonth(a)?KA:qA}function YA(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function XA(e,t){let n=YA(e,t),r=JA(e,t);return t.addDays(n,r*7-1)}var ZA={...Wk,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>vA(e,t,{locale:Wk,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>vA(e,n,{locale:Wk,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>vA(e,t,{locale:Wk,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>vA(e,n,{locale:Wk,...t}),r(e,`cccc`)}}},QA=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?GA.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new GA(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):rk(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):ik(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):hk(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):gk(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):pk(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Sk(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Tk(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):kk(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):XA(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):jk(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Ck(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Ak(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Dk(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):vA(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):Kk(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):xA(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):SA(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):Yk(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):CA(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):wA(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):bk(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):yk(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):TA(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):EA(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):_k(e),this.min=e=>this.overrides?.min?this.overrides.min(e):vk(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):DA(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):OA(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):YA(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):fk(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):ck(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Ek(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):sk(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Ok(e),this.options={locale:ZA,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};QA.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var $A=new QA,ej=class{constructor(e,t,n=$A){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},tj=class{constructor(e,t){this.date=e,this.weeks=t}},nj=class{constructor(e,t){this.days=t,this.weekNumber=e}};function rj(e){return v.createElement(`button`,{...e})}function ij(e){return v.createElement(`span`,{...e})}function aj(e){let{size:t=24,orientation:n=`left`,className:r}=e;return v.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&v.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&v.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&v.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&v.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function oj(e){let{day:t,modifiers:n,...r}=e;return v.createElement(`td`,{...r})}function sj(e){let{day:t,modifiers:n,...r}=e,i=v.useRef(null);return v.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),v.createElement(`button`,{ref:i,...r})}var cj;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(cj||={});var lj;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(lj||={});var uj;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(uj||={});var dj;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(dj||={});function fj(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[cj.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return v.createElement(`span`,{"data-disabled":a.disabled,className:i[cj.DropdownRoot]},v.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>v.createElement(r.Option,{key:e,value:e,disabled:n},t))),v.createElement(`span`,{className:i[cj.CaptionLabel],"aria-hidden":!0},s?.label,v.createElement(r.Chevron,{orientation:`down`,size:18,className:i[cj.Chevron]})))}function pj(e){return v.createElement(`div`,{...e})}function mj(e){return v.createElement(`div`,{...e})}function hj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r},e.children)}function gj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r})}function _j(e){return v.createElement(`table`,{...e})}function vj(e){return v.createElement(`div`,{...e})}var yj=(0,v.createContext)(void 0);function bj(){let e=(0,v.useContext)(yj);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function xj(e){let{components:t}=bj();return v.createElement(t.Dropdown,{...e})}function Sj(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=bj(),u=(0,v.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,v.useCallback)(e=>{r&&t?.(e)},[r,t]);return v.createElement(`nav`,{...a},v.createElement(o.PreviousMonthButton,{type:`button`,className:s[cj.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},v.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[cj.Chevron],orientation:`left`})),v.createElement(o.NextMonthButton,{type:`button`,className:s[cj.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},v.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[cj.Chevron]})))}function Cj(e){let{components:t}=bj();return v.createElement(t.Button,{...e})}function wj(e){return v.createElement(`option`,{...e})}function Tj(e){let{components:t}=bj();return v.createElement(t.Button,{...e})}function Ej(e){let{rootRef:t,...n}=e;return v.createElement(`div`,{...n,ref:t})}function Dj(e){return v.createElement(`select`,{...e})}function Oj(e){let{week:t,...n}=e;return v.createElement(`tr`,{...n})}function kj(e){return v.createElement(`th`,{...e})}function Aj(e){return v.createElement(`thead`,{"aria-hidden":!0},v.createElement(`tr`,{...e}))}function jj(e){let{week:t,...n}=e;return v.createElement(`th`,{...n})}function Mj(e){return v.createElement(`th`,{...e})}function Nj(e){return v.createElement(`tbody`,{...e})}function Pj(e){let{components:t}=bj();return v.createElement(t.Dropdown,{...e})}var Fj=s({Button:()=>rj,CaptionLabel:()=>ij,Chevron:()=>aj,Day:()=>oj,DayButton:()=>sj,Dropdown:()=>fj,DropdownNav:()=>pj,Footer:()=>mj,Month:()=>hj,MonthCaption:()=>gj,MonthGrid:()=>_j,Months:()=>vj,MonthsDropdown:()=>xj,Nav:()=>Sj,NextMonthButton:()=>Cj,Option:()=>wj,PreviousMonthButton:()=>Tj,Root:()=>Ej,Select:()=>Dj,Week:()=>Oj,WeekNumber:()=>jj,WeekNumberHeader:()=>Mj,Weekday:()=>kj,Weekdays:()=>Aj,Weeks:()=>Nj,YearsDropdown:()=>Pj});function Ij(e,t,n=!1,r=$A){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function Lj(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Rj(e){return!!(e&&typeof e==`object`&&`from`in e)}function zj(e){return!!(e&&typeof e==`object`&&`after`in e)}function Bj(e){return!!(e&&typeof e==`object`&&`before`in e)}function Vj(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Hj(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Uj(e,t,n=$A){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(Hj(t,n))return t.some(t=>i(e,t));if(Rj(t))return Ij(t,e,!1,n);if(Vj(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Lj(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return zj(t)?a(e,t.after)>0:Bj(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function Wj(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[lj.focused]:[],[lj.outside]:[],[lj.disabled]:[],[lj.hidden]:[],[lj.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Uj(e,a,i)),S=!!(o&&Uj(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Uj(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[lj.focused]:!1,[lj.disabled]:!1,[lj.hidden]:!1,[lj.outside]:!1,[lj.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Gj(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[lj[r]]?e.push(t[lj[r]]):t[uj[r]]&&e.push(t[uj[r]]),e),[t[cj.Day]])}function Kj(e){return{...Fj,...e}}function qj(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function Jj(){let e={};for(let t in cj)e[cj[t]]=`rdp-${cj[t]}`;for(let t in lj)e[lj[t]]=`rdp-${lj[t]}`;for(let t in uj)e[uj[t]]=`rdp-${uj[t]}`;for(let t in dj)e[dj[t]]=`rdp-${dj[t]}`;return e}function Yj(e,t,n){return(n??new QA(t)).formatMonthYear(e)}var Xj=Yj;function Zj(e,t,n){return(n??new QA(t)).format(e,`d`)}function Qj(e,t=$A){return t.format(e,`LLLL`)}function $j(e,t,n){return(n??new QA(t)).format(e,`cccccc`)}function eM(e,t=$A){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function tM(){return``}function nM(e,t=$A){return t.format(e,`yyyy`)}var rM=nM,iM=s({formatCaption:()=>Yj,formatDay:()=>Zj,formatMonthCaption:()=>Xj,formatMonthDropdown:()=>Qj,formatWeekNumber:()=>eM,formatWeekNumberHeader:()=>tM,formatWeekdayName:()=>$j,formatYearCaption:()=>rM,formatYearDropdown:()=>nM});function aM(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...iM,...e}}function oM(e,t,n,r){let i=(r??new QA(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var sM=oM;function cM(e,t,n){return(n??new QA(t)).formatMonthYear(e)}var lM=cM;function uM(e,t,n,r){let i=(r??new QA(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function dM(e){return`Choose the Month`}function fM(){return``}var pM=`Go to the Next Month`;function mM(e,t){return pM}function hM(e){return`Go to the Previous Month`}function gM(e,t,n){return(n??new QA(t)).format(e,`cccc`)}function _M(e,t){return`Week ${e}`}function vM(e){return`Week Number`}function yM(e){return`Choose the Year`}var bM=s({labelCaption:()=>lM,labelDay:()=>sM,labelDayButton:()=>oM,labelGrid:()=>cM,labelGridcell:()=>uM,labelMonthDropdown:()=>dM,labelNav:()=>fM,labelNext:()=>mM,labelPrevious:()=>hM,labelWeekNumber:()=>_M,labelWeekNumberHeader:()=>vM,labelWeekday:()=>gM,labelYearDropdown:()=>yM}),xM=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function SM(e,t){let n=t.locale?.labels??{};return{...bM,...e??{},labelDayButton:xM(oM,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:xM(dM,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:xM(mM,e?.labelNext,n.labelNext),labelPrevious:xM(hM,e?.labelPrevious,n.labelPrevious),labelWeekNumber:xM(_M,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:xM(yM,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:xM(cM,e?.labelGrid,n.labelGrid),labelGridcell:xM(uM,e?.labelGridcell,n.labelGridcell),labelNav:xM(fM,e?.labelNav,n.labelNav),labelWeekNumberHeader:xM(vM,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:xM(gM,e?.labelWeekday,n.labelWeekday)}}function CM(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function wM(e,t={},n={}){let r={...t?.[cj.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function TM(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function EM(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function DM(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new GA(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(GA.tz(e)),newDate:(t,n,r)=>new GA(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new GA(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new GA(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new GA(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new GA(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>Yk(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>Kk(o(e)),differenceInCalendarDays:(e,t)=>pk(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Sk(o(e),o(t))}}var OM=e=>e instanceof HTMLElement?e:null,kM=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],AM=e=>OM(e.querySelector(`[data-animated-month]`)),jM=e=>OM(e.querySelector(`[data-animated-caption]`)),MM=e=>OM(e.querySelector(`[data-animated-weeks]`)),NM=e=>OM(e.querySelector(`[data-animated-nav]`)),PM=e=>OM(e.querySelector(`[data-animated-weekdays]`));function FM(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(r),c=(0,v.useRef)(!1);(0,v.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[dj.caption_after_enter]:n[dj.caption_before_enter],p=d?n[dj.weeks_after_enter]:n[dj.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(kM(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=AM(e);t&&e.contains(t)&&e.removeChild(t);let n=jM(e);n&&n.classList.remove(f);let r=MM(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?kM(m):[],_=kM(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=NM(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=jM(i);s&&s.classList.add(f);let l=MM(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=PM(o);m&&(m.style.opacity=`0`);let h=jM(o);h&&(h.classList.add(d?n[dj.caption_before_exit]:n[dj.caption_after_exit]),h.addEventListener(`animationend`,u));let _=MM(o);_&&_.classList.add(d?n[dj.weeks_before_exit]:n[dj.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function IM(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function LM(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function RM(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function zM(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function BM(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new tj(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new ej(t,m,r);return a?a.days.push(o):e.push(new nj(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function VM(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function HM(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function UM(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function WM(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function GM(e,t){let[n,r]=(0,v.useState)(e);return[t===void 0?n:t,r]}function KM(e,t){let[n,r]=VM(e,t),{startOfMonth:i,endOfMonth:a}=t,o=zM(e,n,r,t),[s,c]=GM(o,e.month?o:void 0);(0,v.useEffect)(()=>{c(zM(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,v.useMemo)(()=>{let i=RM(s,r,{numberOfMonths:e.numberOfMonths},t),o=BM(i,IM(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:WM(o),days:LM(o),previousMonth:UM(s,n,e,t),nextMonth:HM(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var qM;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(qM||={});function JM(e){return!e[lj.disabled]&&!e[lj.hidden]&&!e[lj.outside]}function YM(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);JM(e)&&(e[lj.focused]&&a<qM.FocusedModifier?(i=o,a=qM.FocusedModifier):r?.isEqualTo(o)&&a<qM.LastFocused?(i=o,a=qM.LastFocused):n(o.date)&&a<qM.Selected?(i=o,a=qM.Selected):e[lj.today]&&a<qM.Today&&(i=o,a=qM.Today))}return i||=e.find(e=>JM(t(e))),i}function XM(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function ZM(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=XM(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Uj(c,a.disabled,o)),u=!!(a.hidden&&Uj(c,a.hidden,o)),d=new ej(c,c,o);return!l&&!u?d:ZM(e,t,d,r,i,a,o,s+1)}function QM(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,v.useState)(),c=YM(t.days,n,r||(()=>!1),o),[l,u]=(0,v.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=ZM(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function $M(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=GM(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function eN(e,t,n=0,r=0,i=!1,a=$A){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function tN(e,t,n=$A){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function nN(e,t,n=$A){return Ij(e,t.from,!1,n)||Ij(e,t.to,!1,n)||Ij(t,e.from,!1,n)||Ij(t,e.to,!1,n)}function rN(e,t,n=$A){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Ij(e,t,!1,n):Hj(t,n)?t.some(t=>Ij(e,t,!1,n)):Rj(t)?t.from&&t.to?nN(e,{from:t.from,to:t.to},n):!1:Vj(t)?tN(e,t.dayOfWeek,n):Lj(t)?n.isAfter(t.before,t.after)?nN(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Uj(e.from,t,n)||Uj(e.to,t,n):zj(t)||Bj(t)?Uj(e.from,t,n)||Uj(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function iN(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=GM(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:eN(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&rN({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Ij(u,e,!1,t)}}function aN(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=GM(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function oN(e,t){let n=aN(e,t),r=$M(e,t),i=iN(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function sN(e,t){return e instanceof GA&&e.timeZone===t?e:new GA(e,t)}function cN(e,t,n){if(!n)return sN(e,t);let r=sN(e,t),i=new GA(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function lN(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?cN(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?cN(e,t,n):e):Rj(e)?{...e,from:e.from?sN(e.from,t):e.from,to:e.to?sN(e.to,t):e.to}:Lj(e)?{before:cN(e.before,t,n),after:cN(e.after,t,n)}:zj(e)?{after:cN(e.after,t,n)}:Bj(e)?{before:cN(e.before,t,n)}:e}function uN(e,t,n){return e&&(Array.isArray(e)?e.map(e=>lN(e,t,n)):lN(e,t,n))}function dN(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=sN(t.today,n),t.month&&=sN(t.month,n),t.defaultMonth&&=sN(t.defaultMonth,n),t.startMonth&&=sN(t.startMonth,n),t.endMonth&&=sN(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=sN(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>sN(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?sN(t.selected.from,n):t.selected.from,to:t.selected.to?sN(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=uN(t.disabled,n)),t.hidden!==void 0&&(t.hidden=uN(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=uN(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,v.useMemo)(()=>{let e={...ZA,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?DM(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new QA({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Kj(t.components),formatters:aM(t.formatters),labels:SM(t.labels,a.options),locale:e,classNames:{...Jj(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:k,formatYearDropdown:A}=i,j=KM(t,o),{days:M,months:N,navStart:P,navEnd:F,previousMonth:I,nextMonth:L,goToMonth:R}=j,ee=Wj(M,t,P,F,o),{isSelected:te,select:ne,selected:z}=oN(t,o)??{},{blur:B,focused:re,isFocusTarget:V,moveFocus:ie,setFocused:ae}=QM(t,j,ee,te??(()=>!1),o),{labelDayButton:oe,labelGridcell:se,labelGrid:ce,labelMonthDropdown:le,labelNav:ue,labelPrevious:de,labelNext:fe,labelWeekday:pe,labelWeekNumber:me,labelWeekNumberHeader:he,labelYearDropdown:ge}=a,_e=(0,v.useMemo)(()=>TM(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),ve=u!==void 0||m!==void 0,ye=(0,v.useCallback)(()=>{I&&(R(I),x?.(I))},[I,R,x]),be=(0,v.useCallback)(()=>{L&&(R(L),b?.(L))},[R,L,b]),xe=(0,v.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),ae(e),!t.disabled&&(ne?.(e.date,t,n),m?.(e.date,t,n))},[ne,m,ae]),Se=(0,v.useCallback)((e,t)=>n=>{ae(e),h?.(e.date,t,n)},[h,ae]),Ce=(0,v.useCallback)((e,t)=>n=>{B(),p?.(e.date,t,n)},[B,p]),we=(0,v.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];ie(e,t)}g?.(e.date,n,r)},[ie,g,t.dir]),Te=(0,v.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Ee=(0,v.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),De=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setMonth(o.startOfMonth(e),n))},[o,R]),Oe=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setYear(o.startOfMonth(e),n))},[o,R]),{className:ke,style:Ae}=(0,v.useMemo)(()=>({className:[c[cj.Root],t.className].filter(Boolean).join(` `),style:{...C?.[cj.Root],...t.style}}),[c,t.className,t.style,C]),je=qj(t),Me=(0,v.useRef)(null);FM(Me,!!t.animate,{classNames:c,months:N,focused:re,dateLib:o});let Ne={dayPickerProps:t,selected:z,select:ne,isSelected:te,months:N,nextMonth:L,previousMonth:I,goToMonth:R,getModifiers:ee,components:r,classNames:c,styles:C,labels:a,formatters:i};return v.createElement(yj.Provider,{value:Ne},v.createElement(r.Root,{rootRef:t.animate?Me:void 0,className:ke,style:Ae,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...je},v.createElement(r.Months,{className:c[cj.Months],style:C?.[cj.Months]},!t.hideNavigation&&!d&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[cj.Nav],style:C?.[cj.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),N.map((e,n)=>v.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[cj.Month],style:C?.[cj.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&v.createElement(r.PreviousMonthButton,{type:`button`,className:c[cj.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":de(I),onClick:ye,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[cj.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),v.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[cj.MonthCaption],style:C?.[cj.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?v.createElement(r.DropdownNav,{className:c[cj.Dropdowns],style:C?.[cj.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?v.createElement(r.MonthsDropdown,{key:`month`,className:c[cj.MonthsDropdown],"aria-label":le(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:De(e.date),options:CM(e.date,P,F,i,o),style:C?.[cj.Dropdown],value:o.getMonth(e.date)}):v.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?v.createElement(r.YearsDropdown,{key:`year`,className:c[cj.YearsDropdown],"aria-label":ge(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Oe(e.date),options:EM(P,F,i,o,!!t.reverseYears),style:C?.[cj.Dropdown],value:o.getYear(e.date)}):v.createElement(`span`,{key:`year`},A(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),v.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):v.createElement(r.CaptionLabel,{className:c[cj.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&v.createElement(r.NextMonthButton,{type:`button`,className:c[cj.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":L?void 0:!0,"aria-label":fe(L),onClick:be,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:L?void 0:!0,className:c[cj.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[cj.Nav],style:C?.[cj.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),v.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":ce(e.date,o.options,o)||void 0,className:c[cj.MonthGrid],style:C?.[cj.MonthGrid]},!t.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[cj.Weekdays],style:C?.[cj.Weekdays]},S&&v.createElement(r.WeekNumberHeader,{"aria-label":he(o.options),className:c[cj.WeekNumberHeader],style:C?.[cj.WeekNumberHeader],scope:`col`},O()),_e.map(e=>v.createElement(r.Weekday,{"aria-label":pe(e,o.options,o),className:c[cj.Weekday],key:String(e),style:C?.[cj.Weekday],scope:`col`},k(e,o.options,o)))),v.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[cj.Weeks],style:C?.[cj.Weeks]},e.weeks.map(e=>v.createElement(r.Week,{className:c[cj.Week],key:e.weekNumber,style:C?.[cj.Week],week:e},S&&v.createElement(r.WeekNumber,{week:e,style:C?.[cj.WeekNumber],"aria-label":me(e.weekNumber,{locale:s}),className:c[cj.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ee(e);if(i[lj.focused]=!i.hidden&&!!re?.isEqualTo(e),i[uj.selected]=te?.(n)||i.selected,Rj(z)){let{from:e,to:t}=z;i[uj.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[uj.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[uj.range_middle]=Ij(z,n,!0,o)}let a=wM(i,C,t.modifiersStyles),s=Gj(i,c,t.modifiersClassNames),l=!ve&&!i.hidden?se(n,i,o.options,o):void 0;return v.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&ve?v.createElement(r.DayButton,{className:c[cj.DayButton],style:C?.[cj.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:V(e)?0:-1,"aria-label":oe(n,i,o.options,o),onClick:xe(e,i),onBlur:Ce(e,i),onFocus:Se(e,i),onKeyDown:we(e,i),onMouseEnter:Te(e,i),onMouseLeave:Ee(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&v.createElement(r.Footer,{className:c[cj.Footer],style:C?.[cj.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function fN({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...s}){let c=Jj();return(0,H.jsx)(dN,{showOutsideDays:n,className:K(`group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:K(`w-fit`,c.root),months:K(`relative flex flex-col gap-4 md:flex-row`,c.months),month:K(`flex w-full flex-col gap-4`,c.month),nav:K(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,c.nav),button_previous:K(Pc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_previous),button_next:K(Pc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_next),month_caption:K(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,c.month_caption),dropdowns:K(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,c.dropdowns),dropdown_root:K(`relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50`,c.dropdown_root),dropdown:K(`absolute inset-0 bg-popover opacity-0`,c.dropdown),caption_label:K(`font-medium select-none`,r===`label`?`text-sm`:`flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,c.caption_label),table:`w-full border-collapse`,weekdays:K(`flex`,c.weekdays),weekday:K(`flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none`,c.weekday),week:K(`mt-2 flex w-full`,c.week),week_number_header:K(`w-(--cell-size) select-none`,c.week_number_header),week_number:K(`text-[0.8rem] text-muted-foreground select-none`,c.week_number),day:K(`group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md`,s.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-md`:`[&:first-child[data-selected=true]_button]:rounded-l-md`,c.day),range_start:K(`rounded-l-md bg-accent`,c.range_start),range_middle:K(`rounded-none`,c.range_middle),range_end:K(`rounded-r-md bg-accent`,c.range_end),today:K(`rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none`,c.today),outside:K(`text-muted-foreground aria-selected:text-muted-foreground`,c.outside),disabled:K(`text-muted-foreground opacity-50`,c.disabled),hidden:K(`invisible`,c.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,H.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:K(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,H.jsx)(ka,{className:K(`size-4`,e),...n}):t===`right`?(0,H.jsx)(Aa,{className:K(`size-4`,e),...n}):(0,H.jsx)(Oa,{className:K(`size-4`,e),...n}),DayButton:pN,WeekNumber:({children:e,...t})=>(0,H.jsx)(`td`,{...t,children:(0,H.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...o},...s})}function pN({className:e,day:t,modifiers:n,...r}){let i=Jj(),a=v.useRef(null);return v.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,H.jsx)(q,{ref:a,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:K(`flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal`,`group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10`,`group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50`,`data-[range-end=true]:rounded-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground`,`data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground`,`data-[range-start=true]:rounded-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground`,`data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground`,`dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70`,i.day,e),...r})}function mN({...e}){return(0,H.jsx)(zx,{"data-slot":`popover`,...e})}function hN({...e}){return(0,H.jsx)(Bx,{"data-slot":`popover-trigger`,...e})}function gN({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,H.jsx)(Vx,{children:(0,H.jsx)(Hx,{"data-slot":`popover-content`,align:t,sideOffset:n,className:K(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden`,`data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,`data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}var _N=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`textarea`,{className:K(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));_N.displayName=`Textarea`;function vN({...e}){return(0,H.jsx)(rb,{"data-slot":`accordion`,...e})}function yN({className:e,...t}){return(0,H.jsx)(ib,{"data-slot":`accordion-item`,className:K(`border-b last:border-b-0`,e),...t})}function bN({className:e,children:t,...n}){return(0,H.jsx)(ab,{className:`flex`,children:(0,H.jsxs)(ob,{"data-slot":`accordion-trigger`,className:K(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,H.jsx)(Oa,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function xN({className:e,children:t,...n}){return(0,H.jsx)(sb,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,H.jsx)(`div`,{className:K(`pt-0 pb-4`,e),children:t})})}function SN(e){this.content=e}SN.prototype={constructor:SN,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new SN(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new SN(n)},addToStart:function(e,t){return new SN([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new SN(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new SN(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=SN.from(e),e.size?new SN(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=SN.from(e),e.size?new SN(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=SN.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},SN.from=function(e){if(e instanceof SN)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new SN(t)};function CN(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=CN(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function wN(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=wN(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var X=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return CN(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return wN(this,e,t,n)}findIndex(e){if(e==0)return EN(0,e);if(e==this.size)return EN(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?EN(t+1,i):EN(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};X.empty=new X([],0);var TN={index:0,offset:0};function EN(e,t){return TN.index=e,TN.offset=t,TN}function DN(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!DN(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!DN(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var ON=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&DN(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};ON.none=[];var kN=class extends Error{},Z=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=jN(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(AN(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(X.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Z.empty=new Z(X.empty,0,0);function AN(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(AN(a.content,t-i-1,n-i-1)))}function jN(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=jN(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function MN(e,t,n){if(n.openStart>e.depth)throw new kN(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new kN(`Inconsistent open depths`);return NN(e,t,n,0)}function NN(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=NN(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return RN(a,BN(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return RN(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=VN(n,e);return RN(a,zN(e,i,o,t,r))}}function PN(e,t){if(!t.type.compatibleContent(e.type))throw new kN(`Cannot join `+t.type.name+` onto `+e.type.name)}function FN(e,t,n){let r=e.node(n);return PN(r,t.node(n)),r}function IN(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function LN(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(IN(e.nodeAfter,r),a++));for(let e=a;e<o;e++)IN(i.child(e),r);t&&t.depth==n&&t.textOffset&&IN(t.nodeBefore,r)}function RN(e,t){return e.type.checkContent(t),e.copy(t)}function zN(e,t,n,r,i){let a=e.depth>i&&FN(e,t,i+1),o=r.depth>i&&FN(n,r,i+1),s=[];return LN(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(PN(a,o),IN(RN(a,zN(e,t,n,r,i+1)),s)):(a&&IN(RN(a,BN(e,t,i+1)),s),LN(t,n,i,s),o&&IN(RN(o,BN(n,r,i+1)),s)),LN(r,null,i,s),new X(s)}function BN(e,t,n){let r=[];return LN(null,e,n,r),e.depth>n&&IN(RN(FN(e,t,n+1),BN(e,t,n+1)),r),LN(t,null,n,r),new X(r)}function VN(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(X.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var HN=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ON.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new KN(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=GN.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else GN.set(t,r=new UN);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%WN,i}},UN=class{constructor(){this.elts=[],this.i=0}},WN=12,GN=new WeakMap,KN=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},qN=Object.create(null),JN=class e{constructor(e,t,n,r=ON.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||X.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&DN(this.attrs,t||e.defaultAttrs||qN)&&ON.sameSet(this.marks,n||ON.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Z.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Z(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return MN(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return HN.resolveCached(this,e)}resolveNoCache(e){return HN.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),XN(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=X.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ON.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!ON.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=X.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};JN.prototype.text=void 0;var YN=class e extends JN{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):XN(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function XN(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ZN=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new QN(t,n);if(r.next==null)return e.empty;let i=$N(r);r.next&&r.err(`Unexpected trailing text`);let a=lP(oP(i));return uP(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return X.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
79
+ `},vT={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function yT(e){let{announcements:t=vT,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=_T}=e,{announce:a,announcement:o}=pT(),s=$w(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),hT((0,v.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=v.createElement(v.Fragment,null,v.createElement(dT,{id:r,value:i.draggable}),v.createElement(fT,{id:s,announcement:o}));return n?(0,b.createPortal)(u,n):u}var bT;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(bT||={});function xT(){}function ST(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function CT(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var wT=Object.freeze({x:0,y:0});function TT(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ET(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function DT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function OT(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function kT(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var AT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=kT(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=TT(kT(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ET)};function jT(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var MT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=jT(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(DT)};function NT(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function PT(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wT}function FT(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var IT=FT(1);function LT(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function RT(e,t,n){let r=LT(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var zT={ignoreTransform:!1};function BT(e,t){t===void 0&&(t=zT);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Bw(e).getComputedStyle(e);t&&(n=RT(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function VT(e){return BT(e,{ignoreTransform:!0})}function HT(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UT(e,t){return t===void 0&&(t=Bw(e).getComputedStyle(e)),t.position===`fixed`}function WT(e,t){t===void 0&&(t=Bw(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function GT(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Vw(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Hw(i)||Uw(i)||n.includes(i))return n;let a=Bw(e).getComputedStyle(i);return i!==e&&WT(i,a)&&n.push(i),UT(i,a)?n:r(i.parentNode)}return e?r(e):n}function KT(e){let[t]=GT(e,1);return t??null}function qT(e){return!Lw||!e?null:Rw(e)?e:zw(e)?Vw(e)||e===Ww(e).scrollingElement?window:Hw(e)?e:null:null}function JT(e){return Rw(e)?e.scrollX:e.scrollLeft}function YT(e){return Rw(e)?e.scrollY:e.scrollTop}function XT(e){return{x:JT(e),y:YT(e)}}var ZT;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(ZT||={});function QT(e){return!Lw||!e?!1:e===document.scrollingElement}function $T(e){let t={x:0,y:0},n=QT(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var eE={x:.2,y:.2};function tE(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=eE);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=$T(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=ZT.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=ZT.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=ZT.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=ZT.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function nE(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function rE(e){return e.reduce((e,t)=>tT(e,XT(t)),wT)}function iE(e){return e.reduce((e,t)=>e+JT(t),0)}function aE(e){return e.reduce((e,t)=>e+YT(t),0)}function oE(e,t){if(t===void 0&&(t=BT),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);KT(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var sE=[[`x`,[`left`,`right`],iE],[`y`,[`top`,`bottom`],aE]],cE=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=GT(t),r=rE(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of sE)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},lE=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function uE(e){let{EventTarget:t}=Bw(e);return e instanceof t?e:Ww(e)}function dE(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var fE;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(fE||={});function pE(e){e.preventDefault()}function mE(e){e.stopPropagation()}var hE;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(hE||={});var gE={start:[hE.Space,hE.Enter],cancel:[hE.Esc],end:[hE.Space,hE.Enter,hE.Tab]},_E=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case hE.Right:return{...n,x:n.x+25};case hE.Left:return{...n,x:n.x-25};case hE.Down:return{...n,y:n.y+25};case hE.Up:return{...n,y:n.y-25}}},vE=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new lE(Ww(t)),this.windowListeners=new lE(Bw(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fE.Resize,this.handleCancel),this.windowListeners.add(fE.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fE.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&oE(n),t(wT)}handleKeyDown(e){if(iT(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=gE,coordinateGetter:a=_E,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:wT;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=nT(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=$T(n),p=nE(n),m={x:Math.min(i===hE.Right?p.right-p.width/2:p.right,Math.max(i===hE.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===hE.Down?p.bottom-p.height/2:p.bottom,Math.max(i===hE.Down?p.top:p.top+p.height/2,u.y))},h=i===hE.Right&&!s||i===hE.Left&&!c,g=i===hE.Down&&!l||i===hE.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===hE.Right&&e<=d.x||i===hE.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===hE.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===hE.Down&&e<=d.y||i===hE.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===hE.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,tT(nT(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};vE.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=gE,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function yE(e){return!!(e&&`distance`in e)}function bE(e){return!!(e&&`delay`in e)}var xE=class{constructor(e,t,n){n===void 0&&(n=uE(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Ww(i),this.documentListeners=new lE(this.document),this.listeners=new lE(n),this.windowListeners=new lE(Bw(i)),this.initialCoordinates=oT(r)??wT,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(fE.Resize,this.handleCancel),this.windowListeners.add(fE.DragStart,pE),this.windowListeners.add(fE.VisibilityChange,this.handleCancel),this.windowListeners.add(fE.ContextMenu,pE),this.documentListeners.add(fE.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bE(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(yE(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(fE.Click,mE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fE.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=oT(e)??wT,s=nT(n,o);if(!t&&a){if(yE(a)){if(a.tolerance!=null&&dE(s,a.tolerance))return this.handleCancel();if(dE(s,a.distance))return this.handleStart()}if(bE(a)&&dE(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===hE.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},SE={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},CE=class extends xE{constructor(e){let{event:t}=e,n=Ww(t.target);super(e,SE,n)}};CE.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var wE={move:{name:`mousemove`},end:{name:`mouseup`}},TE;(function(e){e[e.RightClick=2]=`RightClick`})(TE||={});var EE=class extends xE{constructor(e){super(e,wE,Ww(e.event.target))}};EE.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===TE.RightClick?!1:(r?.({event:n}),!0)}}];var DE={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},OE=class extends xE{constructor(e){super(e,DE)}static setup(){return window.addEventListener(DE.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(DE.move.name,e)};function e(){}}};OE.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var kE;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(kE||={});var AE;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(AE||={});function jE(e){let{acceleration:t,activator:n=kE.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=AE.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=NE({delta:d,disabled:!a}),[m,h]=qw(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case kE.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case kE.DraggableRect:return i}},[n,i,c]),b=(0,v.useRef)(null),x=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,v.useMemo)(()=>s===AE.TreeOrder?[...l].reverse():l,[s,l]);(0,v.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=tE(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var ME={x:{[ZT.Backward]:!1,[ZT.Forward]:!1},y:{[ZT.Backward]:!1,[ZT.Forward]:!1}};function NE(e){let{delta:t,disabled:n}=e,r=Zw(t);return Yw(e=>{if(n||!r||!e)return ME;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ZT.Backward]:e.x[ZT.Backward]||i.x===-1,[ZT.Forward]:e.x[ZT.Forward]||i.x===1},y:{[ZT.Backward]:e.y[ZT.Backward]||i.y===-1,[ZT.Forward]:e.y[ZT.Forward]||i.y===1}}},[n,t,r])}function PE(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Yw(e=>t==null?null:r??e??null,[r,t])}function FE(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var IE;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(IE||={});var LE;(function(e){e.Optimized=`optimized`})(LE||={});var RE=new Map;function zE(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,v.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,v.useRef)(e),d=g(),f=Jw(d),p=(0,v.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,v.useRef)(null),h=Yw(t=>{if(d&&!n)return RE;if(!t||t===RE||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new cE(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,v.useEffect)(()=>{u.current=e},[e]),(0,v.useEffect)(()=>{d||p()},[n,d]),(0,v.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,v.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case IE.Always:return!1;case IE.BeforeDragging:return n;default:return!n}}}function BE(e,t){return Yw(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function VE(e,t){return BE(e,t)}function HE(e){let{callback:t,disabled:n}=e,r=Kw(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function UE(e){let{callback:t,disabled:n}=e,r=Kw(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function WE(e){return new cE(BT(e),e)}function GE(e,t,n){t===void 0&&(t=WE);let[r,i]=(0,v.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=HE({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=UE({callback:a});return Gw(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function KE(e){return PT(e,BE(e))}var qE=[];function JE(e){let t=(0,v.useRef)(e),n=Yw(n=>e?n&&n!==qE&&e&&t.current&&e.parentNode===t.current.parentNode?n:GT(e):qE,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function YE(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=qT(e.target);t&&n(e=>e?(e.set(t,XT(t)),new Map(e)):null)},[]);return(0,v.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=qT(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,XT(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{qT(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>tT(e,t),wT):rE(e):wT,[e,t])}function XE(e,t){t===void 0&&(t=[]);let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{n.current=null},t),(0,v.useEffect)(()=>{let t=e!==wT;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?nT(e,n.current):wT}function ZE(e){(0,v.useEffect)(()=>{if(!Lw)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function QE(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function $E(e){return(0,v.useMemo)(()=>e?HT(e):null,[e])}var eD=[];function tD(e,t){t===void 0&&(t=BT);let[n]=e,r=$E(n?Bw(n):null),[i,a]=(0,v.useState)(eD);function o(){a(()=>e.length?e.map(e=>QT(e)?r:new cE(t(e),e)):eD)}let s=UE({callback:o});return Gw(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function nD(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Hw(t)?t:e}function rD(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=UE({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(Hw(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Xw((0,v.useCallback)(e=>{let n=nD(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,v.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var iD=[{sensor:CE,options:{}},{sensor:vE,options:{}}],aD={current:{}},oD={draggable:{measure:VT},droppable:{measure:VT,strategy:IE.WhileDragging,frequency:LE.Optimized},dragOverlay:{measure:BT}},sD=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},cD={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sD,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xT},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oD,measureDroppableContainers:xT,windowRect:null,measuringScheduled:!1},lD={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:xT,draggableNodes:new Map,over:null,measureDroppableContainers:xT},uD=(0,v.createContext)(lD),dD=(0,v.createContext)(cD);function fD(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sD}}}function pD(e,t){switch(t.type){case bT.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bT.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case bT.DragEnd:case bT.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bT.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new sD(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case bT.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new sD(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case bT.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new sD(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function mD(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(uD),a=Zw(r),o=Zw(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!iT(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=lT(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function hD(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function gD(e){return(0,v.useMemo)(()=>({draggable:{...oD.draggable,...e?.draggable},droppable:{...oD.droppable,...e?.droppable},dragOverlay:{...oD.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _D(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,v.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Gw(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=PT(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=KT(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var vD=(0,v.createContext)({...wT,scaleX:1,scaleY:1}),yD;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(yD||={});var bD=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=iD,collisionDetection:o=MT,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(pD,void 0,fD),[f,p]=gT(),[m,h]=(0,v.useState)(yD.Uninitialized),g=m===yD.Initialized,{draggable:{active:_,nodes:y,translate:x},droppable:{containers:S}}=u,C=_==null?null:y.get(_),w=(0,v.useRef)({initial:null,translated:null}),T=(0,v.useMemo)(()=>_==null?null:{id:_,data:C?.data??aD,rect:w},[_,C]),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),j=Jw(l,Object.values(l)),M=$w(`DndDescribedBy`,t),N=(0,v.useMemo)(()=>S.getEnabled(),[S]),P=gD(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=zE(N,{dragging:g,dependencies:[x.x,x.y],config:P.droppable}),R=PE(y,_),ee=(0,v.useMemo)(()=>k?oT(k):null,[k]),te=ke(),ne=VE(R,P.draggable.measure);_D({activeNode:_==null?null:y.get(_),config:te.layoutShiftCompensation,initialRect:ne,measure:P.draggable.measure});let z=GE(R,P.draggable.measure,ne),B=GE(R?R.parentElement:null),re=(0,v.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),V=S.getNodeFor(re.current.over?.id),ie=rD({measure:P.dragOverlay.measure}),ae=ie.nodeRef.current??R,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=KE(se?null:z),le=$E(ae?Bw(ae):null),ue=JE(g?V??R:null),de=tD(ue),fe=hD(c,{transform:{x:x.x-ce.x,y:x.y-ce.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:oe,over:re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ee?tT(ee,x):null,me=YE(ue),he=XE(me),ge=XE(me,[z]),_e=tT(fe,he),ve=oe?IT(oe,fe):null,ye=T&&ve?o({active:T,collisionRect:ve,droppableRects:F,droppableContainers:N,pointerCoordinates:pe}):null,be=OT(ye,`id`),[xe,Se]=(0,v.useState)(null),Ce=NT(se?fe:tT(fe,ge),xe?.rect??null,z),we=(0,v.useRef)(null),Te=(0,v.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=y.get(E.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:E.current,activeNode:i,event:a,options:r,context:re,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,b.unstable_batchedUpdates)(()=>{r?.(i),h(yD.Initializing),d({type:bT.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(we.current),A(a)})},onMove(e){d({type:bT.DragMove,coordinates:e})},onEnd:o(bT.DragEnd),onCancel:o(bT.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=re.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===bT.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=bT.DragCancel)}E.current=null,(0,b.unstable_batchedUpdates)(()=>{d({type:e}),h(yD.Uninitialized),Se(null),O(null),A(null),we.current=null;let t=e===bT.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ee=FE(a,(0,v.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Te(n,t))},[y,Te]));ZE(a),Gw(()=>{z&&m===yD.Initializing&&h(yD.Initialized)},[z,m]),(0,v.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=re.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:_e.x,y:_e.y},over:i};(0,b.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,v.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=re.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,b.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),Gw(()=>{re.current={activatorEvent:k,active:T,activeNode:R,collisionRect:ve,collisions:ye,droppableRects:F,draggableNodes:y,draggingNode:ae,draggingNodeRect:oe,droppableContainers:S,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},w.current={initial:oe,translated:ve}},[T,R,ye,ve,y,ae,oe,F,S,xe,ue,_e]),jE({...te,delta:x,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,v.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:z,activatorEvent:k,collisions:ye,containerNodeRect:B,dragOverlay:ie,draggableNodes:y,droppableContainers:S,droppableRects:F,over:xe,measureDroppableContainers:I,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:P,measuringScheduled:L,windowRect:le}),[T,R,z,k,ye,B,ie,y,S,F,xe,I,ue,de,P,L,le]),Oe=(0,v.useMemo)(()=>({activatorEvent:k,activators:Ee,active:T,activeNodeRect:z,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:y,over:xe,measureDroppableContainers:I}),[k,Ee,T,z,d,M,y,xe,I]);return v.createElement(mT.Provider,{value:p},v.createElement(uD.Provider,{value:Oe},v.createElement(dD.Provider,{value:De},v.createElement(vD.Provider,{value:Ce},i)),v.createElement(mD,{disabled:n?.restoreFocus===!1})),v.createElement(yT,{...n,hiddenTextDescribedById:M}));function ke(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),xD=(0,v.createContext)(null),SD=`button`,CD=`Draggable`;function wD(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=$w(CD),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(uD),{role:p=SD,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?vD:xD),[y,b]=Xw(),[x,S]=Xw(),C=QE(o,t),w=Jw(n);return Gw(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,v.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===SD?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function TD(){return(0,v.useContext)(dD)}var ED=`Droppable`,DD={timeout:25};function OD(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=$w(ED),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(uD),u=(0,v.useRef)({disabled:n}),d=(0,v.useRef)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...DD,...i},_=Jw(h??r),y=UE({callback:(0,v.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=Xw((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Jw(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:bT.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:bT.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:bT.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function kD(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AD(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function jD(e){return e!==null&&e>=0}function MD(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ND(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var PD=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=kD(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},FD={scaleX:1,scaleY:1},ID=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...FD}:null}let s=LD(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...FD}:r<t&&r>=a?{x:0,y:o.height+s,...FD}:{x:0,y:0,...FD}};function LD(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var RD=`Sortable`,zD=v.createContext({activeIndex:-1,containerId:RD,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:PD,disabled:{draggable:!1,droppable:!1}});function BD(e){let{children:t,id:n,items:r,strategy:i=PD,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=TD(),d=$w(RD,n),f=s.rect!==null,p=(0,v.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,v.useRef)(p),y=!MD(p,_.current),b=g!==-1&&h===-1||y,x=ND(a);Gw(()=>{y&&m&&u(p)},[y,p,m,u]),(0,v.useEffect)(()=>{_.current=p},[p]);let S=(0,v.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:AD(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(zD.Provider,{value:S},t)}var VD=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return kD(n,r,i).indexOf(t)},HD=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},UD={duration:200,easing:`ease`},WD=`transform`,GD=sT.Transition.toString({property:WD,duration:0,easing:`linear`}),KD={roleDescription:`sortable`};function qD(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return Gw(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=BT(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,v.useEffect)(()=>{a&&o(null)},[a]),a}function JD(e){let{animateLayoutChanges:t=HD,attributes:n,disabled:r,data:i,getNewIndex:a=VD,id:o,strategy:s,resizeObserverConfig:c,transition:l=UD}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(zD),b=YD(r,p),x=u.indexOf(o),S=(0,v.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,v.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=OD({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=wD({id:o,data:S,attributes:{...KD,...n},disabled:b.draggable}),R=Iw(D,M),ee=!!O,te=ee&&!m&&jD(f)&&jD(g),ne=!_&&P,z=te?(ne&&te?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,B=jD(f)&&jD(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,re=O?.id,V=(0,v.useRef)({activeId:re,items:u,newIndex:B,containerId:d}),ie=u!==V.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:x,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),oe=qD({disabled:!ae,index:x,node:T,rect:w});return(0,v.useEffect)(()=>{ee&&V.current.newIndex!==B&&(V.current.newIndex=B),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[ee,B,d,u]),(0,v.useEffect)(()=>{if(re===V.current.activeId)return;if(re!=null&&V.current.activeId==null){V.current.activeId=re;return}let e=setTimeout(()=>{V.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:B,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??z,transition:se()};function se(){if(oe||ie&&V.current.newIndex===x)return GD;if(!(ne&&!iT(k)||!l)&&(ee||ae))return sT.Transition.toString({...l,property:WD})}}function YD(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}hE.Down,hE.Right,hE.Up,hE.Left;function XD(e,t){let n=t.toLowerCase().split(`+`),r=n.includes(`mod`),i=n.includes(`shift`),a=n[n.length-1];return(r?e.metaKey||e.ctrlKey:!e.metaKey&&!e.ctrlKey)&&i===e.shiftKey&&!e.altKey&&e.key.toLowerCase()===a}function ZD(e,t,n){let r=n?.enabled??!0,{register:i}=(0,v.useContext)(ca),a=(0,v.useRef)(t);(0,v.useEffect)(()=>{a.current=t}),(0,v.useEffect)(()=>{if(n?.label)return i(e,n.label)},[e,n?.label,i]),(0,v.useEffect)(()=>{function t(t){XD(t,e)&&(t.preventDefault(),r&&a.current())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r])}function QD(e,t){switch(e){case`string`:return{icon:No,label:`Text (string)`,color:`text-blue-600`,bg:`bg-blue-50`};case`text`:return{icon:ko,label:`Long text (string)`,color:`text-sky-600`,bg:`bg-sky-50`};case`richtext`:return{icon:Ga,label:`Rich text (blocks)`,color:`text-violet-600`,bg:`bg-violet-50`};case`number`:return{icon:Qa,label:t===`float`?`Decimal (number)`:`Integer (number)`,color:`text-orange-600`,bg:`bg-orange-50`};case`boolean`:return{icon:jo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`};case`datetime`:return{icon:Ta,label:`Date & time`,color:`text-amber-600`,bg:`bg-amber-50`};case`media`:return{icon:ro,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`};case`mixed`:return{icon:lo,label:`Mixed value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`};case`media-gallery`:return{icon:co,label:`Media Gallery`,color:`text-pink-600`,bg:`bg-pink-50`};case`relation`:return{icon:uo,label:`Relation`,color:`text-indigo-600`,bg:`bg-indigo-50`};case`uid`:return{icon:qa,label:`UID`,color:`text-teal-600`,bg:`bg-teal-50`};case`array`:return{icon:lo,label:`Array`,color:`text-cyan-600`,bg:`bg-cyan-50`};case`navigation`:return{icon:po,label:`Navigation`,color:`text-cyan-600`,bg:`bg-cyan-50`}}}var $D={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`},eO={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,"media-gallery":`full`,relation:`half`,uid:`half`,array:`full`,navigation:`full`};function tO({width:e}){let t=`rounded-sm bg-current`;return e===`full`?(0,H.jsx)(`div`,{className:`flex w-4 gap-px`,children:(0,H.jsx)(`div`,{className:`${t} h-2 w-full`})}):e===`two-thirds`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]}):e===`half`?(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`})]}):(0,H.jsxs)(`div`,{className:`flex w-4 gap-px`,children:[(0,H.jsx)(`div`,{className:`${t} h-2 flex-1`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`}),(0,H.jsx)(`div`,{className:`h-2 flex-1 rounded-sm bg-current opacity-25`})]})}var nO=[{value:`full`,label:`Full width`},{value:`half`,label:`Half`},{value:`third`,label:`1/3`},{value:`two-thirds`,label:`2/3`}];function rO({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i,dragListeners:a,dragAttributes:o}){let{icon:s,label:c,color:l,bg:u}=QD(e.type,e.subtype),d=e.width??`full`,f=!!a,p=e.type===`array`;return(0,H.jsxs)(`div`,{className:`rounded-lg border border-border bg-card shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3`,children:[f&&(0,H.jsx)(`button`,{type:`button`,className:`flex shrink-0 cursor-grab items-center text-muted-foreground/40 hover:text-muted-foreground active:cursor-grabbing`,...a,...o,children:(0,H.jsx)(Za,{className:`size-4`})}),(0,H.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md ${u}`,children:(0,H.jsx)(s,{className:`size-4 ${l}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsxs)(`p`,{className:`truncate text-sm font-medium leading-tight`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),e.relationType===`one-to-many`&&(0,H.jsx)(`span`,{className:`shrink-0 rounded border border-indigo-200 bg-indigo-50 px-1 py-px text-[10px] font-medium text-indigo-600`,children:`Auto`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.relationType===`one-to-many`?`Inverse relation · read-only`:c})]}),t&&!p&&(0,H.jsx)(`div`,{className:`flex shrink-0 items-center gap-px rounded-md border border-border p-0.5`,children:nO.map(({value:e,label:n})=>(0,H.jsx)(`button`,{type:`button`,title:n,onClick:()=>t(e),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,d===e?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(tO,{width:e})},e))}),(r||i)&&(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[r&&(0,H.jsx)(`button`,{type:`button`,title:`Edit field`,onClick:r,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(vo,{className:`size-3.5`})}),i&&(0,H.jsx)(`button`,{type:`button`,title:`Delete field`,onClick:i,className:`flex size-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),p&&e.arrayFields&&e.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-2 px-3 pb-3`,children:e.arrayFields.map(e=>{let t=QD(e.type,e.subtype),r=t.icon;return(0,H.jsxs)(`div`,{className:`${$D[e.width??`full`]} rounded-md border border-dashed border-border p-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${t.bg}`,children:(0,H.jsx)(r,{className:`size-3 ${t.color}`})}),(0,H.jsxs)(`span`,{className:`truncate text-xs font-medium`,children:[e.name,e.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})]}),(0,H.jsx)(`p`,{className:`mt-0.5 truncate pl-6 text-[10px] text-muted-foreground`,children:t.label}),n&&(0,H.jsx)(`div`,{className:`mt-1 flex items-center gap-px rounded-md border border-border p-0.5`,children:nO.map(({value:t,label:r})=>(0,H.jsx)(`button`,{type:`button`,title:r,onClick:()=>n(e.name,t),className:[`flex items-center justify-center rounded px-1.5 py-1 transition-colors`,(e.width??`full`)===t?`bg-foreground text-background`:`text-muted-foreground hover:text-foreground`].join(` `),children:(0,H.jsx)(tO,{width:t})},t))})]},e.name)})})]})}var iO=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(ix,{ref:n,className:K(`peer size-4 shrink-0 rounded-sm border border-input shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary`,e),...t,children:(0,H.jsx)(ox,{className:`flex items-center justify-center text-current`,children:(0,H.jsx)(Da,{className:`size-3`})})}));iO.displayName=ix.displayName;var aO=[{type:`string`,icon:No,label:`Text`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:ko,label:`Long Text`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:Ga,label:`Rich Text`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`number`,subtype:`integer`,icon:Qa,label:`Integer`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:Qa,label:`Decimal`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`boolean`,icon:jo,label:`Boolean`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ta,label:`Date & Time`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:ro,label:`Media`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`mixed`,icon:lo,label:`Mixed Value`,color:`text-fuchsia-600`,bg:`bg-fuchsia-50`}],oO={string:`half`,text:`full`,richtext:`full`,number:`third`,boolean:`third`,datetime:`half`,media:`half`,mixed:`half`},sO={type:`string`,subtype:void 0,name:``,required:!1,allowedTypes:[],width:`half`},cO=[{type:`string`,icon:No,label:`Text (string)`,description:`Titles, names, labels`,color:`text-blue-600`,bg:`bg-blue-50`},{type:`text`,icon:ko,label:`Long text (string)`,description:`Plain text, paragraphs`,color:`text-sky-600`,bg:`bg-sky-50`},{type:`richtext`,icon:Ga,label:`Rich text (blocks)`,description:`Formatted HTML content`,color:`text-violet-600`,bg:`bg-violet-50`},{type:`uid`,icon:qa,label:`UID`,description:`Unique slug from a field`,color:`text-teal-600`,bg:`bg-teal-50`},{type:`boolean`,icon:jo,label:`Boolean`,description:`True or false`,color:`text-emerald-600`,bg:`bg-emerald-50`},{type:`datetime`,icon:Ta,label:`Date & time`,description:`Timestamps and dates`,color:`text-amber-600`,bg:`bg-amber-50`},{type:`media`,icon:ro,label:`Media`,description:`Images, videos or files`,color:`text-rose-600`,bg:`bg-rose-50`},{type:`media-gallery`,icon:co,label:`Media Gallery`,description:`Multiple images for galleries`,color:`text-pink-600`,bg:`bg-pink-50`},{type:`array`,icon:lo,label:`Array`,description:`Repeatable list of items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`navigation`,icon:po,label:`Navigation`,description:`Nested navigation items`,color:`text-cyan-600`,bg:`bg-cyan-50`},{type:`number`,subtype:`integer`,icon:Qa,label:`Integer (number)`,description:`Whole numbers`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`number`,subtype:`float`,icon:Qa,label:`Decimal (number)`,description:`Numbers with decimals`,color:`text-orange-600`,bg:`bg-orange-50`},{type:`relation`,icon:uo,label:`Relation`,description:`Link to another content type`,color:`text-indigo-600`,bg:`bg-indigo-50`}],lO=[{value:`image`,label:`Images`},{value:`video`,label:`Videos`},{value:`audio`,label:`Audio`},{value:`document`,label:`Documents`}],uO=[{value:`many-to-one`,label:`Many-to-One`,description:`Many of these → one of the other`},{value:`one-to-one`,label:`One-to-One`,description:`One of these ↔ one of the other`},{value:`many-to-many`,label:`Many-to-Many`,description:`Many of these ↔ many of the other`}],dO=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.authorization.between.binary.both.case.cast.check.collate.column.constraint.create.cross.current_catalog.current_date.current_role.current_schema.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`));function fO(e){return dO.has(e.toLowerCase())}var pO={name:``,required:!1,relationType:`many-to-one`,relatedTable:``,relatedSlug:``,targetField:``,allowedTypes:[],arrayFields:[]};function mO({open:e,onOpenChange:t,existingNames:n,availableContentTypes:r,stringFields:i,initialField:a,onConfirm:o}){let[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(pO),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),b=!!a;(0,v.useEffect)(()=>{e?a&&(c(cO.find(e=>e.type===a.type&&(e.subtype??void 0)===(a.subtype??void 0))??null),u({name:a.name,required:a.required??!1,relationType:a.relationType??`many-to-one`,relatedTable:a.relatedTable??``,relatedSlug:a.relatedSlug??``,targetField:a.targetField??``,allowedTypes:a.allowedTypes??[],arrayFields:a.arrayFields??[]})):(c(null),u(pO),f(``),m(null),g(``),y(``))},[e,a]);function x(e){t(e)}function S(e){c(e),u(pO),f(``),m(null),g(``),y(``)}function C(){b||(c(null),u(pO),f(``),m(null),g(``),y(``))}function w(){m({...sO}),g(``)}function T(e){m(t=>t?{...t,type:e.type,subtype:e.subtype,width:oO[e.type]}:{...sO,type:e.type,subtype:e.subtype,width:oO[e.type]})}function E(){if(!p)return;let e=p.name.trim();if(!e){g(`Name is required`);return}if(!/^[a-z][a-z0-9_]*$/.test(e)){g(`Lowercase letters, digits and underscores only`);return}if(fO(e)){g(`This name is reserved by SQL. Choose another one.`);return}if(l.arrayFields.some(t=>t.name===e)){g(`A sub-field with this name already exists`);return}let t={name:e,type:p.type,subtype:p.subtype,required:p.required||void 0,allowedTypes:p.type===`media`&&p.allowedTypes.length>0?p.allowedTypes:void 0,width:p.width};u(e=>({...e,arrayFields:[...e.arrayFields,t]})),m(null),g(``)}function D(e){u(t=>({...t,arrayFields:t.arrayFields.filter(t=>t.name!==e)}))}function O(e,t){u(n=>({...n,arrayFields:n.arrayFields.map((n,r)=>r===e?{...n,name:t}:n)})),y(``)}function k(){let e=l.arrayFields.map(e=>e.name.trim());return e.some(e=>!e)?(y(`All sub-fields must have a name.`),!1):e.some(e=>!/^[a-z][a-z0-9_]*$/.test(e))?(y(`Sub-field names must use lowercase letters, digits and underscores.`),!1):e.some(e=>fO(e))?(y(`One or more sub-field names are reserved by SQL.`),!1):new Set(e).size===e.length?!0:(y(`Sub-field names must be unique.`),!1)}function A(){let e=l.name.trim();return e?/^[a-z][a-z0-9_]*$/.test(e)?fO(e)?(f(`This name is reserved by SQL. Choose another one.`),!1):n.includes(e)&&e!==a?.name?(f(`A field with this name already exists`),!1):!0:(f(`Lowercase letters, digits and underscores only`),!1):(f(`Name is required`),!1)}function j(){!s||!A()||s.type===`array`&&!k()||(o({name:l.name.trim(),type:s.type,subtype:s.subtype,required:l.required||void 0,relationType:s.type===`relation`?l.relationType:void 0,relatedTable:s.type===`relation`?l.relatedTable:void 0,relatedSlug:s.type===`relation`?l.relatedSlug:void 0,targetField:s.type===`uid`?l.targetField:void 0,allowedTypes:s.type===`media`&&l.allowedTypes.length>0?l.allowedTypes:s.type===`media-gallery`?[`image`]:void 0,arrayFields:s.type===`array`?l.arrayFields.map(e=>({...e,name:e.name.trim()})):void 0,width:a?.width??eO[s.type]}),x(!1))}let M=!!s,N=s?.label.replace(/\s*\(.*?\)/,``)??``,P=b?`Edit field`:M?`${N} field`:`Add a field`;return(0,H.jsx)(ZC,{open:e,onOpenChange:x,children:(0,H.jsxs)(tw,{className:M?s?.type===`array`?`max-w-lg`:`max-w-md`:`max-w-3xl`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M&&!b&&(0,H.jsx)(`button`,{type:`button`,onClick:C,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Sa,{className:`size-4`})}),(0,H.jsx)(iw,{children:P})]})}),!M&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 pt-1`,children:cO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>!e.disabled&&S(e),className:`flex flex-col items-start gap-2 rounded-lg border border-border p-3 text-left transition-colors hover:border-primary hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,H.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md ${e.bg}`,children:(0,H.jsx)(t,{className:`size-4 ${e.color}`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.disabled?`Coming soon`:e.description})]})]},n)})}),M&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 pt-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`field-name`,children:`Field name`}),(0,H.jsx)(Ev,{id:`field-name`,placeholder:`e.g. article_title`,value:l.name,autoFocus:!0,onChange:e=>{u(t=>({...t,name:e.target.value})),f(``)},onKeyDown:e=>{e.key===`Enter`&&j()}}),d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:d}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits and underscores. Must start with a letter.`})]}),s?.type===`media`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Allowed file types`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground -mt-1`,children:`Leave all unchecked to allow any file type.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:lO.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`media-type-${e}`,checked:l.allowedTypes.includes(e),onCheckedChange:t=>u(n=>({...n,allowedTypes:t?[...n.allowedTypes,e]:n.allowedTypes.filter(t=>t!==e)}))}),(0,H.jsx)(Y,{htmlFor:`media-type-${e}`,className:`cursor-pointer font-normal`,children:t})]},e))})]}),s?.type===`array`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(Y,{children:`Sub-fields`}),!p&&(0,H.jsxs)(`button`,{type:`button`,onClick:w,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,H.jsx)(yo,{className:`size-3`}),`Add sub-field`]})]}),l.arrayFields.length===0&&!p&&(0,H.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-xs text-muted-foreground`,children:`No sub-fields yet. Add at least one to make this field useful.`}),l.arrayFields.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-1.5`,children:l.arrayFields.map((e,t)=>{let n=aO.find(t=>t.type===e.type&&(t.subtype??void 0)===(e.subtype??void 0)),r=n?.icon??No;return(0,H.jsxs)(`div`,{className:`${$D[e.width??`full`]} flex items-center gap-1.5 rounded-md border border-dashed border-border p-2`,children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${n?.bg??`bg-muted`}`,children:(0,H.jsx)(r,{className:`size-3 ${n?.color??`text-muted-foreground`}`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(Ev,{value:e.name,onChange:e=>O(t,e.target.value),className:`h-6 px-1.5 text-xs`}),(0,H.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:n?.label})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(e.name),className:`flex shrink-0 size-5 items-center justify-center rounded text-muted-foreground hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3`})})]},`subfield-${t}`)})}),_&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:_}),p&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:aO.map(e=>{let t=e.icon,n=`${e.type}${e.subtype??``}`;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>T(e),className:[`flex items-center gap-1.5 rounded-md border px-2 py-1.5 text-left transition-colors`,p.type===e.type&&(p.subtype??void 0)===(e.subtype??void 0)?`border-primary bg-accent`:`border-border hover:border-primary hover:bg-accent`].join(` `),children:[(0,H.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center rounded ${e.bg}`,children:(0,H.jsx)(t,{className:`size-3 ${e.color}`})}),(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.label})]},n)})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(Ev,{placeholder:`sub_field_name`,autoFocus:!0,value:p.name,onChange:e=>{m(t=>t&&{...t,name:e.target.value}),g(``)},onKeyDown:e=>{e.key===`Enter`&&E()}}),h&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:h})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(iO,{id:`subfield-required`,checked:p.required,onCheckedChange:e=>m(t=>t&&{...t,required:!!e})}),(0,H.jsx)(Y,{htmlFor:`subfield-required`,className:`cursor-pointer font-normal text-sm`,children:`Required`})]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>{m(null),g(``)},children:`Cancel`}),(0,H.jsx)(q,{size:`sm`,onClick:E,children:`Add`})]})]})]})]}),s?.type===`uid`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Source field`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The slug will be auto-generated from this field's value.`}),i.length>0?(0,H.jsxs)(ow,{value:l.targetField,onValueChange:e=>u(t=>({...t,targetField:e})),children:[(0,H.jsx)(lw,{children:(0,H.jsx)(cw,{placeholder:`Select a text field`})}),(0,H.jsx)(fw,{children:i.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))})]}):(0,H.jsx)(`p`,{className:`rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground`,children:`No short text fields available. Add a string field first.`})]}),s?.type===`relation`&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Relation type`}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:uO.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(t=>({...t,relationType:e.value})),className:`flex items-start gap-3 rounded-md border px-3 py-2 text-left transition-colors hover:border-primary ${l.relationType===e.value?`border-primary bg-accent`:`border-border`}`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium leading-none`,children:e.label}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description})]})},e.value))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Related content type`}),r.length>0?(0,H.jsxs)(ow,{value:l.relatedTable,onValueChange:e=>{let t=r.find(t=>t.tableName===e);u(n=>({...n,relatedTable:e,relatedSlug:t?.slug??``}))},children:[(0,H.jsx)(lw,{children:(0,H.jsx)(cw,{placeholder:`Select a content type`})}),(0,H.jsx)(fw,{children:r.map(e=>(0,H.jsx)(mw,{value:e.tableName,children:e.name},e.tableName))})]}):(0,H.jsx)(Ev,{placeholder:`table_name`,value:l.relatedTable,onChange:e=>u(t=>({...t,relatedTable:e.target.value}))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`field-required`,checked:l.required,onCheckedChange:e=>u(t=>({...t,required:!!e}))}),(0,H.jsx)(Y,{htmlFor:`field-required`,className:`cursor-pointer font-normal`,children:`Required field`})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border pt-3`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>x(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:j,children:b?`Save changes`:`Add field`})]})]})]})})}function hO(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function gO(e){return e.replace(/-/g,`_`)}function _O({field:e,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=JD({id:e.name});return(0,H.jsx)(`div`,{ref:s,style:{transform:sT.Transform.toString(c),transition:l,opacity:u?.5:1},className:$D[e.width??`full`],children:(0,H.jsx)(rO,{field:e,dragListeners:o,dragAttributes:a,onWidthChange:t,onArraySubFieldWidthChange:n,onEdit:r,onDelete:i})})}function vO(){let{slug:e}=rr(),t=$n(),n=!e,{user:r}=ia(),i=r?.permissions??[],a=i.includes(`*`)||i.includes(`content-types:delete`),{data:o,loading:s}=fa(n?``:`/cms/admin/content-types/${e}`),{data:c,refetch:l}=fa(`/cms/admin/content-types`),{loading:u,request:d}=Tv(),{loading:f,request:p}=Tv(),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`collection`),[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(!1),k=(0,v.useRef)({name:``,slug:``,fields:`[]`});(0,v.useEffect)(()=>(window.addEventListener(`plank:content-types-changed`,l),()=>window.removeEventListener(`plank:content-types-changed`,l)),[l]),(0,v.useEffect)(()=>{if(n){h(``),_(``),b(`collection`),S([]),k.current={name:``,slug:``,fields:`[]`};return}o&&(h(o.name),_(o.slug),b(o.kind??`collection`),S(o.fields),k.current={name:o.name,slug:o.slug,fields:JSON.stringify(o.fields)})},[o,n]),(0,v.useEffect)(()=>{n&&m&&_(hO(m))},[n,m]);let A=m!==k.current.name||JSON.stringify(x)!==k.current.fields,j=(0,v.useRef)(!1),M=Cr((0,v.useCallback)(()=>j.current?!1:A,[A])),N=CT(ST(CE,{activationConstraint:{distance:5}}));function P(e){let{active:t,over:n}=e;!n||t.id===n.id||S(e=>kD(e,e.findIndex(e=>e.name===t.id),e.findIndex(e=>e.name===n.id)))}function F(e){S(t=>[...t,e])}function I(e){S(t=>t.map(t=>t.name===T?.name?e:t)),E(null)}function L(e){S(t=>t.filter(t=>t.name!==e))}function R(e,t){S(n=>n.map(n=>n.name===e?{...n,width:t}:n))}function ee(e,t,n){S(r=>r.map(r=>r.name!==e||r.type!==`array`||!r.arrayFields?r:{...r,arrayFields:r.arrayFields.map(e=>e.name===t?{...e,width:n}:e)}))}async function te(){if(!m.trim()||!g.trim())return;let r=n?{name:m.trim(),slug:g,kind:y,tableName:gO(g),fields:x}:{name:m.trim(),slug:g,tableName:gO(g),fields:x};try{let i=await d(n?`/cms/admin/content-types`:`/cms/admin/content-types/${e}`,n?`POST`:`PUT`,r);h(i.name),_(i.slug),S(i.fields),k.current={name:i.name,slug:i.slug,fields:JSON.stringify(i.fields)},window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),(n||i.slug!==e)&&(j.current=!0,t(`/content-types/${i.slug}`,{replace:!0}))}catch{}}async function ne(){if(a)try{await p(`/cms/admin/content-types/${e}`,`DELETE`),window.dispatchEvent(new CustomEvent(`plank:content-types-changed`)),t(`/content-types`,{replace:!0})}catch{}}let z=(c??[]).filter(t=>t.slug!==e).map(e=>({tableName:e.tableName,slug:e.slug,name:e.name})),B=x.filter(e=>e.type===`string`),re=x.map(e=>e.name);return ZD(`mod+s`,te,{enabled:A&&!u&&!!m.trim(),label:`Save content type`}),ZD(`mod+k`,()=>w(!0),{label:`Add field`}),!n&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Content type name`,className:`bg-transparent text-2xl font-bold outline-none placeholder:text-muted-foreground/40 -mt-2`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`API ID:`}),(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g||`—`})]}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>b(`collection`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`collection`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(mo,{className:`size-3`}),`Collection`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>b(`single`),className:`flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium transition-colors ${y===`single`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(Ka,{className:`size-3`}),`Single`]})]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-muted-foreground ${y===`single`?`border-violet-500/30 bg-violet-500/10 text-violet-600 dark:text-violet-400`:``}`,children:[y===`single`?(0,H.jsx)(Ka,{className:`size-3`}):(0,H.jsx)(mo,{className:`size-3`}),y===`single`?`Single`:`Collection`]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!n&&a&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>O(!0),disabled:f,children:(0,H.jsx)(Mo,{className:`size-4`})}),(0,H.jsxs)(q,{onClick:te,disabled:!A||u||!m.trim(),children:[u?(0,H.jsx)(iy,{className:`size-4`}):null,`Save`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[x.length>0?(()=>{let e=x.filter(e=>e.relationType!==`one-to-many`),t=x.filter(e=>e.relationType===`one-to-many`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.length>0&&(0,H.jsx)(bD,{sensors:N,collisionDetection:AT,onDragEnd:P,children:(0,H.jsx)(BD,{items:e.map(e=>e.name),strategy:ID,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:e.map(e=>(0,H.jsx)(_O,{field:e,onWidthChange:t=>R(e.name,t),onArraySubFieldWidthChange:(t,n)=>ee(e.name,t,n),onEdit:()=>E(e),onDelete:()=>L(e.name)},e.name))})})}),t.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:t.map(e=>(0,H.jsx)(`div`,{className:`col-span-6`,children:(0,H.jsx)(rO,{field:e})},e.name))})]})})():(0,H.jsx)(Ow,{className:`border`,children:(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No fields yet`}),(0,H.jsx)(Nw,{children:`Add your first field to define this content type's structure.`})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(q,{variant:`outline`,onClick:()=>w(!0),className:`gap-2`,children:[(0,H.jsx)(yo,{className:`size-4`}),`Add field`]})}),(0,H.jsx)(mO,{open:C,onOpenChange:w,existingNames:re,availableContentTypes:z,stringFields:B,onConfirm:F}),(0,H.jsx)(mO,{open:!!T,onOpenChange:e=>{e||E(null)},existingNames:re,availableContentTypes:z,stringFields:B,initialField:T??void 0,onConfirm:I}),(0,H.jsx)(ZC,{open:D,onOpenChange:O,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete "`,m,`"?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will permanently delete the content type and all its entries. This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>O(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:ne,disabled:f,children:[f?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:M.state===`blocked`,onOpenChange:()=>M.reset?.(),children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You have unsaved changes. Leave without saving?`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>M.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>M.proceed?.(),children:`Leave`})]})]})})]})]})}function yO(){let{pathname:e}=Xn(),{data:t,loading:n,error:r,refetch:i}=fa(`/cms/admin/content-types`),{request:a}=Tv();async function o(e,t){e.preventDefault(),e.stopPropagation(),await a(`/cms/admin/content-types/${t}/default`,`PUT`),i()}function s(t){return e===`/content/${t}`||e.startsWith(`/content/${t}/`)}let c=(t??[]).filter(e=>e.kind===`collection`),l=(t??[]).filter(e=>e.kind===`single`);return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Content`})}),n&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}),r&&(0,H.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:r}),!n&&!r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Collection Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:c.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No collection types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:c.map(e=>(0,H.jsxs)(Fi,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,s(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,H.jsx)(`button`,{type:`button`,title:e.isDefault?`Default content type`:`Set as default`,onClick:t=>o(t,e.slug),className:[`shrink-0 rounded transition-colors`,e.isDefault?`text-amber-400`:`text-transparent group-hover:text-muted-foreground/40 hover:!text-amber-400`].join(` `),children:(0,H.jsx)(Do,{className:`size-3.5 ${e.isDefault?`fill-amber-400`:``}`})})]},e.slug))})})]}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-sidebar-border`}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-4 py-2`,children:(0,H.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60`,children:`Single Types`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:l.length===0?(0,H.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:`No single types yet.`}):(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:l.map(e=>(0,H.jsx)(Fi,{to:`/content/${e.slug}`,className:[`group flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,s(e.slug)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})},e.slug))})})]})]})]})}function bO(){return Tw((0,H.jsx)(yO,{})),(0,H.jsx)(Br,{})}function xO(){let e=$n(),{data:t,loading:n}=fa(`/cms/admin/content-types`);return(0,v.useEffect)(()=>{!t||t.length===0||e(`/content/${(t.find(e=>e.isDefault)??t[0]).slug}`,{replace:!0})},[t,e]),n||t&&t.length>0?null:(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(oo,{})}),(0,H.jsx)(Mw,{children:`No content types yet`}),(0,H.jsx)(Nw,{children:`Create a content type in the Builder before managing content.`})]}),(0,H.jsx)(Pw,{children:(0,H.jsx)(q,{onClick:()=>e(`/content-types/new`),children:`Go to Builder`})})]})}var SO=ls(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col [&>*]:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`[&>[data-slot=field-label]]:flex-auto`,`has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto`,`@md/field-group:[&>[data-slot=field-label]]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}});function CO({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(SO({orientation:t}),e),...n})}function wO({className:e,...t}){return(0,H.jsx)(Y,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4`,`has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10`,e),...t})}function TO({className:e,...t}){return(0,H.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,"data-slot":`pagination`,className:K(`mx-auto flex w-full justify-center`,e),...t})}function EO({className:e,...t}){return(0,H.jsx)(`ul`,{"data-slot":`pagination-content`,className:K(`flex flex-row items-center gap-1`,e),...t})}function DO({...e}){return(0,H.jsx)(`li`,{"data-slot":`pagination-item`,...e})}function OO({className:e,isActive:t,size:n=`icon`,...r}){return(0,H.jsx)(`a`,{"aria-current":t?`page`:void 0,"data-slot":`pagination-link`,"data-active":t,className:K(Pc({variant:t?`outline`:`ghost`,size:n}),e),...r})}function kO({className:e,...t}){return(0,H.jsxs)(OO,{"aria-label":`Go to previous page`,size:`default`,className:K(`gap-1 px-2.5 sm:pl-2.5`,e),...t,children:[(0,H.jsx)(ka,{}),(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Previous`})]})}function AO({className:e,...t}){return(0,H.jsxs)(OO,{"aria-label":`Go to next page`,size:`default`,className:K(`gap-1 px-2.5 sm:pr-2.5`,e),...t,children:[(0,H.jsx)(`span`,{className:`hidden sm:block`,children:`Next`}),(0,H.jsx)(Aa,{})]})}function jO({page:e,totalPages:t,limit:n,onPageChange:r,onLimitChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsxs)(CO,{orientation:`horizontal`,className:`w-fit`,children:[(0,H.jsx)(wO,{htmlFor:`select-rows-per-page`,children:`Rows per page`}),(0,H.jsxs)(ow,{value:String(n),onValueChange:e=>i(Number(e)),children:[(0,H.jsx)(lw,{className:`w-20`,id:`select-rows-per-page`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{align:`start`,children:(0,H.jsxs)(sw,{children:[(0,H.jsx)(mw,{value:`10`,children:`10`}),(0,H.jsx)(mw,{value:`30`,children:`30`}),(0,H.jsx)(mw,{value:`50`,children:`50`}),(0,H.jsx)(mw,{value:`70`,children:`70`}),(0,H.jsx)(mw,{value:`100`,children:`100`})]})})]})]}),(0,H.jsx)(TO,{className:`mx-0 w-auto`,children:(0,H.jsxs)(EO,{children:[(0,H.jsx)(DO,{children:(0,H.jsx)(kO,{href:`#`,onClick:t=>{t.preventDefault(),e>1&&r(e-1)},"aria-disabled":e===1,className:e===1?`pointer-events-none opacity-50`:``})}),(0,H.jsx)(DO,{children:(0,H.jsx)(AO,{href:`#`,onClick:n=>{n.preventDefault(),e<t&&r(e+1)},"aria-disabled":e===t,className:e===t?`pointer-events-none opacity-50`:``})})]})})]})}var MO=4,NO={field:`created_at`,dir:`desc`},PO=[{name:`created_at`,label:`Created`},{name:`updated_at`,label:`Updated`},{name:`published_at`,label:`Published`}];function FO(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function IO(e){return e.find(e=>e.name===`title`)?.name??e.find(e=>e.name===`name`)?.name??e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}function LO(e){if(Array.isArray(e))return e.map(e=>String(e??``).trim()).filter(Boolean);let t=String(e??``).trim();return t?[t]:[]}function RO({relatedSlug:e,value:t,displayField:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1),s=LO(t);return(0,v.useEffect)(()=>{let r=LO(t);if(!e||r.length===0){i([]);return}let a=!1;o(!0);let s=localStorage.getItem(`plank_token`),c=s?{Authorization:`Bearer ${s}`}:{};return(n?Promise.resolve(n):fetch(`/cms/admin/content-types/${e}`,{headers:c}).then(e=>e.ok?e.json():null).then(e=>IO(e?.fields??[])).catch(()=>null)).then(t=>Promise.all(r.map(n=>fetch(`/cms/admin/entries/${e}/${n}`,{headers:c}).then(e=>e.ok?e.json():null).then(e=>e?String((t&&e[t])??e.title??e.name??n):n).catch(()=>n)))).then(e=>{a||i(e.filter(Boolean))}).catch(()=>{a||i(r)}).finally(()=>{a||o(!1)}),()=>{a=!0}},[e,n,t]),s.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a&&r.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`…`}):(0,H.jsx)(`span`,{className:`font-medium truncate max-w-50 block`,children:r.join(`, `)})}function zO(e){return{visibleFields:e.slice(0,MO).map(e=>e.name),sort:NO}}function BO(e,t){if(!e)return zO(t);let n=(e.visibleFields??[]).filter(e=>{let n=String(e).split(`.`)[0];return t.some(e=>e.name===n)});return{visibleFields:n.length>0?n:t.slice(0,MO).map(e=>e.name),sort:e.sort??NO}}async function VO(e){let t=localStorage.getItem(`plank_token`),n=await fetch(`/cms/admin/users/me/prefs/view_${e}`,{headers:t?{Authorization:`Bearer ${t}`}:{}});if(!n.ok)return null;let{value:r}=await n.json();return r}async function HO(e,t){let n=localStorage.getItem(`plank_token`);await fetch(`/cms/admin/users/me/prefs/view_${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`,...n?{Authorization:`Bearer ${n}`}:{}},body:JSON.stringify({value:t})})}function UO({value:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e.startsWith(`http`)){n(e);return}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(e=>n(e?.url??null)).catch(()=>{})},[e]),t?/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(t)?(0,H.jsx)(`img`,{src:t,alt:``,className:`size-8 object-cover`}):(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,H.jsx)(Ka,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate max-w-30`,children:`File`})]}):(0,H.jsx)(ro,{className:`size-4 text-muted-foreground`})}function WO({field:e,value:t,displayField:n}){let{timezone:r}=sa();if(t==null||t===``)return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`boolean`)return t?(0,H.jsx)(Da,{className:`size-4 text-primary`}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});if(e.type===`datetime`)return(0,H.jsx)(`span`,{children:cy(String(t),r)});if(e.type===`number`)return(0,H.jsx)(`span`,{children:String(t)});if(e.type===`media`)return(0,H.jsx)(UO,{value:String(t)});if(e.type===`relation`)return(0,H.jsx)(RO,{relatedSlug:e.relatedSlug,value:t,displayField:n});if(e.type===`text`||e.type===`richtext`){let e=String(t);return(0,H.jsx)(`span`,{className:`text-muted-foreground truncate max-w-50 block`,children:e.length>60?e.slice(0,60)+`…`:e})}let i=String(t);return(0,H.jsx)(`span`,{className:e.type===`uid`?`font-mono text-xs text-muted-foreground truncate max-w-40 block`:`font-medium truncate max-w-50 block`,children:i.length>60?i.slice(0,60)+`…`:i})}function GO({entry:e}){let t=e._author_first_name,n=e._author_last_name,r=t||n?[t,n].filter(Boolean).join(` `):null,i=(0,H.jsx)(ul,{avatarUrl:e._author_avatar_url,firstName:t,lastName:n,className:`size-7`,fallbackClassName:`text-[10px]`});return r?(0,H.jsxs)(yv,{children:[(0,H.jsx)(bv,{asChild:!0,children:i}),(0,H.jsx)(xv,{children:r})]}):i}function KO({entry:e,fields:t}){let{timezone:n}=sa();if(e.status===`scheduled`)return(0,H.jsxs)(XC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(wa,{className:`size-3 mr-1`}),e.scheduled_for?sy(e.scheduled_for,n):`Scheduled`]});if(e.status===`draft`)return(0,H.jsx)(XC,{variant:`outline`,children:`Draft`});let r=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=new Date(e);return isNaN(t.getTime())?e:t.toISOString()}return e};return(0,H.jsx)(XC,{variant:e.published_data!=null&&t.some(t=>JSON.stringify(r(e[t.name],t.type))!==JSON.stringify(r(e.published_data[t.name],t.type)))?`secondary`:`default`,children:`Published`})}function qO({open:e,onOpenChange:t,allFields:n,config:r,onApply:i}){let[a,o]=(0,v.useState)(r.visibleFields),[s,c]=(0,v.useState)(r.sort);(0,v.useEffect)(()=>{e&&(o(r.visibleFields),c(r.sort))},[e,r]);let l=n.filter(e=>!a.some(t=>t.split(`.`)[0]===e.name));function u({fieldName:e}){let t=e.split(`.`)[0],r=n.find(e=>e.name===t)?.relatedSlug,{data:i}=fa(r?`/cms/admin/content-types/${r}`:null),s=a.find(e=>e.split(`.`)[0]===t),c=s&&s.includes(`.`)?s.split(`.`)[1]:void 0;function l(e,t){o(n=>n.map(n=>n.split(`.`)[0]===e?t?`${e}.${t}`:e:n))}return(0,v.useEffect)(()=>{if(!i?.fields||c)return;let e=[`title`,`name`],n=i.fields.find(t=>e.includes(t.name))||i.fields[0];n&&l(t,n.name)},[i,c,t]),i?.fields?(0,H.jsxs)(ow,{value:c,onValueChange:e=>l(t,e),children:[(0,H.jsx)(lw,{className:`h-8 text-sm w-32`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{children:i.fields.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.name},e.name))})]}):null}function d(e,t){o(n=>{let r=n.indexOf(e);if(r===-1)return n;let i=[...n],a=r+t;return a<0||a>=i.length?n:([i[r],i[a]]=[i[a],i[r]],i)})}function f(e){o(t=>[...t,e])}function p(e){o(t=>t.filter(t=>t!==e))}let m=[...PO,...n.filter(e=>![`media`,`text`,`richtext`,`relation`].includes(e.type)).map(e=>({name:e.name,label:FO(e.name)}))];return(0,H.jsx)(ZC,{open:e,onOpenChange:t,children:(0,H.jsxs)(tw,{className:`max-w-md h-[80vh] flex flex-col`,children:[(0,H.jsx)(nw,{className:`flex-none`,children:(0,H.jsx)(iw,{children:`Configure the view`})}),(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 gap-5 py-1`,children:[(0,H.jsxs)(`div`,{className:`flex-none`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Displayed fields`}),a.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-2`,children:`No fields selected.`}):(0,H.jsx)(`ul`,{className:`space-y-1`,children:a.map((e,t)=>{let r=String(e).split(`.`)[0],i=n.find(e=>e.name===r);return(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`flex-1 font-medium`,children:FO(r)}),i&&(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.type}),i&&i.type===`relation`&&(0,H.jsx)(`div`,{className:`ml-2`,children:(0,H.jsx)(u,{fieldName:e})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===0,onClick:()=>d(e,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:t===a.length-1,onClick:()=>d(e,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>p(e),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Na,{className:`size-3.5`})})]},e)})})]}),l.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide flex-none`,children:`Available fields`}),(0,H.jsx)(`ul`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0`,children:l.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md border border-dashed px-3 py-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`flex-1`,children:FO(e.name)}),(0,H.jsx)(`span`,{className:`text-xs`,children:e.type}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(e.name),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(Pa,{className:`size-3.5`})})]},e.name))})]}),(0,H.jsxs)(`div`,{className:`flex-none`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Sort entries`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(ow,{value:s.field,onValueChange:e=>c(t=>({...t,field:e})),children:[(0,H.jsx)(lw,{className:`h-8 text-sm`,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{children:m.map(e=>(0,H.jsx)(mw,{value:e.name,children:e.label},e.name))})]}),(0,H.jsxs)(ow,{value:s.dir,onValueChange:e=>c(t=>({...t,dir:e})),children:[(0,H.jsx)(lw,{className:`h-8 text-sm`,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`asc`,children:`Ascending`}),(0,H.jsx)(mw,{value:`desc`,children:`Descending`})]})]})]})]})]}),(0,H.jsxs)(rw,{className:`flex-none`,children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:()=>{i({visibleFields:a,sort:s}),t(!1)},children:`Apply`})]})]})})}function JO(){let{slug:e}=rr(),t=$n(),{timezone:n}=sa(),{user:r}=ia(),[i,a]=Hi(),o=Math.max(1,Number(i.get(`page`)??1)),s=[10,30,50,70,100].includes(Number(i.get(`limit`)))?Number(i.get(`limit`)):10;function c(e){a(t=>(t.set(`page`,String(e)),t),{replace:!0})}function l(e){a(t=>(t.set(`limit`,String(e)),t.set(`page`,`1`),t),{replace:!0})}let[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),{loading:C,request:w}=Tv(),{data:T,loading:E}=fa(e?`/cms/admin/content-types/${e}`:null);(0,v.useEffect)(()=>{!T||!e||VO(e).then(e=>h(BO(e,T.fields))).catch(()=>h(zO(T.fields)))},[T?.slug]),(0,v.useEffect)(()=>{_(new Set)},[o,s]);let D=m??{visibleFields:T?.fields.slice(0,MO).map(e=>e.name)??[],sort:NO},{sort:O}=D,k=(D.visibleFields??[]).map(e=>{let t=String(e).split(`.`),n=t[0],r=t[1],i=T?.fields.find(e=>e.name===n);return i?{field:i,displayField:r}:null}).filter(Boolean),{data:A,loading:j,refetch:M}=fa(e&&m?`/cms/admin/content-types/${e}/entries?page=${o}&limit=${s}&sort=${O.field}&order=${O.dir}`:null);async function N(){!u||!e||(await w(`/cms/admin/entries/${e}/${u}`,`DELETE`),d(null),M())}let P=r?.permissions??[],F=P.includes(`*`)||P.includes(`entries:write`),I=P.includes(`*`)||P.includes(`entries:delete`),L=(A?.data??[]).map(e=>e.id),R=L.length>0&&L.every(e=>g.has(e)),ee=!R&&L.some(e=>g.has(e));function te(){_(e=>{let t=new Set(e);return R?L.forEach(e=>t.delete(e)):L.forEach(e=>t.add(e)),t})}function ne(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function z(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all([...g].map(t=>fetch(`/cms/admin/entries/${e}/${t}/status`,{method:`PATCH`,headers:n,body:JSON.stringify({status:`draft`})}))),_(new Set),M()}finally{b(!1)}}}async function B(){if(!(!e||y)){b(!0);try{let t=localStorage.getItem(`plank_token`),n={...t?{Authorization:`Bearer ${t}`}:{}};await Promise.all([...g].map(t=>fetch(`/cms/admin/entries/${e}/${t}`,{method:`DELETE`,headers:n}))),S(!1),_(new Set),M()}finally{b(!1)}}}function re(t){h(t),e&&HO(e,t).catch(()=>{}),c(1)}if(E||!m)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!T)return null;let V=Math.ceil((A?.total??0)/(A?.limit??20));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-6`,children:T.name}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>p(!0),className:`gap-1.5`,children:[(0,H.jsx)(wo,{className:`size-3.5`}),`Configure the view`]}),F&&(0,H.jsxs)(q,{onClick:()=>t(`/content/${e}/new`),className:`gap-2`,children:[(0,H.jsx)(yo,{className:`size-4`}),`New entry`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[j&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading entries…`})]}),!j&&(A?.data??[]).length===0&&(0,H.jsxs)(Ow,{className:`border`,children:[(0,H.jsxs)(kw,{children:[(0,H.jsx)(jw,{variant:`icon`,children:(0,H.jsx)(Ga,{})}),(0,H.jsx)(Mw,{children:`No entries yet`}),(0,H.jsxs)(Nw,{children:[`Create your first entry for `,T.name,`.`]})]}),(0,H.jsx)(Pw,{children:F&&(0,H.jsx)(q,{onClick:()=>t(`/content/${e}/new`),children:`New entry`})})]}),!j&&(A?.data??[]).length>0&&(0,H.jsxs)(vv,{children:[g.size>0&&(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-4 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[g.size,` selected`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,H.jsxs)(q,{variant:`outline`,size:`sm`,disabled:y,onClick:z,children:[y?(0,H.jsx)(iy,{className:`size-3.5`}):null,`Unpublish`]}),I&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:y,onClick:()=>S(!0),children:[(0,H.jsx)(Mo,{className:`size-3.5`}),`Delete`]})]})]}),(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,H.jsxs)(gw,{className:`w-full`,children:[(0,H.jsx)(_w,{className:`border-b border-border font-bold uppercase`,children:(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`w-10 px-4 py-3`,children:(0,H.jsx)(iO,{checked:R?!0:ee?`indeterminate`:!1,onCheckedChange:te,"aria-label":`Select all`})}),k.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:FO(e.field.name)},e.field.name)),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Created`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Updated`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Pub / Sch`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Status`}),(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:`Author`}),(0,H.jsx)(bw,{className:`px-4 py-3`})]})}),(0,H.jsx)(vw,{className:`divide-y divide-border`,children:(A?.data??[]).map(r=>(0,H.jsxs)(yw,{className:`group transition-colors ${g.has(r.id)?`bg-muted/40`:`hover:bg-muted/30`}`,children:[(0,H.jsx)(xw,{className:`w-10 px-4 py-3`,children:(0,H.jsx)(iO,{checked:g.has(r.id),onCheckedChange:()=>ne(r.id),"aria-label":`Select row`})}),k.map(e=>{let t=r[e.field.name],n=t;return e.field.type===`relation`?n=t:e.displayField&&(n=t&&typeof t==`object`?t[e.displayField]:t&&typeof t==`object`?t.title:t),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(WO,{field:e.field,value:n,displayField:e.displayField})},e.field.name)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sy(r.created_at,n)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:sy(r.updated_at,n)}),(0,H.jsx)(xw,{className:`px-4 py-3 text-muted-foreground whitespace-nowrap`,children:r.status===`scheduled`&&r.scheduled_for?sy(r.scheduled_for,n):r.published_at?sy(r.published_at,n):`—`}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(KO,{entry:r,fields:T.fields})}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsx)(GO,{entry:r})}),(0,H.jsx)(xw,{className:`px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>t(`/content/${e}/${r.id}`),className:`flex size-8 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,H.jsx)(vo,{className:`size-3.5`})}),I&&(0,H.jsx)(q,{size:`icon`,variant:`ghost`,onClick:()=>d(r.id),className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})})]},r.id))})]})}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(jO,{page:o,totalPages:V,limit:s,onPageChange:c,onLimitChange:l})})]}),m&&(0,H.jsx)(qO,{open:f,onOpenChange:p,allFields:T.fields,config:m,onApply:re}),(0,H.jsx)(ZC,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>d(null),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:N,disabled:C,children:[C?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:x,onOpenChange:e=>{e||S(!1)},children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete `,g.size,` `,g.size===1?`entry`:`entries`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>S(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:B,disabled:y,children:[y?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function YO(){let{slug:e}=rr(),t=$n(),{user:n}=ia(),{data:r,loading:i}=fa(e?`/cms/admin/content-types/${e}`:null),a=r?.kind===`single`,{data:o,loading:s,error:c}=fa(a&&e?`/cms/admin/content-types/${e}/single`:null);return(0,v.useEffect)(()=>{if(!a||s)return;let r=n?.role?.toLowerCase()===`user`;o?t(`/content/${e}/${o.id}`,{replace:!0}):c&&!r&&t(`/content/${e}/new`,{replace:!0})},[a,s,o,c,e,t,n?.role]),i||a&&s?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):a?o?null:(0,H.jsx)(`div`,{className:`py-12 text-sm text-muted-foreground`,children:`No entry is available for this Single Type.`}):(0,H.jsx)(JO,{})}var XO=365.2425,ZO=6048e5,QO=864e5,$O=3600*24;$O*7,$O*XO/12*3;var ek=Symbol.for(`constructDateFrom`);function tk(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ek in e?e[ek](t):e instanceof Date?new e.constructor(t):new Date(t)}function nk(e,t){return tk(t||e,e)}function rk(e,t,n){let r=nk(e,n?.in);return isNaN(t)?tk(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function ik(e,t,n){let r=nk(e,n?.in);if(isNaN(t))return tk(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=tk(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var ak={};function ok(){return ak}function sk(e,t){let n=ok(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=nk(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function ck(e,t){return sk(e,{...t,weekStartsOn:1})}function lk(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=tk(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=ck(i),o=tk(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=ck(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function uk(e){let t=nk(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function dk(e,...t){let n=tk.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function fk(e,t){let n=nk(e,t?.in);return n.setHours(0,0,0,0),n}function pk(e,t,n){let[r,i]=dk(n?.in,e,t),a=fk(r),o=fk(i),s=+a-uk(a),c=+o-uk(o);return Math.round((s-c)/QO)}function mk(e,t){let n=lk(e,t),r=tk(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),ck(r)}function hk(e,t,n){return rk(e,t*7,n)}function gk(e,t,n){return ik(e,t*12,n)}function _k(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=tk.bind(null,e));let t=nk(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),tk(r,n||NaN)}function vk(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=tk.bind(null,e));let t=nk(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),tk(r,n||NaN)}function yk(e,t,n){let[r,i]=dk(n?.in,e,t);return+fk(r)==+fk(i)}function bk(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function xk(e){return!(!bk(e)&&typeof e!=`number`||isNaN(+nk(e)))}function Sk(e,t,n){let[r,i]=dk(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ck(e,t){let n=nk(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function wk(e,t){let[n,r]=dk(e,t.start,t.end);return{start:n,end:r}}function Tk(e,t){let{start:n,end:r}=wk(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(tk(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Ek(e,t){let n=nk(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Dk(e,t){let n=nk(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Ok(e,t){let n=nk(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function kk(e,t){let{start:n,end:r}=wk(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(tk(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Ak(e,t){let n=ok(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=nk(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function jk(e,t){return Ak(e,{...t,weekStartsOn:1})}var Mk={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Nk=(e,t,n)=>{let r,i=Mk[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Pk(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Fk={date:Pk({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Pk({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Pk({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Ik={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Lk=(e,t,n,r)=>Ik[e];function Rk(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var zk={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Rk({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Rk({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Rk({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Rk({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Rk({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Bk(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Hk(s,e=>e.test(o)):Vk(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Vk(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Hk(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Uk(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Wk={code:`en-US`,formatDistance:Nk,formatLong:Fk,formatRelative:Lk,localize:zk,match:{ordinalNumber:Uk({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Bk({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Bk({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Bk({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Bk({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Bk({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gk(e,t){let n=nk(e,t?.in);return pk(n,Ok(n))+1}function Kk(e,t){let n=nk(e,t?.in),r=ck(n)-+mk(n);return Math.round(r/ZO)+1}function qk(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=ok(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=tk(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=sk(o,t),c=tk(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=sk(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Jk(e,t){let n=ok(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=qk(e,t),a=tk(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),sk(a,t)}function Yk(e,t){let n=nk(e,t?.in),r=sk(n,t)-+Jk(n,t);return Math.round(r/ZO)+1}function Xk(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var Zk={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Xk(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Xk(n+1,2)},d(e,t){return Xk(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Xk(e.getHours()%12||12,t.length)},H(e,t){return Xk(e.getHours(),t.length)},m(e,t){return Xk(e.getMinutes(),t.length)},s(e,t){return Xk(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Xk(Math.trunc(r*10**(n-3)),t.length)}},Qk={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},$k={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return Zk.y(e,t)},Y:function(e,t,n,r){let i=qk(e,r),a=i>0?i:1-i;return t===`YY`?Xk(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Xk(a,t.length)},R:function(e,t){return Xk(lk(e),t.length)},u:function(e,t){return Xk(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Xk(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Xk(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return Zk.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Xk(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Yk(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Xk(i,t.length)},I:function(e,t,n){let r=Kk(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Xk(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):Zk.d(e,t)},D:function(e,t,n){let r=Gk(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Xk(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Xk(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Xk(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Xk(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Qk.noon:r===0?Qk.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Qk.evening:r>=12?Qk.afternoon:r>=4?Qk.morning:Qk.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return Zk.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):Zk.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Xk(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Xk(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):Zk.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):Zk.s(e,t)},S:function(e,t){return Zk.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return tA(r);case`XXXX`:case`XX`:return nA(r);default:return nA(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return tA(r);case`xxxx`:case`xx`:return nA(r);default:return nA(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+eA(r,`:`);default:return`GMT`+nA(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+eA(r,`:`);default:return`GMT`+nA(r,`:`)}},t:function(e,t,n){return Xk(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Xk(+e,t.length)}};function eA(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Xk(a,2)}function tA(e,t){return e%60==0?(e>0?`-`:`+`)+Xk(Math.abs(e)/60,2):nA(e,t)}function nA(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Xk(Math.trunc(r/60),2),a=Xk(r%60,2);return n+i+t+a}var rA=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},iA=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},aA={p:iA,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return rA(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,rA(r,t)).replace(`{{time}}`,iA(i,t))}},oA=/^D+$/,sA=/^Y+$/,cA=[`D`,`DD`,`YY`,`YYYY`];function lA(e){return oA.test(e)}function uA(e){return sA.test(e)}function dA(e,t,n){let r=fA(e,t,n);if(console.warn(r),cA.includes(e))throw RangeError(r)}function fA(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var pA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,mA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,hA=/^'([^]*?)'?$/,gA=/''/g,_A=/[a-zA-Z]/;function vA(e,t,n){let r=ok(),i=n?.locale??r.locale??Wk,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=nk(e,n?.in);if(!xk(s))throw RangeError(`Invalid time value`);let c=t.match(mA).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=aA[t];return n(e,i.formatLong)}return e}).join(``).match(pA).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:yA(e)};if($k[t])return{isToken:!0,value:e};if(t.match(_A))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&uA(a)||!n?.useAdditionalDayOfYearTokens&&lA(a))&&dA(a,t,String(e));let o=$k[a[0]];return o(s,a,i.localize,l)}).join(``)}function yA(e){let t=e.match(hA);return t?t[1].replace(gA,`'`):e}function bA(e,t){let n=nk(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=tk(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function xA(e,t){return nk(e,t?.in).getMonth()}function SA(e,t){return nk(e,t?.in).getFullYear()}function CA(e,t){return+nk(e)>+nk(t)}function wA(e,t){return+nk(e)<+nk(t)}function TA(e,t,n){let[r,i]=dk(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function EA(e,t,n){let[r,i]=dk(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function DA(e,t,n){let r=nk(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=tk(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=bA(o);return r.setMonth(t,Math.min(a,s)),r}function OA(e,t,n){let r=nk(e,n?.in);return isNaN(+r)?tk(n?.in||e,NaN):(r.setFullYear(t),r)}function kA({className:e,...t}){return(0,H.jsx)(GC,{"data-slot":`tabs`,className:K(`flex flex-col gap-2`,e),...t})}function AA({className:e,...t}){return(0,H.jsx)(KC,{"data-slot":`tabs-list`,className:K(`inline-flex h-9 items-center justify-start rounded-lg bg-muted p-1 text-muted-foreground w-full`,e),...t})}function jA({className:e,...t}){return(0,H.jsx)(qC,{"data-slot":`tabs-trigger`,className:K(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow`,e),...t})}function MA({className:e,...t}){return(0,H.jsx)(JC,{"data-slot":`tabs-content`,className:K(`flex-1 outline-none`,e),...t})}function NA({className:e,...t}){return(0,H.jsx)(OC,{"data-slot":`switch`,className:K(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,children:(0,H.jsx)(kC,{className:K(`pointer-events-none block size-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})})}function PA(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var FA={},IA={};function LA(e,t){try{let n=(FA[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in IA?IA[n]:zA(n,n.split(`:`))}catch{if(e in IA)return IA[e];let t=e?.match(RA);return t?zA(e,t.slice(1)):NaN}}var RA=/([+-]\d\d):?(\d\d)?/;function zA(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return IA[e]=n*60+r>0?n*60+r+i:n*60-r-i}var BA=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(LA(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),WA(this,NaN),HA(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-LA(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),HA(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},VA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!VA.test(e))return;let t=e.replace(VA,`$1UTC`);BA.prototype[t]&&(e.startsWith(`get`)?BA.prototype[e]=function(){return this.internal[t]()}:(BA.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),UA(this),+this},BA.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),HA(this),+this}))});function HA(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-LA(e.timeZone,e)*60))}function UA(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),WA(e)}function WA(e){let t=LA(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(LA(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=LA(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=LA(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var GA=class e extends BA{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${PA(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},KA=5,qA=4;function JA(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,KA*7-1);return t.getMonth(e)===t.getMonth(a)?KA:qA}function YA(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function XA(e,t){let n=YA(e,t),r=JA(e,t);return t.addDays(n,r*7-1)}var ZA={...Wk,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>vA(e,t,{locale:Wk,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>vA(e,n,{locale:Wk,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>vA(e,t,{locale:Wk,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>vA(e,n,{locale:Wk,...t}),r(e,`cccc`)}}},QA=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?GA.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new GA(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):rk(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):ik(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):hk(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):gk(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):pk(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Sk(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Tk(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):kk(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):XA(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):jk(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Ck(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Ak(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Dk(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):vA(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):Kk(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):xA(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):SA(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):Yk(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):CA(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):wA(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):bk(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):yk(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):TA(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):EA(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):_k(e),this.min=e=>this.overrides?.min?this.overrides.min(e):vk(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):DA(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):OA(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):YA(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):fk(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):ck(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Ek(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):sk(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Ok(e),this.options={locale:ZA,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};QA.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var $A=new QA,ej=class{constructor(e,t,n=$A){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},tj=class{constructor(e,t){this.date=e,this.weeks=t}},nj=class{constructor(e,t){this.days=t,this.weekNumber=e}};function rj(e){return v.createElement(`button`,{...e})}function ij(e){return v.createElement(`span`,{...e})}function aj(e){let{size:t=24,orientation:n=`left`,className:r}=e;return v.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&v.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&v.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&v.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&v.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function oj(e){let{day:t,modifiers:n,...r}=e;return v.createElement(`td`,{...r})}function sj(e){let{day:t,modifiers:n,...r}=e,i=v.useRef(null);return v.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),v.createElement(`button`,{ref:i,...r})}var cj;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(cj||={});var lj;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(lj||={});var uj;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(uj||={});var dj;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(dj||={});function fj(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[cj.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return v.createElement(`span`,{"data-disabled":a.disabled,className:i[cj.DropdownRoot]},v.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>v.createElement(r.Option,{key:e,value:e,disabled:n},t))),v.createElement(`span`,{className:i[cj.CaptionLabel],"aria-hidden":!0},s?.label,v.createElement(r.Chevron,{orientation:`down`,size:18,className:i[cj.Chevron]})))}function pj(e){return v.createElement(`div`,{...e})}function mj(e){return v.createElement(`div`,{...e})}function hj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r},e.children)}function gj(e){let{calendarMonth:t,displayIndex:n,...r}=e;return v.createElement(`div`,{...r})}function _j(e){return v.createElement(`table`,{...e})}function vj(e){return v.createElement(`div`,{...e})}var yj=(0,v.createContext)(void 0);function bj(){let e=(0,v.useContext)(yj);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function xj(e){let{components:t}=bj();return v.createElement(t.Dropdown,{...e})}function Sj(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=bj(),u=(0,v.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,v.useCallback)(e=>{r&&t?.(e)},[r,t]);return v.createElement(`nav`,{...a},v.createElement(o.PreviousMonthButton,{type:`button`,className:s[cj.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},v.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[cj.Chevron],orientation:`left`})),v.createElement(o.NextMonthButton,{type:`button`,className:s[cj.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},v.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[cj.Chevron]})))}function Cj(e){let{components:t}=bj();return v.createElement(t.Button,{...e})}function wj(e){return v.createElement(`option`,{...e})}function Tj(e){let{components:t}=bj();return v.createElement(t.Button,{...e})}function Ej(e){let{rootRef:t,...n}=e;return v.createElement(`div`,{...n,ref:t})}function Dj(e){return v.createElement(`select`,{...e})}function Oj(e){let{week:t,...n}=e;return v.createElement(`tr`,{...n})}function kj(e){return v.createElement(`th`,{...e})}function Aj(e){return v.createElement(`thead`,{"aria-hidden":!0},v.createElement(`tr`,{...e}))}function jj(e){let{week:t,...n}=e;return v.createElement(`th`,{...n})}function Mj(e){return v.createElement(`th`,{...e})}function Nj(e){return v.createElement(`tbody`,{...e})}function Pj(e){let{components:t}=bj();return v.createElement(t.Dropdown,{...e})}var Fj=s({Button:()=>rj,CaptionLabel:()=>ij,Chevron:()=>aj,Day:()=>oj,DayButton:()=>sj,Dropdown:()=>fj,DropdownNav:()=>pj,Footer:()=>mj,Month:()=>hj,MonthCaption:()=>gj,MonthGrid:()=>_j,Months:()=>vj,MonthsDropdown:()=>xj,Nav:()=>Sj,NextMonthButton:()=>Cj,Option:()=>wj,PreviousMonthButton:()=>Tj,Root:()=>Ej,Select:()=>Dj,Week:()=>Oj,WeekNumber:()=>jj,WeekNumberHeader:()=>Mj,Weekday:()=>kj,Weekdays:()=>Aj,Weeks:()=>Nj,YearsDropdown:()=>Pj});function Ij(e,t,n=!1,r=$A){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function Lj(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Rj(e){return!!(e&&typeof e==`object`&&`from`in e)}function zj(e){return!!(e&&typeof e==`object`&&`after`in e)}function Bj(e){return!!(e&&typeof e==`object`&&`before`in e)}function Vj(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Hj(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Uj(e,t,n=$A){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(Hj(t,n))return t.some(t=>i(e,t));if(Rj(t))return Ij(t,e,!1,n);if(Vj(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Lj(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return zj(t)?a(e,t.after)>0:Bj(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function Wj(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[lj.focused]:[],[lj.outside]:[],[lj.disabled]:[],[lj.hidden]:[],[lj.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Uj(e,a,i)),S=!!(o&&Uj(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Uj(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[lj.focused]:!1,[lj.disabled]:!1,[lj.hidden]:!1,[lj.outside]:!1,[lj.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Gj(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[lj[r]]?e.push(t[lj[r]]):t[uj[r]]&&e.push(t[uj[r]]),e),[t[cj.Day]])}function Kj(e){return{...Fj,...e}}function qj(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function Jj(){let e={};for(let t in cj)e[cj[t]]=`rdp-${cj[t]}`;for(let t in lj)e[lj[t]]=`rdp-${lj[t]}`;for(let t in uj)e[uj[t]]=`rdp-${uj[t]}`;for(let t in dj)e[dj[t]]=`rdp-${dj[t]}`;return e}function Yj(e,t,n){return(n??new QA(t)).formatMonthYear(e)}var Xj=Yj;function Zj(e,t,n){return(n??new QA(t)).format(e,`d`)}function Qj(e,t=$A){return t.format(e,`LLLL`)}function $j(e,t,n){return(n??new QA(t)).format(e,`cccccc`)}function eM(e,t=$A){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function tM(){return``}function nM(e,t=$A){return t.format(e,`yyyy`)}var rM=nM,iM=s({formatCaption:()=>Yj,formatDay:()=>Zj,formatMonthCaption:()=>Xj,formatMonthDropdown:()=>Qj,formatWeekNumber:()=>eM,formatWeekNumberHeader:()=>tM,formatWeekdayName:()=>$j,formatYearCaption:()=>rM,formatYearDropdown:()=>nM});function aM(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...iM,...e}}function oM(e,t,n,r){let i=(r??new QA(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var sM=oM;function cM(e,t,n){return(n??new QA(t)).formatMonthYear(e)}var lM=cM;function uM(e,t,n,r){let i=(r??new QA(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function dM(e){return`Choose the Month`}function fM(){return``}var pM=`Go to the Next Month`;function mM(e,t){return pM}function hM(e){return`Go to the Previous Month`}function gM(e,t,n){return(n??new QA(t)).format(e,`cccc`)}function _M(e,t){return`Week ${e}`}function vM(e){return`Week Number`}function yM(e){return`Choose the Year`}var bM=s({labelCaption:()=>lM,labelDay:()=>sM,labelDayButton:()=>oM,labelGrid:()=>cM,labelGridcell:()=>uM,labelMonthDropdown:()=>dM,labelNav:()=>fM,labelNext:()=>mM,labelPrevious:()=>hM,labelWeekNumber:()=>_M,labelWeekNumberHeader:()=>vM,labelWeekday:()=>gM,labelYearDropdown:()=>yM}),xM=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function SM(e,t){let n=t.locale?.labels??{};return{...bM,...e??{},labelDayButton:xM(oM,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:xM(dM,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:xM(mM,e?.labelNext,n.labelNext),labelPrevious:xM(hM,e?.labelPrevious,n.labelPrevious),labelWeekNumber:xM(_M,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:xM(yM,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:xM(cM,e?.labelGrid,n.labelGrid),labelGridcell:xM(uM,e?.labelGridcell,n.labelGridcell),labelNav:xM(fM,e?.labelNav,n.labelNav),labelWeekNumberHeader:xM(vM,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:xM(gM,e?.labelWeekday,n.labelWeekday)}}function CM(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function wM(e,t={},n={}){let r={...t?.[cj.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function TM(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function EM(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function DM(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new GA(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(GA.tz(e)),newDate:(t,n,r)=>new GA(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new GA(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new GA(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new GA(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new GA(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>Yk(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>Kk(o(e)),differenceInCalendarDays:(e,t)=>pk(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Sk(o(e),o(t))}}var OM=e=>e instanceof HTMLElement?e:null,kM=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],AM=e=>OM(e.querySelector(`[data-animated-month]`)),jM=e=>OM(e.querySelector(`[data-animated-caption]`)),MM=e=>OM(e.querySelector(`[data-animated-weeks]`)),NM=e=>OM(e.querySelector(`[data-animated-nav]`)),PM=e=>OM(e.querySelector(`[data-animated-weekdays]`));function FM(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(r),c=(0,v.useRef)(!1);(0,v.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[dj.caption_after_enter]:n[dj.caption_before_enter],p=d?n[dj.weeks_after_enter]:n[dj.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(kM(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=AM(e);t&&e.contains(t)&&e.removeChild(t);let n=jM(e);n&&n.classList.remove(f);let r=MM(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?kM(m):[],_=kM(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=NM(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=jM(i);s&&s.classList.add(f);let l=MM(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=PM(o);m&&(m.style.opacity=`0`);let h=jM(o);h&&(h.classList.add(d?n[dj.caption_before_exit]:n[dj.caption_after_exit]),h.addEventListener(`animationend`,u));let _=MM(o);_&&_.classList.add(d?n[dj.weeks_before_exit]:n[dj.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function IM(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function LM(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function RM(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function zM(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function BM(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new tj(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new ej(t,m,r);return a?a.days.push(o):e.push(new nj(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function VM(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function HM(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function UM(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function WM(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function GM(e,t){let[n,r]=(0,v.useState)(e);return[t===void 0?n:t,r]}function KM(e,t){let[n,r]=VM(e,t),{startOfMonth:i,endOfMonth:a}=t,o=zM(e,n,r,t),[s,c]=GM(o,e.month?o:void 0);(0,v.useEffect)(()=>{c(zM(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,v.useMemo)(()=>{let i=RM(s,r,{numberOfMonths:e.numberOfMonths},t),o=BM(i,IM(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:WM(o),days:LM(o),previousMonth:UM(s,n,e,t),nextMonth:HM(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var qM;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(qM||={});function JM(e){return!e[lj.disabled]&&!e[lj.hidden]&&!e[lj.outside]}function YM(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);JM(e)&&(e[lj.focused]&&a<qM.FocusedModifier?(i=o,a=qM.FocusedModifier):r?.isEqualTo(o)&&a<qM.LastFocused?(i=o,a=qM.LastFocused):n(o.date)&&a<qM.Selected?(i=o,a=qM.Selected):e[lj.today]&&a<qM.Today&&(i=o,a=qM.Today))}return i||=e.find(e=>JM(t(e))),i}function XM(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function ZM(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=XM(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Uj(c,a.disabled,o)),u=!!(a.hidden&&Uj(c,a.hidden,o)),d=new ej(c,c,o);return!l&&!u?d:ZM(e,t,d,r,i,a,o,s+1)}function QM(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,v.useState)(),c=YM(t.days,n,r||(()=>!1),o),[l,u]=(0,v.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=ZM(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function $M(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=GM(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function eN(e,t,n=0,r=0,i=!1,a=$A){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function tN(e,t,n=$A){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function nN(e,t,n=$A){return Ij(e,t.from,!1,n)||Ij(e,t.to,!1,n)||Ij(t,e.from,!1,n)||Ij(t,e.to,!1,n)}function rN(e,t,n=$A){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Ij(e,t,!1,n):Hj(t,n)?t.some(t=>Ij(e,t,!1,n)):Rj(t)?t.from&&t.to?nN(e,{from:t.from,to:t.to},n):!1:Vj(t)?tN(e,t.dayOfWeek,n):Lj(t)?n.isAfter(t.before,t.after)?nN(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Uj(e.from,t,n)||Uj(e.to,t,n):zj(t)||Bj(t)?Uj(e.from,t,n)||Uj(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function iN(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=GM(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:eN(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&rN({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Ij(u,e,!1,t)}}function aN(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=GM(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function oN(e,t){let n=aN(e,t),r=$M(e,t),i=iN(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function sN(e,t){return e instanceof GA&&e.timeZone===t?e:new GA(e,t)}function cN(e,t,n){if(!n)return sN(e,t);let r=sN(e,t),i=new GA(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function lN(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?cN(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?cN(e,t,n):e):Rj(e)?{...e,from:e.from?sN(e.from,t):e.from,to:e.to?sN(e.to,t):e.to}:Lj(e)?{before:cN(e.before,t,n),after:cN(e.after,t,n)}:zj(e)?{after:cN(e.after,t,n)}:Bj(e)?{before:cN(e.before,t,n)}:e}function uN(e,t,n){return e&&(Array.isArray(e)?e.map(e=>lN(e,t,n)):lN(e,t,n))}function dN(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=sN(t.today,n),t.month&&=sN(t.month,n),t.defaultMonth&&=sN(t.defaultMonth,n),t.startMonth&&=sN(t.startMonth,n),t.endMonth&&=sN(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=sN(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>sN(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?sN(t.selected.from,n):t.selected.from,to:t.selected.to?sN(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=uN(t.disabled,n)),t.hidden!==void 0&&(t.hidden=uN(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=uN(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,v.useMemo)(()=>{let e={...ZA,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?DM(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new QA({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Kj(t.components),formatters:aM(t.formatters),labels:SM(t.labels,a.options),locale:e,classNames:{...Jj(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:k,formatYearDropdown:A}=i,j=KM(t,o),{days:M,months:N,navStart:P,navEnd:F,previousMonth:I,nextMonth:L,goToMonth:R}=j,ee=Wj(M,t,P,F,o),{isSelected:te,select:ne,selected:z}=oN(t,o)??{},{blur:B,focused:re,isFocusTarget:V,moveFocus:ie,setFocused:ae}=QM(t,j,ee,te??(()=>!1),o),{labelDayButton:oe,labelGridcell:se,labelGrid:ce,labelMonthDropdown:le,labelNav:ue,labelPrevious:de,labelNext:fe,labelWeekday:pe,labelWeekNumber:me,labelWeekNumberHeader:he,labelYearDropdown:ge}=a,_e=(0,v.useMemo)(()=>TM(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),ve=u!==void 0||m!==void 0,ye=(0,v.useCallback)(()=>{I&&(R(I),x?.(I))},[I,R,x]),be=(0,v.useCallback)(()=>{L&&(R(L),b?.(L))},[R,L,b]),xe=(0,v.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),ae(e),!t.disabled&&(ne?.(e.date,t,n),m?.(e.date,t,n))},[ne,m,ae]),Se=(0,v.useCallback)((e,t)=>n=>{ae(e),h?.(e.date,t,n)},[h,ae]),Ce=(0,v.useCallback)((e,t)=>n=>{B(),p?.(e.date,t,n)},[B,p]),we=(0,v.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];ie(e,t)}g?.(e.date,n,r)},[ie,g,t.dir]),Te=(0,v.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Ee=(0,v.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),De=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setMonth(o.startOfMonth(e),n))},[o,R]),Oe=(0,v.useCallback)(e=>t=>{let n=Number(t.target.value);R(o.setYear(o.startOfMonth(e),n))},[o,R]),{className:ke,style:Ae}=(0,v.useMemo)(()=>({className:[c[cj.Root],t.className].filter(Boolean).join(` `),style:{...C?.[cj.Root],...t.style}}),[c,t.className,t.style,C]),je=qj(t),Me=(0,v.useRef)(null);FM(Me,!!t.animate,{classNames:c,months:N,focused:re,dateLib:o});let Ne={dayPickerProps:t,selected:z,select:ne,isSelected:te,months:N,nextMonth:L,previousMonth:I,goToMonth:R,getModifiers:ee,components:r,classNames:c,styles:C,labels:a,formatters:i};return v.createElement(yj.Provider,{value:Ne},v.createElement(r.Root,{rootRef:t.animate?Me:void 0,className:ke,style:Ae,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...je},v.createElement(r.Months,{className:c[cj.Months],style:C?.[cj.Months]},!t.hideNavigation&&!d&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[cj.Nav],style:C?.[cj.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),N.map((e,n)=>v.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[cj.Month],style:C?.[cj.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&v.createElement(r.PreviousMonthButton,{type:`button`,className:c[cj.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":de(I),onClick:ye,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[cj.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),v.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[cj.MonthCaption],style:C?.[cj.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?v.createElement(r.DropdownNav,{className:c[cj.Dropdowns],style:C?.[cj.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?v.createElement(r.MonthsDropdown,{key:`month`,className:c[cj.MonthsDropdown],"aria-label":le(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:De(e.date),options:CM(e.date,P,F,i,o),style:C?.[cj.Dropdown],value:o.getMonth(e.date)}):v.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?v.createElement(r.YearsDropdown,{key:`year`,className:c[cj.YearsDropdown],"aria-label":ge(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Oe(e.date),options:EM(P,F,i,o,!!t.reverseYears),style:C?.[cj.Dropdown],value:o.getYear(e.date)}):v.createElement(`span`,{key:`year`},A(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),v.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):v.createElement(r.CaptionLabel,{className:c[cj.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&v.createElement(r.NextMonthButton,{type:`button`,className:c[cj.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":L?void 0:!0,"aria-label":fe(L),onClick:be,"data-animated-button":t.animate?`true`:void 0},v.createElement(r.Chevron,{disabled:L?void 0:!0,className:c[cj.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&v.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[cj.Nav],style:C?.[cj.Nav],"aria-label":ue(),onPreviousClick:ye,onNextClick:be,previousMonth:I,nextMonth:L}),v.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":ce(e.date,o.options,o)||void 0,className:c[cj.MonthGrid],style:C?.[cj.MonthGrid]},!t.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[cj.Weekdays],style:C?.[cj.Weekdays]},S&&v.createElement(r.WeekNumberHeader,{"aria-label":he(o.options),className:c[cj.WeekNumberHeader],style:C?.[cj.WeekNumberHeader],scope:`col`},O()),_e.map(e=>v.createElement(r.Weekday,{"aria-label":pe(e,o.options,o),className:c[cj.Weekday],key:String(e),style:C?.[cj.Weekday],scope:`col`},k(e,o.options,o)))),v.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[cj.Weeks],style:C?.[cj.Weeks]},e.weeks.map(e=>v.createElement(r.Week,{className:c[cj.Week],key:e.weekNumber,style:C?.[cj.Week],week:e},S&&v.createElement(r.WeekNumber,{week:e,style:C?.[cj.WeekNumber],"aria-label":me(e.weekNumber,{locale:s}),className:c[cj.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ee(e);if(i[lj.focused]=!i.hidden&&!!re?.isEqualTo(e),i[uj.selected]=te?.(n)||i.selected,Rj(z)){let{from:e,to:t}=z;i[uj.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[uj.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[uj.range_middle]=Ij(z,n,!0,o)}let a=wM(i,C,t.modifiersStyles),s=Gj(i,c,t.modifiersClassNames),l=!ve&&!i.hidden?se(n,i,o.options,o):void 0;return v.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&ve?v.createElement(r.DayButton,{className:c[cj.DayButton],style:C?.[cj.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:V(e)?0:-1,"aria-label":oe(n,i,o.options,o),onClick:xe(e,i),onBlur:Ce(e,i),onFocus:Se(e,i),onKeyDown:we(e,i),onMouseEnter:Te(e,i),onMouseLeave:Ee(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&v.createElement(r.Footer,{className:c[cj.Footer],style:C?.[cj.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function fN({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...s}){let c=Jj();return(0,H.jsx)(dN,{showOutsideDays:n,className:K(`group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:K(`w-fit`,c.root),months:K(`relative flex flex-col gap-4 md:flex-row`,c.months),month:K(`flex w-full flex-col gap-4`,c.month),nav:K(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,c.nav),button_previous:K(Pc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_previous),button_next:K(Pc({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,c.button_next),month_caption:K(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,c.month_caption),dropdowns:K(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,c.dropdowns),dropdown_root:K(`relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50`,c.dropdown_root),dropdown:K(`absolute inset-0 bg-popover opacity-0`,c.dropdown),caption_label:K(`font-medium select-none`,r===`label`?`text-sm`:`flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,c.caption_label),table:`w-full border-collapse`,weekdays:K(`flex`,c.weekdays),weekday:K(`flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none`,c.weekday),week:K(`mt-2 flex w-full`,c.week),week_number_header:K(`w-(--cell-size) select-none`,c.week_number_header),week_number:K(`text-[0.8rem] text-muted-foreground select-none`,c.week_number),day:K(`group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md`,s.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-md`:`[&:first-child[data-selected=true]_button]:rounded-l-md`,c.day),range_start:K(`rounded-l-md bg-accent`,c.range_start),range_middle:K(`rounded-none`,c.range_middle),range_end:K(`rounded-r-md bg-accent`,c.range_end),today:K(`rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none`,c.today),outside:K(`text-muted-foreground aria-selected:text-muted-foreground`,c.outside),disabled:K(`text-muted-foreground opacity-50`,c.disabled),hidden:K(`invisible`,c.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,H.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:K(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,H.jsx)(ka,{className:K(`size-4`,e),...n}):t===`right`?(0,H.jsx)(Aa,{className:K(`size-4`,e),...n}):(0,H.jsx)(Oa,{className:K(`size-4`,e),...n}),DayButton:pN,WeekNumber:({children:e,...t})=>(0,H.jsx)(`td`,{...t,children:(0,H.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...o},...s})}function pN({className:e,day:t,modifiers:n,...r}){let i=Jj(),a=v.useRef(null);return v.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,H.jsx)(q,{ref:a,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:K(`flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal`,`group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10`,`group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50`,`data-[range-end=true]:rounded-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground`,`data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground`,`data-[range-start=true]:rounded-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground`,`data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground`,`dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70`,i.day,e),...r})}function mN({...e}){return(0,H.jsx)(zx,{"data-slot":`popover`,...e})}function hN({...e}){return(0,H.jsx)(Bx,{"data-slot":`popover-trigger`,...e})}function gN({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,H.jsx)(Vx,{children:(0,H.jsx)(Hx,{"data-slot":`popover-content`,align:t,sideOffset:n,className:K(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden`,`data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,`data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}var _N=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`textarea`,{className:K(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));_N.displayName=`Textarea`;function vN({...e}){return(0,H.jsx)(rb,{"data-slot":`accordion`,...e})}function yN({className:e,...t}){return(0,H.jsx)(ib,{"data-slot":`accordion-item`,className:K(`border-b last:border-b-0`,e),...t})}function bN({className:e,children:t,...n}){return(0,H.jsx)(ab,{className:`flex`,children:(0,H.jsxs)(ob,{"data-slot":`accordion-trigger`,className:K(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,H.jsx)(Oa,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function xN({className:e,children:t,...n}){return(0,H.jsx)(sb,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,H.jsx)(`div`,{className:K(`pt-0 pb-4`,e),children:t})})}function SN(e){this.content=e}SN.prototype={constructor:SN,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new SN(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new SN(n)},addToStart:function(e,t){return new SN([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new SN(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new SN(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=SN.from(e),e.size?new SN(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=SN.from(e),e.size?new SN(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=SN.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},SN.from=function(e){if(e instanceof SN)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new SN(t)};function CN(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=CN(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function wN(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=wN(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var X=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return CN(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return wN(this,e,t,n)}findIndex(e){if(e==0)return EN(0,e);if(e==this.size)return EN(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?EN(t+1,i):EN(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};X.empty=new X([],0);var TN={index:0,offset:0};function EN(e,t){return TN.index=e,TN.offset=t,TN}function DN(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!DN(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!DN(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var ON=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&DN(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};ON.none=[];var kN=class extends Error{},Z=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=jN(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(AN(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(X.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Z.empty=new Z(X.empty,0,0);function AN(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(AN(a.content,t-i-1,n-i-1)))}function jN(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=jN(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function MN(e,t,n){if(n.openStart>e.depth)throw new kN(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new kN(`Inconsistent open depths`);return NN(e,t,n,0)}function NN(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=NN(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return RN(a,BN(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return RN(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=VN(n,e);return RN(a,zN(e,i,o,t,r))}}function PN(e,t){if(!t.type.compatibleContent(e.type))throw new kN(`Cannot join `+t.type.name+` onto `+e.type.name)}function FN(e,t,n){let r=e.node(n);return PN(r,t.node(n)),r}function IN(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function LN(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(IN(e.nodeAfter,r),a++));for(let e=a;e<o;e++)IN(i.child(e),r);t&&t.depth==n&&t.textOffset&&IN(t.nodeBefore,r)}function RN(e,t){return e.type.checkContent(t),e.copy(t)}function zN(e,t,n,r,i){let a=e.depth>i&&FN(e,t,i+1),o=r.depth>i&&FN(n,r,i+1),s=[];return LN(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(PN(a,o),IN(RN(a,zN(e,t,n,r,i+1)),s)):(a&&IN(RN(a,BN(e,t,i+1)),s),LN(t,n,i,s),o&&IN(RN(o,BN(n,r,i+1)),s)),LN(r,null,i,s),new X(s)}function BN(e,t,n){let r=[];return LN(null,e,n,r),e.depth>n&&IN(RN(FN(e,t,n+1),BN(e,t,n+1)),r),LN(t,null,n,r),new X(r)}function VN(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(X.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var HN=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ON.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new KN(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=GN.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else GN.set(t,r=new UN);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%WN,i}},UN=class{constructor(){this.elts=[],this.i=0}},WN=12,GN=new WeakMap,KN=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},qN=Object.create(null),JN=class e{constructor(e,t,n,r=ON.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||X.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&DN(this.attrs,t||e.defaultAttrs||qN)&&ON.sameSet(this.marks,n||ON.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Z.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Z(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return MN(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return HN.resolveCached(this,e)}resolveNoCache(e){return HN.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),XN(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=X.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ON.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!ON.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=X.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};JN.prototype.text=void 0;var YN=class e extends JN{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):XN(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function XN(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ZN=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new QN(t,n);if(r.next==null)return e.empty;let i=$N(r);r.next&&r.err(`Unexpected trailing text`);let a=lP(oP(i));return uP(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return X.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
80
80
  `)}};ZN.empty=new ZN(!0);var QN=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function $N(e){let t=[];do t.push(eP(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function eP(e){let t=[];do t.push(tP(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function tP(e){let t=aP(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=rP(e,t);else break;return t}function nP(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function rP(e,t){let n=nP(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:nP(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function iP(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function aP(e){if(e.eat(`(`)){let t=$N(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=iP(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function oP(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function sP(e,t){return t-e}function cP(e,t){let n=[];return r(t),n.sort(sP);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function lP(e){let t=Object.create(null);return n(cP(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);cP(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ZN(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(sP);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function uP(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function dP(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function fP(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function pP(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function mP(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new _P(e,r,t[r]);return n}var hP=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=mP(e,n.attrs),this.defaultAttrs=dP(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ZN.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fP(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new JN(this,this.computeAttrs(e),X.from(t),ON.setFrom(n))}createChecked(e=null,t,n){return t=X.from(t),this.checkContent(t),new JN(this,this.computeAttrs(e),t,ON.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=X.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(X.empty,!0);return i?new JN(this,e,t.append(i),ON.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){pP(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:ON.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function gP(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var _P=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?gP(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},vP=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=mP(e,r.attrs),this.excluded=null;let i=dP(this.attrs);this.instance=i?new ON(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ON(this,fP(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){pP(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},yP=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=SN.from(e.nodes),t.marks=SN.from(e.marks||{}),this.nodes=hP.compile(this.spec.nodes,this),this.marks=vP.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ZN.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?bP(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:bP(this,n.split(` `))}this.nodeFromJSON=e=>JN.fromJSON(this,e),this.markFromJSON=e=>ON.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof hP))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new YN(n,n.defaultAttrs,e,ON.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function bP(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function xP(e){return e.tag!=null}function SP(e){return e.style!=null}var CP=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(xP(e))this.tags.push(e);else if(SP(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new MP(this,t,!1);return n.addAll(e,ON.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new MP(this,t,!0);return n.addAll(e,ON.none,t.from,t.to),Z.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(PP(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=FP(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=FP(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},wP={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},TP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},EP={ol:!0,ul:!0},DP=1,OP=2,kP=4;function AP(e,t,n){return t==null?e&&e.whitespace==`pre`?DP|OP:n&~kP:(t?DP:0)|(t===`full`?OP:0)}var jP=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=ON.none,this.match=i||(a&kP?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(X.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&DP)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=X.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(X.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!wP.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},MP=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=AP(null,t.preserveWhitespace,0)|(n?kP:0);i=r?new jP(r.type,r.attrs,ON.none,!0,t.topMatch||r.type.contentMatch,a):n?new jP(null,null,ON.none,!0,null,a):new jP(e.schema.topNodeType,null,ON.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&OP?`full`:this.localPreserveWS||(r.options&DP)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
81
81
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;EP.hasOwnProperty(a)&&this.parser.normalizeLists&&NP(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:TP.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(wP.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
82
82
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=ON.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):IP(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=AP(e,i,a.options);a.options&kP&&a.content.length==0&&(o|=kP);let s=ON.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):IP(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new jP(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=DP);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function NP(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&EP.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function PP(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function FP(e){let t={};for(let n in e)t[n]=e[n];return t}function IP(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var LP=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=zP(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=UP(zP(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&UP(zP(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return UP(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=RP(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return RP(e.marks)}};function RP(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function zP(e){return e.document||window.document}var BP=new WeakMap;function VP(e){let t=BP.get(e);return t===void 0&&BP.set(e,t=HP(e)),t}function HP(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function UP(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=VP(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=UP(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var WP=65535,GP=2**16;function KP(e,t){return e+t*GP}function qP(e){return e&WP}function JP(e){return(e-(e&WP))/GP}var YP=1,XP=2,ZP=4,QP=8,$P=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&QP)>0}get deletedBefore(){return(this.delInfo&(YP|ZP))>0}get deletedAfter(){return(this.delInfo&(XP|ZP))>0}get deletedAcross(){return(this.delInfo&ZP)>0}},eF=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=qP(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+JP(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:KP(o/3,e-s),f=e==s?XP:e==u?YP:ZP;return(t<0?e!=s:e!=u)&&(f|=QP),new $P(a,f,d)}r+=l-c}return n?e+r:new $P(e+r,0,null)}touches(e,t){let n=0,r=qP(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};eF.empty=new eF([]);var tF=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new $P(e,r,null)}},nF=Object.create(null),rF=class{getMap(){return eF.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=nF[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in nF)throw RangeError(`Duplicate use of step JSON ID `+e);return nF[e]=t,t.prototype.jsonID=e,t}},iF=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof kN)return e.fail(t.message);throw t}}};function aF(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(aF(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return X.fromArray(r)}var oF=class e extends rF{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Z(aF(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return iF.fromReplace(e,this.from,this.to,i)}invert(){return new sF(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};rF.jsonID(`addMark`,oF);var sF=class e extends rF{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Z(aF(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return iF.fromReplace(e,this.from,this.to,n)}invert(){return new oF(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};rF.jsonID(`removeMark`,sF);var cF=class e extends rF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return iF.fromReplace(e,this.pos,this.pos+1,new Z(X.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new lF(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};rF.jsonID(`addNodeMark`,cF);var lF=class e extends rF{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iF.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return iF.fromReplace(e,this.pos,this.pos+1,new Z(X.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new cF(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};rF.jsonID(`removeNodeMark`,lF);var uF=class e extends rF{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&fF(e,this.from,this.to)?iF.fail(`Structure replace would overwrite content`):iF.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new eF([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,Z.fromJSON(t,n.slice),!!n.structure)}};uF.MAP_BIAS=1,rF.jsonID(`replace`,uF);var dF=class e extends rF{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(fF(e,this.from,this.gapFrom)||fF(e,this.gapTo,this.to)))return iF.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return iF.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?iF.fromReplace(e,this.from,this.to,n):iF.fail(`Content does not fit in gap`)}getMap(){return new eF([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(t,n.slice),n.insert,!!n.structure)}};rF.jsonID(`replaceAround`,dF);function fF(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function pF(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new sF(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new oF(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function mF(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof vP){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new sF(t.from,t.to,t.style)))}function hF(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new uF(s,l,Z.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new sF(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new Z(X.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new uF(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(X.empty,!0);e.replace(s,s,new Z(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function gF(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function _F(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!gF(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function vF(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=X.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=X.from(r.node(e).copy(u)),d++):c--;let f=X.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=X.from(i.node(e).copy(f)),p++):l++;e.step(new dF(c,l,o,s,new Z(u.append(f),d,p),u.size-d,!0))}function yF(e,t,n=null,r=e){let i=xF(e,t),a=i&&SF(r,t);return a?i.map(bF).concat({type:t,attrs:n}).concat(a.map(bF)):null}function bF(e){return{type:e,attrs:null}}function xF(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function SF(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function CF(e,t,n){let r=X.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=X.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new dF(i,a,i,a,new Z(r,0,0),n.length,!0))}function wF(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&DF(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&EF(e,t,n,a),hF(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new dF(c,l,c+1,l-1,new Z(X.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&TF(e,t,n,a),!1}})}function TF(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function EF(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -216,8 +216,8 @@ ${n}`}}),s}function PG(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants
216
216
  `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
217
217
  `),[i,a]=uX(r);if(i.length===0)return;let o=dX(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
218
218
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pX,this.editor.getAttributes(mX)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=xG({find:hX,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xG({find:hX,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(mX)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),_X=/^\s*(\[([( |x])?\])\s$/,vX=FG.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,NU(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>NG(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=PU(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[xG({find:_X,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),yX=FG.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,NU(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
219
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=MG(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=MG(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});nG.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(qY.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(JY.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(aX.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(gX.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(vX.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(yX.configure(this.options.taskList)),e}});var bX=`&nbsp;`,xX=`\xA0`,SX=FG.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,NU(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===bX||n[0].text===bX||n[0].raw===xX||n[0].text===xX)&&r.length===1&&r[0].type===`text`&&(r[0].text===bX||r[0].text===xX)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?bX:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),CX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,TX=qW.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,NU(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vG({find:CX,type:this.type})]},addPasteRules(){return[IG({find:wX,type:this.type})]}}),EX=FG.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),DX=qW.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,NU(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function OX(e={}){return new EI({view(t){return new kX(t,e)}})}var kX=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=LF(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},AX=class e extends iI{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):iI.near(r)}content(){return Z.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new jX(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!NX(e)||!PX(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!uI.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};AX.prototype.visible=!1,AX.findFrom=AX.findGapCursorFrom,iI.jsonID(`gapcursor`,AX);var jX=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return AX.valid(t)?new AX(t):iI.near(t)}};function MX(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function NX(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||MX(e.type))return!0;if(e.inlineContent)return!1}}return!0}function PX(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||MX(e.type))return!0;if(e.inlineContent)return!1}}return!0}function FX(){return new EI({props:{decorations:BX,createSelectionBetween(e,t,n){return t.pos==n.pos&&AX.valid(n)?new AX(n):null},handleClick:RX,handleKeyDown:IX,handleDOMEvents:{beforeinput:zX}}})}var IX=nH({ArrowLeft:LX(`horiz`,-1),ArrowRight:LX(`horiz`,1),ArrowUp:LX(`vert`,-1),ArrowDown:LX(`vert`,1)});function LX(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof cI){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=AX.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new AX(c))),!0):!1}}function RX(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!AX.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&uI.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new AX(r))),!0)}function zX(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof AX))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=X.empty;for(let e=r.length-1;e>=0;e--)i=X.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return a.setSelection(cI.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function BX(e){if(!(e.selection instanceof AX))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,tV.create(e.doc,[QB.widget(e.selection.head,t,{key:`gapcursor`})])}var VX=200,HX=function(){};HX.prototype.append=function(e){return e.length?(e=HX.from(e),!this.length&&e||e.length<VX&&this.leafAppend(e)||this.length<VX&&e.leafPrepend(this)||this.appendInner(e)):this},HX.prototype.prepend=function(e){return e.length?HX.from(e).append(this):this},HX.prototype.appendInner=function(e){return new WX(this,e)},HX.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?HX.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},HX.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},HX.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},HX.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},HX.from=function(e){return e instanceof HX?e:e&&e.length?new UX(e):HX.empty};var UX=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=VX)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=VX)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(HX);HX.empty=new UX([]);var WX=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(HX),GX=500,KX=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new JX(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new JX(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new JX(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>XX&&(s=qX(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new tF;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new JX(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new JX(i,o,l))}else r.push(new JX(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new JX(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>GX&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new JX(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(HX.from(i.reverse()),a)}};KX.empty=new KX(HX.empty,0);function qX(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var JX=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},YX=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},XX=20;function ZX(e,t,n,r){let i=n.getMeta(aZ),a;if(i)return i.historyState;n.getMeta(oZ)&&(e=new YX(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(aZ))return o.getMeta(aZ).redo?new YX(e.done.addTransform(n,void 0,r,iZ(t)),e.undone,$X(n.mapping.maps),e.prevTime,e.prevComposition):new YX(e.done,e.undone.addTransform(n,void 0,r,iZ(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!QX(n,e.prevRanges)),s=o?eZ(e.prevRanges,n.mapping):$X(n.mapping.maps);return new YX(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,iZ(t)),KX.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new YX(e.done.rebased(n,a),e.undone.rebased(n,a),eZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new YX(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),eZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function QX(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function $X(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function eZ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function tZ(e,t,n){let r=iZ(t),i=aZ.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new YX(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(aZ,{redo:n,historyState:c})}var nZ=!1,rZ=null;function iZ(e){let t=e.plugins;if(rZ!=t){nZ=!1,rZ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){nZ=!0;break}}return nZ}var aZ=new kI(`history`),oZ=new kI(`closeHistory`);function sZ(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new EI({key:aZ,state:{init(){return new YX(KX.empty,KX.empty,null,0,-1)},apply(t,n,r){return ZX(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?lZ:n==`historyRedo`?uZ:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function cZ(e,t){return(n,r)=>{let i=aZ.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=tZ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var lZ=cZ(!1,!0),uZ=cZ(!0,!0);nG.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new EI({key:new kI(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var dZ=nG.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[OX(this.options)]}});nG.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new EI({key:new kI(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return tV.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(QB.node(t,t+e.nodeSize,{class:this.options.className}))}),tV.create(e,a)}}})]}});var fZ=nG.create({name:`gapCursor`,addProseMirrorPlugins(){return[FX()]},extendNodeSchema(e){return{allowGapCursor:DU(Q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),pZ=`placeholder`;function mZ(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}nG.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:pZ,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${mZ(this.options.dataAttribute)}`:`data-${pZ}`;return[new EI({key:new kI(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&cW(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=QB.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),tV.create(t,a)}}})]}}),nG.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new EI({key:new kI(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||lW(n.selection)||e.view.dragging?null:tV.create(n.doc,[QB.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function hZ({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var gZ=nG.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new kI(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new EI({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!hZ({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!hZ({node:r,types:n})}}})]}}),_Z=nG.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>lZ(e,t),redo:()=>({state:e,dispatch:t})=>uZ(e,t)}},addProseMirrorPlugins(){return[sZ(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),vZ=nG.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(uq.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(aq.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(qY.configure(this.options.bulletList)),this.options.code!==!1&&e.push(pq.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(_q.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(vq.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(dZ.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(fZ.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(yq.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(bq.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(_Z.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(xq.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Eq.configure(this.options.italic)),this.options.listItem!==!1&&e.push(JY.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(aX.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(VY.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(gX.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(SX.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(TX.configure(this.options.strike)),this.options.text!==!1&&e.push(EX.configure(this.options.text)),this.options.underline!==!1&&e.push(DX.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(gZ.configure(this.options?.trailingNode)),e}}),yZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,bZ=FG.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,NU(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new CG({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[yG({find:yZ,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function xZ({onClick:e,active:t,disabled:n,title:r,children:i}){return(0,H.jsx)(`button`,{type:`button`,title:r,disabled:n,onMouseDown:t=>{t.preventDefault(),e()},className:K(`flex size-7 items-center justify-center rounded transition-colors`,t?`bg-foreground text-background`:`text-muted-foreground hover:bg-accent hover:text-accent-foreground`,n&&`pointer-events-none opacity-40`),children:i})}function SZ(){return(0,H.jsx)(`div`,{className:`mx-0.5 h-4 w-px bg-border`})}function CZ({value:e,onChange:t,placeholder:n,onInsertImage:r}){let[i,a]=(0,v.useState)(!e),o=YK({extensions:[vZ.configure({link:{openOnClick:!1,HTMLAttributes:{class:`text-primary underline`}}}),bZ.extend({addAttributes(){return{...this.parent?.(),width:{default:null},height:{default:null}}}}).configure({HTMLAttributes:{class:`max-w-full rounded`}})],content:(()=>{if(!e)return``;try{return JSON.parse(e)}catch{return e}})(),editorProps:{attributes:{class:`h-128 px-3 py-2.5 focus:outline-none`}},onUpdate({editor:e}){a(e.isEmpty),t(JSON.stringify(e.getJSON()))}});(0,v.useEffect)(()=>{if(!o)return;let t=e?(()=>{try{return JSON.parse(e)}catch{return e}})():``;JSON.stringify(o.getJSON())!==e&&o.commands.setContent(t,{emitUpdate:!1}),a(o.isEmpty)},[e]);async function s(){if(!o||!r)return;let e=await r();e&&o.chain().focus().setImage({src:e.src,alt:e.alt??void 0,width:e.width??void 0,height:e.height??void 0}).run()}function c(){if(!o)return;let e=o.getAttributes(`link`).href,t=window.prompt(`URL`,e??`https://`);if(t!==null){if(!t){o.chain().focus().unsetLink().run();return}o.chain().focus().setLink({href:t}).run()}}return o?(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-input bg-background focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-0.5 border-b border-border bg-background px-2 py-1.5`,children:[(0,H.jsx)(xZ,{title:`Bold`,active:o.isActive(`bold`),onClick:()=>o.chain().focus().toggleBold().run(),children:(0,H.jsx)(Ca,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Italic`,active:o.isActive(`italic`),onClick:()=>o.chain().focus().toggleItalic().run(),children:(0,H.jsx)(io,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Underline`,active:o.isActive(`underline`),onClick:()=>o.chain().focus().toggleUnderline().run(),children:(0,H.jsx)(Po,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Strikethrough`,active:o.isActive(`strike`),onClick:()=>o.chain().focus().toggleStrike().run(),children:(0,H.jsx)(Oo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Heading 1`,active:o.isActive(`heading`,{level:1}),onClick:()=>o.chain().focus().toggleHeading({level:1}).run(),children:(0,H.jsx)($a,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Heading 2`,active:o.isActive(`heading`,{level:2}),onClick:()=>o.chain().focus().toggleHeading({level:2}).run(),children:(0,H.jsx)(eo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Heading 3`,active:o.isActive(`heading`,{level:3}),onClick:()=>o.chain().focus().toggleHeading({level:3}).run(),children:(0,H.jsx)(to,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Bullet list`,active:o.isActive(`bulletList`),onClick:()=>o.chain().focus().toggleBulletList().run(),children:(0,H.jsx)(mo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Ordered list`,active:o.isActive(`orderedList`),onClick:()=>o.chain().focus().toggleOrderedList().run(),children:(0,H.jsx)(fo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Blockquote`,active:o.isActive(`blockquote`),onClick:()=>o.chain().focus().toggleBlockquote().run(),children:(0,H.jsx)(bo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Inline code`,active:o.isActive(`code`),onClick:()=>o.chain().focus().toggleCode().run(),children:(0,H.jsx)(Ia,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Code block`,active:o.isActive(`codeBlock`),onClick:()=>o.chain().focus().toggleCodeBlock().run(),children:(0,H.jsx)(Eo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Add link`,active:o.isActive(`link`),onClick:c,children:(0,H.jsx)(uo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Remove link`,disabled:!o.isActive(`link`),onClick:()=>o.chain().focus().unsetLink().run(),children:(0,H.jsx)(Fo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),r&&(0,H.jsx)(xZ,{title:`Insert image`,onClick:s,children:(0,H.jsx)(ro,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Hard break (Shift + Enter)`,onClick:()=>o.chain().focus().setHardBreak().run(),children:(0,H.jsx)(Ao,{className:`size-3.5`})})]}),(0,H.jsxs)(`div`,{className:`relative overflow-y-auto`,children:[i&&n&&(0,H.jsx)(`p`,{className:`pointer-events-none absolute left-3 top-2.5 text-muted-foreground select-none`,children:n}),(0,H.jsx)(VK,{editor:o})]})]}):null}function wZ(e){return{...e}}function TZ(e){return e.type.startsWith(`image/`)?new Promise(t=>{let n=new Image,r=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(r),t({width:n.naturalWidth,height:n.naturalHeight})},n.onerror=()=>{URL.revokeObjectURL(r),t(null)},n.src=r}):Promise.resolve(null)}async function EZ(e,t){let n=await TZ(e),r=await fetch(`/cms/admin/media/presign`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type,folderId:t?.folderId??null})});if(!r.ok)throw Error(`Upload failed.`);let i=await r.json();if(i.mode===`presigned`){if(!(await fetch(i.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let r=await fetch(`/cms/admin/media/confirm`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({key:i.key,filename:e.name,mimeType:e.type,size:e.size,folderId:t?.folderId??null,width:n?.width??null,height:n?.height??null})});if(!r.ok)throw Error(`Upload failed.`);return r.json()}let a=new FormData;a.append(`files`,e,e.name),t?.folderId&&a.append(`folder_id`,t.folderId),n?.width&&a.append(`width`,String(n.width)),n?.height&&a.append(`height`,String(n.height));let o=await fetch(`/cms/admin/media`,{method:`POST`,credentials:`include`,headers:wZ(),body:a});if(!o.ok)throw Error(`Upload failed.`);return o.json()}async function DZ(e){let t=await fetch(`/cms/admin/users/me/avatar/presign`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type})});if(!t.ok)throw Error(`Upload failed.`);let n=await t.json();if(n.mode===`presigned`){if(!(await fetch(n.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let t=await fetch(`/cms/admin/users/me/avatar/confirm`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({key:n.key})});if(!t.ok)throw Error(`Upload failed.`);return(await t.json()).avatarUrl}let r=new FormData;r.append(`file`,e);let i=await fetch(`/cms/admin/users/me/avatar`,{method:`POST`,credentials:`include`,headers:wZ(),body:r});if(!i.ok)throw Error(`Upload failed.`);return(await i.json()).avatarUrl}var OZ=1,kZ=.9,AZ=.8,jZ=.17,MZ=.1,NZ=.999,PZ=.9999,FZ=.99,IZ=/[\\\/_+.#"@\[\(\{&]/,LZ=/[\\\/_+.#"@\[\(\{&]/g,RZ=/[\s-]/,zZ=/[\s-]/g;function BZ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?OZ:FZ;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=BZ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=OZ:IZ.test(e.charAt(l-1))?(d*=AZ,p=e.slice(i,l-1).match(LZ),p&&i>0&&(d*=NZ**+p.length)):RZ.test(e.charAt(l-1))?(d*=kZ,m=e.slice(i,l-1).match(zZ),m&&i>0&&(d*=NZ**+m.length)):(d*=jZ,i>0&&(d*=NZ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=PZ)),(d<MZ&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=BZ(e,t,n,r,l+1,a+2,o),f*MZ>d&&(d=f*MZ)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function VZ(e){return e.toLowerCase().replace(zZ,` `)}function HZ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,BZ(e,t,VZ(e),VZ(t),0,0,{})}var UZ=`[cmdk-group=""]`,WZ=`[cmdk-group-items=""]`,GZ=`[cmdk-group-heading=""]`,KZ=`[cmdk-item=""]`,qZ=`${KZ}:not([aria-disabled="true"])`,JZ=`cmdk-item-select`,YZ=`data-value`,XZ=(e,t,n)=>HZ(e,t,n),ZZ=v.createContext(void 0),QZ=()=>v.useContext(ZZ),$Z=v.createContext(void 0),eQ=()=>v.useContext($Z),tQ=v.createContext(void 0),nQ=v.forwardRef((e,t)=>{let n=gQ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=gQ(()=>new Set),i=gQ(()=>new Map),a=gQ(()=>new Map),o=gQ(()=>new Set),s=mQ(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,y=fu(),b=fu(),x=fu(),S=v.useRef(null),C=yQ();hQ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),hQ(()=>{C(6,A)},[]);let w=v.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=v.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??XZ;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(WZ);t?t.appendChild(e.parentElement===t?e:e.closest(`${WZ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${WZ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${UZ}[${YZ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(YZ);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(UZ)?.querySelector(GZ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${KZ}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(qZ)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(YZ))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(YZ))}function F(e){let t=j()?.closest(UZ),n;for(;t&&!n;)t=e>0?fQ(t,UZ):pQ(t,UZ),n=t?.querySelector(qZ);n?w.setState(`value`,n.getAttribute(YZ)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return v.createElement(zc.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(JZ);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:SQ},c),xQ(e,e=>v.createElement($Z.Provider,{value:w},v.createElement(ZZ.Provider,{value:T},e))))}),rQ=v.forwardRef((e,t)=>{let n=fu(),r=v.useRef(null),i=v.useContext(tQ),a=QZ(),o=mQ(e),s=o.current?.forceMount??i?.forceMount;hQ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=vQ(n,r,[e.value,e.children,r],e.keywords),l=eQ(),u=_Q(e=>e.value&&e.value===c.current),d=_Q(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);v.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(JZ,f),()=>t.removeEventListener(JZ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:y,...b}=e;return v.createElement(zc.div,{ref:Go(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),iQ=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=fu(),s=v.useRef(null),c=v.useRef(null),l=fu(),u=QZ(),d=_Q(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);hQ(()=>u.group(o),[]),vQ(o,s,[e.value,e.heading,c]);let f=v.useMemo(()=>({id:o,forceMount:i}),[i]);return v.createElement(zc.div,{ref:Go(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&v.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),xQ(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},v.createElement(tQ.Provider,{value:f},e))))}),aQ=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),a=_Q(e=>!e.search);return!n&&!a?null:v.createElement(zc.div,{ref:Go(i,t),...r,"cmdk-separator":``,role:`separator`})}),oQ=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=eQ(),o=_Q(e=>e.search),s=_Q(e=>e.selectedItemId),c=QZ();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(zc.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),sQ=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=v.useRef(null),o=v.useRef(null),s=_Q(e=>e.selectedItemId),c=QZ();return v.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(zc.div,{ref:Go(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xQ(e,e=>v.createElement(`div`,{ref:Go(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),cQ=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(Hb,{open:n,onOpenChange:r},v.createElement(Ub,{container:o},v.createElement(Wb,{"cmdk-overlay":``,className:i}),v.createElement(Gb,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(nQ,{ref:t,...s}))))}),lQ=v.forwardRef((e,t)=>_Q(e=>e.filtered.count===0)?v.createElement(zc.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),uQ=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(zc.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},xQ(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),dQ=Object.assign(nQ,{List:sQ,Item:rQ,Input:oQ,Group:iQ,Separator:aQ,Dialog:cQ,Empty:lQ,Loading:uQ});function fQ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function pQ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mQ(e){let t=v.useRef(e);return hQ(()=>{t.current=e}),t}var hQ=typeof window>`u`?v.useEffect:v.useLayoutEffect;function gQ(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function _Q(e){let t=eQ(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function vQ(e,t,n,r=[]){let i=v.useRef(),a=QZ();return hQ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(YZ,s),i.current=s}),i}var yQ=()=>{let[e,t]=v.useState(),n=gQ(()=>new Map);return hQ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function bQ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function xQ({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(bQ(t),{ref:t.ref},n(t.props.children)):n(t)}var SQ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},CQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ,{ref:n,className:K(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));CQ.displayName=dQ.displayName;var wQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,H.jsx)(Co,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,H.jsx)(dQ.Input,{ref:n,className:K(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));wQ.displayName=dQ.Input.displayName;var TQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.List,{ref:n,className:K(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));TQ.displayName=dQ.List.displayName;var EQ=v.forwardRef((e,t)=>(0,H.jsx)(dQ.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));EQ.displayName=dQ.Empty.displayName;var DQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Group,{ref:n,className:K(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));DQ.displayName=dQ.Group.displayName;var OQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Separator,{ref:n,className:K(`-mx-1 h-px bg-border`,e),...t}));OQ.displayName=dQ.Separator.displayName;var kQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Item,{ref:n,className:K(`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));kQ.displayName=dQ.Item.displayName;var AQ=({className:e,...t})=>(0,H.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});AQ.displayName=`CommandShortcut`;var jQ={image:`image/*`,video:`video/*`,audio:`audio/*`,document:`.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv`};function MQ(e){return!e||e.length===0?`*/*`:e.map(e=>jQ[e]).join(`,`)}function NQ(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function PQ(e){return e?.startsWith(`image/`)??!1}async function FQ(e,t){return EZ(e,{folderId:t})}function IQ(e,t){if(!t||t.length===0)return!0;let n=e??``;return t.some(e=>e===`image`?n.startsWith(`image/`):e===`video`?n.startsWith(`video/`):e===`audio`?n.startsWith(`audio/`):e===`document`?n.startsWith(`application/`)||n.startsWith(`text/`):!1)}function LQ({open:e,onOpenChange:t,allowedTypes:n,onSelect:r}){let[i,a]=(0,v.useState)([{id:null,name:`Media`}]),o=i[i.length-1].id,[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;f(!0);let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=o??``;Promise.all([fetch(`/cms/admin/folders?parent_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{folders:[]}).then(e=>e.folders),fetch(`/cms/admin/media?folder_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{items:[]}).then(e=>e.items)]).then(([e,t])=>{c(e),u(t)}).catch(()=>{c([]),u([])}).finally(()=>f(!1))},[e,o]),(0,v.useEffect)(()=>{e||a([{id:null,name:`Media`}])},[e]);function p(e){a(t=>[...t,{id:e.id,name:e.name}])}function m(e){a(t=>t.slice(0,e+1))}let h=l.filter(e=>IQ(e.mime_type,n)),g=s.length===0&&h.length===0;return(0,H.jsx)(ZC,{open:e,onOpenChange:t,children:(0,H.jsxs)(tw,{className:`max-w-3xl`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Media Library`})}),i.length>1&&(0,H.jsx)(`div`,{className:`flex items-center gap-1 text-sm -mt-1`,children:i.map((e,t)=>(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-muted-foreground`,children:[t>0&&(0,H.jsx)(`span`,{children:`/`}),t===i.length-1?(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name}):(0,H.jsx)(`button`,{onClick:()=>m(t),className:`hover:text-foreground transition-colors`,children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name})]},t))}),d?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,H.jsx)(iy,{className:`size-5`})}):g?(0,H.jsx)(`p`,{className:`py-16 text-center text-sm text-muted-foreground`,children:l.length===0&&s.length===0?`No media found.`:`No matching files in this folder.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto pr-1`,children:[s.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>p(e),className:`flex items-center gap-2.5 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-muted/50 hover:border-primary`,children:[(0,H.jsx)(Xa,{className:`size-7 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-xs font-bold leading-tight`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]})]},e.id))}),h.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5`,children:h.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{r(e),t(!1)},className:`group relative overflow-hidden rounded-md border bg-card text-left transition-colors hover:border-primary`,children:[(0,H.jsx)(`div`,{className:`aspect-square bg-muted`,children:PQ(e.mime_type)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(Ka,{className:`size-6 text-muted-foreground`})})}),(0,H.jsxs)(`div`,{className:`p-1.5`,children:[(0,H.jsx)(`p`,{className:`truncate text-[11px] font-medium leading-tight`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:NQ(e.size)})]}),(0,H.jsx)(`div`,{className:`absolute inset-0 rounded-md ring-2 ring-primary ring-offset-1 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none`})]},e.id))})]})]})})}function RQ({value:e,onChange:t,allowedTypes:n,disabled:r=!1}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),p=typeof e==`string`&&e.startsWith(`http`);(0,v.useEffect)(()=>{if(!e){u(null);return}if(p){u(e);return}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(e=>u(e?.url??null)).catch(()=>u(null))},[e,p]);async function m(e){o(!0),c(null);try{let n=await FQ(e);u(n.url),t(n.id)}catch(e){c(e instanceof Error?e.message:`Upload failed.`)}finally{o(!1),i.current&&(i.current.value=``)}}let h=l&&/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(l);return e?(0,H.jsxs)(`div`,{className:`relative w-full rounded-md border bg-muted/30 overflow-hidden`,children:[l?h?(0,H.jsx)(`img`,{src:l,alt:`Media`,className:`max-h-72 w-full object-contain`}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,H.jsx)(ro,{className:`size-4 text-muted-foreground shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:l})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground`,children:[(0,H.jsx)(ro,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs`,children:`Loading…`})]}),(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`secondary`,className:`absolute top-1.5 right-1.5 size-6`,onClick:()=>{t(null),u(null)},disabled:r,children:(0,H.jsx)(Bo,{className:`size-3.5`})})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`input`,{ref:i,type:`file`,accept:MQ(n),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&m(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{if(r)return;e.preventDefault();let t=e.dataTransfer.files[0];t&&m(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>i.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),a?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>f(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),s&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:s}),(0,H.jsx)(LQ,{open:d,onOpenChange:f,allowedTypes:n,onSelect:e=>{u(e.url),t(e.id)}})]})}function zQ({id:e,previewUrl:t,filename:n,onRemove:r,disabled:i=!1}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=JD({id:e});return(0,H.jsxs)(`div`,{ref:s,style:{transform:sT.Transform.toString(c),transition:l,opacity:u?.4:1},className:`relative aspect-square overflow-hidden rounded-md border bg-muted`,children:[t?(0,H.jsx)(`img`,{src:t,alt:n,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(ro,{className:`size-5 text-muted-foreground`})}),n&&(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 bg-background/75 backdrop-blur-sm px-1.5 py-1 pointer-events-none`,children:(0,H.jsx)(`p`,{className:`truncate text-[10px] leading-none text-foreground`,children:n})}),(0,H.jsx)(`button`,{type:`button`,onClick:r,disabled:i,className:`absolute right-1 top-1 flex size-5 items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm hover:bg-background`,children:(0,H.jsx)(Bo,{className:`size-3`})}),!i&&(0,H.jsx)(`button`,{type:`button`,className:`absolute bottom-6 left-1 flex size-5 cursor-grab items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm active:cursor-grabbing`,...o,...a,children:(0,H.jsx)(Za,{className:`size-3`})})]})}function BQ({value:e,onChange:t,disabled:n=!1}){let r=Array.isArray(e)?e:[],[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=(0,v.useRef)(null),h=CT(ST(CE,{activationConstraint:{distance:5}}));(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in i));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);Promise.all(e.map(e=>fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(t=>t?[e,t.url]:null).catch(()=>null))).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);Object.keys(t).length>0&&a(e=>({...e,...t}))})},[r.join(`,`)]),(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in o));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():{items:[]}).then(t=>{let n={};for(let r of t.items)e.includes(r.id)&&(n[r.id]=r.filename);Object.keys(n).length>0&&s(e=>({...e,...n}))}).catch(()=>{})},[r.join(`,`)]);function g(e){return e.startsWith(`http`)?e:i[e]??null}function _(e){return o[e]??``}function y(e){if(n)return;let{active:i,over:a}=e;!a||i.id===a.id||t(kD(r,r.indexOf(i.id),r.indexOf(a.id)))}async function b(e){if(e.length===0)return;l(!0),d(null);let n=r;try{for(let r of e){let e=await FQ(r);a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:r.name})),n=[...n,e.id],t(n)}}catch(e){d(e instanceof Error?e.message:`Upload failed.`)}finally{l(!1),m.current&&(m.current.value=``)}}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`input`,{ref:m,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{b(Array.from(e.target.files??[]))}}),r.length>0&&(0,H.jsx)(bD,{sensors:h,collisionDetection:AT,onDragEnd:y,children:(0,H.jsx)(BD,{items:r,strategy:PD,children:(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,children:r.map(e=>(0,H.jsx)(zQ,{id:e,previewUrl:g(e),filename:_(e),onRemove:()=>t(r.filter(t=>t!==e)),disabled:n},e))})})}),(0,H.jsxs)(`div`,{className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>m.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),c?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>p(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),u&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:u}),(0,H.jsx)(LQ,{open:f,onOpenChange:p,allowedTypes:[`image`],onSelect:e=>{r.includes(e.id)||(a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:e.filename})),t([...r,e.id]))}})]})}function VQ({value:e,onChange:t,disabled:n=!1}){let[r,i]=(0,v.useState)(()=>e!=null&&e!==``?String(e):``);(0,v.useEffect)(()=>{if(e==null||e===``){i(``);return}let t=typeof e==`number`?e:parseFloat(String(e));!isNaN(t)&&t!==parseFloat(r)&&i(String(t))},[e]);function a(e){let n=e.target.value.replace(`,`,`.`);if(i(n),n===``||n===`-`){t(null);return}let r=parseFloat(n);isNaN(r)||t(r)}return(0,H.jsx)(Ev,{type:`text`,inputMode:`decimal`,className:K(`w-full`,`text-base!`),value:r,placeholder:`0.00`,onChange:a,disabled:n})}function HQ({value:e,onChange:t,timezone:n,disabled:r=!1}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(`00:00`);(0,v.useEffect)(()=>{if(!e){s(void 0),l(`00:00`);return}let t=new Date(e);isNaN(t.getTime())||(s(t),l(ly(e,n)))},[e,n]);function u(e){s(e),a(!1),e&&t(uy(e,c,n))}function d(e){l(e),o&&t(uy(o,e,n))}return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(mN,{open:i&&!r,onOpenChange:a,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal text-base`,disabled:r,children:[o?vA(o,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Oa,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(fN,{mode:`single`,selected:o,captionLayout:`dropdown`,defaultMonth:o??new Date,onSelect:u})})]}),(0,H.jsx)(Ev,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none text-base!`,value:c,onChange:e=>d(e.target.value),disabled:r}),e&&(0,H.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground hover:text-foreground`,onClick:()=>{s(void 0),l(`00:00`),t(null)},disabled:r,children:(0,H.jsx)(Bo,{className:`size-3.5`})})]})}function UQ(e){return e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}var WQ={data:null,promise:null};function GQ(e){return WQ.data?Promise.resolve(WQ.data):(WQ.promise||=fetch(`/cms/admin/content-types`,{headers:e}).then(e=>e.ok?e.json():[]).then(e=>(WQ.data=e,e)).catch(()=>[]),WQ.promise)}function KQ(e,t){return e.find(e=>e.tableName===t)??null}function qQ(e,t){return fetch(`/cms/admin/content-types/${e}/entries?limit=200`,{headers:t}).then(e=>e.ok?e.json():{data:[]}).catch(()=>({data:[]}))}function JQ(e){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e)return;i(!0);let t=localStorage.getItem(`plank_token`),r=t?{Authorization:`Bearer ${t}`}:{};GQ(r).then(t=>{let n=KQ(t,e);return n?qQ(n.slug,r).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:t})=>{let r=e?UQ(e.fields??[]):null;n(t.data.map(e=>({id:String(e.id),label:String(r?e[r]??e.id:e.id)})))}).catch(()=>n([])).finally(()=>i(!1))},[e]),{entries:t,loading:r}}function YQ(e,t,n){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e||!n){i([]);return}o(!0);let r=localStorage.getItem(`plank_token`),a=r?{Authorization:`Bearer ${r}`}:{};GQ(a).then(t=>{let n=KQ(t,e);return n?qQ(n.slug,a).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:r})=>{let a=e?UQ(e.fields??[]):null;i(r.data.filter(e=>String(e[t]??``)===n).map(e=>({id:String(e.id),label:String(a?e[a]??e.id:e.id)})))}).catch(()=>i([])).finally(()=>o(!1))},[e,t,n]),{entries:r,loading:a}}function XQ({relatedTable:e,relatedField:t,currentId:n}){let{entries:r,loading:i}=YQ(e,t,n);return n?i?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,H.jsx)(iy,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading…`})]}):r.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No linked entries.`}):(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-md border bg-muted px-2 py-0.5 text-xs`,children:e.label},e.id))}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this entry first to see linked items.`})}function ZQ({relationType:e,relatedTable:t,relatedField:n,currentEntryId:r,value:i,onChange:a,disabled:o=!1}){let s=e===`many-to-many`,[c,l]=(0,v.useState)(!1),{entries:u,loading:d}=JQ(t);if(e===`one-to-many`)return(0,H.jsx)(XQ,{relatedTable:t,relatedField:n,currentId:r});let f=s?Array.isArray(i)?i:[]:i&&!Array.isArray(i)?[i]:[];function p(e){return u.find(t=>t.id===e)?.label??e}function m(e){if(s){let t=f.includes(e)?f.filter(t=>t!==e):[...f,e];a(t.length>0?t:null)}else a(f[0]===e?null:e),l(!1)}function h(e){if(s){let t=f.filter(t=>t!==e);a(t.length>0?t:null)}else a(null)}let g=s?f.length>0?`${f.length} selected`:`Select entries…`:f.length>0?p(f[0]):`Select entry…`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(mN,{open:c&&!o,onOpenChange:l,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":c,className:`w-full justify-between font-normal text-base`,disabled:o,children:[(0,H.jsx)(`span`,{className:`truncate text-left`,children:g}),(0,H.jsx)(Ma,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,H.jsxs)(CQ,{children:[(0,H.jsx)(wQ,{placeholder:`Search…`}),(0,H.jsx)(TQ,{children:d?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(EQ,{children:`No entries found.`}),(0,H.jsx)(DQ,{children:u.map(e=>{let t=f.includes(e.id);return(0,H.jsxs)(kQ,{value:e.label,onSelect:()=>{o||m(e.id)},children:[(0,H.jsx)(Da,{className:`mr-2 size-4 ${t?`opacity-100`:`opacity-0`}`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.label}),(0,H.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground opacity-60 shrink-0`,children:e.id.slice(0,8)})]},e.id)})})]})})]})})]}),f.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-muted px-2 py-0.5 text-xs`,children:[p(e),(0,H.jsx)(`button`,{type:`button`,onClick:()=>h(e),disabled:o,className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(Bo,{className:`size-3`})})]},e))})]})}var QQ={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`};function $Q({field:e,value:t,onChange:n,disabled:r=!1}){let i=Array.isArray(t)?t:[],a=e.arrayFields??[];function o(){return Object.fromEntries(a.map(e=>[e.name,e.type===`boolean`?!1:null]))}function s(){n([...i,o()])}function c(e){n(i.filter((t,n)=>n!==e))}function l(e,t){let r=e+t;if(r<0||r>=i.length)return;let a=[...i];[a[e],a[r]]=[a[r],a[e]],n(a)}function u(e,t,r){n(i.map((n,i)=>i===e?{...n,[t]:r}:n))}return a.length===0?(0,H.jsx)(`div`,{className:`flex w-full items-center justify-center rounded-md border border-dashed p-4 text-xs text-muted-foreground`,children:`No sub-fields defined for this array.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(vN,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>(0,H.jsxs)(yN,{value:`item-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsxs)(bN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:[`Item `,t+1]}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>c(t),disabled:r,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),(0,H.jsx)(xN,{className:`px-3 pt-3`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:a.map(n=>(0,H.jsxs)(`div`,{className:QQ[n.width??`full`]??`col-span-6`,children:[(0,H.jsx)(`div`,{className:`mb-1 flex items-center gap-1`,children:(0,H.jsxs)(Y,{className:`text-xs font-medium`,children:[n.name,n.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})}),(0,H.jsx)(a$,{field:{...n,type:n.type},value:e[n.name]??null,onChange:e=>u(t,n.name,e),allValues:e,disabled:r})]},n.name))})})]},t))}),(0,H.jsxs)(`button`,{type:`button`,onClick:s,disabled:r,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]})]})}var e$=3,t$=20;function n$({value:e,onChange:t,disabled:n=!1,depth:r=0}){let i=Array.isArray(e)?e:[],a=r+1<e$,o=i.length<t$;function s(){return{label:``,href:``}}function c(e,n){let r=(t,i)=>{let a=e[i];return t.map((t,o)=>{if(o!==a)return t;if(i===e.length-1)return n(t);let s=Array.isArray(t.items)?t.items:[];return{...t,items:r(s,i+1)}})};t(r(i,0))}function l(e,n){let r=(t,i)=>{if(i===e.length-1){let r=e[i],a=r+n;if(a<0||a>=t.length)return t;let o=[...t];return[o[r],o[a]]=[o[a],o[r]],o}let a=e[i];return t.map((e,t)=>{if(t!==a)return e;let n=Array.isArray(e.items)?e.items:[];return{...e,items:r(n,i+1)}})};t(r(i,0))}function u(e){let n=(t,r)=>{let i=e[r];return r===e.length-1?t.filter((e,t)=>t!==i):t.map((e,t)=>{if(t!==i)return e;let a=Array.isArray(e.items)?e.items:[];return{...e,items:n(a,r+1)}})};t(n(i,0))}function d(){o&&t([...i,s()])}return i.length===0?(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n||!o,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/20`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(vN,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>{let o=[t],s=e.label?.trim()?e.label:`Item ${t+1}`;return(0,H.jsxs)(yN,{value:`navigation-item-${r}-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsx)(bN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:s}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>u(o),disabled:n,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),(0,H.jsxs)(xN,{className:`px-3 pt-3`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-6 gap-3`,children:[(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`label`}),(0,H.jsx)(Ev,{className:`text-base`,value:e.label??``,onChange:e=>c(o,t=>({...t,label:e.target.value})),disabled:n})]}),(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`href`}),(0,H.jsx)(Ev,{className:`text-base`,value:e.href??``,onChange:e=>c(o,t=>({...t,href:e.target.value})),disabled:n})]})]}),a?(0,H.jsxs)(`div`,{className:`mt-3 border-l border-border pl-3`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Child items`}),(0,H.jsx)(n$,{value:e.items??[],onChange:e=>c(o,t=>({...t,items:Array.isArray(e)&&e.length>0?e:void 0})),disabled:n,depth:r+1})]}):(0,H.jsxs)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:[`Maximum depth reached (`,e$,` levels).`]})]})]},t)})}),(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]}),!o&&(0,H.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Maximum `,t$,` items allowed per level.`]})]})}function r$(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function i$({value:e,onChange:t,disabled:n=!1}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null);function p(){return o(!0),new Promise(e=>{i.current=e})}function m(e){i.current?.(e),i.current=null}function h(e){e||m(null),o(e)}async function g(e){u(!0),f(null);try{let t=await EZ(e);m({src:t.url,alt:t.alt,width:t.width,height:t.height}),o(!1)}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}finally{u(!1),r.current&&(r.current.value=``)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:n?`pointer-events-none opacity-70`:``,children:(0,H.jsx)(CZ,{value:String(e??``),onChange:t,placeholder:`Type or add your content here...`,onInsertImage:p})}),(0,H.jsx)(ZC,{open:a,onOpenChange:h,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Insert Image`})}),(0,H.jsx)(`input`,{ref:r,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&g(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files[0];t&&g(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>r.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),l?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>c(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),d&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:d})]})}),(0,H.jsx)(LQ,{open:s,onOpenChange:e=>{!e&&!a&&m(null),c(e)},allowedTypes:[`image`],onSelect:e=>{m({src:e.url,alt:e.alt,width:e.width,height:e.height}),c(!1),o(!1)}})]})}function a$({field:e,value:t,onChange:n,allValues:r,disabled:i}){let a=(0,v.useRef)(!1),{timezone:o}=sa();(0,v.useEffect)(()=>{if(e.type!==`uid`||!e.targetField||a.current)return;let t=r,i=e.targetField,o=!!t.__localizationEnabled,s=r[i];if(s!=null&&String(s).trim()!==``){n(r$(String(s)));return}let c=r.localized&&typeof r.localized==`object`?r.localized:{};if(o){let e=r.__defaultLocale;e&&c[e]&&c[e][i]!==void 0&&String(c[e][i]).trim()!==``&&n(r$(String(c[e][i])));return}let l=Object.keys(c).filter(e=>!e.startsWith(`_`));for(let e of l)if(c[e]&&c[e][i]!==void 0&&String(c[e][i]).trim()!==``){n(r$(String(c[e][i])));return}},[e.type,e.targetField,r[e.targetField??``],JSON.stringify(r.localized??{}),r.__localizationEnabled]);let s=`w-full`;return e.type===`boolean`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(iO,{id:`field-${e.name}`,checked:!!t,onCheckedChange:e=>n(!!e),disabled:!!i}),(0,H.jsx)(Y,{htmlFor:`field-${e.name}`,className:`cursor-pointer font-normal text-base`,children:t?`Yes`:`No`})]}):e.type===`richtext`?(0,H.jsx)(i$,{value:t,onChange:n,disabled:!!i}):e.type===`text`?(0,H.jsx)(_N,{className:K(s,`text-base`),value:String(t??``),placeholder:e.name,onChange:e=>n(e.target.value),disabled:!!i}):e.type===`number`?e.subtype===`float`?(0,H.jsx)(VQ,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Ev,{type:`number`,className:K(s,`text-base!`),value:t==null?``:String(t),step:`1`,placeholder:`0`,onChange:e=>{let t=e.target.value;if(t===``){n(null);return}n(parseInt(t,10))},disabled:!!i}):e.type===`datetime`?(0,H.jsx)(HQ,{value:t,onChange:n,timezone:o,disabled:!!i}):e.type===`uid`?(0,H.jsx)(Ev,{className:K(s,`text-base md:text-base`),value:String(t??``),placeholder:`auto-generated`,onChange:e=>{let t=e.target.value;a.current=!!(t&&t!==``),n(e.target.value)},disabled:!!i}):e.type===`media`?(0,H.jsx)(RQ,{value:t,onChange:n,allowedTypes:e.allowedTypes,disabled:!!i}):e.type===`media-gallery`?(0,H.jsx)(BQ,{value:t,onChange:n,disabled:!!i}):e.type===`relation`?(0,H.jsx)(ZQ,{relationType:e.relationType??`many-to-one`,relatedTable:e.relatedTable??``,relatedField:e.relatedField??``,currentEntryId:String(r.id??``),value:t,onChange:n,disabled:!!i}):e.type===`array`?(0,H.jsx)($Q,{field:e,value:t,onChange:n,disabled:!!i}):e.type===`navigation`?(0,H.jsx)(n$,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Ev,{className:K(s,`text-base md:text-base`),value:String(t??``),placeholder:e.name,onChange:e=>n(e.target.value),disabled:!!i})}function o$(e){return Array.isArray(e)?e.map(o$):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,o$(t)])):e}function s$(e){return JSON.stringify(o$(e))}function c$(){let{slug:e,id:t}=rr(),n=$n(),r=!t,{timezone:i,locales:a,defaultLocale:o}=sa(),{user:s}=ia(),{data:c,loading:l}=fa(e?`/cms/admin/content-types/${e}`:null),{data:u,loading:d}=fa(e&&t?`/cms/admin/entries/${e}/${t}`:null),{loading:f,request:p}=Tv(),{loading:m,request:h}=Tv(),{loading:g,request:_}=Tv(),[y,b]=(0,v.useState)({}),[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(`draft`),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(!1),[ee,te]=(0,v.useState)(),[ne,z]=(0,v.useState)(`09:00`),B=(0,v.useRef)(`{}`),re=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(r){let e={};c?.fields.forEach(t=>{e[t.name]=t.type===`boolean`?!1:``}),e.localized={};let t=a&&a.length>0?a:[`en`];S(t),w(o??t[0]),E(!1),b(e),O(`draft`),A(``),M(!1),B.current=s$(e);return}if(!u||!c)return;let e={};c.fields.forEach(t=>{e[t.name]=u[t.name]??(t.type===`boolean`?!1:``)});let t=u.localized,n=t&&typeof t==`object`?t:{};e.localized=n;let s=Object.keys(n).filter(e=>!e.startsWith(`_`)),l=n._meta||{},d=l.enabled??s.length>0;if(l.primary??s[0],s.length>0)S(s),w(s[0]);else{let e=a&&a.length>0?a:[`en`];S(e),w(o??e[0])}if(E(!!d),b(e),O(u.status??`draft`),B.current=s$(e),u.scheduled_for?(A(u.scheduled_for),te(new Date(u.scheduled_for)),z(ly(u.scheduled_for,i))):A(``),u.status===`published`&&u.published_data){let t=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=/Z|[+-]\d{2}:\d{2}$/.test(e)?e:e+`Z`,n=new Date(t);return isNaN(n.getTime())?e:n.toISOString()}return e},n={},r={};c.fields.forEach(i=>{i.name in u.published_data&&(n[i.name]=t(u.published_data[i.name]??(i.type===`boolean`?!1:``),i.type),r[i.name]=t(e[i.name],i.type))}),M(s$(r)!==s$(n))}else M(!1)},[u,c,r]);let V=s$(y)!==B.current,ie=Cr((0,v.useCallback)(()=>re.current?!1:V,[V]));function ae(e,t){b(n=>({...n,[e]:t}))}function oe(e,t,n){b(r=>{let i={...r||{}};return(!i.localized||typeof i.localized!=`object`)&&(i.localized={}),i.localized[e]={...i.localized[e]||{}},i.localized[e][t]=n,i})}function se(e){E(e),b(t=>{let n={...t||{}};if((!n.localized||typeof n.localized!=`object`)&&(n.localized={}),n.localized._meta||(n.localized._meta={}),e&&o)n.localized[o]||(n.localized[o]={},c&&c.fields&&c.fields.forEach(e=>{if([`string`,`text`,`richtext`].includes(e.type)){let t=n[e.name];t!=null&&t!==``&&(n.localized[o][e.name]=t)}})),n.localized._meta.primary=o;else if(!e&&o){let e=n.localized&&n.localized[o]?n.localized[o]:null;e&&c&&c.fields&&c.fields.forEach(t=>{if([`string`,`text`,`richtext`,`uid`].includes(t.type)){let r=e[t.name];r!==void 0&&(n[t.name]=r)}})}return n.localized._meta.enabled=e,n})}function ce(){if(k)te(new Date(k)),z(ly(k,i));else{let e=new Date;e.setDate(e.getDate()+1),te(e),z(`09:00`)}I(!0)}async function le(){if(!e||!c)return null;let n={},i=T&&y.localized&&typeof y.localized==`object`&&y.localized[o]?y.localized[o]:null;c.fields.forEach(e=>{let t=y[e.name];(t==null||t===``)&&i&&i[e.name]!==void 0&&(t=i[e.name]),e.type===`media`&&t===null?n[e.name]=null:t!==``&&t!=null&&(n[e.name]=t)}),y.localized&&Object.keys(y.localized).length>0&&(y.localized._meta||(y.localized._meta={}),y.localized._meta.enabled=T,y.localized._meta.primary=o,n.localized=y.localized);try{let i=await p(r?`/cms/admin/content-types/${e}/entries`:`/cms/admin/entries/${e}/${t}`,r?`POST`:`PUT`,n);return B.current=s$(y),i}catch{return null}}async function ue(){let i=await le();if(i){if(D===`scheduled`){let n=r?i.id:t;try{await h(`/cms/admin/entries/${e}/${n}/status`,`PATCH`,{status:`draft`}),O(`draft`),A(``),I(!1)}catch{}}else D===`published`&&M(!0);r&&(re.current=!0,n(`/content/${e}/${i.id}`,{replace:!0}))}}async function de(){if(!e)return;let i=t;if(V||r){let e=await le();if(!e)return;i=r?e.id:t,r&&(re.current=!0)}try{await h(`/cms/admin/entries/${e}/${i}/status`,`PATCH`,{status:`published`}),O(`published`),A(``),M(!1),I(!1),r&&n(`/content/${e}/${i}`,{replace:!0})}catch{r&&i&&n(`/content/${e}/${i}`,{replace:!0})}}async function fe(){if(!e||!ee||!ne)return;let a=uy(ee,ne,i);if(new Date(a)<=new Date)return;let o=t;if(V||r){let e=await le();if(!e)return;o=r?e.id:t,r&&(re.current=!0)}try{await h(`/cms/admin/entries/${e}/${o}/status`,`PATCH`,{status:`scheduled`,scheduled_for:a}),O(`scheduled`),A(a),I(!1),r&&n(`/content/${e}/${o}`,{replace:!0})}catch{r&&o&&n(`/content/${e}/${o}`,{replace:!0})}}async function pe(){if(!(!e||!t))try{await h(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`draft`}),O(`draft`),A(``),M(!1)}catch{}}async function me(){if(!(!e||!t))try{await _(`/cms/admin/entries/${e}/${t}`,`DELETE`),re.current=!0,n(`/content/${e}`,{replace:!0})}catch{}}let he=l||!r&&d,ge=f||m,_e=s?.permissions??[],ve=_e.includes(`*`)||_e.includes(`entries:write`),ye=_e.includes(`*`)||_e.includes(`entries:delete`),be=s?.role?.toLowerCase()===`user`&&c?.kind===`single`,xe=!ve||be,Se=V||D===`draft`||D===`scheduled`||j,Ce=!!(ee&&ne);if(ZD(`mod+s`,ue,{enabled:!xe&&!ge&&(D===`scheduled`?!0:V),label:`Save draft`}),ZD(`mod+shift+p`,de,{enabled:Se&&!ge&&!xe,label:`Publish`}),he)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!c)return null;let we;return we=D===`scheduled`?(0,H.jsxs)(XC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(wa,{className:`size-3 mr-1`}),k?`Scheduled · ${cy(k,i)}`:`Scheduled`]}):D===`published`?(0,H.jsx)(XC,{variant:j?`secondary`:`default`,children:j?`Published (pending changes)`:`Published`}):(0,H.jsx)(XC,{variant:`secondary`,children:`Draft`}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:r?`New entry`:`Edit entry`}),we]}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs mt-1`,children:c.name})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&ye&&!be&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>P(!0),disabled:g,children:(0,H.jsx)(Mo,{className:`size-4`})}),!r&&D===`published`&&!xe&&(0,H.jsxs)(q,{variant:`outline`,onClick:pe,disabled:ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Revert to draft`]}),!r&&D===`scheduled`&&!xe&&(0,H.jsxs)(q,{variant:`outline`,onClick:pe,disabled:ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Cancel schedule`]}),(0,H.jsxs)(q,{variant:`outline`,onClick:ue,disabled:xe||(D===`scheduled`?ge:!V||ge),children:[f?(0,H.jsx)(iy,{className:`size-4`}):null,D===`scheduled`?`Save draft (cancel schedule)`:`Save draft`]}),D!==`scheduled`&&(0,H.jsxs)(q,{variant:`outline`,onClick:ce,disabled:xe||ge,children:[(0,H.jsx)(wa,{className:`size-4`}),`Schedule`]}),(0,H.jsxs)(q,{onClick:de,disabled:xe||!Se||ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,D===`scheduled`?`Publish now`:D===`published`&&!j?`Republish`:`Publish`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[F&&!xe&&(0,H.jsxs)(`div`,{className:`mb-6 flex items-end gap-2 rounded-lg border p-4 bg-muted/30`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Date`}),(0,H.jsxs)(mN,{open:L,onOpenChange:R,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal`,children:[ee?vA(ee,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Oa,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(fN,{mode:`single`,selected:ee,captionLayout:`dropdown`,defaultMonth:ee??new Date,disabled:{before:new Date},onSelect:e=>{te(e),R(!1)}})})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{children:[`Time `,(0,H.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(24h)`})]}),(0,H.jsx)(Ev,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none`,value:ne,onChange:e=>z(e.target.value)})]}),(0,H.jsxs)(q,{onClick:fe,disabled:!Ce||ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Confirm`]}),(0,H.jsx)(q,{variant:`ghost`,onClick:()=>I(!1),children:`Cancel`})]}),(0,H.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(NA,{checked:T,onCheckedChange:se,disabled:xe}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Localization`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enable per-entry localization`})]})]}),(0,H.jsx)(`div`,{})]}),(0,H.jsx)(`div`,{children:T&&(0,H.jsx)(kA,{value:C,onValueChange:e=>w(e),children:(0,H.jsx)(AA,{children:x.map(e=>(0,H.jsx)(jA,{value:e,disabled:xe,children:e.toUpperCase()},e))})})})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-4`,children:c.fields.map(e=>{let n=[`string`,`text`,`richtext`].includes(e.type),r=y.localized&&y.localized[C]?y.localized[C][e.name]:void 0,i=n&&T?r:y[e.name],a=e.type===`uid`&&e.targetField&&T&&[`string`,`text`,`richtext`].includes(c.fields.find(t=>t.name===e.targetField)?.type??``);return(0,H.jsx)(`div`,{className:$D[e.width??`full`],children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`entry-${e.name}`,className:`capitalize`,children:[e.name.replace(/_/g,` `),e.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,H.jsx)(a$,{field:e,value:i,onChange:t=>{n&&T?oe(C,e.name,t):ae(e.name,t)},allValues:{...y,id:t,__activeLocale:C,__localizationEnabled:T,__defaultLocale:o},disabled:!!a||xe})]})},e.name)})}),(0,H.jsx)(ZC,{open:N,onOpenChange:P,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete this entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>P(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:me,disabled:g,children:[g?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:ie.state===`blocked`,onOpenChange:()=>ie.reset?.(),children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Leave without saving?`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ie.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>ie.proceed?.(),children:`Leave`})]})]})})]})]})}function l$({...e}){return(0,H.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,...e})}function u$({className:e,...t}){return(0,H.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:K(`flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5`,e),...t})}function d$({className:e,...t}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:K(`inline-flex items-center gap-1.5`,e),...t})}function f$({asChild:e,className:t,...n}){return(0,H.jsx)(e?yl:`a`,{"data-slot":`breadcrumb-link`,className:K(`transition-colors hover:text-foreground`,t),...n})}function p$({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:K(`font-normal text-foreground`,e),...t})}function m$({children:e,className:t,...n}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:K(`[&>svg]:size-3.5`,t),...n,children:e??(0,H.jsx)(Aa,{})})}function h$(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function g$(e){return!!e?.startsWith(`image/`)}function _$(e){return!!e?.startsWith(`video/`)}function v$(e){return!!e?.startsWith(`audio/`)}function y$(e){return e===`application/pdf`}function b$(e,t){return e.split(`?`)[0].endsWith(`.m3u8`)||t===`application/x-mpegurl`||t===`application/vnd.apple.mpegurl`}async function x$(e){if(e.isFile)return new Promise(t=>{e.file(n=>t([{file:n,relativePath:e.fullPath.replace(/^\//,``)}]))});if(e.isDirectory){let t=e.createReader(),n=[];return await new Promise(e=>{let r=()=>{t.readEntries(async t=>{if(t.length===0){e();return}let i=await Promise.all(t.map(x$));n.push(...i.flat()),r()})};r()}),n}return[]}function S$({url:e}){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let n=t.current;if(!n)return;if(n.canPlayType(`application/vnd.apple.mpegurl`)){n.src=e;return}let r=null;return w(async()=>{let{default:e}=await import(`./hls-0EiSYoTw.js`);return{default:e}},[]).then(({default:t})=>{if(!t.isSupported())return;let i=new t;r=i,i.loadSource(e),i.attachMedia(n)}),()=>{r?.destroy()}},[e]),(0,H.jsx)(`video`,{ref:t,controls:!0,className:`max-h-[70vh] w-full rounded-md bg-black`})}function C$({item:e}){let t=e.mime_type?.toLowerCase()??null;return g$(t)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`max-h-full max-w-full rounded-md object-contain`}):b$(e.url,t)?(0,H.jsx)(S$,{url:e.url}):_$(t)?(0,H.jsx)(`video`,{src:e.url,controls:!0,preload:`none`,className:`max-h-[70vh] w-full rounded-md bg-black`}):v$(t)?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-6`,children:[(0,H.jsx)(Ua,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full`})]}):y$(t)?(0,H.jsx)(`iframe`,{src:e.url,title:e.filename,className:`h-[70vh] w-full rounded-md border`}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-center`,children:[(0,H.jsx)(Ga,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.mime_type??`Unknown type`}),(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,download:e.filename,children:(0,H.jsxs)(q,{variant:`outline`,size:`sm`,children:[(0,H.jsx)(za,{className:`size-4`}),`Download`]})})]})}function w$({folder:e,onOpen:t,onDelete:n,onRename:r,canDelete:i,canRename:a,selected:o,onToggle:s}){return(0,H.jsxs)(`div`,{className:`group relative flex items-center gap-3 rounded-lg border bg-card px-3 py-2.5 transition-colors cursor-pointer hover:bg-muted/50 ${o?`ring-2 ring-primary`:``}`,onClick:()=>{o||t(e)},children:[(0,H.jsxs)(`div`,{className:`relative shrink-0 size-7 flex items-center justify-center`,children:[(0,H.jsx)(Xa,{className:`size-7 text-muted-foreground transition-opacity ${o?`opacity-0`:`group-hover:opacity-0`}`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center transition-opacity ${o?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(iO,{checked:o,onCheckedChange:()=>s(`folder:${e.id}`),"aria-label":`Select folder`})})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-bold truncate`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]}),!o&&(a||i)&&(0,H.jsxs)(v_,{children:[(0,H.jsx)(y_,{asChild:!0,children:(0,H.jsx)(`button`,{className:`shrink-0 opacity-0 group-hover:opacity-100 transition-opacity flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(Ba,{className:`size-4`})})}),(0,H.jsxs)(S_,{align:`end`,onClick:e=>e.stopPropagation(),children:[a&&(0,H.jsxs)(C_,{onSelect:()=>r(e),children:[(0,H.jsx)(vo,{className:`size-4`}),`Rename`]}),i&&(0,H.jsxs)(C_,{onSelect:()=>n(e),className:`text-destructive focus:text-destructive`,children:[(0,H.jsx)(Mo,{className:`size-4`}),`Delete`]})]})]})]})}function T$({item:e,onDelete:t,onPreview:n,canDelete:r,selected:i,onToggle:a}){let o=e.mime_type?.toLowerCase()??null;return(0,H.jsxs)(`div`,{className:`group relative rounded-lg border bg-card overflow-hidden transition-colors ${i?`ring-2 ring-primary`:``}`,children:[(0,H.jsx)(`div`,{className:`aspect-square bg-muted flex items-center justify-center cursor-pointer`,onClick:()=>{i||n(e)},children:g$(o)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):_$(o)||b$(e.url,o)?(0,H.jsx)(Wa,{className:`size-10 text-muted-foreground`}):v$(o)?(0,H.jsx)(Ua,{className:`size-10 text-muted-foreground`}):y$(o)?(0,H.jsx)(Ga,{className:`size-10 text-muted-foreground`}):(0,H.jsx)(Ka,{className:`size-10 text-muted-foreground`})}),(0,H.jsx)(`div`,{className:`absolute top-1.5 left-1.5 transition-opacity ${i?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,H.jsx)(iO,{checked:i,onCheckedChange:()=>a(e.id),"aria-label":`Select file`,className:`bg-background/80 backdrop-blur-sm`})}),!i&&r&&(0,H.jsx)(`button`,{onClick:()=>t(e),className:`absolute top-1.5 right-1.5 flex size-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground opacity-0 backdrop-blur-sm transition-opacity hover:text-destructive group-hover:opacity-100`,children:(0,H.jsx)(Mo,{className:`size-3.5`})}),(0,H.jsxs)(`div`,{className:`p-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium truncate`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h$(e.size)})]})]})}function E$(){let e=(0,v.useRef)(null),{user:t}=ia(),n=t?.permissions??[],r=n.includes(`*`)||n.includes(`media:write`),i=n.includes(`*`)||n.includes(`media:delete`),[a,o]=(0,v.useState)([{id:null,name:`Media`}]),s=a[a.length-1].id,{data:c,loading:l,refetch:u}=fa(`/cms/admin/folders?parent_id=${s??``}`),{data:d,loading:f,refetch:p}=fa(`/cms/admin/media?folder_id=${s??``}`),m=(0,v.useCallback)(()=>{u(),p()},[u,p]),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(new Set),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(null),[I,L]=(0,v.useState)(null),[R,ee]=(0,v.useState)(``),[te,ne]=(0,v.useState)(!1),[z,B]=(0,v.useState)(``),[re,V]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(!1),{loading:oe,error:se,request:ce}=Tv(),{loading:le,error:ue,request:de}=Tv();async function fe(e){if(e.some(({relativePath:e})=>e.endsWith(`.m3u8`))){let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=new FormData;for(let{file:t,relativePath:n}of e)r.append(`files`,t,n);s&&r.append(`folder_id`,s),r.append(`bundle`,`true`);let i=await fetch(`/cms/admin/media`,{method:`POST`,headers:n,body:r});if(!i.ok){let e=await i.text(),t=`Upload failed.`;try{t=JSON.parse(e).error??t}catch{}throw Error(t)}}else await Promise.all(e.map(({file:e})=>EZ(e,{folderId:s})))}async function pe(t){if(r&&!(!t||t.length===0)){g(!0),y(null);try{await fe(Array.from(t).map(e=>({file:e,relativePath:e.webkitRelativePath||e.name}))),m()}catch(e){y(e instanceof Error?e.message:`Upload failed.`)}finally{g(!1),e.current&&(e.current.value=``)}}}async function me(e){if(!r)return;e.preventDefault();let t=Array.from(e.dataTransfer.items);if(!t.some(e=>typeof e.webkitGetAsEntry==`function`)){pe(e.dataTransfer.files);return}g(!0),y(null);try{let e=t.map(e=>e.webkitGetAsEntry()).filter(e=>e!==null);await fe((await Promise.all(e.map(x$))).flat()),m()}catch(e){y(e instanceof Error?e.message:`Upload failed.`)}finally{g(!1)}}function he(e){o(t=>[...t,{id:e.id,name:e.name}]),x(new Set)}function ge(e){o(t=>t.slice(0,e+1)),x(new Set)}async function _e(){if(r&&z.trim())try{await de(`/cms/admin/folders`,`POST`,{name:z.trim(),parent_id:s}),ne(!1),B(``),u()}catch{}}async function ve(){if(r&&!(!I||!R.trim()))try{await de(`/cms/admin/folders/${I.id}`,`PATCH`,{name:R.trim()}),L(null),u()}catch{}}async function ye(){if(i&&P)try{await ce(`/cms/admin/folders/${P.id}`,`DELETE`),F(null),u()}catch{}}async function be(){if(i&&M)try{await ce(`/cms/admin/media/${M.id}`,`DELETE`),N(null),p()}catch{}}function xe(e){x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let Se=c?.folders??[],Ce=d?.items??[],we=[...Se.map(e=>`folder:${e.id}`),...Ce.map(e=>e.id)],Te=we.length>0&&we.every(e=>b.has(e)),Ee=!Te&&we.some(e=>b.has(e));async function De(){if(!i||ie)return;ae(!0);let e=localStorage.getItem(`plank_token`),t=e?{Authorization:`Bearer ${e}`}:{};try{await Promise.all([...[...b].filter(e=>e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/folders/${e.slice(7)}`,{method:`DELETE`,headers:t})),...[...b].filter(e=>!e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/media/${e}`,{method:`DELETE`,headers:t}))]),V(!1),x(new Set),m()}finally{ae(!1)}}let Oe=l||f,ke=Se.length===0&&Ce.length===0;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Media Library`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d?`${d.total} file${d.total===1?``:`s`}`:``})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>{B(``),ne(!0)},disabled:!r,children:[(0,H.jsx)(Ya,{className:`size-4`}),`New folder`]}),(0,H.jsxs)(q,{onClick:()=>e.current?.click(),disabled:h||!r,children:[h?(0,H.jsx)(iy,{className:`size-4`}):(0,H.jsx)(Io,{className:`size-4`}),h?`Uploading…`:`Upload`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[a.length>1&&(0,H.jsx)(l$,{className:`mb-4`,children:(0,H.jsx)(u$,{children:a.map((e,t)=>(0,H.jsxs)(v.Fragment,{children:[t>0&&(0,H.jsx)(m$,{}),(0,H.jsx)(d$,{children:t===a.length-1?(0,H.jsx)(p$,{children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name}):(0,H.jsx)(f$,{asChild:!0,children:(0,H.jsx)(`button`,{onClick:()=>ge(t),children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name})})})]},t))})}),!ke&&!Oe&&(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-4 py-2.5`,children:[(0,H.jsx)(iO,{checked:Te?!0:Ee?`indeterminate`:!1,onCheckedChange:()=>{x(Te?new Set:new Set(we))},"aria-label":`Select all`}),b.size>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[b.size,` selected`]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,H.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>x(new Set),children:`Clear`}),i&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:ie,onClick:()=>V(!0),children:[(0,H.jsx)(Mo,{className:`size-3.5`}),`Delete`]})]})]}):(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Select all`})]}),(0,H.jsx)(`input`,{ref:e,type:`file`,multiple:!0,className:`hidden`,onChange:e=>pe(e.target.files)}),_&&(0,H.jsx)(`p`,{className:`mb-4 text-sm text-destructive`,children:_}),Oe?(0,H.jsx)(`div`,{className:`flex items-center gap-2 py-16 justify-center text-muted-foreground`,children:(0,H.jsx)(iy,{className:`size-5`})}):ke?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-lg border border-dashed py-20 text-center cursor-pointer hover:bg-muted/50 transition-colors`,onClick:()=>r&&e.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:me,children:[(0,H.jsx)(Io,{className:`size-8 text-muted-foreground mb-3`}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Drop files or folders here, or click to upload`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Images, videos, audio, documents and more`})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,onDragOver:e=>e.preventDefault(),onDrop:me,children:[Se.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,children:Se.map(e=>(0,H.jsx)(w$,{folder:e,onOpen:he,onDelete:F,onRename:e=>{L(e),ee(e.name)},canDelete:i,canRename:r,selected:b.has(`folder:${e.id}`),onToggle:xe},e.id))}),Ce.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6`,children:Ce.map(e=>(0,H.jsx)(T$,{item:e,onDelete:N,onPreview:e=>{C(e),T(e.filename),D(e.alt??``),j(null)},canDelete:i,selected:b.has(e.id),onToggle:xe},e.id))})]}),(0,H.jsx)(ZC,{open:!!S,onOpenChange:e=>{e||(C(null),j(null))},children:(0,H.jsxs)(tw,{className:`sm:max-w-4xl h-[80vh] flex flex-col`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{className:`truncate pr-6`,title:S?.filename,children:S?.filename})}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center overflow-hidden`,children:S&&(0,H.jsx)(C$,{item:S})}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:S?.mime_type??`—`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[S?.width&&S?.height&&(0,H.jsxs)(`span`,{children:[S.width,` × `,S.height]}),(0,H.jsx)(`span`,{children:h$(S?.size??null)}),(0,H.jsx)(`a`,{href:S?.url,target:`_blank`,rel:`noreferrer`,download:S?.filename,children:(0,H.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,children:(0,H.jsx)(za,{className:`size-3.5`})})})]})]}),S&&g$(S.mime_type)&&(0,H.jsxs)(`form`,{className:`flex flex-col gap-3 border-t pt-3`,onSubmit:async e=>{e.preventDefault(),k(!0),j(null);let t=localStorage.getItem(`plank_token`);try{let e=await fetch(`/cms/admin/media/${S.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({filename:w||S.filename,alt:E||null})});if(!e.ok)throw Error(`Save failed.`);C(await e.json()),p()}catch(e){j(e instanceof Error?e.message:`Save failed.`)}finally{k(!1)}},children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Filename`}),(0,H.jsx)(Ev,{value:w,onChange:e=>T(e.target.value),placeholder:S.filename,className:`h-8 text-sm`,disabled:!r})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Alt text`}),(0,H.jsx)(Ev,{value:E,onChange:e=>D(e.target.value),placeholder:`Describe the image…`,className:`h-8 text-sm`,disabled:!r})]})]}),A&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:A}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(q,{type:`submit`,size:`sm`,disabled:O||!r,children:O?`Saving…`:`Save`})})]})]})}),(0,H.jsx)(ZC,{open:te,onOpenChange:e=>{e||ne(!1)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New folder`})}),(0,H.jsx)(Ev,{placeholder:`Folder name`,value:z,onChange:e=>B(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_e()},autoFocus:!0}),ue&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ue}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ne(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:_e,disabled:le||!z.trim()||!r,children:le?`Creating…`:`Create`})]})]})}),(0,H.jsx)(ZC,{open:!!I,onOpenChange:e=>{e||L(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Rename folder`})}),(0,H.jsx)(Ev,{value:R,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ve()},autoFocus:!0}),ue&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ue}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>L(null),children:`Cancel`}),(0,H.jsx)(q,{onClick:ve,disabled:le||!R.trim()||!r,children:le?`Saving…`:`Save`})]})]})}),(0,H.jsx)(ZC,{open:!!M,onOpenChange:e=>{e||N(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete file`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:M?.filename}),`? This action cannot be undone.`]}),se&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:se}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>N(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:be,disabled:oe||!i,children:oe?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(ZC,{open:!!P,onOpenChange:e=>{e||F(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete folder`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:P?.name}),`? The folder must be empty.`]}),se&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:se}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>F(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:ye,disabled:oe||!i,children:oe?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(ZC,{open:re,onOpenChange:e=>{e||V(!1)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete `,b.size,` `,b.size===1?`item`:`items`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone. Non-empty folders will be skipped.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>V(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:De,disabled:ie,children:[ie?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function D$({items:e}){let{pathname:t}=Xn();function n(e){return t===e||t.startsWith(e+`/`)}return(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:e.map(({label:e,to:t,icon:r})=>(0,H.jsxs)(Fi,{to:t,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,n(t)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[r&&(0,H.jsx)(r,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:e})]},t))})}function O$(e,t){return e?.permissions.includes(`*`)||e?.permissions.includes(t)||!1}function k$(){let{user:e}=ia(),t=[{label:`Overview`,to:`/settings/overview`,icon:wo,permission:`settings:overview:read`},{label:`Users`,to:`/settings/users`,icon:Ro,permission:`settings:users:read`},{label:`Roles`,to:`/settings/roles`,icon:To,permission:`settings:roles:read`},{label:`API Tokens`,to:`/settings/api-tokens`,icon:ao,permission:`settings:api-tokens:read`},{label:`Webhooks`,to:`/settings/webhooks`,icon:zo,permission:`settings:webhooks:read`}].filter(({permission:t})=>O$(e,t));return(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Settings`})}),(0,H.jsx)(D$,{items:t})]})}function A$(){return Tw((0,H.jsx)(k$,{})),(0,H.jsx)(Br,{})}var j$=`••••••••`;function M$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-uploads-dir`,children:`Upload directory`}),(0,H.jsx)(Ev,{id:`local-uploads-dir`,placeholder:`public/uploads`,value:e[`local.uploads_dir`]??``,onChange:e=>t(`local.uploads_dir`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Path on disk where files are stored. Relative to the server working directory.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-public-url`,children:`Public URL`}),(0,H.jsx)(Ev,{id:`local-public-url`,placeholder:`http://localhost:1337`,value:e[`local.public_url`]??``,onChange:e=>t(`local.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Base URL used to build file URLs. Should match the server's public address.`})]})]})}function N$({id:e,label:t,fieldKey:n,values:r,onChange:i,placeholder:a,disabled:o=!1}){let[s,c]=(0,v.useState)(!1),l=r[n]===j$,u=r[n]??``;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:e,children:t}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ev,{id:e,type:s?`text`:`password`,placeholder:l?`Leave blank to keep current value`:a,value:l?``:u,onChange:e=>i(n,e.target.value),className:`pr-9`,disabled:o}),(0,H.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,disabled:o,children:s?(0,H.jsx)(Va,{className:`size-4`}):(0,H.jsx)(Ha,{className:`size-4`})})]}),l&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A value is already saved. Enter a new one to replace it.`})]})}function P$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-access-key`,children:`Access key ID`}),(0,H.jsx)(Ev,{id:`s3-access-key`,placeholder:`AKIAIOSFODNN7EXAMPLE`,value:e[`s3.access_key_id`]??``,onChange:e=>t(`s3.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(N$,{id:`s3-secret-key`,label:`Secret access key`,fieldKey:`s3.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-region`,children:`Region`}),(0,H.jsx)(Ev,{id:`s3-region`,placeholder:`us-east-1`,value:e[`s3.region`]??``,onChange:e=>t(`s3.region`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-bucket`,children:`Bucket`}),(0,H.jsx)(Ev,{id:`s3-bucket`,placeholder:`my-bucket`,value:e[`s3.bucket`]??``,onChange:e=>t(`s3.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Ev,{id:`s3-path-prefix`,placeholder:`cms/media`,value:e[`s3.path_prefix`]??``,onChange:e=>t(`s3.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-public-url`,children:`Public URL`}),(0,H.jsx)(Ev,{id:`s3-public-url`,placeholder:`https://cdn.example.com`,value:e[`s3.public_url`]??``,onChange:e=>t(`s3.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Leave blank to use the default S3 URL.`})]})]})}function F$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-access-key`,children:`Access key ID`}),(0,H.jsx)(Ev,{id:`r2-access-key`,placeholder:`R2 access key ID`,value:e[`r2.access_key_id`]??``,onChange:e=>t(`r2.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(N$,{id:`r2-secret-key`,label:`Secret access key`,fieldKey:`r2.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-bucket`,children:`Bucket`}),(0,H.jsx)(Ev,{id:`r2-bucket`,placeholder:`my-bucket`,value:e[`r2.bucket`]??``,onChange:e=>t(`r2.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Ev,{id:`r2-path-prefix`,placeholder:`cms/media`,value:e[`r2.path_prefix`]??``,onChange:e=>t(`r2.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`r2-public-url`,children:[`Public URL `,(0,H.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,H.jsx)(Ev,{id:`r2-public-url`,placeholder:`https://assets.example.com`,value:e[`r2.public_url`]??``,onChange:e=>t(`r2.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Required. R2 does not generate public URLs automatically.`})]})]})}function I$(){let{user:e}=ia(),{data:t,loading:n}=fa(`/cms/admin/settings/media`),{loading:r,error:i,request:a}=Tv(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),u=o??t??{provider:`local`},d=u.provider||`local`,f=e?.permissions??[],p=f.includes(`*`)||f.includes(`settings:overview:write`);function m(e,t){s({...u,[e]:t})}function h(e){s({...u,provider:e})}async function g(e){e.preventDefault();try{await a(`/cms/admin/settings/media`,`PUT`,u),l(!0),setTimeout(()=>l(!1),2500)}catch{}}return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading settings…`})]}):(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Storage`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure where uploaded files are stored.`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`provider`,children:`Storage provider`}),(0,H.jsxs)(ow,{value:d,onValueChange:e=>h(e),children:[(0,H.jsx)(lw,{id:`provider`,disabled:!p,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`local`,children:`Local`}),(0,H.jsx)(mw,{value:`s3`,children:`Amazon S3`}),(0,H.jsx)(mw,{value:`r2`,children:`Cloudflare R2`})]})]})]}),d===`r2`&&(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-account-id`,children:`Account ID`}),(0,H.jsx)(Ev,{id:`r2-account-id`,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:u[`r2.account_id`]??``,onChange:e=>m(`r2.account_id`,e.target.value),disabled:!p}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Found in the Cloudflare dashboard under R2 > Overview.`})]})]}),(0,H.jsxs)(`div`,{className:`border-t pt-6`,children:[d===`local`&&(0,H.jsx)(M$,{values:u,onChange:m,disabled:!p}),d===`s3`&&(0,H.jsx)(P$,{values:u,onChange:m,disabled:!p}),d===`r2`&&(0,H.jsx)(F$,{values:u,onChange:m,disabled:!p})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(q,{type:`submit`,disabled:r||!p,children:r?`Saving…`:`Save`}),c&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Changes saved.`}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i})]})]})}function L$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card`,className:K(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function R$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-header`,className:K(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function z$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-title`,className:K(`leading-none font-semibold`,e),...t})}function B$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-action`,className:K(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function V$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-content`,className:K(`px-6`,e),...t})}var H$={name:`@plank-cms/admin`,version:`0.15.2`,type:`module`,scripts:{build:`vite build`,dev:`vite`,lint:`eslint src/`},dependencies:{"@dnd-kit/core":`6.3.1`,"@dnd-kit/sortable":`10.0.0`,"@dnd-kit/utilities":`3.2.2`,"@radix-ui/react-avatar":`1.1.11`,"@radix-ui/react-checkbox":`1.3.3`,"@radix-ui/react-dialog":`1.1.15`,"@radix-ui/react-dropdown-menu":`2.1.16`,"@radix-ui/react-label":`2.1.8`,"@radix-ui/react-popover":`1.1.15`,"@radix-ui/react-select":`2.2.6`,"@radix-ui/react-separator":`1.1.8`,"@radix-ui/react-slot":`1.2.4`,"@radix-ui/react-switch":`1.2.6`,"@radix-ui/react-tabs":`1.1.13`,"@radix-ui/react-tooltip":`1.2.8`,"@tanstack/react-table":`8.21.3`,"@tiptap/extension-image":`3.22.4`,"@tiptap/pm":`3.22.4`,"@tiptap/react":`3.22.4`,"@tiptap/starter-kit":`3.22.4`,"class-variance-authority":`0.7.1`,clsx:`2.1.1`,cmdk:`1.1.1`,"date-fns":`4.1.0`,"hls.js":`1.6.16`,"input-otp":`1.4.2`,"lucide-react":`1.8.0`,"qrcode.react":`4.2.0`,"radix-ui":`1.4.3`,react:`19.2.5`,"react-day-picker":`9.14.0`,"react-dom":`19.2.5`,"react-router-dom":`7.14.1`,"tailwind-merge":`3.5.0`},devDependencies:{"@tailwindcss/vite":`4.2.3`,"@types/react":`19.2.14`,"@types/react-dom":`19.2.3`,"@types/react-router-dom":`5.3.3`,"@vitejs/plugin-react":`6.0.1`,tailwindcss:`4.2.3`,vite:`8.0.9`}},U$=[{value:`UTC`,label:`UTC — Coordinated Universal Time`},{value:`America/New_York`,label:`America/New_York — Eastern Time (UTC-5/4)`},{value:`America/Chicago`,label:`America/Chicago — Central Time (UTC-6/5)`},{value:`America/Denver`,label:`America/Denver — Mountain Time (UTC-7/6)`},{value:`America/Los_Angeles`,label:`America/Los_Angeles — Pacific Time (UTC-8/7)`},{value:`America/Anchorage`,label:`America/Anchorage — Alaska Time (UTC-9/8)`},{value:`America/Honolulu`,label:`America/Honolulu — Hawaii Time (UTC-10)`},{value:`America/Mexico_City`,label:`America/Mexico_City — Mexico City (UTC-6/5)`},{value:`America/El_Salvador`,label:`America/El_Salvador — El Salvador (UTC-6)`},{value:`America/Bogota`,label:`America/Bogota — Colombia Time (UTC-5)`},{value:`America/Lima`,label:`America/Lima — Peru Time (UTC-5)`},{value:`America/Santiago`,label:`America/Santiago — Chile Time (UTC-4/3)`},{value:`America/Argentina/Buenos_Aires`,label:`America/Buenos_Aires — Argentina (UTC-3)`},{value:`America/Sao_Paulo`,label:`America/Sao_Paulo — Brasília Time (UTC-3/2)`},{value:`Atlantic/Reykjavik`,label:`Atlantic/Reykjavik — Iceland (UTC+0)`},{value:`Europe/London`,label:`Europe/London — GMT/BST (UTC+0/1)`},{value:`Europe/Paris`,label:`Europe/Paris — Central European Time (UTC+1/2)`},{value:`Europe/Berlin`,label:`Europe/Berlin — Central European Time (UTC+1/2)`},{value:`Europe/Madrid`,label:`Europe/Madrid — Central European Time (UTC+1/2)`},{value:`Europe/Rome`,label:`Europe/Rome — Central European Time (UTC+1/2)`},{value:`Europe/Helsinki`,label:`Europe/Helsinki — Eastern European Time (UTC+2/3)`},{value:`Europe/Istanbul`,label:`Europe/Istanbul — Turkey Time (UTC+3)`},{value:`Europe/Moscow`,label:`Europe/Moscow — Moscow Standard Time (UTC+3)`},{value:`Asia/Dubai`,label:`Asia/Dubai — Gulf Standard Time (UTC+4)`},{value:`Asia/Karachi`,label:`Asia/Karachi — Pakistan Standard Time (UTC+5)`},{value:`Asia/Kolkata`,label:`Asia/Kolkata — India Standard Time (UTC+5:30)`},{value:`Asia/Dhaka`,label:`Asia/Dhaka — Bangladesh Standard Time (UTC+6)`},{value:`Asia/Bangkok`,label:`Asia/Bangkok — Indochina Time (UTC+7)`},{value:`Asia/Singapore`,label:`Asia/Singapore — Singapore Time (UTC+8)`},{value:`Asia/Shanghai`,label:`Asia/Shanghai — China Standard Time (UTC+8)`},{value:`Asia/Tokyo`,label:`Asia/Tokyo — Japan Standard Time (UTC+9)`},{value:`Asia/Seoul`,label:`Asia/Seoul — Korea Standard Time (UTC+9)`},{value:`Australia/Sydney`,label:`Australia/Sydney — AEST/AEDT (UTC+10/11)`},{value:`Australia/Melbourne`,label:`Australia/Melbourne — AEST/AEDT (UTC+10/11)`},{value:`Pacific/Auckland`,label:`Pacific/Auckland — New Zealand (UTC+12/13)`}];function W$(){let{user:e}=ia(),{data:t,loading:n}=fa(`/cms/admin/settings/general`),{request:r,loading:i}=Tv(),{refreshSettings:a}=sa(),[o,s]=(0,v.useState)(`UTC`),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(`en`),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),g=e?.permissions??[],_=g.includes(`*`)||g.includes(`settings:overview:write`);(0,v.useEffect)(()=>{if(t?.timezone&&s(t.timezone),t?.locales)try{let e=JSON.parse(t.locales);Array.isArray(e)&&l(e)}catch{l((t.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean))}t?.default_locale&&d(t.default_locale)},[t]);async function y(){let e={timezone:o};c.length&&(e.locales=JSON.stringify(c)),u&&(e.default_locale=u),await r(`/cms/admin/settings/general`,`PUT`,e),a(),h(!0),setTimeout(()=>h(!1),2e3)}return n?(0,H.jsx)(iy,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(L$,{children:(0,H.jsxs)(V$,{className:`flex items-center gap-4 py-2`,children:[(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10 w-auto`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-bold`,children:`Plank CMS by AM25`}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,H$.version]})]})]})}),(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Commons`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`General settings that apply across the CMS.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`timezone`,children:`Timezone`}),(0,H.jsxs)(ow,{value:o,onValueChange:s,children:[(0,H.jsx)(lw,{id:`timezone`,className:`w-1/2`,disabled:!_,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{className:`max-h-72`,children:U$.map(e=>(0,H.jsx)(mw,{value:e.value,children:e.label},e.value))})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Used to display dates and times across the admin panel.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{children:`Locales`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Ev,{placeholder:`E.g. "en"`,value:f,onChange:e=>p(e.target.value),className:`w-1/4`,disabled:!_}),(0,H.jsx)(q,{variant:`outline`,disabled:!_,onClick:()=>{let e=f.trim().toLowerCase();e&&(c.includes(e)||l(t=>[...t,e]),p(``))},children:`Add`})]}),(0,H.jsx)(`div`,{className:`flex gap-2 mt-2`,children:c.map(e=>(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>l(t=>t.filter(t=>t!==e)),disabled:!_,children:e.toUpperCase()},e))}),(0,H.jsxs)(`div`,{className:`mt-2`,children:[(0,H.jsx)(Y,{htmlFor:`default-locale`,children:`Default locale`}),(0,H.jsxs)(ow,{value:u,onValueChange:d,children:[(0,H.jsx)(lw,{id:`default-locale`,className:`w-1/2`,disabled:!_,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{className:`max-h-72`,children:c.length===0?(0,H.jsx)(mw,{value:u,children:u}):c.map(e=>(0,H.jsx)(mw,{value:e,children:e.toUpperCase()},e))})]})]})]}),(0,H.jsx)(q,{onClick:y,disabled:i||!_,children:m?`Saved`:i?`Saving…`:`Save`})]})}function G$(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(ry,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Overview`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`General configuration for your CMS instance.`})]}),(0,H.jsxs)(kA,{defaultValue:`general`,className:`mt-24`,children:[(0,H.jsxs)(AA,{className:`mb-6`,children:[(0,H.jsx)(jA,{value:`general`,children:`General`}),(0,H.jsx)(jA,{value:`media`,children:`Media Library`})]}),(0,H.jsx)(MA,{value:`general`,children:(0,H.jsx)(W$,{})}),(0,H.jsx)(MA,{value:`media`,children:(0,H.jsx)(I$,{})})]})]})}function K$(e,t){return typeof e==`function`?e(t):e}function q$(e,t){return n=>{t.setState(t=>({...t,[e]:K$(n,t[e])}))}}function J$(e){return e instanceof Function}function Y$(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function X$(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function Z$(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
219
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=MG(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=MG(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});nG.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(qY.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(JY.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(aX.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(gX.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(vX.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(yX.configure(this.options.taskList)),e}});var bX=`&nbsp;`,xX=`\xA0`,SX=FG.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,NU(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===bX||n[0].text===bX||n[0].raw===xX||n[0].text===xX)&&r.length===1&&r[0].type===`text`&&(r[0].text===bX||r[0].text===xX)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?bX:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),CX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,TX=qW.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,NU(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vG({find:CX,type:this.type})]},addPasteRules(){return[IG({find:wX,type:this.type})]}}),EX=FG.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),DX=qW.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,NU(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function OX(e={}){return new EI({view(t){return new kX(t,e)}})}var kX=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=LF(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},AX=class e extends iI{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):iI.near(r)}content(){return Z.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new jX(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!NX(e)||!PX(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!uI.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};AX.prototype.visible=!1,AX.findFrom=AX.findGapCursorFrom,iI.jsonID(`gapcursor`,AX);var jX=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return AX.valid(t)?new AX(t):iI.near(t)}};function MX(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function NX(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||MX(e.type))return!0;if(e.inlineContent)return!1}}return!0}function PX(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||MX(e.type))return!0;if(e.inlineContent)return!1}}return!0}function FX(){return new EI({props:{decorations:BX,createSelectionBetween(e,t,n){return t.pos==n.pos&&AX.valid(n)?new AX(n):null},handleClick:RX,handleKeyDown:IX,handleDOMEvents:{beforeinput:zX}}})}var IX=nH({ArrowLeft:LX(`horiz`,-1),ArrowRight:LX(`horiz`,1),ArrowUp:LX(`vert`,-1),ArrowDown:LX(`vert`,1)});function LX(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof cI){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=AX.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new AX(c))),!0):!1}}function RX(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!AX.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&uI.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new AX(r))),!0)}function zX(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof AX))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=X.empty;for(let e=r.length-1;e>=0;e--)i=X.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return a.setSelection(cI.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function BX(e){if(!(e.selection instanceof AX))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,tV.create(e.doc,[QB.widget(e.selection.head,t,{key:`gapcursor`})])}var VX=200,HX=function(){};HX.prototype.append=function(e){return e.length?(e=HX.from(e),!this.length&&e||e.length<VX&&this.leafAppend(e)||this.length<VX&&e.leafPrepend(this)||this.appendInner(e)):this},HX.prototype.prepend=function(e){return e.length?HX.from(e).append(this):this},HX.prototype.appendInner=function(e){return new WX(this,e)},HX.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?HX.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},HX.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},HX.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},HX.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},HX.from=function(e){return e instanceof HX?e:e&&e.length?new UX(e):HX.empty};var UX=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=VX)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=VX)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(HX);HX.empty=new UX([]);var WX=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(HX),GX=500,KX=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new JX(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new JX(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new JX(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>XX&&(s=qX(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new tF;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new JX(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new JX(i,o,l))}else r.push(new JX(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new JX(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>GX&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new JX(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(HX.from(i.reverse()),a)}};KX.empty=new KX(HX.empty,0);function qX(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var JX=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},YX=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},XX=20;function ZX(e,t,n,r){let i=n.getMeta(aZ),a;if(i)return i.historyState;n.getMeta(oZ)&&(e=new YX(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(aZ))return o.getMeta(aZ).redo?new YX(e.done.addTransform(n,void 0,r,iZ(t)),e.undone,$X(n.mapping.maps),e.prevTime,e.prevComposition):new YX(e.done,e.undone.addTransform(n,void 0,r,iZ(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!QX(n,e.prevRanges)),s=o?eZ(e.prevRanges,n.mapping):$X(n.mapping.maps);return new YX(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,iZ(t)),KX.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new YX(e.done.rebased(n,a),e.undone.rebased(n,a),eZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new YX(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),eZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function QX(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function $X(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function eZ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function tZ(e,t,n){let r=iZ(t),i=aZ.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new YX(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(aZ,{redo:n,historyState:c})}var nZ=!1,rZ=null;function iZ(e){let t=e.plugins;if(rZ!=t){nZ=!1,rZ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){nZ=!0;break}}return nZ}var aZ=new kI(`history`),oZ=new kI(`closeHistory`);function sZ(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new EI({key:aZ,state:{init(){return new YX(KX.empty,KX.empty,null,0,-1)},apply(t,n,r){return ZX(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?lZ:n==`historyRedo`?uZ:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function cZ(e,t){return(n,r)=>{let i=aZ.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=tZ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var lZ=cZ(!1,!0),uZ=cZ(!0,!0);nG.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new EI({key:new kI(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var dZ=nG.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[OX(this.options)]}});nG.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new EI({key:new kI(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return tV.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(QB.node(t,t+e.nodeSize,{class:this.options.className}))}),tV.create(e,a)}}})]}});var fZ=nG.create({name:`gapCursor`,addProseMirrorPlugins(){return[FX()]},extendNodeSchema(e){return{allowGapCursor:DU(Q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),pZ=`placeholder`;function mZ(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}nG.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:pZ,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${mZ(this.options.dataAttribute)}`:`data-${pZ}`;return[new EI({key:new kI(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&cW(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=QB.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),tV.create(t,a)}}})]}}),nG.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new EI({key:new kI(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||lW(n.selection)||e.view.dragging?null:tV.create(n.doc,[QB.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function hZ({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var gZ=nG.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new kI(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new EI({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!hZ({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!hZ({node:r,types:n})}}})]}}),_Z=nG.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>lZ(e,t),redo:()=>({state:e,dispatch:t})=>uZ(e,t)}},addProseMirrorPlugins(){return[sZ(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),vZ=nG.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(uq.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(aq.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(qY.configure(this.options.bulletList)),this.options.code!==!1&&e.push(pq.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(_q.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(vq.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(dZ.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(fZ.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(yq.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(bq.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(_Z.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(xq.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Eq.configure(this.options.italic)),this.options.listItem!==!1&&e.push(JY.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(aX.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(VY.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(gX.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(SX.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(TX.configure(this.options.strike)),this.options.text!==!1&&e.push(EX.configure(this.options.text)),this.options.underline!==!1&&e.push(DX.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(gZ.configure(this.options?.trailingNode)),e}}),yZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,bZ=FG.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,NU(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new CG({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[yG({find:yZ,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function xZ({onClick:e,active:t,disabled:n,title:r,children:i}){return(0,H.jsx)(`button`,{type:`button`,title:r,disabled:n,onMouseDown:t=>{t.preventDefault(),e()},className:K(`flex size-7 items-center justify-center rounded transition-colors`,t?`bg-foreground text-background`:`text-muted-foreground hover:bg-accent hover:text-accent-foreground`,n&&`pointer-events-none opacity-40`),children:i})}function SZ(){return(0,H.jsx)(`div`,{className:`mx-0.5 h-4 w-px bg-border`})}function CZ({value:e,onChange:t,placeholder:n,onInsertImage:r}){let[i,a]=(0,v.useState)(!e),o=YK({extensions:[vZ.configure({link:{openOnClick:!1,HTMLAttributes:{class:`text-primary underline`}}}),bZ.extend({addAttributes(){return{...this.parent?.(),width:{default:null},height:{default:null}}}}).configure({HTMLAttributes:{class:`max-w-full rounded`}})],content:(()=>{if(!e)return``;try{return JSON.parse(e)}catch{return e}})(),editorProps:{attributes:{class:`h-128 px-3 py-2.5 focus:outline-none`}},onUpdate({editor:e}){a(e.isEmpty),t(JSON.stringify(e.getJSON()))}});(0,v.useEffect)(()=>{if(!o)return;let t=e?(()=>{try{return JSON.parse(e)}catch{return e}})():``;JSON.stringify(o.getJSON())!==e&&o.commands.setContent(t,{emitUpdate:!1}),a(o.isEmpty)},[e]);async function s(){if(!o||!r)return;let e=await r();e&&o.chain().focus().setImage({src:e.src,alt:e.alt??void 0,width:e.width??void 0,height:e.height??void 0}).run()}function c(){if(!o)return;let e=o.getAttributes(`link`).href,t=window.prompt(`URL`,e??`https://`);if(t!==null){if(!t){o.chain().focus().unsetLink().run();return}o.chain().focus().setLink({href:t}).run()}}return o?(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-input bg-background focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-0.5 border-b border-border bg-background px-2 py-1.5`,children:[(0,H.jsx)(xZ,{title:`Bold`,active:o.isActive(`bold`),onClick:()=>o.chain().focus().toggleBold().run(),children:(0,H.jsx)(Ca,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Italic`,active:o.isActive(`italic`),onClick:()=>o.chain().focus().toggleItalic().run(),children:(0,H.jsx)(io,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Underline`,active:o.isActive(`underline`),onClick:()=>o.chain().focus().toggleUnderline().run(),children:(0,H.jsx)(Po,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Strikethrough`,active:o.isActive(`strike`),onClick:()=>o.chain().focus().toggleStrike().run(),children:(0,H.jsx)(Oo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Heading 1`,active:o.isActive(`heading`,{level:1}),onClick:()=>o.chain().focus().toggleHeading({level:1}).run(),children:(0,H.jsx)($a,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Heading 2`,active:o.isActive(`heading`,{level:2}),onClick:()=>o.chain().focus().toggleHeading({level:2}).run(),children:(0,H.jsx)(eo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Heading 3`,active:o.isActive(`heading`,{level:3}),onClick:()=>o.chain().focus().toggleHeading({level:3}).run(),children:(0,H.jsx)(to,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Bullet list`,active:o.isActive(`bulletList`),onClick:()=>o.chain().focus().toggleBulletList().run(),children:(0,H.jsx)(mo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Ordered list`,active:o.isActive(`orderedList`),onClick:()=>o.chain().focus().toggleOrderedList().run(),children:(0,H.jsx)(fo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Blockquote`,active:o.isActive(`blockquote`),onClick:()=>o.chain().focus().toggleBlockquote().run(),children:(0,H.jsx)(bo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Inline code`,active:o.isActive(`code`),onClick:()=>o.chain().focus().toggleCode().run(),children:(0,H.jsx)(Ia,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Code block`,active:o.isActive(`codeBlock`),onClick:()=>o.chain().focus().toggleCodeBlock().run(),children:(0,H.jsx)(Eo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),(0,H.jsx)(xZ,{title:`Add link`,active:o.isActive(`link`),onClick:c,children:(0,H.jsx)(uo,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Remove link`,disabled:!o.isActive(`link`),onClick:()=>o.chain().focus().unsetLink().run(),children:(0,H.jsx)(Fo,{className:`size-3.5`})}),(0,H.jsx)(SZ,{}),r&&(0,H.jsx)(xZ,{title:`Insert image`,onClick:s,children:(0,H.jsx)(ro,{className:`size-3.5`})}),(0,H.jsx)(xZ,{title:`Hard break (Shift + Enter)`,onClick:()=>o.chain().focus().setHardBreak().run(),children:(0,H.jsx)(Ao,{className:`size-3.5`})})]}),(0,H.jsxs)(`div`,{className:`relative overflow-y-auto`,children:[i&&n&&(0,H.jsx)(`p`,{className:`pointer-events-none absolute left-3 top-2.5 text-muted-foreground select-none`,children:n}),(0,H.jsx)(VK,{editor:o})]})]}):null}function wZ(e){return{...e}}function TZ(e){return e.type.startsWith(`image/`)?new Promise(t=>{let n=new Image,r=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(r),t({width:n.naturalWidth,height:n.naturalHeight})},n.onerror=()=>{URL.revokeObjectURL(r),t(null)},n.src=r}):Promise.resolve(null)}async function EZ(e,t){let n=await TZ(e),r=await fetch(`/cms/admin/media/presign`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type,folderId:t?.folderId??null})});if(!r.ok)throw Error(`Upload failed.`);let i=await r.json();if(i.mode===`presigned`){if(!(await fetch(i.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let r=await fetch(`/cms/admin/media/confirm`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({key:i.key,filename:e.name,mimeType:e.type,size:e.size,folderId:t?.folderId??null,width:n?.width??null,height:n?.height??null})});if(!r.ok)throw Error(`Upload failed.`);return r.json()}let a=new FormData;a.append(`files`,e,e.name),t?.folderId&&a.append(`folder_id`,t.folderId),n?.width&&a.append(`width`,String(n.width)),n?.height&&a.append(`height`,String(n.height));let o=await fetch(`/cms/admin/media`,{method:`POST`,credentials:`include`,headers:wZ(),body:a});if(!o.ok)throw Error(`Upload failed.`);return o.json()}async function DZ(e){let t=await fetch(`/cms/admin/users/me/avatar/presign`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({filename:e.name,mimeType:e.type})});if(!t.ok)throw Error(`Upload failed.`);let n=await t.json();if(n.mode===`presigned`){if(!(await fetch(n.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":e.type}})).ok)throw Error(`Upload failed.`);let t=await fetch(`/cms/admin/users/me/avatar/confirm`,{method:`POST`,credentials:`include`,headers:wZ({"Content-Type":`application/json`}),body:JSON.stringify({key:n.key})});if(!t.ok)throw Error(`Upload failed.`);return(await t.json()).avatarUrl}let r=new FormData;r.append(`file`,e);let i=await fetch(`/cms/admin/users/me/avatar`,{method:`POST`,credentials:`include`,headers:wZ(),body:r});if(!i.ok)throw Error(`Upload failed.`);return(await i.json()).avatarUrl}var OZ=1,kZ=.9,AZ=.8,jZ=.17,MZ=.1,NZ=.999,PZ=.9999,FZ=.99,IZ=/[\\\/_+.#"@\[\(\{&]/,LZ=/[\\\/_+.#"@\[\(\{&]/g,RZ=/[\s-]/,zZ=/[\s-]/g;function BZ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?OZ:FZ;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=BZ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=OZ:IZ.test(e.charAt(l-1))?(d*=AZ,p=e.slice(i,l-1).match(LZ),p&&i>0&&(d*=NZ**+p.length)):RZ.test(e.charAt(l-1))?(d*=kZ,m=e.slice(i,l-1).match(zZ),m&&i>0&&(d*=NZ**+m.length)):(d*=jZ,i>0&&(d*=NZ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=PZ)),(d<MZ&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=BZ(e,t,n,r,l+1,a+2,o),f*MZ>d&&(d=f*MZ)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function VZ(e){return e.toLowerCase().replace(zZ,` `)}function HZ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,BZ(e,t,VZ(e),VZ(t),0,0,{})}var UZ=`[cmdk-group=""]`,WZ=`[cmdk-group-items=""]`,GZ=`[cmdk-group-heading=""]`,KZ=`[cmdk-item=""]`,qZ=`${KZ}:not([aria-disabled="true"])`,JZ=`cmdk-item-select`,YZ=`data-value`,XZ=(e,t,n)=>HZ(e,t,n),ZZ=v.createContext(void 0),QZ=()=>v.useContext(ZZ),$Z=v.createContext(void 0),eQ=()=>v.useContext($Z),tQ=v.createContext(void 0),nQ=v.forwardRef((e,t)=>{let n=gQ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=gQ(()=>new Set),i=gQ(()=>new Map),a=gQ(()=>new Map),o=gQ(()=>new Set),s=mQ(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,y=fu(),b=fu(),x=fu(),S=v.useRef(null),C=yQ();hQ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),hQ(()=>{C(6,A)},[]);let w=v.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=v.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??XZ;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(WZ);t?t.appendChild(e.parentElement===t?e:e.closest(`${WZ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${WZ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${UZ}[${YZ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(YZ);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(UZ)?.querySelector(GZ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${KZ}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(qZ)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(YZ))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(YZ))}function F(e){let t=j()?.closest(UZ),n;for(;t&&!n;)t=e>0?fQ(t,UZ):pQ(t,UZ),n=t?.querySelector(qZ);n?w.setState(`value`,n.getAttribute(YZ)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return v.createElement(zc.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(JZ);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:SQ},c),xQ(e,e=>v.createElement($Z.Provider,{value:w},v.createElement(ZZ.Provider,{value:T},e))))}),rQ=v.forwardRef((e,t)=>{let n=fu(),r=v.useRef(null),i=v.useContext(tQ),a=QZ(),o=mQ(e),s=o.current?.forceMount??i?.forceMount;hQ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=vQ(n,r,[e.value,e.children,r],e.keywords),l=eQ(),u=_Q(e=>e.value&&e.value===c.current),d=_Q(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);v.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(JZ,f),()=>t.removeEventListener(JZ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:y,...b}=e;return v.createElement(zc.div,{ref:Go(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),iQ=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=fu(),s=v.useRef(null),c=v.useRef(null),l=fu(),u=QZ(),d=_Q(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);hQ(()=>u.group(o),[]),vQ(o,s,[e.value,e.heading,c]);let f=v.useMemo(()=>({id:o,forceMount:i}),[i]);return v.createElement(zc.div,{ref:Go(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&v.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),xQ(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},v.createElement(tQ.Provider,{value:f},e))))}),aQ=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),a=_Q(e=>!e.search);return!n&&!a?null:v.createElement(zc.div,{ref:Go(i,t),...r,"cmdk-separator":``,role:`separator`})}),oQ=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=eQ(),o=_Q(e=>e.search),s=_Q(e=>e.selectedItemId),c=QZ();return v.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),v.createElement(zc.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),sQ=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=v.useRef(null),o=v.useRef(null),s=_Q(e=>e.selectedItemId),c=QZ();return v.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(zc.div,{ref:Go(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xQ(e,e=>v.createElement(`div`,{ref:Go(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),cQ=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(Hb,{open:n,onOpenChange:r},v.createElement(Ub,{container:o},v.createElement(Wb,{"cmdk-overlay":``,className:i}),v.createElement(Gb,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(nQ,{ref:t,...s}))))}),lQ=v.forwardRef((e,t)=>_Q(e=>e.filtered.count===0)?v.createElement(zc.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),uQ=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return v.createElement(zc.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},xQ(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),dQ=Object.assign(nQ,{List:sQ,Item:rQ,Input:oQ,Group:iQ,Separator:aQ,Dialog:cQ,Empty:lQ,Loading:uQ});function fQ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function pQ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mQ(e){let t=v.useRef(e);return hQ(()=>{t.current=e}),t}var hQ=typeof window>`u`?v.useEffect:v.useLayoutEffect;function gQ(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function _Q(e){let t=eQ(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function vQ(e,t,n,r=[]){let i=v.useRef(),a=QZ();return hQ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(YZ,s),i.current=s}),i}var yQ=()=>{let[e,t]=v.useState(),n=gQ(()=>new Map);return hQ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function bQ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function xQ({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(bQ(t),{ref:t.ref},n(t.props.children)):n(t)}var SQ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},CQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ,{ref:n,className:K(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));CQ.displayName=dQ.displayName;var wQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,H.jsx)(Co,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,H.jsx)(dQ.Input,{ref:n,className:K(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));wQ.displayName=dQ.Input.displayName;var TQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.List,{ref:n,className:K(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));TQ.displayName=dQ.List.displayName;var EQ=v.forwardRef((e,t)=>(0,H.jsx)(dQ.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));EQ.displayName=dQ.Empty.displayName;var DQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Group,{ref:n,className:K(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));DQ.displayName=dQ.Group.displayName;var OQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Separator,{ref:n,className:K(`-mx-1 h-px bg-border`,e),...t}));OQ.displayName=dQ.Separator.displayName;var kQ=v.forwardRef(({className:e,...t},n)=>(0,H.jsx)(dQ.Item,{ref:n,className:K(`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));kQ.displayName=dQ.Item.displayName;var AQ=({className:e,...t})=>(0,H.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});AQ.displayName=`CommandShortcut`;var jQ={image:`image/*`,video:`video/*`,audio:`audio/*`,document:`.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv`};function MQ(e){return!e||e.length===0?`*/*`:e.map(e=>jQ[e]).join(`,`)}function NQ(e){let t=e.replace(/_/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):`Value`}function PQ(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function FQ(e){return e?.startsWith(`image/`)??!1}async function IQ(e,t){return EZ(e,{folderId:t})}function LQ(e,t){if(!t||t.length===0)return!0;let n=e??``;return t.some(e=>e===`image`?n.startsWith(`image/`):e===`video`?n.startsWith(`video/`):e===`audio`?n.startsWith(`audio/`):e===`document`?n.startsWith(`application/`)||n.startsWith(`text/`):!1)}function RQ({open:e,onOpenChange:t,allowedTypes:n,onSelect:r}){let[i,a]=(0,v.useState)([{id:null,name:`Media`}]),o=i[i.length-1].id,[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;f(!0);let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=o??``;Promise.all([fetch(`/cms/admin/folders?parent_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{folders:[]}).then(e=>e.folders),fetch(`/cms/admin/media?folder_id=${r}`,{headers:n}).then(e=>e.ok?e.json():{items:[]}).then(e=>e.items)]).then(([e,t])=>{c(e),u(t)}).catch(()=>{c([]),u([])}).finally(()=>f(!1))},[e,o]),(0,v.useEffect)(()=>{e||a([{id:null,name:`Media`}])},[e]);function p(e){a(t=>[...t,{id:e.id,name:e.name}])}function m(e){a(t=>t.slice(0,e+1))}let h=l.filter(e=>LQ(e.mime_type,n)),g=s.length===0&&h.length===0;return(0,H.jsx)(ZC,{open:e,onOpenChange:t,children:(0,H.jsxs)(tw,{className:`max-w-3xl`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Media Library`})}),i.length>1&&(0,H.jsx)(`div`,{className:`flex items-center gap-1 text-sm -mt-1`,children:i.map((e,t)=>(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-muted-foreground`,children:[t>0&&(0,H.jsx)(`span`,{children:`/`}),t===i.length-1?(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name}):(0,H.jsx)(`button`,{onClick:()=>m(t),className:`hover:text-foreground transition-colors`,children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name})]},t))}),d?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,H.jsx)(iy,{className:`size-5`})}):g?(0,H.jsx)(`p`,{className:`py-16 text-center text-sm text-muted-foreground`,children:l.length===0&&s.length===0?`No media found.`:`No matching files in this folder.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto pr-1`,children:[s.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>p(e),className:`flex items-center gap-2.5 rounded-md border bg-card px-2.5 py-2 text-left transition-colors hover:bg-muted/50 hover:border-primary`,children:[(0,H.jsx)(Xa,{className:`size-7 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-xs font-bold leading-tight`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]})]},e.id))}),h.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5`,children:h.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{r(e),t(!1)},className:`group relative overflow-hidden rounded-md border bg-card text-left transition-colors hover:border-primary`,children:[(0,H.jsx)(`div`,{className:`aspect-square bg-muted`,children:FQ(e.mime_type)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(Ka,{className:`size-6 text-muted-foreground`})})}),(0,H.jsxs)(`div`,{className:`p-1.5`,children:[(0,H.jsx)(`p`,{className:`truncate text-[11px] font-medium leading-tight`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:PQ(e.size)})]}),(0,H.jsx)(`div`,{className:`absolute inset-0 rounded-md ring-2 ring-primary ring-offset-1 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none`})]},e.id))})]})]})})}function zQ({value:e,onChange:t,allowedTypes:n,disabled:r=!1}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),p=typeof e==`string`&&e.startsWith(`http`);(0,v.useEffect)(()=>{if(!e){u(null);return}if(p){u(e);return}let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(e=>u(e?.url??null)).catch(()=>u(null))},[e,p]);async function m(e){o(!0),c(null);try{let n=await IQ(e);u(n.url),t(n.id)}catch(e){c(e instanceof Error?e.message:`Upload failed.`)}finally{o(!1),i.current&&(i.current.value=``)}}let h=l&&/\.(jpe?g|png|gif|webp|avif|svg)(\?|$)/i.test(l);return e?(0,H.jsxs)(`div`,{className:`relative w-full rounded-md border bg-muted/30 overflow-hidden`,children:[l?h?(0,H.jsx)(`img`,{src:l,alt:`Media`,className:`max-h-72 w-full object-contain`}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,H.jsx)(ro,{className:`size-4 text-muted-foreground shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:l})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground`,children:[(0,H.jsx)(ro,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs`,children:`Loading…`})]}),(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`secondary`,className:`absolute top-1.5 right-1.5 size-6`,onClick:()=>{t(null),u(null)},disabled:r,children:(0,H.jsx)(Bo,{className:`size-3.5`})})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`input`,{ref:i,type:`file`,accept:MQ(n),className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&m(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{if(r)return;e.preventDefault();let t=e.dataTransfer.files[0];t&&m(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>i.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),a?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:a||r,onClick:()=>f(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),s&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:s}),(0,H.jsx)(RQ,{open:d,onOpenChange:f,allowedTypes:n,onSelect:e=>{u(e.url),t(e.id)}})]})}function BQ({id:e,previewUrl:t,filename:n,onRemove:r,disabled:i=!1}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=JD({id:e});return(0,H.jsxs)(`div`,{ref:s,style:{transform:sT.Transform.toString(c),transition:l,opacity:u?.4:1},className:`relative aspect-square overflow-hidden rounded-md border bg-muted`,children:[t?(0,H.jsx)(`img`,{src:t,alt:n,className:`h-full w-full object-cover`}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(ro,{className:`size-5 text-muted-foreground`})}),n&&(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 bg-background/75 backdrop-blur-sm px-1.5 py-1 pointer-events-none`,children:(0,H.jsx)(`p`,{className:`truncate text-[10px] leading-none text-foreground`,children:n})}),(0,H.jsx)(`button`,{type:`button`,onClick:r,disabled:i,className:`absolute right-1 top-1 flex size-5 items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm hover:bg-background`,children:(0,H.jsx)(Bo,{className:`size-3`})}),!i&&(0,H.jsx)(`button`,{type:`button`,className:`absolute bottom-6 left-1 flex size-5 cursor-grab items-center justify-center rounded-full bg-background/80 text-foreground shadow-sm active:cursor-grabbing`,...o,...a,children:(0,H.jsx)(Za,{className:`size-3`})})]})}function VQ({value:e,onChange:t,disabled:n=!1}){let r=Array.isArray(e)?e:[],[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=(0,v.useRef)(null),h=CT(ST(CE,{activationConstraint:{distance:5}}));(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in i));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);Promise.all(e.map(e=>fetch(`/cms/admin/media/${e}/url`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():null).then(t=>t?[e,t.url]:null).catch(()=>null))).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);Object.keys(t).length>0&&a(e=>({...e,...t}))})},[r.join(`,`)]),(0,v.useEffect)(()=>{let e=r.filter(e=>!e.startsWith(`http`)&&!(e in o));if(e.length===0)return;let t=localStorage.getItem(`plank_token`);fetch(`/cms/admin/media`,{headers:t?{Authorization:`Bearer ${t}`}:{}}).then(e=>e.ok?e.json():{items:[]}).then(t=>{let n={};for(let r of t.items)e.includes(r.id)&&(n[r.id]=r.filename);Object.keys(n).length>0&&s(e=>({...e,...n}))}).catch(()=>{})},[r.join(`,`)]);function g(e){return e.startsWith(`http`)?e:i[e]??null}function _(e){return o[e]??``}function y(e){if(n)return;let{active:i,over:a}=e;!a||i.id===a.id||t(kD(r,r.indexOf(i.id),r.indexOf(a.id)))}async function b(e){if(e.length===0)return;l(!0),d(null);let n=r;try{for(let r of e){let e=await IQ(r);a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:r.name})),n=[...n,e.id],t(n)}}catch(e){d(e instanceof Error?e.message:`Upload failed.`)}finally{l(!1),m.current&&(m.current.value=``)}}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`input`,{ref:m,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{b(Array.from(e.target.files??[]))}}),r.length>0&&(0,H.jsx)(bD,{sensors:h,collisionDetection:AT,onDragEnd:y,children:(0,H.jsx)(BD,{items:r,strategy:PD,children:(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,children:r.map(e=>(0,H.jsx)(BQ,{id:e,previewUrl:g(e),filename:_(e),onRemove:()=>t(r.filter(t=>t!==e)),disabled:n},e))})})}),(0,H.jsxs)(`div`,{className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>m.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),c?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:c||n,onClick:()=>p(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),u&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:u}),(0,H.jsx)(RQ,{open:f,onOpenChange:p,allowedTypes:[`image`],onSelect:e=>{r.includes(e.id)||(a(t=>({...t,[e.id]:e.url})),s(t=>({...t,[e.id]:e.filename})),t([...r,e.id]))}})]})}function HQ({value:e,onChange:t,disabled:n=!1}){let[r,i]=(0,v.useState)(()=>e!=null&&e!==``?String(e):``);(0,v.useEffect)(()=>{if(e==null||e===``){i(``);return}let t=typeof e==`number`?e:parseFloat(String(e));!isNaN(t)&&t!==parseFloat(r)&&i(String(t))},[e]);function a(e){let n=e.target.value.replace(`,`,`.`);if(i(n),n===``||n===`-`){t(null);return}let r=parseFloat(n);isNaN(r)||t(r)}return(0,H.jsx)(Ev,{type:`text`,inputMode:`decimal`,className:K(`w-full`,`text-base!`),value:r,placeholder:`0.00`,onChange:a,disabled:n})}function UQ(e){if(typeof e==`object`&&e){let t=e;if(t.kind===`string`&&typeof t.value==`string`)return{kind:`string`,value:t.value};if(t.kind===`number`&&typeof t.value==`number`&&!isNaN(t.value))return{kind:`number`,value:t.value};if(t.kind===`boolean`&&typeof t.value==`boolean`)return{kind:`boolean`,value:t.value}}return typeof e==`number`&&!isNaN(e)?{kind:`number`,value:e}:typeof e==`boolean`?{kind:`boolean`,value:e}:{kind:`string`,value:typeof e==`string`?e:``}}function WQ({value:e,onChange:t,inputId:n,disabled:r=!1}){let i=UQ(e);function a(e){e===`string`&&t({kind:e,value:``}),e===`number`&&t({kind:e,value:0}),e===`boolean`&&t({kind:e,value:!1})}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-md border border-border p-1`,children:[`string`,`number`,`boolean`].map(e=>(0,H.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>a(e),className:K(`rounded px-2 py-1 text-xs transition-colors`,i.kind===e?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/60`),children:e===`string`?`Text`:e===`number`?`Number`:`Boolean`},e))}),i.kind===`string`&&(0,H.jsx)(Ev,{className:K(`w-full`,`text-base md:text-base`),value:String(i.value),placeholder:`Value`,onChange:e=>t({kind:`string`,value:e.target.value}),disabled:r}),i.kind===`number`&&(0,H.jsx)(HQ,{value:i.value,onChange:e=>t({kind:`number`,value:typeof e==`number`&&!isNaN(e)?e:0}),disabled:r}),i.kind===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(iO,{id:n,checked:!!i.value,onCheckedChange:e=>t({kind:`boolean`,value:!!e}),disabled:r}),(0,H.jsx)(Y,{htmlFor:n,className:`cursor-pointer font-normal text-base`,children:i.value?`True`:`False`})]})]})}function GQ({value:e,onChange:t,timezone:n,disabled:r=!1}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(`00:00`);(0,v.useEffect)(()=>{if(!e){s(void 0),l(`00:00`);return}let t=new Date(e);isNaN(t.getTime())||(s(t),l(ly(e,n)))},[e,n]);function u(e){s(e),a(!1),e&&t(uy(e,c,n))}function d(e){l(e),o&&t(uy(o,e,n))}return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(mN,{open:i&&!r,onOpenChange:a,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal text-base`,disabled:r,children:[o?vA(o,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Oa,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(fN,{mode:`single`,selected:o,captionLayout:`dropdown`,defaultMonth:o??new Date,onSelect:u})})]}),(0,H.jsx)(Ev,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none text-base!`,value:c,onChange:e=>d(e.target.value),disabled:r}),e&&(0,H.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground hover:text-foreground`,onClick:()=>{s(void 0),l(`00:00`),t(null)},disabled:r,children:(0,H.jsx)(Bo,{className:`size-3.5`})})]})}function KQ(e){return e.find(e=>e.type===`uid`)?.name??e.find(e=>e.type===`string`)?.name??null}var qQ={data:null,promise:null};function JQ(e){return qQ.data?Promise.resolve(qQ.data):(qQ.promise||=fetch(`/cms/admin/content-types`,{headers:e}).then(e=>e.ok?e.json():[]).then(e=>(qQ.data=e,e)).catch(()=>[]),qQ.promise)}function YQ(e,t){return e.find(e=>e.tableName===t)??null}function XQ(e,t){return fetch(`/cms/admin/content-types/${e}/entries?limit=200`,{headers:t}).then(e=>e.ok?e.json():{data:[]}).catch(()=>({data:[]}))}function ZQ(e){let[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e)return;i(!0);let t=localStorage.getItem(`plank_token`),r=t?{Authorization:`Bearer ${t}`}:{};JQ(r).then(t=>{let n=YQ(t,e);return n?XQ(n.slug,r).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:t})=>{let r=e?KQ(e.fields??[]):null;n(t.data.map(e=>({id:String(e.id),label:String(r?e[r]??e.id:e.id)})))}).catch(()=>n([])).finally(()=>i(!1))},[e]),{entries:t,loading:r}}function QQ(e,t,n){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!e||!n){i([]);return}o(!0);let r=localStorage.getItem(`plank_token`),a=r?{Authorization:`Bearer ${r}`}:{};JQ(a).then(t=>{let n=YQ(t,e);return n?XQ(n.slug,a).then(e=>({ctDef:n,res:e})):Promise.resolve({ctDef:null,res:{data:[]}})}).then(({ctDef:e,res:r})=>{let a=e?KQ(e.fields??[]):null;i(r.data.filter(e=>String(e[t]??``)===n).map(e=>({id:String(e.id),label:String(a?e[a]??e.id:e.id)})))}).catch(()=>i([])).finally(()=>o(!1))},[e,t,n]),{entries:r,loading:a}}function $Q({relatedTable:e,relatedField:t,currentId:n}){let{entries:r,loading:i}=QQ(e,t,n);return n?i?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,H.jsx)(iy,{className:`size-3.5`}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading…`})]}):r.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No linked entries.`}):(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-md border bg-muted px-2 py-0.5 text-xs`,children:e.label},e.id))}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this entry first to see linked items.`})}function e$({relationType:e,relatedTable:t,relatedField:n,currentEntryId:r,value:i,onChange:a,disabled:o=!1}){let s=e===`many-to-many`,[c,l]=(0,v.useState)(!1),{entries:u,loading:d}=ZQ(t);if(e===`one-to-many`)return(0,H.jsx)($Q,{relatedTable:t,relatedField:n,currentId:r});let f=s?Array.isArray(i)?i:[]:i&&!Array.isArray(i)?[i]:[];function p(e){return u.find(t=>t.id===e)?.label??e}function m(e){if(s){let t=f.includes(e)?f.filter(t=>t!==e):[...f,e];a(t.length>0?t:null)}else a(f[0]===e?null:e),l(!1)}function h(e){if(s){let t=f.filter(t=>t!==e);a(t.length>0?t:null)}else a(null)}let g=s?f.length>0?`${f.length} selected`:`Select entries…`:f.length>0?p(f[0]):`Select entry…`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(mN,{open:c&&!o,onOpenChange:l,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":c,className:`w-full justify-between font-normal text-base`,disabled:o,children:[(0,H.jsx)(`span`,{className:`truncate text-left`,children:g}),(0,H.jsx)(Ma,{className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,H.jsxs)(CQ,{children:[(0,H.jsx)(wQ,{placeholder:`Search…`}),(0,H.jsx)(TQ,{children:d?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,H.jsx)(iy,{className:`size-4`})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(EQ,{children:`No entries found.`}),(0,H.jsx)(DQ,{children:u.map(e=>{let t=f.includes(e.id);return(0,H.jsxs)(kQ,{value:e.label,onSelect:()=>{o||m(e.id)},children:[(0,H.jsx)(Da,{className:`mr-2 size-4 ${t?`opacity-100`:`opacity-0`}`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.label}),(0,H.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground opacity-60 shrink-0`,children:e.id.slice(0,8)})]},e.id)})})]})})]})})]}),f.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-muted px-2 py-0.5 text-xs`,children:[p(e),(0,H.jsx)(`button`,{type:`button`,onClick:()=>h(e),disabled:o,className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(Bo,{className:`size-3`})})]},e))})]})}var t$={full:`col-span-6`,"two-thirds":`col-span-4`,half:`col-span-3`,third:`col-span-2`};function n$({field:e,value:t,onChange:n,disabled:r=!1}){let i=Array.isArray(t)?t:[],a=e.arrayFields??[];function o(){return Object.fromEntries(a.map(e=>[e.name,e.type===`boolean`?!1:null]))}function s(){n([...i,o()])}function c(e){n(i.filter((t,n)=>n!==e))}function l(e,t){let r=e+t;if(r<0||r>=i.length)return;let a=[...i];[a[e],a[r]]=[a[r],a[e]],n(a)}function u(e,t,r){n(i.map((n,i)=>i===e?{...n,[t]:r}:n))}return a.length===0?(0,H.jsx)(`div`,{className:`flex w-full items-center justify-center rounded-md border border-dashed p-4 text-xs text-muted-foreground`,children:`No sub-fields defined for this array.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(vN,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>(0,H.jsxs)(yN,{value:`item-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsxs)(bN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:[`Item `,t+1]}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:r||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(t,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>c(t),disabled:r,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),(0,H.jsx)(xN,{className:`px-3 pt-3`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-3`,children:a.map(n=>(0,H.jsxs)(`div`,{className:t$[n.width??`full`]??`col-span-6`,children:[(0,H.jsx)(`div`,{className:`mb-1 flex items-center gap-1`,children:(0,H.jsxs)(Y,{className:`text-xs font-medium`,children:[n.name,n.required&&(0,H.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]})}),(0,H.jsx)(c$,{field:{...n,type:n.type},value:e[n.name]??null,onChange:e=>u(t,n.name,e),allValues:e,disabled:r})]},n.name))})})]},t))}),(0,H.jsxs)(`button`,{type:`button`,onClick:s,disabled:r,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]})]})}var r$=3,i$=20;function a$({value:e,onChange:t,disabled:n=!1,depth:r=0}){let i=Array.isArray(e)?e:[],a=r+1<r$,o=i.length<i$;function s(){return{label:``,href:``}}function c(e,n){let r=(t,i)=>{let a=e[i];return t.map((t,o)=>{if(o!==a)return t;if(i===e.length-1)return n(t);let s=Array.isArray(t.items)?t.items:[];return{...t,items:r(s,i+1)}})};t(r(i,0))}function l(e,n){let r=(t,i)=>{if(i===e.length-1){let r=e[i],a=r+n;if(a<0||a>=t.length)return t;let o=[...t];return[o[r],o[a]]=[o[a],o[r]],o}let a=e[i];return t.map((e,t)=>{if(t!==a)return e;let n=Array.isArray(e.items)?e.items:[];return{...e,items:r(n,i+1)}})};t(r(i,0))}function u(e){let n=(t,r)=>{let i=e[r];return r===e.length-1?t.filter((e,t)=>t!==i):t.map((e,t)=>{if(t!==i)return e;let a=Array.isArray(e.items)?e.items:[];return{...e,items:n(a,r+1)}})};t(n(i,0))}function d(){o&&t([...i,s()])}return i.length===0?(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n||!o,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/20`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(vN,{type:`single`,collapsible:!0,className:`w-full`,children:i.map((e,t)=>{let o=[t],s=e.label?.trim()?e.label:`Item ${t+1}`;return(0,H.jsxs)(yN,{value:`navigation-item-${r}-${t}`,className:`mb-2 rounded-md border border-dashed last:border-b transition-colors hover:bg-accent/50`,children:[(0,H.jsxs)(`div`,{className:`relative data-[state=open]:border-b data-[state=open]:border-border/50`,children:[(0,H.jsx)(bN,{className:`w-full py-2 pl-3 pr-24 text-muted-foreground [&>svg]:hidden`,children:s}),(0,H.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===0,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,-1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(ja,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,disabled:n||t===i.length-1,onMouseDown:e=>e.stopPropagation(),onClick:()=>l(o,1),className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-accent disabled:opacity-30`,children:(0,H.jsx)(Oa,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onMouseDown:e=>e.stopPropagation(),onClick:()=>u(o),disabled:n,className:`flex size-6 items-center justify-center rounded text-destructive transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})]}),(0,H.jsxs)(xN,{className:`px-3 pt-3`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-6 gap-3`,children:[(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`label`}),(0,H.jsx)(Ev,{className:`text-base`,value:e.label??``,onChange:e=>c(o,t=>({...t,label:e.target.value})),disabled:n})]}),(0,H.jsxs)(`div`,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`mb-1 block text-xs font-medium`,children:`href`}),(0,H.jsx)(Ev,{className:`text-base`,value:e.href??``,onChange:e=>c(o,t=>({...t,href:e.target.value})),disabled:n})]})]}),a?(0,H.jsxs)(`div`,{className:`mt-3 border-l border-border pl-3`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Child items`}),(0,H.jsx)(a$,{value:e.items??[],onChange:e=>c(o,t=>({...t,items:Array.isArray(e)&&e.length>0?e:void 0})),disabled:n,depth:r+1})]}):(0,H.jsxs)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:[`Maximum depth reached (`,r$,` levels).`]})]})]},t)})}),(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:n,className:`flex w-full items-center justify-center gap-1.5 rounded-md border border-dashed py-2 text-xs text-muted-foreground transition-colors hover:bg-accent/50`,children:[(0,H.jsx)(yo,{className:`size-3.5`}),`Add item`]}),!o&&(0,H.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Maximum `,i$,` items allowed per level.`]})]})}function o$(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/^-+|-+$/g,``)}function s$({value:e,onChange:t,disabled:n=!1}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null);function p(){return o(!0),new Promise(e=>{i.current=e})}function m(e){i.current?.(e),i.current=null}function h(e){e||m(null),o(e)}async function g(e){u(!0),f(null);try{let t=await EZ(e);m({src:t.url,alt:t.alt,width:t.width,height:t.height}),o(!1)}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}finally{u(!1),r.current&&(r.current.value=``)}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:n?`pointer-events-none opacity-70`:``,children:(0,H.jsx)(CZ,{value:String(e??``),onChange:t,placeholder:`Type or add your content here...`,onInsertImage:p})}),(0,H.jsx)(ZC,{open:a,onOpenChange:h,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Insert Image`})}),(0,H.jsx)(`input`,{ref:r,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&g(t)}}),(0,H.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files[0];t&&g(t)},className:`flex w-full gap-2 rounded-md border border-dashed p-3`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>r.current?.click(),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Io,{className:`size-4`}),l?`Uploading…`:`Upload`]}),(0,H.jsx)(`div`,{className:`w-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>c(!0),className:`flex flex-1 items-center justify-center gap-2 rounded-md py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 disabled:opacity-50`,children:[(0,H.jsx)(Ja,{className:`size-4`}),`Library`]})]}),d&&(0,H.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:d})]})}),(0,H.jsx)(RQ,{open:s,onOpenChange:e=>{!e&&!a&&m(null),c(e)},allowedTypes:[`image`],onSelect:e=>{m({src:e.url,alt:e.alt,width:e.width,height:e.height}),c(!1),o(!1)}})]})}function c$({field:e,value:t,onChange:n,allValues:r,disabled:i}){let a=(0,v.useRef)(!1),{timezone:o}=sa();(0,v.useEffect)(()=>{if(e.type!==`uid`||!e.targetField||a.current)return;let t=r,i=e.targetField,o=!!t.__localizationEnabled,s=t[i];if(s!=null&&String(s).trim()!==``){n(o$(String(s)));return}let c=t.localized&&typeof t.localized==`object`?t.localized:{};if(o){let e=typeof t.__defaultLocale==`string`?t.__defaultLocale:void 0,r=e&&c[e]&&typeof c[e]==`object`?c[e]:null;r&&r[i]!==void 0&&String(r[i]).trim()!==``&&n(o$(String(r[i])));return}let l=Object.keys(c).filter(e=>!e.startsWith(`_`));for(let e of l){let t=c[e]&&typeof c[e]==`object`?c[e]:null;if(t&&t[i]!==void 0&&String(t[i]).trim()!==``){n(o$(String(t[i])));return}}},[e.type,e.targetField,r[e.targetField??``],JSON.stringify(r.localized??{}),r.__localizationEnabled]);let s=`w-full`;return e.type===`boolean`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(iO,{id:`field-${e.name}`,checked:!!t,onCheckedChange:e=>n(!!e),disabled:!!i}),(0,H.jsx)(Y,{htmlFor:`field-${e.name}`,className:`cursor-pointer font-normal text-base`,children:t?`Yes`:`No`})]}):e.type===`richtext`?(0,H.jsx)(s$,{value:t,onChange:n,disabled:!!i}):e.type===`text`?(0,H.jsx)(_N,{className:K(s,`text-base`),value:String(t??``),placeholder:NQ(e.name),onChange:e=>n(e.target.value),disabled:!!i}):e.type===`number`?e.subtype===`float`?(0,H.jsx)(HQ,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Ev,{type:`number`,className:K(s,`text-base!`),value:t==null?``:String(t),step:`1`,placeholder:`0`,onChange:e=>{let t=e.target.value;if(t===``){n(null);return}n(parseInt(t,10))},disabled:!!i}):e.type===`datetime`?(0,H.jsx)(GQ,{value:t,onChange:n,timezone:o,disabled:!!i}):e.type===`uid`?(0,H.jsx)(Ev,{className:K(s,`text-base md:text-base`),value:String(t??``),placeholder:`auto-generated`,onChange:e=>{let t=e.target.value;a.current=!!(t&&t!==``),n(e.target.value)},disabled:!!i}):e.type===`media`?(0,H.jsx)(zQ,{value:t,onChange:n,allowedTypes:e.allowedTypes,disabled:!!i}):e.type===`media-gallery`?(0,H.jsx)(VQ,{value:t,onChange:n,disabled:!!i}):e.type===`relation`?(0,H.jsx)(e$,{relationType:e.relationType??`many-to-one`,relatedTable:e.relatedTable??``,relatedField:e.relatedField??``,currentEntryId:String(r.id??``),value:t,onChange:n,disabled:!!i}):e.type===`array`?(0,H.jsx)(n$,{field:e,value:t,onChange:n,disabled:!!i}):e.type===`mixed`?(0,H.jsx)(WQ,{value:t,onChange:n,inputId:`field-${e.name}-mixed-boolean`,disabled:!!i}):e.type===`navigation`?(0,H.jsx)(a$,{value:t,onChange:n,disabled:!!i}):(0,H.jsx)(Ev,{className:K(s,`text-base md:text-base`),value:String(t??``),placeholder:NQ(e.name),onChange:e=>n(e.target.value),disabled:!!i})}function l$(e){return Array.isArray(e)?e.map(l$):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,l$(t)])):e}function u$(e){return JSON.stringify(l$(e))}function d$(){let{slug:e,id:t}=rr(),n=$n(),r=!t,{timezone:i,locales:a,defaultLocale:o}=sa(),{user:s}=ia(),{data:c,loading:l}=fa(e?`/cms/admin/content-types/${e}`:null),{data:u,loading:d}=fa(e&&t?`/cms/admin/entries/${e}/${t}`:null),{loading:f,request:p}=Tv(),{loading:m,request:h}=Tv(),{loading:g,request:_}=Tv(),[y,b]=(0,v.useState)({}),[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(`draft`),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(!1),[ee,te]=(0,v.useState)(),[ne,z]=(0,v.useState)(`09:00`),B=(0,v.useRef)(`{}`),re=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(r){let e={};c?.fields.forEach(t=>{e[t.name]=t.type===`boolean`?!1:``}),e.localized={};let t=a&&a.length>0?a:[`en`];S(t),w(o??t[0]),E(!1),b(e),O(`draft`),A(``),M(!1),B.current=u$(e);return}if(!u||!c)return;let e={};c.fields.forEach(t=>{e[t.name]=u[t.name]??(t.type===`boolean`?!1:``)});let t=u.localized,n=t&&typeof t==`object`?t:{};e.localized=n;let s=Object.keys(n).filter(e=>!e.startsWith(`_`)),l=(n._meta||{}).enabled??s.length>0;if(s.length>0)S(s),w(s[0]);else{let e=a&&a.length>0?a:[`en`];S(e),w(o??e[0])}if(E(!!l),b(e),O(u.status??`draft`),B.current=u$(e),u.scheduled_for?(A(u.scheduled_for),te(new Date(u.scheduled_for)),z(ly(u.scheduled_for,i))):A(``),u.status===`published`&&u.published_data){let t=(e,t)=>{if(t===`datetime`&&e&&typeof e==`string`){let t=/Z|[+-]\d{2}:\d{2}$/.test(e)?e:e+`Z`,n=new Date(t);return isNaN(n.getTime())?e:n.toISOString()}return e},n={},r={};c.fields.forEach(i=>{i.name in u.published_data&&(n[i.name]=t(u.published_data[i.name]??(i.type===`boolean`?!1:``),i.type),r[i.name]=t(e[i.name],i.type))}),M(u$(r)!==u$(n))}else M(!1)},[u,c,r]);let V=u$(y)!==B.current,ie=Cr((0,v.useCallback)(()=>re.current?!1:V,[V]));function ae(e,t){b(n=>({...n,[e]:t}))}function oe(e,t,n){b(r=>{let i={...r},a=i.localized&&typeof i.localized==`object`?i.localized:{},o=a[e]&&typeof a[e]==`object`?a[e]:{};return o[t]=n,a[e]=o,i.localized=a,i})}function se(e){E(e),b(t=>{let n={...t},r=n.localized&&typeof n.localized==`object`?n.localized:{};if(r._meta||={},e&&o){if(!(r[o]&&typeof r[o]==`object`&&r[o])&&(r[o]={},c&&c.fields)){let e=r[o];c.fields.forEach(t=>{if([`string`,`text`,`richtext`].includes(t.type)){let r=n[t.name];r!=null&&r!==``&&(e[t.name]=r)}})}r._meta.primary=o}else if(!e&&o){let e=r[o]&&typeof r[o]==`object`?r[o]:null;e&&c&&c.fields&&c.fields.forEach(t=>{if([`string`,`text`,`richtext`,`uid`].includes(t.type)){let r=e[t.name];r!==void 0&&(n[t.name]=r)}})}return r._meta.enabled=e,n.localized=r,n})}function ce(){if(k)te(new Date(k)),z(ly(k,i));else{let e=new Date;e.setDate(e.getDate()+1),te(e),z(`09:00`)}I(!0)}async function le(){if(!e||!c)return null;let n={},i=T&&y.localized&&typeof y.localized==`object`&&y.localized[o]&&typeof y.localized[o]==`object`?y.localized[o]:null;if(c.fields.forEach(e=>{let t=y[e.name];(t==null||t===``)&&i&&i[e.name]!==void 0&&(t=i[e.name]),e.type===`media`&&t===null?n[e.name]=null:t!==``&&t!=null&&(n[e.name]=t)}),y.localized&&Object.keys(y.localized).length>0){let e=y.localized;e._meta||={},e._meta.enabled=T,e._meta.primary=o,n.localized=e}try{let i=await p(r?`/cms/admin/content-types/${e}/entries`:`/cms/admin/entries/${e}/${t}`,r?`POST`:`PUT`,n);return B.current=u$(y),i}catch{return null}}async function ue(){let i=await le();if(i){if(D===`scheduled`){let n=r?i.id:t;try{await h(`/cms/admin/entries/${e}/${n}/status`,`PATCH`,{status:`draft`}),O(`draft`),A(``),I(!1)}catch{}}else D===`published`&&M(!0);r&&(re.current=!0,n(`/content/${e}/${i.id}`,{replace:!0}))}}async function de(){if(!e)return;let i=t;if(V||r){let e=await le();if(!e)return;i=r?e.id:t,r&&(re.current=!0)}try{await h(`/cms/admin/entries/${e}/${i}/status`,`PATCH`,{status:`published`}),O(`published`),A(``),M(!1),I(!1),r&&n(`/content/${e}/${i}`,{replace:!0})}catch{r&&i&&n(`/content/${e}/${i}`,{replace:!0})}}async function fe(){if(!e||!ee||!ne)return;let a=uy(ee,ne,i);if(new Date(a)<=new Date)return;let o=t;if(V||r){let e=await le();if(!e)return;o=r?e.id:t,r&&(re.current=!0)}try{await h(`/cms/admin/entries/${e}/${o}/status`,`PATCH`,{status:`scheduled`,scheduled_for:a}),O(`scheduled`),A(a),I(!1),r&&n(`/content/${e}/${o}`,{replace:!0})}catch{r&&o&&n(`/content/${e}/${o}`,{replace:!0})}}async function pe(){if(!(!e||!t))try{await h(`/cms/admin/entries/${e}/${t}/status`,`PATCH`,{status:`draft`}),O(`draft`),A(``),M(!1)}catch{}}async function me(){if(!(!e||!t))try{await _(`/cms/admin/entries/${e}/${t}`,`DELETE`),re.current=!0,n(`/content/${e}`,{replace:!0})}catch{}}let he=l||!r&&d,ge=f||m,_e=s?.permissions??[],ve=_e.includes(`*`)||_e.includes(`entries:write`),ye=_e.includes(`*`)||_e.includes(`entries:delete`),be=s?.role?.toLowerCase()===`user`&&c?.kind===`single`,xe=!ve||be,Se=V||D===`draft`||D===`scheduled`||j,Ce=!!(ee&&ne);if(ZD(`mod+s`,ue,{enabled:!xe&&!ge&&(D===`scheduled`?!0:V),label:`Save draft`}),ZD(`mod+shift+p`,de,{enabled:Se&&!ge&&!xe,label:`Publish`}),he)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-12 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]});if(!c)return null;let we;return we=D===`scheduled`?(0,H.jsxs)(XC,{variant:`outline`,className:`border-blue-500 text-blue-600`,children:[(0,H.jsx)(wa,{className:`size-3 mr-1`}),k?`Scheduled · ${cy(k,i)}`:`Scheduled`]}):D===`published`?(0,H.jsx)(XC,{variant:j?`secondary`:`default`,children:j?`Published (pending changes)`:`Published`}):(0,H.jsx)(XC,{variant:`secondary`,children:`Draft`}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:r?`New entry`:`Edit entry`}),we]}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs mt-1`,children:c.name})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&ye&&!be&&(0,H.jsx)(q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:()=>P(!0),disabled:g,children:(0,H.jsx)(Mo,{className:`size-4`})}),!r&&D===`published`&&!xe&&(0,H.jsxs)(q,{variant:`outline`,onClick:pe,disabled:ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Revert to draft`]}),!r&&D===`scheduled`&&!xe&&(0,H.jsxs)(q,{variant:`outline`,onClick:pe,disabled:ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Cancel schedule`]}),(0,H.jsxs)(q,{variant:`outline`,onClick:ue,disabled:xe||(D===`scheduled`?ge:!V||ge),children:[f?(0,H.jsx)(iy,{className:`size-4`}):null,D===`scheduled`?`Save draft (cancel schedule)`:`Save draft`]}),D!==`scheduled`&&(0,H.jsxs)(q,{variant:`outline`,onClick:ce,disabled:xe||ge,children:[(0,H.jsx)(wa,{className:`size-4`}),`Schedule`]}),(0,H.jsxs)(q,{onClick:de,disabled:xe||!Se||ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,D===`scheduled`?`Publish now`:D===`published`&&!j?`Republish`:`Publish`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[F&&!xe&&(0,H.jsxs)(`div`,{className:`mb-6 flex items-end gap-2 rounded-lg border p-4 bg-muted/30`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Date`}),(0,H.jsxs)(mN,{open:L,onOpenChange:R,children:[(0,H.jsx)(hN,{asChild:!0,children:(0,H.jsxs)(q,{variant:`outline`,className:`w-40 justify-between font-normal`,children:[ee?vA(ee,`MMM d, yyyy`):`Select date`,(0,H.jsx)(Oa,{className:`size-4 opacity-50`})]})}),(0,H.jsx)(gN,{className:`w-auto overflow-hidden p-0`,align:`start`,children:(0,H.jsx)(fN,{mode:`single`,selected:ee,captionLayout:`dropdown`,defaultMonth:ee??new Date,disabled:{before:new Date},onSelect:e=>{te(e),R(!1)}})})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{children:[`Time `,(0,H.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(24h)`})]}),(0,H.jsx)(Ev,{type:`time`,className:`w-32 appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none`,value:ne,onChange:e=>z(e.target.value)})]}),(0,H.jsxs)(q,{onClick:fe,disabled:!Ce||ge,children:[m?(0,H.jsx)(iy,{className:`size-4`}):null,`Confirm`]}),(0,H.jsx)(q,{variant:`ghost`,onClick:()=>I(!1),children:`Cancel`})]}),(0,H.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(NA,{checked:T,onCheckedChange:se,disabled:xe}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Localization`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enable per-entry localization`})]})]}),(0,H.jsx)(`div`,{})]}),(0,H.jsx)(`div`,{children:T&&(0,H.jsx)(kA,{value:C,onValueChange:e=>w(e),children:(0,H.jsx)(AA,{children:x.map(e=>(0,H.jsx)(jA,{value:e,disabled:xe,children:e.toUpperCase()},e))})})})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-6 gap-4`,children:c.fields.map(e=>{let n=[`string`,`text`,`richtext`].includes(e.type),r=y.localized&&y.localized[C]?y.localized[C][e.name]:void 0,i=n&&T?r:y[e.name],a=e.type===`uid`&&e.targetField&&T&&[`string`,`text`,`richtext`].includes(c.fields.find(t=>t.name===e.targetField)?.type??``);return(0,H.jsx)(`div`,{className:$D[e.width??`full`],children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`entry-${e.name}`,className:`capitalize`,children:[e.name.replace(/_/g,` `),e.required&&(0,H.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,H.jsx)(c$,{field:e,value:i,onChange:t=>{n&&T?oe(C,e.name,t):ae(e.name,t)},allValues:{...y,id:t,__activeLocale:C,__localizationEnabled:T,__defaultLocale:o},disabled:!!a||xe})]})},e.name)})}),(0,H.jsx)(ZC,{open:N,onOpenChange:P,children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete this entry?`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>P(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:me,disabled:g,children:[g?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})}),(0,H.jsx)(ZC,{open:ie.state===`blocked`,onOpenChange:()=>ie.reset?.(),children:(0,H.jsxs)(tw,{className:`max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Unsaved changes`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Leave without saving?`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ie.reset?.(),children:`Stay`}),(0,H.jsx)(q,{variant:`destructive`,onClick:()=>ie.proceed?.(),children:`Leave`})]})]})})]})]})}function f$({...e}){return(0,H.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,...e})}function p$({className:e,...t}){return(0,H.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:K(`flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5`,e),...t})}function m$({className:e,...t}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:K(`inline-flex items-center gap-1.5`,e),...t})}function h$({asChild:e,className:t,...n}){return(0,H.jsx)(e?yl:`a`,{"data-slot":`breadcrumb-link`,className:K(`transition-colors hover:text-foreground`,t),...n})}function g$({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:K(`font-normal text-foreground`,e),...t})}function _$({children:e,className:t,...n}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:K(`[&>svg]:size-3.5`,t),...n,children:e??(0,H.jsx)(Aa,{})})}function v$(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:`—`}function y$(e){return!!e?.startsWith(`image/`)}function b$(e){return!!e?.startsWith(`video/`)}function x$(e){return!!e?.startsWith(`audio/`)}function S$(e){return e===`application/pdf`}function C$(e,t){return e.split(`?`)[0].endsWith(`.m3u8`)||t===`application/x-mpegurl`||t===`application/vnd.apple.mpegurl`}async function w$(e){if(e.isFile)return new Promise(t=>{e.file(n=>t([{file:n,relativePath:e.fullPath.replace(/^\//,``)}]))});if(e.isDirectory){let t=e.createReader(),n=[];return await new Promise(e=>{let r=()=>{t.readEntries(async t=>{if(t.length===0){e();return}let i=await Promise.all(t.map(w$));n.push(...i.flat()),r()})};r()}),n}return[]}function T$({url:e}){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let n=t.current;if(!n)return;if(n.canPlayType(`application/vnd.apple.mpegurl`)){n.src=e;return}let r=null;return w(async()=>{let{default:e}=await import(`./hls-0EiSYoTw.js`);return{default:e}},[]).then(({default:t})=>{if(!t.isSupported())return;let i=new t;r=i,i.loadSource(e),i.attachMedia(n)}),()=>{r?.destroy()}},[e]),(0,H.jsx)(`video`,{ref:t,controls:!0,className:`max-h-[70vh] w-full rounded-md bg-black`})}function E$({item:e}){let t=e.mime_type?.toLowerCase()??null;return y$(t)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`max-h-full max-w-full rounded-md object-contain`}):C$(e.url,t)?(0,H.jsx)(T$,{url:e.url}):b$(t)?(0,H.jsx)(`video`,{src:e.url,controls:!0,preload:`none`,className:`max-h-[70vh] w-full rounded-md bg-black`}):x$(t)?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-6`,children:[(0,H.jsx)(Ua,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full`})]}):S$(t)?(0,H.jsx)(`iframe`,{src:e.url,title:e.filename,className:`h-[70vh] w-full rounded-md border`}):(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-center`,children:[(0,H.jsx)(Ga,{className:`size-14 text-muted-foreground`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.mime_type??`Unknown type`}),(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,download:e.filename,children:(0,H.jsxs)(q,{variant:`outline`,size:`sm`,children:[(0,H.jsx)(za,{className:`size-4`}),`Download`]})})]})}function D$({folder:e,onOpen:t,onDelete:n,onRename:r,canDelete:i,canRename:a,selected:o,onToggle:s}){return(0,H.jsxs)(`div`,{className:`group relative flex items-center gap-3 rounded-lg border bg-card px-3 py-2.5 transition-colors cursor-pointer hover:bg-muted/50 ${o?`ring-2 ring-primary`:``}`,onClick:()=>{o||t(e)},children:[(0,H.jsxs)(`div`,{className:`relative shrink-0 size-7 flex items-center justify-center`,children:[(0,H.jsx)(Xa,{className:`size-7 text-muted-foreground transition-opacity ${o?`opacity-0`:`group-hover:opacity-0`}`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center transition-opacity ${o?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(iO,{checked:o,onCheckedChange:()=>s(`folder:${e.id}`),"aria-label":`Select folder`})})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-bold truncate`,title:e.name,children:e.name}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.item_count,` `,e.item_count===1?`item`:`items`]})]}),!o&&(a||i)&&(0,H.jsxs)(v_,{children:[(0,H.jsx)(y_,{asChild:!0,children:(0,H.jsx)(`button`,{className:`shrink-0 opacity-0 group-hover:opacity-100 transition-opacity flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(Ba,{className:`size-4`})})}),(0,H.jsxs)(S_,{align:`end`,onClick:e=>e.stopPropagation(),children:[a&&(0,H.jsxs)(C_,{onSelect:()=>r(e),children:[(0,H.jsx)(vo,{className:`size-4`}),`Rename`]}),i&&(0,H.jsxs)(C_,{onSelect:()=>n(e),className:`text-destructive focus:text-destructive`,children:[(0,H.jsx)(Mo,{className:`size-4`}),`Delete`]})]})]})]})}function O$({item:e,onDelete:t,onPreview:n,canDelete:r,selected:i,onToggle:a}){let o=e.mime_type?.toLowerCase()??null;return(0,H.jsxs)(`div`,{className:`group relative rounded-lg border bg-card overflow-hidden transition-colors ${i?`ring-2 ring-primary`:``}`,children:[(0,H.jsx)(`div`,{className:`aspect-square bg-muted flex items-center justify-center cursor-pointer`,onClick:()=>{i||n(e)},children:y$(o)?(0,H.jsx)(`img`,{src:e.url,alt:e.filename,className:`h-full w-full object-cover`}):b$(o)||C$(e.url,o)?(0,H.jsx)(Wa,{className:`size-10 text-muted-foreground`}):x$(o)?(0,H.jsx)(Ua,{className:`size-10 text-muted-foreground`}):S$(o)?(0,H.jsx)(Ga,{className:`size-10 text-muted-foreground`}):(0,H.jsx)(Ka,{className:`size-10 text-muted-foreground`})}),(0,H.jsx)(`div`,{className:`absolute top-1.5 left-1.5 transition-opacity ${i?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,H.jsx)(iO,{checked:i,onCheckedChange:()=>a(e.id),"aria-label":`Select file`,className:`bg-background/80 backdrop-blur-sm`})}),!i&&r&&(0,H.jsx)(`button`,{onClick:()=>t(e),className:`absolute top-1.5 right-1.5 flex size-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground opacity-0 backdrop-blur-sm transition-opacity hover:text-destructive group-hover:opacity-100`,children:(0,H.jsx)(Mo,{className:`size-3.5`})}),(0,H.jsxs)(`div`,{className:`p-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium truncate`,title:e.filename,children:e.filename}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v$(e.size)})]})]})}function k$(){let e=(0,v.useRef)(null),{user:t}=ia(),n=t?.permissions??[],r=n.includes(`*`)||n.includes(`media:write`),i=n.includes(`*`)||n.includes(`media:delete`),[a,o]=(0,v.useState)([{id:null,name:`Media`}]),s=a[a.length-1].id,{data:c,loading:l,refetch:u}=fa(`/cms/admin/folders?parent_id=${s??``}`),{data:d,loading:f,refetch:p}=fa(`/cms/admin/media?folder_id=${s??``}`),m=(0,v.useCallback)(()=>{u(),p()},[u,p]),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(new Set),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(null),[I,L]=(0,v.useState)(null),[R,ee]=(0,v.useState)(``),[te,ne]=(0,v.useState)(!1),[z,B]=(0,v.useState)(``),[re,V]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(!1),{loading:oe,error:se,request:ce}=Tv(),{loading:le,error:ue,request:de}=Tv();async function fe(e){if(e.some(({relativePath:e})=>e.endsWith(`.m3u8`))){let t=localStorage.getItem(`plank_token`),n=t?{Authorization:`Bearer ${t}`}:{},r=new FormData;for(let{file:t,relativePath:n}of e)r.append(`files`,t,n);s&&r.append(`folder_id`,s),r.append(`bundle`,`true`);let i=await fetch(`/cms/admin/media`,{method:`POST`,headers:n,body:r});if(!i.ok){let e=await i.text(),t=`Upload failed.`;try{t=JSON.parse(e).error??t}catch{}throw Error(t)}}else await Promise.all(e.map(({file:e})=>EZ(e,{folderId:s})))}async function pe(t){if(r&&!(!t||t.length===0)){g(!0),y(null);try{await fe(Array.from(t).map(e=>({file:e,relativePath:e.webkitRelativePath||e.name}))),m()}catch(e){y(e instanceof Error?e.message:`Upload failed.`)}finally{g(!1),e.current&&(e.current.value=``)}}}async function me(e){if(!r)return;e.preventDefault();let t=Array.from(e.dataTransfer.items);if(!t.some(e=>typeof e.webkitGetAsEntry==`function`)){pe(e.dataTransfer.files);return}g(!0),y(null);try{let e=t.map(e=>e.webkitGetAsEntry()).filter(e=>e!==null);await fe((await Promise.all(e.map(w$))).flat()),m()}catch(e){y(e instanceof Error?e.message:`Upload failed.`)}finally{g(!1)}}function he(e){o(t=>[...t,{id:e.id,name:e.name}]),x(new Set)}function ge(e){o(t=>t.slice(0,e+1)),x(new Set)}async function _e(){if(r&&z.trim())try{await de(`/cms/admin/folders`,`POST`,{name:z.trim(),parent_id:s}),ne(!1),B(``),u()}catch{}}async function ve(){if(r&&!(!I||!R.trim()))try{await de(`/cms/admin/folders/${I.id}`,`PATCH`,{name:R.trim()}),L(null),u()}catch{}}async function ye(){if(i&&P)try{await ce(`/cms/admin/folders/${P.id}`,`DELETE`),F(null),u()}catch{}}async function be(){if(i&&M)try{await ce(`/cms/admin/media/${M.id}`,`DELETE`),N(null),p()}catch{}}function xe(e){x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let Se=c?.folders??[],Ce=d?.items??[],we=[...Se.map(e=>`folder:${e.id}`),...Ce.map(e=>e.id)],Te=we.length>0&&we.every(e=>b.has(e)),Ee=!Te&&we.some(e=>b.has(e));async function De(){if(!i||ie)return;ae(!0);let e=localStorage.getItem(`plank_token`),t=e?{Authorization:`Bearer ${e}`}:{};try{await Promise.all([...[...b].filter(e=>e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/folders/${e.slice(7)}`,{method:`DELETE`,headers:t})),...[...b].filter(e=>!e.startsWith(`folder:`)).map(e=>fetch(`/cms/admin/media/${e}`,{method:`DELETE`,headers:t}))]),V(!1),x(new Set),m()}finally{ae(!1)}}let Oe=l||f,ke=Se.length===0&&Ce.length===0;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Media Library`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d?`${d.total} file${d.total===1?``:`s`}`:``})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(q,{variant:`outline`,onClick:()=>{B(``),ne(!0)},disabled:!r,children:[(0,H.jsx)(Ya,{className:`size-4`}),`New folder`]}),(0,H.jsxs)(q,{onClick:()=>e.current?.click(),disabled:h||!r,children:[h?(0,H.jsx)(iy,{className:`size-4`}):(0,H.jsx)(Io,{className:`size-4`}),h?`Uploading…`:`Upload`]})]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[a.length>1&&(0,H.jsx)(f$,{className:`mb-4`,children:(0,H.jsx)(p$,{children:a.map((e,t)=>(0,H.jsxs)(v.Fragment,{children:[t>0&&(0,H.jsx)(_$,{}),(0,H.jsx)(m$,{children:t===a.length-1?(0,H.jsx)(g$,{children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name}):(0,H.jsx)(h$,{asChild:!0,children:(0,H.jsx)(`button`,{onClick:()=>ge(t),children:t===0?(0,H.jsx)(no,{className:`size-3.5`}):e.name})})})]},t))})}),!ke&&!Oe&&(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-4 py-2.5`,children:[(0,H.jsx)(iO,{checked:Te?!0:Ee?`indeterminate`:!1,onCheckedChange:()=>{x(Te?new Set:new Set(we))},"aria-label":`Select all`}),b.size>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-sm font-medium`,children:[b.size,` selected`]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,H.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>x(new Set),children:`Clear`}),i&&(0,H.jsxs)(q,{variant:`destructive`,size:`sm`,disabled:ie,onClick:()=>V(!0),children:[(0,H.jsx)(Mo,{className:`size-3.5`}),`Delete`]})]})]}):(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Select all`})]}),(0,H.jsx)(`input`,{ref:e,type:`file`,multiple:!0,className:`hidden`,onChange:e=>pe(e.target.files)}),_&&(0,H.jsx)(`p`,{className:`mb-4 text-sm text-destructive`,children:_}),Oe?(0,H.jsx)(`div`,{className:`flex items-center gap-2 py-16 justify-center text-muted-foreground`,children:(0,H.jsx)(iy,{className:`size-5`})}):ke?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-lg border border-dashed py-20 text-center cursor-pointer hover:bg-muted/50 transition-colors`,onClick:()=>r&&e.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:me,children:[(0,H.jsx)(Io,{className:`size-8 text-muted-foreground mb-3`}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`Drop files or folders here, or click to upload`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Images, videos, audio, documents and more`})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,onDragOver:e=>e.preventDefault(),onDrop:me,children:[Se.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,children:Se.map(e=>(0,H.jsx)(D$,{folder:e,onOpen:he,onDelete:F,onRename:e=>{L(e),ee(e.name)},canDelete:i,canRename:r,selected:b.has(`folder:${e.id}`),onToggle:xe},e.id))}),Ce.length>0&&(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6`,children:Ce.map(e=>(0,H.jsx)(O$,{item:e,onDelete:N,onPreview:e=>{C(e),T(e.filename),D(e.alt??``),j(null)},canDelete:i,selected:b.has(e.id),onToggle:xe},e.id))})]}),(0,H.jsx)(ZC,{open:!!S,onOpenChange:e=>{e||(C(null),j(null))},children:(0,H.jsxs)(tw,{className:`sm:max-w-4xl h-[80vh] flex flex-col`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{className:`truncate pr-6`,title:S?.filename,children:S?.filename})}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center overflow-hidden`,children:S&&(0,H.jsx)(E$,{item:S})}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:S?.mime_type??`—`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[S?.width&&S?.height&&(0,H.jsxs)(`span`,{children:[S.width,` × `,S.height]}),(0,H.jsx)(`span`,{children:v$(S?.size??null)}),(0,H.jsx)(`a`,{href:S?.url,target:`_blank`,rel:`noreferrer`,download:S?.filename,children:(0,H.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,children:(0,H.jsx)(za,{className:`size-3.5`})})})]})]}),S&&y$(S.mime_type)&&(0,H.jsxs)(`form`,{className:`flex flex-col gap-3 border-t pt-3`,onSubmit:async e=>{e.preventDefault(),k(!0),j(null);let t=localStorage.getItem(`plank_token`);try{let e=await fetch(`/cms/admin/media/${S.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`,...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({filename:w||S.filename,alt:E||null})});if(!e.ok)throw Error(`Save failed.`);C(await e.json()),p()}catch(e){j(e instanceof Error?e.message:`Save failed.`)}finally{k(!1)}},children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Filename`}),(0,H.jsx)(Ev,{value:w,onChange:e=>T(e.target.value),placeholder:S.filename,className:`h-8 text-sm`,disabled:!r})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{className:`text-xs`,children:`Alt text`}),(0,H.jsx)(Ev,{value:E,onChange:e=>D(e.target.value),placeholder:`Describe the image…`,className:`h-8 text-sm`,disabled:!r})]})]}),A&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:A}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(q,{type:`submit`,size:`sm`,disabled:O||!r,children:O?`Saving…`:`Save`})})]})]})}),(0,H.jsx)(ZC,{open:te,onOpenChange:e=>{e||ne(!1)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New folder`})}),(0,H.jsx)(Ev,{placeholder:`Folder name`,value:z,onChange:e=>B(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_e()},autoFocus:!0}),ue&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ue}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>ne(!1),children:`Cancel`}),(0,H.jsx)(q,{onClick:_e,disabled:le||!z.trim()||!r,children:le?`Creating…`:`Create`})]})]})}),(0,H.jsx)(ZC,{open:!!I,onOpenChange:e=>{e||L(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Rename folder`})}),(0,H.jsx)(Ev,{value:R,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ve()},autoFocus:!0}),ue&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:ue}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>L(null),children:`Cancel`}),(0,H.jsx)(q,{onClick:ve,disabled:le||!R.trim()||!r,children:le?`Saving…`:`Save`})]})]})}),(0,H.jsx)(ZC,{open:!!M,onOpenChange:e=>{e||N(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete file`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:M?.filename}),`? This action cannot be undone.`]}),se&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:se}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>N(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:be,disabled:oe||!i,children:oe?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(ZC,{open:!!P,onOpenChange:e=>{e||F(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete folder`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:P?.name}),`? The folder must be empty.`]}),se&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:se}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>F(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:ye,disabled:oe||!i,children:oe?`Deleting…`:`Delete`})]})]})}),(0,H.jsx)(ZC,{open:re,onOpenChange:e=>{e||V(!1)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsxs)(iw,{children:[`Delete `,b.size,` `,b.size===1?`item`:`items`,`?`]})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This action cannot be undone. Non-empty folders will be skipped.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>V(!1),children:`Cancel`}),(0,H.jsxs)(q,{variant:`destructive`,onClick:De,disabled:ie,children:[ie?(0,H.jsx)(iy,{className:`size-4`}):null,`Delete`]})]})]})})]})]})}function A$({items:e}){let{pathname:t}=Xn();function n(e){return t===e||t.startsWith(e+`/`)}return(0,H.jsx)(`nav`,{className:`flex flex-col gap-0.5 p-2`,children:e.map(({label:e,to:t,icon:r})=>(0,H.jsxs)(Fi,{to:t,className:[`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors`,n(t)?`bg-sidebar-accent text-sidebar-accent-foreground font-medium`:`text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`].join(` `),children:[r&&(0,H.jsx)(r,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:e})]},t))})}function j$(e,t){return e?.permissions.includes(`*`)||e?.permissions.includes(t)||!1}function M$(){let{user:e}=ia(),t=[{label:`Overview`,to:`/settings/overview`,icon:wo,permission:`settings:overview:read`},{label:`Users`,to:`/settings/users`,icon:Ro,permission:`settings:users:read`},{label:`Roles`,to:`/settings/roles`,icon:To,permission:`settings:roles:read`},{label:`API Tokens`,to:`/settings/api-tokens`,icon:ao,permission:`settings:api-tokens:read`},{label:`Webhooks`,to:`/settings/webhooks`,icon:zo,permission:`settings:webhooks:read`}].filter(({permission:t})=>j$(e,t));return(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsx)(`div`,{className:`border-b border-sidebar-border px-4 py-3`,children:(0,H.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Settings`})}),(0,H.jsx)(A$,{items:t})]})}function N$(){return Tw((0,H.jsx)(M$,{})),(0,H.jsx)(Br,{})}var P$=`••••••••`;function F$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-uploads-dir`,children:`Upload directory`}),(0,H.jsx)(Ev,{id:`local-uploads-dir`,placeholder:`public/uploads`,value:e[`local.uploads_dir`]??``,onChange:e=>t(`local.uploads_dir`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Path on disk where files are stored. Relative to the server working directory.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`local-public-url`,children:`Public URL`}),(0,H.jsx)(Ev,{id:`local-public-url`,placeholder:`http://localhost:1337`,value:e[`local.public_url`]??``,onChange:e=>t(`local.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Base URL used to build file URLs. Should match the server's public address.`})]})]})}function I$({id:e,label:t,fieldKey:n,values:r,onChange:i,placeholder:a,disabled:o=!1}){let[s,c]=(0,v.useState)(!1),l=r[n]===P$,u=r[n]??``;return(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:e,children:t}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ev,{id:e,type:s?`text`:`password`,placeholder:l?`Leave blank to keep current value`:a,value:l?``:u,onChange:e=>i(n,e.target.value),className:`pr-9`,disabled:o}),(0,H.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,disabled:o,children:s?(0,H.jsx)(Va,{className:`size-4`}):(0,H.jsx)(Ha,{className:`size-4`})})]}),l&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A value is already saved. Enter a new one to replace it.`})]})}function L$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-access-key`,children:`Access key ID`}),(0,H.jsx)(Ev,{id:`s3-access-key`,placeholder:`AKIAIOSFODNN7EXAMPLE`,value:e[`s3.access_key_id`]??``,onChange:e=>t(`s3.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(I$,{id:`s3-secret-key`,label:`Secret access key`,fieldKey:`s3.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-region`,children:`Region`}),(0,H.jsx)(Ev,{id:`s3-region`,placeholder:`us-east-1`,value:e[`s3.region`]??``,onChange:e=>t(`s3.region`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-bucket`,children:`Bucket`}),(0,H.jsx)(Ev,{id:`s3-bucket`,placeholder:`my-bucket`,value:e[`s3.bucket`]??``,onChange:e=>t(`s3.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Ev,{id:`s3-path-prefix`,placeholder:`cms/media`,value:e[`s3.path_prefix`]??``,onChange:e=>t(`s3.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`s3-public-url`,children:`Public URL`}),(0,H.jsx)(Ev,{id:`s3-public-url`,placeholder:`https://cdn.example.com`,value:e[`s3.public_url`]??``,onChange:e=>t(`s3.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Leave blank to use the default S3 URL.`})]})]})}function R$({values:e,onChange:t,disabled:n=!1}){return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-access-key`,children:`Access key ID`}),(0,H.jsx)(Ev,{id:`r2-access-key`,placeholder:`R2 access key ID`,value:e[`r2.access_key_id`]??``,onChange:e=>t(`r2.access_key_id`,e.target.value),disabled:n})]}),(0,H.jsx)(I$,{id:`r2-secret-key`,label:`Secret access key`,fieldKey:`r2.secret_access_key`,values:e,onChange:t,disabled:n})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-bucket`,children:`Bucket`}),(0,H.jsx)(Ev,{id:`r2-bucket`,placeholder:`my-bucket`,value:e[`r2.bucket`]??``,onChange:e=>t(`r2.bucket`,e.target.value),disabled:n})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-path-prefix`,children:`Path prefix`}),(0,H.jsx)(Ev,{id:`r2-path-prefix`,placeholder:`cms/media`,value:e[`r2.path_prefix`]??``,onChange:e=>t(`r2.path_prefix`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Optional. Shared bucket subfolder.`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsxs)(Y,{htmlFor:`r2-public-url`,children:[`Public URL `,(0,H.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,H.jsx)(Ev,{id:`r2-public-url`,placeholder:`https://assets.example.com`,value:e[`r2.public_url`]??``,onChange:e=>t(`r2.public_url`,e.target.value),disabled:n}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Required. R2 does not generate public URLs automatically.`})]})]})}function z$(){let{user:e}=ia(),{data:t,loading:n}=fa(`/cms/admin/settings/media`),{loading:r,error:i,request:a}=Tv(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),u=o??t??{provider:`local`},d=u.provider||`local`,f=e?.permissions??[],p=f.includes(`*`)||f.includes(`settings:overview:write`);function m(e,t){s({...u,[e]:t})}function h(e){s({...u,provider:e})}async function g(e){e.preventDefault();try{await a(`/cms/admin/settings/media`,`PUT`,u),l(!0),setTimeout(()=>l(!1),2500)}catch{}}return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-muted-foreground`,children:[(0,H.jsx)(iy,{className:`size-4`}),(0,H.jsx)(`span`,{className:`text-sm`,children:`Loading settings…`})]}):(0,H.jsxs)(`form`,{onSubmit:g,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Storage`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure where uploaded files are stored.`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`provider`,children:`Storage provider`}),(0,H.jsxs)(ow,{value:d,onValueChange:e=>h(e),children:[(0,H.jsx)(lw,{id:`provider`,disabled:!p,children:(0,H.jsx)(cw,{})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`local`,children:`Local`}),(0,H.jsx)(mw,{value:`s3`,children:`Amazon S3`}),(0,H.jsx)(mw,{value:`r2`,children:`Cloudflare R2`})]})]})]}),d===`r2`&&(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`r2-account-id`,children:`Account ID`}),(0,H.jsx)(Ev,{id:`r2-account-id`,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:u[`r2.account_id`]??``,onChange:e=>m(`r2.account_id`,e.target.value),disabled:!p}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Found in the Cloudflare dashboard under R2 > Overview.`})]})]}),(0,H.jsxs)(`div`,{className:`border-t pt-6`,children:[d===`local`&&(0,H.jsx)(F$,{values:u,onChange:m,disabled:!p}),d===`s3`&&(0,H.jsx)(L$,{values:u,onChange:m,disabled:!p}),d===`r2`&&(0,H.jsx)(R$,{values:u,onChange:m,disabled:!p})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(q,{type:`submit`,disabled:r||!p,children:r?`Saving…`:`Save`}),c&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Changes saved.`}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i})]})]})}function B$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card`,className:K(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function V$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-header`,className:K(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function H$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-title`,className:K(`leading-none font-semibold`,e),...t})}function U$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-action`,className:K(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function W$({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-content`,className:K(`px-6`,e),...t})}var G$={name:`@plank-cms/admin`,version:`0.16.0`,type:`module`,scripts:{build:`vite build`,dev:`vite`,lint:`eslint src/`},dependencies:{"@dnd-kit/core":`6.3.1`,"@dnd-kit/sortable":`10.0.0`,"@dnd-kit/utilities":`3.2.2`,"@radix-ui/react-avatar":`1.1.11`,"@radix-ui/react-checkbox":`1.3.3`,"@radix-ui/react-dialog":`1.1.15`,"@radix-ui/react-dropdown-menu":`2.1.16`,"@radix-ui/react-label":`2.1.8`,"@radix-ui/react-popover":`1.1.15`,"@radix-ui/react-select":`2.2.6`,"@radix-ui/react-separator":`1.1.8`,"@radix-ui/react-slot":`1.2.4`,"@radix-ui/react-switch":`1.2.6`,"@radix-ui/react-tabs":`1.1.13`,"@radix-ui/react-tooltip":`1.2.8`,"@tanstack/react-table":`8.21.3`,"@tiptap/extension-image":`3.22.4`,"@tiptap/pm":`3.22.4`,"@tiptap/react":`3.22.4`,"@tiptap/starter-kit":`3.22.4`,"class-variance-authority":`0.7.1`,clsx:`2.1.1`,cmdk:`1.1.1`,"date-fns":`4.1.0`,"hls.js":`1.6.16`,"input-otp":`1.4.2`,"lucide-react":`1.8.0`,"qrcode.react":`4.2.0`,"radix-ui":`1.4.3`,react:`19.2.5`,"react-day-picker":`9.14.0`,"react-dom":`19.2.5`,"react-router-dom":`7.14.1`,"tailwind-merge":`3.5.0`},devDependencies:{"@tailwindcss/vite":`4.2.3`,"@types/react":`19.2.14`,"@types/react-dom":`19.2.3`,"@types/react-router-dom":`5.3.3`,"@vitejs/plugin-react":`6.0.1`,tailwindcss:`4.2.3`,vite:`8.0.9`}},K$=[{value:`UTC`,label:`UTC — Coordinated Universal Time`},{value:`America/New_York`,label:`America/New_York — Eastern Time (UTC-5/4)`},{value:`America/Chicago`,label:`America/Chicago — Central Time (UTC-6/5)`},{value:`America/Denver`,label:`America/Denver — Mountain Time (UTC-7/6)`},{value:`America/Los_Angeles`,label:`America/Los_Angeles — Pacific Time (UTC-8/7)`},{value:`America/Anchorage`,label:`America/Anchorage — Alaska Time (UTC-9/8)`},{value:`America/Honolulu`,label:`America/Honolulu — Hawaii Time (UTC-10)`},{value:`America/Mexico_City`,label:`America/Mexico_City — Mexico City (UTC-6/5)`},{value:`America/El_Salvador`,label:`America/El_Salvador — El Salvador (UTC-6)`},{value:`America/Bogota`,label:`America/Bogota — Colombia Time (UTC-5)`},{value:`America/Lima`,label:`America/Lima — Peru Time (UTC-5)`},{value:`America/Santiago`,label:`America/Santiago — Chile Time (UTC-4/3)`},{value:`America/Argentina/Buenos_Aires`,label:`America/Buenos_Aires — Argentina (UTC-3)`},{value:`America/Sao_Paulo`,label:`America/Sao_Paulo — Brasília Time (UTC-3/2)`},{value:`Atlantic/Reykjavik`,label:`Atlantic/Reykjavik — Iceland (UTC+0)`},{value:`Europe/London`,label:`Europe/London — GMT/BST (UTC+0/1)`},{value:`Europe/Paris`,label:`Europe/Paris — Central European Time (UTC+1/2)`},{value:`Europe/Berlin`,label:`Europe/Berlin — Central European Time (UTC+1/2)`},{value:`Europe/Madrid`,label:`Europe/Madrid — Central European Time (UTC+1/2)`},{value:`Europe/Rome`,label:`Europe/Rome — Central European Time (UTC+1/2)`},{value:`Europe/Helsinki`,label:`Europe/Helsinki — Eastern European Time (UTC+2/3)`},{value:`Europe/Istanbul`,label:`Europe/Istanbul — Turkey Time (UTC+3)`},{value:`Europe/Moscow`,label:`Europe/Moscow — Moscow Standard Time (UTC+3)`},{value:`Asia/Dubai`,label:`Asia/Dubai — Gulf Standard Time (UTC+4)`},{value:`Asia/Karachi`,label:`Asia/Karachi — Pakistan Standard Time (UTC+5)`},{value:`Asia/Kolkata`,label:`Asia/Kolkata — India Standard Time (UTC+5:30)`},{value:`Asia/Dhaka`,label:`Asia/Dhaka — Bangladesh Standard Time (UTC+6)`},{value:`Asia/Bangkok`,label:`Asia/Bangkok — Indochina Time (UTC+7)`},{value:`Asia/Singapore`,label:`Asia/Singapore — Singapore Time (UTC+8)`},{value:`Asia/Shanghai`,label:`Asia/Shanghai — China Standard Time (UTC+8)`},{value:`Asia/Tokyo`,label:`Asia/Tokyo — Japan Standard Time (UTC+9)`},{value:`Asia/Seoul`,label:`Asia/Seoul — Korea Standard Time (UTC+9)`},{value:`Australia/Sydney`,label:`Australia/Sydney — AEST/AEDT (UTC+10/11)`},{value:`Australia/Melbourne`,label:`Australia/Melbourne — AEST/AEDT (UTC+10/11)`},{value:`Pacific/Auckland`,label:`Pacific/Auckland — New Zealand (UTC+12/13)`}];function q$(){let{user:e}=ia(),{data:t,loading:n}=fa(`/cms/admin/settings/general`),{request:r,loading:i}=Tv(),{refreshSettings:a}=sa(),[o,s]=(0,v.useState)(`UTC`),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(`en`),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),g=e?.permissions??[],_=g.includes(`*`)||g.includes(`settings:overview:write`);(0,v.useEffect)(()=>{if(t?.timezone&&s(t.timezone),t?.locales)try{let e=JSON.parse(t.locales);Array.isArray(e)&&l(e)}catch{l((t.locales||``).split(`,`).map(e=>e.trim()).filter(Boolean))}t?.default_locale&&d(t.default_locale)},[t]);async function y(){let e={timezone:o};c.length&&(e.locales=JSON.stringify(c)),u&&(e.default_locale=u),await r(`/cms/admin/settings/general`,`PUT`,e),a(),h(!0),setTimeout(()=>h(!1),2e3)}return n?(0,H.jsx)(iy,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(B$,{children:(0,H.jsxs)(W$,{className:`flex items-center gap-4 py-2`,children:[(0,H.jsx)(`img`,{src:`/admin/plank-logo-w.svg`,alt:`Plank CMS`,className:`h-10 w-auto`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`font-bold`,children:`Plank CMS by AM25`}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,G$.version]})]})]})}),(0,H.jsxs)(`div`,{className:`border-b pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`Commons`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`General settings that apply across the CMS.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`timezone`,children:`Timezone`}),(0,H.jsxs)(ow,{value:o,onValueChange:s,children:[(0,H.jsx)(lw,{id:`timezone`,className:`w-1/2`,disabled:!_,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{className:`max-h-72`,children:K$.map(e=>(0,H.jsx)(mw,{value:e.value,children:e.label},e.value))})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Used to display dates and times across the admin panel.`})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{children:`Locales`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Ev,{placeholder:`E.g. "en"`,value:f,onChange:e=>p(e.target.value),className:`w-1/4`,disabled:!_}),(0,H.jsx)(q,{variant:`outline`,disabled:!_,onClick:()=>{let e=f.trim().toLowerCase();e&&(c.includes(e)||l(t=>[...t,e]),p(``))},children:`Add`})]}),(0,H.jsx)(`div`,{className:`flex gap-2 mt-2`,children:c.map(e=>(0,H.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>l(t=>t.filter(t=>t!==e)),disabled:!_,children:e.toUpperCase()},e))}),(0,H.jsxs)(`div`,{className:`mt-2`,children:[(0,H.jsx)(Y,{htmlFor:`default-locale`,children:`Default locale`}),(0,H.jsxs)(ow,{value:u,onValueChange:d,children:[(0,H.jsx)(lw,{id:`default-locale`,className:`w-1/2`,disabled:!_,children:(0,H.jsx)(cw,{})}),(0,H.jsx)(fw,{className:`max-h-72`,children:c.length===0?(0,H.jsx)(mw,{value:u,children:u}):c.map(e=>(0,H.jsx)(mw,{value:e,children:e.toUpperCase()},e))})]})]})]}),(0,H.jsx)(q,{onClick:y,disabled:i||!_,children:m?`Saved`:i?`Saving…`:`Save`})]})}function J$(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(ry,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Overview`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`General configuration for your CMS instance.`})]}),(0,H.jsxs)(kA,{defaultValue:`general`,className:`mt-24`,children:[(0,H.jsxs)(AA,{className:`mb-6`,children:[(0,H.jsx)(jA,{value:`general`,children:`General`}),(0,H.jsx)(jA,{value:`media`,children:`Media Library`})]}),(0,H.jsx)(MA,{value:`general`,children:(0,H.jsx)(q$,{})}),(0,H.jsx)(MA,{value:`media`,children:(0,H.jsx)(z$,{})})]})]})}function Y$(e,t){return typeof e==`function`?e(t):e}function X$(e,t){return n=>{t.setState(t=>({...t,[e]:Y$(n,t[e])}))}}function Z$(e){return e instanceof Function}function Q$(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function $$(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function e1(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
220
220
  font-size: .6rem;
221
221
  font-weight: bold;
222
- color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function Q$(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function $$(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:Z$(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),Q$(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function e1(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:Z$(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],Q$(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:Z$(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},Q$(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var t1=`debugHeaders`;function n1(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var r1={createTable:e=>{e.getHeaderGroups=Z$(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return i1(t,[...a,...s,...o],e)},Q$(e.options,t1,`getHeaderGroups`)),e.getCenterHeaderGroups=Z$(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),i1(t,n,e,`center`)),Q$(e.options,t1,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=Z$(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>i1(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),Q$(e.options,t1,`getLeftHeaderGroups`)),e.getRightHeaderGroups=Z$(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>i1(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),Q$(e.options,t1,`getRightHeaderGroups`)),e.getFooterGroups=Z$(()=>[e.getHeaderGroups()],e=>[...e].reverse(),Q$(e.options,t1,`getFooterGroups`)),e.getLeftFooterGroups=Z$(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),Q$(e.options,t1,`getLeftFooterGroups`)),e.getCenterFooterGroups=Z$(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),Q$(e.options,t1,`getCenterFooterGroups`)),e.getRightFooterGroups=Z$(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),Q$(e.options,t1,`getRightFooterGroups`)),e.getFlatHeaders=Z$(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),Q$(e.options,t1,`getFlatHeaders`)),e.getLeftFlatHeaders=Z$(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),Q$(e.options,t1,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=Z$(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),Q$(e.options,t1,`getCenterFlatHeaders`)),e.getRightFlatHeaders=Z$(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),Q$(e.options,t1,`getRightFlatHeaders`)),e.getCenterLeafHeaders=Z$(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Q$(e.options,t1,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=Z$(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Q$(e.options,t1,`getLeftLeafHeaders`)),e.getRightLeafHeaders=Z$(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Q$(e.options,t1,`getRightLeafHeaders`)),e.getLeafHeaders=Z$(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),Q$(e.options,t1,`getLeafHeaders`))}};function i1(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=n1(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>n1(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var a1=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>X$(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Z$(()=>[e.getAllLeafColumns()],t=>t.map(t=>$$(e,s,t,t.id)),Q$(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:Z$(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),Q$(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},o1={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},s1=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};s1.autoRemove=e=>_1(e);var c1=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};c1.autoRemove=e=>_1(e);var l1=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};l1.autoRemove=e=>_1(e);var u1=(e,t,n)=>e.getValue(t)?.includes(n);u1.autoRemove=e=>_1(e);var d1=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});d1.autoRemove=e=>_1(e)||!(e!=null&&e.length);var f1=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));f1.autoRemove=e=>_1(e)||!(e!=null&&e.length);var p1=(e,t,n)=>e.getValue(t)===n;p1.autoRemove=e=>_1(e);var m1=(e,t,n)=>e.getValue(t)==n;m1.autoRemove=e=>_1(e);var h1=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};h1.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},h1.autoRemove=e=>_1(e)||_1(e[0])&&_1(e[1]);var g1={includesString:s1,includesStringSensitive:c1,equalsString:l1,arrIncludes:u1,arrIncludesAll:d1,arrIncludesSome:f1,equals:p1,weakEquals:m1,inNumberRange:h1};function _1(e){return e==null||e===``}var v1={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:q$(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?g1.includesString:typeof n==`number`?g1.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?g1.equals:Array.isArray(n)?g1.arrIncludes:g1.weakEquals},e.getFilterFn=()=>J$(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??g1[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=K$(n,i?i.value:void 0);if(y1(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>K$(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&y1(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function y1(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var b1={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!Y$(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},x1={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:q$(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return b1.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return b1.extent},e.getAggregationFn=()=>{if(!e)throw Error();return J$(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??b1[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function S1(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var C1={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:q$(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=Z$(e=>[P1(t,e)],t=>t.findIndex(t=>t.id===e.id),Q$(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>P1(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=P1(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=Z$(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return S1(i,t,n)},Q$(e.options,`debugTable`,`_getOrderColumnsFn`))}},w1=()=>({left:[],right:[]}),T1={getInitialState:e=>({columnPinning:w1(),...e}),getDefaultOptions:e=>({onColumnPinningChange:q$(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Z$(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},Q$(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=Z$(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),Q$(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=Z$(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),Q$(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?w1():e.initialState?.columnPinning??w1()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=Z$(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Q$(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=Z$(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Q$(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=Z$(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},Q$(e.options,`debugColumns`,`getCenterLeafColumns`))}};function E1(e){return e||(typeof document<`u`?document:null)}var D1={size:150,minSize:20,maxSize:2**53-1},O1=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),k1={getDefaultColumnDef:()=>D1,getInitialState:e=>({columnSizing:{},columnSizingInfo:O1(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:q$(`columnSizing`,e),onColumnSizingInfoChange:q$(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??D1.minSize,n??e.columnDef.size??D1.size),e.columnDef.maxSize??D1.maxSize)},e.getStart=Z$(e=>[e,P1(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),Q$(t.options,`debugColumns`,`getStart`)),e.getAfter=Z$(e=>[e,P1(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),Q$(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),M1(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=M1(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=E1(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=j1()?{passive:!1}:!1;M1(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?O1():e.initialState.columnSizingInfo??O1())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},A1=null;function j1(){if(typeof A1==`boolean`)return A1;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return A1=e,A1}function M1(e){return e.type===`touchstart`}var N1={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:q$(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Z$(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),Q$(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=Z$(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],Q$(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>Z$(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),Q$(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function P1(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var F1={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},I1={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:q$(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>g1.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return J$(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??g1[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},L1={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:q$(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},R1=0,z1=10,B1=()=>({pageIndex:R1,pageSize:z1}),V1={getInitialState:e=>({...e,pagination:{...B1(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:q$(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>K$(t,e)),e.resetPagination=t=>{e.setPagination(t?B1():e.initialState.pagination??B1())},e.setPageIndex=t=>{e.setPagination(n=>{let r=K$(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?R1:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??R1)},e.resetPageSize=t=>{var n;e.setPageSize(t?z1:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??z1)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,K$(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=K$(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=Z$(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},Q$(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},H1=()=>({top:[],bottom:[]}),U1={getInitialState:e=>({rowPinning:H1(),...e}),getDefaultOptions:e=>({onRowPinningChange:q$(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?H1():e.initialState?.rowPinning??H1()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=Z$(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),Q$(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=Z$(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),Q$(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=Z$(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},Q$(e.options,`debugRows`,`getCenterRows`))}},W1={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:q$(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{G1(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Z$(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?K1(e,n):{rows:[],flatRows:[],rowsById:{}},Q$(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=Z$(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?K1(e,n):{rows:[],flatRows:[],rowsById:{}},Q$(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=Z$(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?K1(e,n):{rows:[],flatRows:[],rowsById:{}},Q$(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return G1(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return q1(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return J1(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return J1(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},G1=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>G1(e,t.id,n,r,i))};function K1(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=q1(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function q1(e,t){return t[e.id]??!1}function J1(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(q1(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=J1(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Y1=/([0-9]+)/gm,X1=(e,t,n)=>i0(r0(e.getValue(n)).toLowerCase(),r0(t.getValue(n)).toLowerCase()),Z1=(e,t,n)=>i0(r0(e.getValue(n)),r0(t.getValue(n))),Q1=(e,t,n)=>n0(r0(e.getValue(n)).toLowerCase(),r0(t.getValue(n)).toLowerCase()),$1=(e,t,n)=>n0(r0(e.getValue(n)),r0(t.getValue(n))),e0=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},t0=(e,t,n)=>n0(e.getValue(n),t.getValue(n));function n0(e,t){return e===t?0:e>t?1:-1}function r0(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function i0(e,t){let n=e.split(Y1).filter(Boolean),r=t.split(Y1).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var a0={alphanumeric:X1,alphanumericCaseSensitive:Z1,text:Q1,textCaseSensitive:$1,datetime:e0,basic:t0},o0=[r1,N1,C1,T1,o1,v1,F1,I1,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:q$(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return a0.datetime;if(typeof n==`string`&&(r=!0,n.split(Y1).length>1))return a0.alphanumeric}return r?a0.text:a0.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return J$(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??a0[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},x1,L1,V1,U1,W1,k1];function s0(e){let t=[...o0,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(K$(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:Z$(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),Q$(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:Z$(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=e1(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},Q$(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:Z$(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),Q$(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:Z$(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),Q$(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:Z$(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),Q$(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function c0(){return e=>Z$(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=a1(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},Q$(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function l0(e,t){return e?u0(e)?v.createElement(e,t):e:null}function u0(e){return d0(e)||typeof e==`function`||f0(e)}function d0(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function f0(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function p0(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:s0(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var m0={"super admin":`default`,admin:`secondary`,user:`outline`};function h0({roleId:e,roleName:t,roles:n}){let r=n.find(t=>t.id===e),i=t??r?.name??e;return(0,H.jsx)(XC,{variant:m0[i.toLowerCase()]??`secondary`,children:i})}function g0({user:e,currentUserId:t,currentUserRole:n,onEdit:r,onDelete:i}){let a=e.id===t,o=(e.role_name??``).toLowerCase()===`super admin`,s=n.toLowerCase()===`super admin`;return(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,disabled:o&&!a&&!s,onClick:()=>r(e),children:(0,H.jsx)(vo,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,disabled:a||o,onClick:()=>i(e),children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})}var _0={email:``,password:``,roleId:``};function v0(){let{user:e,updateUser:t}=ia(),{data:n,loading:r,refetch:i}=fa(`/cms/admin/users`),{data:a,loading:o}=fa(`/cms/admin/roles`),s=r||o,{request:c,loading:l,error:u}=Tv(),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(_0),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)({email:``,roleId:``,firstName:``,lastName:``}),[b,x]=(0,v.useState)(null),S=a??[],C=e?.role?.toLowerCase()===`super admin`?S:S.filter(e=>e.name.toLowerCase()!==`super admin`),w=(0,v.useMemo)(()=>[{id:`name`,header:`Name`,cell:({row:e})=>{let{first_name:t,last_name:n}=e.original;return!t&&!n?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):(0,H.jsx)(`span`,{className:`font-bold`,children:[t,n].filter(Boolean).join(` `)})}},{accessorKey:`email`,header:`Email`},{accessorKey:`role_id`,header:`Role`,cell:({row:e,getValue:t})=>(0,H.jsx)(h0,{roleId:t(),roleName:e.original.role_name,roles:S})},{id:`actions`,header:``,cell:({row:t})=>(0,H.jsx)(g0,{user:t.original,currentUserId:e?.id??``,currentUserRole:e?.role??``,onEdit:e=>{g(e),y({email:e.email,roleId:e.role_id,firstName:e.first_name??``,lastName:e.last_name??``})},onDelete:x})}],[S,e?.id,e?.role]),T=p0({data:(0,v.useMemo)(()=>[...n??[]].sort((e,t)=>{let n=[e.first_name,e.last_name].filter(Boolean).join(` `)||e.email,r=[t.first_name,t.last_name].filter(Boolean).join(` `)||t.email;return n.localeCompare(r)}),[n]),columns:w,getCoreRowModel:c0()});async function E(e){e.preventDefault();try{await c(`/cms/admin/users`,`POST`,p),f(!1),m(_0),i()}catch{}}async function D(n){n.preventDefault();try{await c(`/cms/admin/users/${h.id}`,`PUT`,_),h.id===e?.id&&t({email:_.email,firstName:_.firstName||null,lastName:_.lastName||null}),g(null),i()}catch{}}async function O(){try{await c(`/cms/admin/users/${b.id}`,`DELETE`),x(null),i()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Users`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage who has access to the admin panel.`})]}),(0,H.jsxs)(q,{onClick:()=>f(!0),children:[(0,H.jsx)(yo,{className:`size-4`}),`New user`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:T.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:l0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:s?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:w.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):T.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:w.length,className:`h-24 text-center text-muted-foreground`,children:`No users found.`})}):T.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:l0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:d,onOpenChange:f,children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New user`})}),(0,H.jsxs)(`form`,{id:`create-user-form`,onSubmit:E,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-email`,children:`Email`}),(0,H.jsx)(Ev,{id:`c-email`,type:`email`,placeholder:`user@example.com`,value:p.email,onChange:e=>m(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-password`,children:`Password`}),(0,H.jsx)(Ev,{id:`c-password`,type:`password`,placeholder:`Min. 8 characters`,value:p.password,onChange:e=>m(t=>({...t,password:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-role`,children:`Role`}),(0,H.jsxs)(ow,{value:p.roleId,onValueChange:e=>m(t=>({...t,roleId:e})),children:[(0,H.jsx)(lw,{id:`c-role`,children:(0,H.jsx)(cw,{placeholder:`Select a role`})}),(0,H.jsx)(fw,{children:C.map(e=>(0,H.jsx)(mw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>f(!1),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-user-form`,disabled:l,children:l?`Creating…`:`Create user`})]})]})}),(0,H.jsx)(ZC,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Edit user`})}),(0,H.jsxs)(`form`,{id:`edit-user-form`,onSubmit:D,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-email`,children:`Email`}),(0,H.jsx)(Ev,{id:`e-email`,type:`email`,value:_.email,onChange:e=>y(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-fname`,children:`First name`}),(0,H.jsx)(Ev,{id:`e-fname`,value:_.firstName,onChange:e=>y(t=>({...t,firstName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-lname`,children:`Last name`}),(0,H.jsx)(Ev,{id:`e-lname`,value:_.lastName,onChange:e=>y(t=>({...t,lastName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-role`,children:`Role`}),(0,H.jsxs)(ow,{value:_.roleId,onValueChange:e=>y(t=>({...t,roleId:e})),children:[(0,H.jsx)(lw,{id:`e-role`,children:(0,H.jsx)(cw,{placeholder:`Select a role`})}),(0,H.jsx)(fw,{children:C.map(e=>(0,H.jsx)(mw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>g(null),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`edit-user-form`,disabled:l,children:l?`Saving…`:`Save changes`})]})]})}),(0,H.jsx)(ZC,{open:!!b,onOpenChange:e=>{e||x(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete user`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:b?.email}),`? This action cannot be undone.`]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>x(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:O,disabled:l,children:l?`Deleting…`:`Delete`})]})]})})]})]})}var y0=[{key:`content-types`,label:`Content Types`,actions:[`read`,`write`,`delete`]},{key:`entries`,label:`Entries`,actions:[`read`,`write`,`delete`]},{key:`media`,label:`Media`,actions:[`read`,`write`,`delete`]},{key:`settings:overview`,label:`Settings / Overview`,actions:[`read`,`write`]},{key:`settings:users`,label:`Settings / Users`,actions:[`read`,`write`,`delete`]},{key:`settings:roles`,label:`Settings / Roles`,actions:[`read`,`write`]},{key:`settings:api-tokens`,label:`Settings / API Tokens`,actions:[`read`,`write`,`delete`]},{key:`settings:webhooks`,label:`Settings / Webhooks`,actions:[`read`,`write`,`delete`]}],b0=[{key:`read`,label:`R`},{key:`write`,label:`W`},{key:`delete`,label:`D`}];function x0(e){return Object.fromEntries(e.map(e=>[e.id,new Set(e.permissions)]))}function S0(e,t){return e.includes(t)}function C0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/roles`),{request:i,loading:a}=Tv(),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(!1);(0,v.useEffect)(()=>{t&&s(x0(t))},[t]);function f(e,t){s(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:r}}),l(t=>new Set(t).add(e))}async function p(e){await i(`/cms/admin/roles/${e.id}`,`PUT`,{permissions:Array.from(o[e.id]??[])}),l(t=>{let n=new Set(t);return n.delete(e.id),n})}async function m(){await i(`/cms/admin/roles/reset`,`POST`),d(!1),l(new Set),r()}let h=e?.role===`Super Admin`,g=(t??[]).filter(e=>e.name!==`Super Admin`),_=(t??[]).find(e=>e.name===`Super Admin`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Roles`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure what each role can do across the CMS.`})]}),h&&(0,H.jsxs)(q,{variant:`outline`,onClick:()=>d(!0),children:[(0,H.jsx)(xo,{className:`size-4`}),`Reset defaults`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsxs)(_w,{children:[(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`w-40`,rowSpan:2}),_&&(0,H.jsx)(bw,{colSpan:3,className:`border-l text-center`,children:_.name}),g.map(e=>(0,H.jsx)(bw,{colSpan:3,className:`border-l`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),(0,H.jsxs)(q,{size:`sm`,variant:c.has(e.id)?`default`:`ghost`,className:`h-6 px-2 text-xs`,disabled:!c.has(e.id)||a,onClick:()=>p(e),children:[(0,H.jsx)(So,{className:`size-3`}),`Save`]})]})},e.id))]}),(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[_&&b0.map((e,t)=>(0,H.jsx)(bw,{className:`w-12 text-center font-normal ${t===0?`border-l`:``}`,children:e.label},e.key)),g.map(e=>b0.map((t,n)=>(0,H.jsx)(bw,{className:`w-12 text-center font-normal ${n===0?`border-l`:``}`,children:t.label},`${e.id}-${t.key}`)))]})]}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:99,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):y0.map(({key:e,label:t,actions:n})=>(0,H.jsxs)(yw,{children:[(0,H.jsx)(xw,{className:`font-medium`,children:t}),_&&b0.map((e,t)=>(0,H.jsx)(xw,{className:`text-center ${t===0?`border-l`:``}`,children:S0(n,e.key)?(0,H.jsx)(iO,{checked:!0,disabled:!0}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},e.key)),g.map(t=>b0.map((r,i)=>{let a=S0(n,r.key),s=`${e}:${r.key}`;return(0,H.jsx)(xw,{className:`text-center ${i===0?`border-l`:``}`,children:a?(0,H.jsx)(iO,{checked:o[t.id]?.has(s)??!1,onCheckedChange:()=>f(t.id,s)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},`${t.id}-${r.key}`)}))]},e))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:d,children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Reset to defaults`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will restore all role permissions to their original configuration. Any custom changes will be lost.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>d(!1),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:m,disabled:a,children:a?`Resetting…`:`Reset`})]})]})})]})]})}var w0={"full-access":`default`,"read-only":`secondary`},T0={"full-access":`Full access`,"read-only":`Read only`};function E0({value:e}){let[t,n]=(0,v.useState)(!1);function r(){navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`outline`,className:`shrink-0`,onClick:r,children:t?(0,H.jsx)(Da,{className:`size-4 text-green-500`}):(0,H.jsx)(Ra,{className:`size-4`})})}var D0={name:``,accessType:``};function O0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/api-tokens`),{request:i,loading:a,error:o}=Tv(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:api-tokens:write`),l=s.includes(`*`)||s.includes(`settings:api-tokens:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(D0),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),y=[{accessorKey:`name`,header:`Name`},{accessorKey:`access_type`,header:`Access`,cell:({getValue:e})=>{let t=e();return(0,H.jsx)(XC,{variant:w0[t]??`secondary`,children:T0[t]??t})}},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,onClick:()=>_(e.original),children:(0,H.jsx)(Mo,{className:`size-3.5`})}):null}],b=p0({data:t??[],columns:y,getCoreRowModel:c0()});async function x(e){e.preventDefault();try{h(await i(`/cms/admin/api-tokens`,`POST`,{name:f.name,accessType:f.accessType})),r()}catch{}}function S(){d(!1),h(null),p(D0)}async function C(){try{await i(`/cms/admin/api-tokens/${g.id}`,`DELETE`),_(null),r()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`API Tokens`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage tokens for consuming the public API.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(yo,{className:`size-4`}),`New token`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:b.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:l0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:y.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):b.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:y.length,className:`h-24 text-center text-muted-foreground`,children:`No tokens yet.`})}):b.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:l0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:e=>{e||S()},children:(0,H.jsx)(tw,{className:`sm:max-w-md`,children:m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Token generated`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,children:`Make sure to copy your token now. You won't be able to see it again.`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Token`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Ev,{readOnly:!0,value:m.token,className:`font-mono text-xs`}),(0,H.jsx)(E0,{value:m.token})]})]})]}),(0,H.jsx)(rw,{children:(0,H.jsx)(q,{onClick:S,children:`Done`})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New API token`})}),(0,H.jsxs)(`form`,{id:`create-token-form`,onSubmit:x,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-name`,children:`Name`}),(0,H.jsx)(Ev,{id:`token-name`,placeholder:`e.g. Production frontend`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-access`,children:`Access type`}),(0,H.jsxs)(ow,{value:f.accessType,onValueChange:e=>p(t=>({...t,accessType:e})),children:[(0,H.jsx)(lw,{id:`token-access`,children:(0,H.jsx)(cw,{placeholder:`Select access type`})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`read-only`,children:`Read only`}),(0,H.jsx)(mw,{value:`full-access`,children:`Full access`})]})]})]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:S,children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-token-form`,disabled:a||!f.accessType||!c,children:a?`Generating…`:`Generate token`})]})]})})}),(0,H.jsx)(ZC,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Revoke token`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to revoke`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:g?.name}),`? Any frontend using it will immediately lose access.`]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:C,disabled:a||!l,children:a?`Revoking…`:`Revoke`})]})]})})]})]})}var k0=[{value:`entry.published`,label:`Entry published`},{value:`entry.unpublished`,label:`Entry unpublished`},{value:`entry.created`,label:`Entry created`},{value:`entry.updated`,label:`Entry updated`},{value:`entry.deleted`,label:`Entry deleted`}],A0={name:``,url:``,events:[]};function j0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/webhooks`),{request:i,loading:a,error:o}=Tv(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:webhooks:write`),l=s.includes(`*`)||s.includes(`settings:webhooks:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(A0),[m,h]=(0,v.useState)(null),g=[{accessorKey:`name`,header:`Name`},{accessorKey:`url`,header:`URL`,cell:({getValue:e})=>(0,H.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground truncate max-w-xs block`,children:e()})},{accessorKey:`events`,header:`Events`,cell:({getValue:e})=>(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e().map(e=>(0,H.jsx)(XC,{variant:`secondary`,className:`text-xs font-mono`,children:e},e))})},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`size-8 text-destructive hover:text-destructive`,onClick:()=>h(e.original),children:(0,H.jsx)(Mo,{className:`size-3.5`})}):null}],_=p0({data:t??[],columns:g,getCoreRowModel:c0()});function y(e){p(t=>({...t,events:t.events.includes(e)?t.events.filter(t=>t!==e):[...t.events,e]}))}async function b(e){e.preventDefault();try{await i(`/cms/admin/webhooks`,`POST`,f),d(!1),p(A0),r()}catch{}}async function x(){try{await i(`/cms/admin/webhooks/${m.id}`,`DELETE`),h(null),r()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Webhooks`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Notify external services when content events occur.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(yo,{className:`size-4`}),`New webhook`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:_.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:l0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:g.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):_.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:g.length,className:`h-24 text-center text-muted-foreground`,children:`No webhooks yet.`})}):_.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:l0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:e=>{e||(d(!1),p(A0))},children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New webhook`})}),(0,H.jsxs)(`form`,{id:`create-webhook-form`,onSubmit:b,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-name`,children:`Name`}),(0,H.jsx)(Ev,{id:`webhook-name`,placeholder:`e.g. Dokploy deploy`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-url`,children:`URL`}),(0,H.jsx)(Ev,{id:`webhook-url`,type:`url`,placeholder:`https://...`,value:f.url,onChange:e=>p(t=>({...t,url:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Events`}),k0.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`event-${e}`,checked:f.events.includes(e),onCheckedChange:()=>y(e)}),(0,H.jsxs)(`label`,{htmlFor:`event-${e}`,className:`text-sm cursor-pointer`,children:[t,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e})]})]},e))]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>{d(!1),p(A0)},children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-webhook-form`,disabled:a||f.events.length===0||!c,children:a?`Creating…`:`Create webhook`})]})]})}),(0,H.jsx)(ZC,{open:!!m,onOpenChange:e=>{e||h(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete webhook`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:m?.name}),`? It will stop receiving events immediately.`]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>h(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:x,disabled:a||!l,children:a?`Deleting…`:`Delete`})]})]})})]})]})}function M0({...e}){return(0,H.jsx)(Ty,{"data-slot":`collapsible`,...e})}function N0({...e}){return(0,H.jsx)(Sy,{"data-slot":`collapsible-content`,...e})}function P0(){let{user:e,updateUser:t}=ia(),{loading:n,error:r,request:i}=Tv(),{request:a}=Tv(),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(e?.firstName??``),[_,y]=(0,v.useState)(e?.lastName??``),[b,x]=(0,v.useState)(e?.jobTitle??``),[S,C]=(0,v.useState)(e?.organization??``),[w,T]=(0,v.useState)(e?.country??``);function E(){p&&(g(e?.firstName??``),y(e?.lastName??``),x(e?.jobTitle??``),C(e?.organization??``),T(e?.country??``)),m(!p)}async function D(e){let n=e.target.files?.[0];if(n){c(!0),f(null);try{t({avatarUrl:await DZ(n)})}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}finally{c(!1),o.current&&(o.current.value=``)}}}async function O(){u(!0),f(null);try{await a(`/cms/admin/users/me/avatar`,`DELETE`),t({avatarUrl:null})}catch(e){f(e instanceof Error?e.message:`Delete failed.`)}finally{u(!1)}}async function k(e){e.preventDefault();try{let e=await i(`/cms/admin/users/me`,`PATCH`,{firstName:h,lastName:_,jobTitle:b,organization:S,country:w});t({firstName:e.first_name,lastName:e.last_name,jobTitle:e.job_title,organization:e.organization,country:e.country}),m(!1)}catch{}}return(0,H.jsx)(M0,{open:p,onOpenChange:m,children:(0,H.jsxs)(L$,{children:[(0,H.jsxs)(R$,{children:[(0,H.jsx)(z$,{className:`uppercase`,children:`Account`}),(0,H.jsx)(B$,{children:(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:E,children:p?(0,H.jsx)(Bo,{className:`size-4`}):(0,H.jsx)(vo,{className:`size-4`})})})]}),(0,H.jsxs)(V$,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4 -mt-4`,children:[(0,H.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`block`,onClick:()=>o.current?.click(),disabled:s||l,title:`Change avatar`,children:[(0,H.jsx)(ul,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email,className:`size-20`,fallbackClassName:`text-xl`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center rounded-full bg-black/40 opacity-0 transition-opacity group-hover:opacity-100`,children:s||l?(0,H.jsx)(`div`,{className:`size-4 animate-spin rounded-full border-2 border-white border-t-transparent`}):(0,H.jsx)(Ea,{className:`size-5 text-white`})})]}),e?.avatarUrl&&!s&&!l&&(0,H.jsx)(`button`,{type:`button`,onClick:O,title:`Remove avatar`,className:`absolute -top-1 -right-1 flex size-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground opacity-0 transition-opacity group-hover:opacity-100`,children:(0,H.jsx)(Mo,{className:`size-3`})})]}),(0,H.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,className:`hidden`,onChange:D}),(0,H.jsxs)(`div`,{children:[d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive mb-1`,children:d}),(0,H.jsx)(`p`,{className:`font-bold text-xl`,children:e?.firstName||e?.lastName?`${e.firstName??``} ${e.lastName??``}`.trim():e?.email}),(e?.jobTitle||e?.organization)&&(0,H.jsx)(`p`,{className:`text-sm`,children:[e.jobTitle,e.organization].filter(Boolean).join(` · `)}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e?.email}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,H.jsx)(XC,{className:`capitalize`,children:e?.role}),e?.country&&(0,H.jsx)(XC,{variant:`outline`,children:e.country})]})]})]}),(0,H.jsx)(N0,{children:(0,H.jsxs)(`form`,{onSubmit:k,className:`space-y-4 mt-8`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`firstName`,children:`First name`}),(0,H.jsx)(Ev,{id:`firstName`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`lastName`,children:`Last name`}),(0,H.jsx)(Ev,{id:`lastName`,value:_,onChange:e=>y(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`jobTitle`,children:`Job title`}),(0,H.jsx)(Ev,{id:`jobTitle`,value:b,onChange:e=>x(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`organization`,children:`Organization`}),(0,H.jsx)(Ev,{id:`organization`,value:S,onChange:e=>C(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`country`,children:`Country`}),(0,H.jsx)(Ev,{id:`country`,value:w,onChange:e=>T(e.target.value)})]})]}),r&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:r}),(0,H.jsx)(q,{type:`submit`,disabled:n,children:n?`Saving…`:`Save changes`})]})})]})]})})}var F0=Object.defineProperty,I0=Object.getOwnPropertySymbols,L0=Object.prototype.hasOwnProperty,R0=Object.prototype.propertyIsEnumerable,z0=(e,t,n)=>t in e?F0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B0=(e,t)=>{for(var n in t||={})L0.call(t,n)&&z0(e,n,t[n]);if(I0)for(var n of I0(t))R0.call(t,n)&&z0(e,n,t[n]);return e},V0=(e,t)=>{var n={};for(var r in e)L0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&I0)for(var r of I0(e))t.indexOf(r)<0&&R0.call(e,r)&&(n[r]=e[r]);return n},H0;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(H0||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(H0||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(H0||={});var U0=H0,W0={L:U0.QrCode.Ecc.LOW,M:U0.QrCode.Ecc.MEDIUM,Q:U0.QrCode.Ecc.QUARTILE,H:U0.QrCode.Ecc.HIGH},G0=128,K0=`L`,q0=`#FFFFFF`,J0=`#000000`,Y0=!1,X0=1,Z0=4,Q0=0,$0=.1;function e2(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function t2(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function n2(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*$0),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function r2(e,t){return t==null?e?Z0:Q0:Math.max(Math.floor(t),0)}function i2({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=v.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...U0.QrSegment.makeSegments(t)),e),[]);return U0.QrCode.encodeSegments(r,W0[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=v.useMemo(()=>{let e=c.getModules(),t=r2(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:n2(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var a2=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),o2=v.forwardRef(function(e,t){let n=e,{value:r,size:i=G0,level:a=K0,bgColor:o=q0,fgColor:s=J0,includeMargin:c=Y0,minVersion:l=X0,boostLevel:u,marginSize:d,imageSettings:f}=n,p=V0(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=V0(p,[`style`]),g=f?.src,_=v.useRef(null),y=v.useRef(null),b=v.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=v.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=i2({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});v.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=t2(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,a2?t.fill(new Path2D(e2(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),v.useEffect(()=>{S(!1)},[g]);let D=B0({height:i,width:i},m),O=null;return g!=null&&(O=v.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),v.createElement(v.Fragment,null,v.createElement(`canvas`,B0({style:D,height:i,width:i,ref:b,role:`img`},h)),O)});o2.displayName=`QRCodeCanvas`;var s2=v.forwardRef(function(e,t){let n=e,{value:r,size:i=G0,level:a=K0,bgColor:o=q0,fgColor:s=J0,includeMargin:c=Y0,minVersion:l=X0,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=V0(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:y}=i2({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),b=g,x=null;p!=null&&y!=null&&(y.excavation!=null&&(b=t2(g,y.excavation)),x=v.createElement(`image`,{href:p.src,height:y.h,width:y.w,x:y.x+h,y:y.y+h,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=e2(b,h);return v.createElement(`svg`,B0({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&v.createElement(`title`,null,d),v.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),v.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});s2.displayName=`QRCodeSVG`;function c2(){let{user:e,updateUser:t,logout:n}=ia(),{loading:r,error:i,request:a}=Tv(),{loading:o,error:s,request:c}=Tv(),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)([]),[M,N]=(0,v.useState)(!1);(0,v.useEffect)(()=>{typeof e?.twoFactorEnabled==`boolean`&&x(e.twoFactorEnabled)},[e?.twoFactorEnabled]);function P(){u(``),f(``),m(``),g(``),y(null),C(null),T(``)}function F(){C(null),T(``),D(``),k(!1),N(!1)}async function I(e){if(e.preventDefault(),y(null),p!==h){y(`New passwords do not match`);return}try{await a(`/cms/admin/users/me/password`,`PATCH`,{currentPassword:d,newPassword:p}),P()}catch{}}async function L(){C(await c(`/cms/admin/users/me/2fa/setup`,`POST`))}async function R(){let e=await c(`/cms/admin/users/me/2fa/verify`,`POST`,{code:w});x(!0),t({twoFactorEnabled:!0}),C(null),T(``),k(!0),j(e.backupCodes??[])}async function ee(){await c(`/cms/admin/users/me/2fa/disable`,`POST`,{code:w,password:E}),x(!1),t({twoFactorEnabled:!1}),T(``),D(``),j([]),N(!1)}return(0,H.jsxs)(L$,{children:[(0,H.jsxs)(R$,{children:[(0,H.jsx)(z$,{className:`uppercase`,children:`Security`}),(0,H.jsx)(B$,{})]}),(0,H.jsx)(V$,{className:`space-y-6`,children:(0,H.jsxs)(kA,{value:l,children:[(0,H.jsxs)(AA,{children:[(0,H.jsx)(jA,{value:`password`,onClick:()=>u(e=>e===`password`?``:`password`),children:`Password`}),(0,H.jsx)(jA,{value:`two-factor`,onClick:()=>u(e=>e===`two-factor`?``:`two-factor`),children:`2FA`})]}),(0,H.jsx)(MA,{value:`password`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Update your account password.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:P,children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsxs)(`form`,{onSubmit:I,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`current`,children:`Current password`}),(0,H.jsx)(Ev,{id:`current`,type:`password`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`new`,children:`New password`}),(0,H.jsx)(Ev,{id:`new`,type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,minLength:8})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`confirm`,children:`Confirm new password`}),(0,H.jsx)(Ev,{id:`confirm`,type:`password`,value:h,onChange:e=>g(e.target.value),required:!0})]}),(_??i)&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:_??i}),(0,H.jsx)(q,{type:`submit`,disabled:r,children:r?`Saving…`:`Update password`})]})]})}),(0,H.jsx)(MA,{value:`two-factor`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[!b&&!S&&(0,H.jsx)(q,{variant:`secondary`,onClick:L,disabled:o,children:`Enable 2FA`}),S&&!b&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scan this QR code with your authenticator app and enter the 6-digit code.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:F,children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsx)(`div`,{className:`inline-flex rounded-md bg-white p-2`,children:(0,H.jsx)(s2,{value:S.otpauthUri,size:176})}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Manual code: `,S.secret]}),(0,H.jsx)(Qv,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)($v,{className:`w-fit`,children:[(0,H.jsx)(ey,{index:0}),(0,H.jsx)(ey,{index:1}),(0,H.jsx)(ey,{index:2}),(0,H.jsx)(ey,{index:3}),(0,H.jsx)(ey,{index:4}),(0,H.jsx)(ey,{index:5})]})}),(0,H.jsx)(q,{onClick:R,disabled:o||w.length!==6,children:`Confirm and enable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]}),b&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[O&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-emerald-500/40 bg-emerald-500/10 p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-emerald-300`,children:`2FA is now enabled.`}),(0,H.jsx)(`p`,{className:`text-xs text-emerald-200/90`,children:`For security, re-login is recommended now. This prevents accidental changes and confirms your new security state.`}),(0,H.jsx)(q,{variant:`default`,onClick:()=>{n()},children:`Re-login now`}),A.length>0&&(0,H.jsxs)(`div`,{className:`space-y-2 rounded-md border border-emerald-400/30 bg-background/40 p-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-emerald-200`,children:`Save these backup codes now. Each code can be used once if you lose access to your authenticator.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:A.map(e=>(0,H.jsx)(`code`,{className:`rounded bg-black/20 px-2 py-1 text-xs text-emerald-100`,children:e},e))}),(0,H.jsx)(q,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(A.join(`
223
- `)),N(!0),setTimeout(()=>N(!1),2e3)}catch{N(!1)}},children:M?`Copied`:`Copy backup codes`})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enter a verification code from your authenticator app to disable 2FA.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>{T(``),D(``)},children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsx)(Qv,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)($v,{className:`w-fit`,children:[(0,H.jsx)(ey,{index:0}),(0,H.jsx)(ey,{index:1}),(0,H.jsx)(ey,{index:2}),(0,H.jsx)(ey,{index:3}),(0,H.jsx)(ey,{index:4}),(0,H.jsx)(ey,{index:5})]})}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`disable-2fa-password`,children:`Current password`}),(0,H.jsx)(Ev,{id:`disable-2fa-password`,type:`password`,value:E,onChange:e=>D(e.target.value),required:!0})]}),(0,H.jsx)(q,{variant:`destructive`,onClick:ee,disabled:O||o||w.length!==6||!E,children:`Disable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]})]})})]})})]})}function l2(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Profile`})}),(0,H.jsx)(`section`,{className:`mt-18`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-4 items-start`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(P0,{}),(0,H.jsx)(c2,{})]})})})]})}var u2=ki([{path:`/login`,element:(0,H.jsx)(ny,{})},{element:(0,H.jsx)(da,{children:(0,H.jsx)(wv,{})}),children:[{index:!0,element:(0,H.jsx)(ww,{})},{path:`content`,element:(0,H.jsx)(bO,{}),children:[{index:!0,element:(0,H.jsx)(xO,{})},{path:`:slug`,element:(0,H.jsx)(YO,{})},{path:`:slug/new`,element:(0,H.jsx)(c$,{})},{path:`:slug/:id`,element:(0,H.jsx)(c$,{})}]},{path:`media`,element:(0,H.jsx)(E$,{})},{path:`content-types`,element:(0,H.jsx)(da,{permission:`content-types:write`,children:(0,H.jsx)(Dw,{})}),children:[{index:!0,element:(0,H.jsx)(Fw,{})},{path:`new`,element:(0,H.jsx)(vO,{})},{path:`:slug`,element:(0,H.jsx)(vO,{})}]},{path:`settings`,element:(0,H.jsx)(da,{permission:`settings:overview:read`,children:(0,H.jsx)(A$,{})}),children:[{index:!0,element:(0,H.jsx)(zr,{to:`overview`,replace:!0})},{path:`overview`,element:(0,H.jsx)(da,{permission:`settings:overview:read`,children:(0,H.jsx)(G$,{})})},{path:`users`,element:(0,H.jsx)(da,{permission:`settings:users:read`,children:(0,H.jsx)(v0,{})})},{path:`roles`,element:(0,H.jsx)(da,{permission:`settings:roles:read`,children:(0,H.jsx)(C0,{})})},{path:`api-tokens`,element:(0,H.jsx)(da,{permission:`settings:api-tokens:read`,children:(0,H.jsx)(O0,{})})},{path:`webhooks`,element:(0,H.jsx)(da,{permission:`settings:webhooks:read`,children:(0,H.jsx)(j0,{})})}]},{path:`profile`,element:(0,H.jsx)(l2,{})}]},{path:`*`,element:(0,H.jsx)(zr,{to:`/`,replace:!0})}],{basename:`/admin/`.replace(/\/$/,``)||`/`});function d2(){return(0,H.jsx)(ra,{children:(0,H.jsx)(oa,{children:(0,H.jsx)(la,{children:(0,H.jsx)($i,{router:u2})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(v.StrictMode,{children:(0,H.jsx)(d2,{})}));
222
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function t1(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function n1(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:e1(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),t1(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function r1(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:e1(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],t1(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:e1(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},t1(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var i1=`debugHeaders`;function a1(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var o1={createTable:e=>{e.getHeaderGroups=e1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return s1(t,[...a,...s,...o],e)},t1(e.options,i1,`getHeaderGroups`)),e.getCenterHeaderGroups=e1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),s1(t,n,e,`center`)),t1(e.options,i1,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=e1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>s1(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),t1(e.options,i1,`getLeftHeaderGroups`)),e.getRightHeaderGroups=e1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>s1(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),t1(e.options,i1,`getRightHeaderGroups`)),e.getFooterGroups=e1(()=>[e.getHeaderGroups()],e=>[...e].reverse(),t1(e.options,i1,`getFooterGroups`)),e.getLeftFooterGroups=e1(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),t1(e.options,i1,`getLeftFooterGroups`)),e.getCenterFooterGroups=e1(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),t1(e.options,i1,`getCenterFooterGroups`)),e.getRightFooterGroups=e1(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),t1(e.options,i1,`getRightFooterGroups`)),e.getFlatHeaders=e1(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),t1(e.options,i1,`getFlatHeaders`)),e.getLeftFlatHeaders=e1(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),t1(e.options,i1,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=e1(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),t1(e.options,i1,`getCenterFlatHeaders`)),e.getRightFlatHeaders=e1(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),t1(e.options,i1,`getRightFlatHeaders`)),e.getCenterLeafHeaders=e1(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),t1(e.options,i1,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=e1(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),t1(e.options,i1,`getLeftLeafHeaders`)),e.getRightLeafHeaders=e1(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),t1(e.options,i1,`getRightLeafHeaders`)),e.getLeafHeaders=e1(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),t1(e.options,i1,`getLeafHeaders`))}};function s1(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=a1(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>a1(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var c1=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>$$(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:e1(()=>[e.getAllLeafColumns()],t=>t.map(t=>n1(e,s,t,t.id)),t1(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:e1(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),t1(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},l1={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},u1=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};u1.autoRemove=e=>b1(e);var d1=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};d1.autoRemove=e=>b1(e);var f1=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};f1.autoRemove=e=>b1(e);var p1=(e,t,n)=>e.getValue(t)?.includes(n);p1.autoRemove=e=>b1(e);var m1=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});m1.autoRemove=e=>b1(e)||!(e!=null&&e.length);var h1=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));h1.autoRemove=e=>b1(e)||!(e!=null&&e.length);var g1=(e,t,n)=>e.getValue(t)===n;g1.autoRemove=e=>b1(e);var _1=(e,t,n)=>e.getValue(t)==n;_1.autoRemove=e=>b1(e);var v1=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};v1.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},v1.autoRemove=e=>b1(e)||b1(e[0])&&b1(e[1]);var y1={includesString:u1,includesStringSensitive:d1,equalsString:f1,arrIncludes:p1,arrIncludesAll:m1,arrIncludesSome:h1,equals:g1,weakEquals:_1,inNumberRange:v1};function b1(e){return e==null||e===``}var x1={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:X$(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?y1.includesString:typeof n==`number`?y1.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?y1.equals:Array.isArray(n)?y1.arrIncludes:y1.weakEquals},e.getFilterFn=()=>Z$(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??y1[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=Y$(n,i?i.value:void 0);if(S1(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>Y$(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&S1(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function S1(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var C1={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!Q$(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},w1={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:X$(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return C1.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return C1.extent},e.getAggregationFn=()=>{if(!e)throw Error();return Z$(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??C1[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function T1(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var E1={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:X$(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=e1(e=>[L1(t,e)],t=>t.findIndex(t=>t.id===e.id),t1(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>L1(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=L1(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=e1(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return T1(i,t,n)},t1(e.options,`debugTable`,`_getOrderColumnsFn`))}},D1=()=>({left:[],right:[]}),O1={getInitialState:e=>({columnPinning:D1(),...e}),getDefaultOptions:e=>({onColumnPinningChange:X$(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=e1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},t1(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=e1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),t1(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=e1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),t1(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?D1():e.initialState?.columnPinning??D1()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=e1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),t1(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=e1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),t1(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=e1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},t1(e.options,`debugColumns`,`getCenterLeafColumns`))}};function k1(e){return e||(typeof document<`u`?document:null)}var A1={size:150,minSize:20,maxSize:2**53-1},j1=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),M1={getDefaultColumnDef:()=>A1,getInitialState:e=>({columnSizing:{},columnSizingInfo:j1(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:X$(`columnSizing`,e),onColumnSizingInfoChange:X$(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??A1.minSize,n??e.columnDef.size??A1.size),e.columnDef.maxSize??A1.maxSize)},e.getStart=e1(e=>[e,L1(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),t1(t.options,`debugColumns`,`getStart`)),e.getAfter=e1(e=>[e,L1(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),t1(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),F1(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=F1(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=k1(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=P1()?{passive:!1}:!1;F1(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?j1():e.initialState.columnSizingInfo??j1())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},N1=null;function P1(){if(typeof N1==`boolean`)return N1;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return N1=e,N1}function F1(e){return e.type===`touchstart`}var I1={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:X$(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=e1(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),t1(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=e1(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],t1(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>e1(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),t1(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function L1(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var R1={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},z1={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:X$(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>y1.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return Z$(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??y1[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},B1={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:X$(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},V1=0,H1=10,U1=()=>({pageIndex:V1,pageSize:H1}),W1={getInitialState:e=>({...e,pagination:{...U1(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:X$(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>Y$(t,e)),e.resetPagination=t=>{e.setPagination(t?U1():e.initialState.pagination??U1())},e.setPageIndex=t=>{e.setPagination(n=>{let r=Y$(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?V1:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??V1)},e.resetPageSize=t=>{var n;e.setPageSize(t?H1:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??H1)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,Y$(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=Y$(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=e1(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},t1(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},G1=()=>({top:[],bottom:[]}),K1={getInitialState:e=>({rowPinning:G1(),...e}),getDefaultOptions:e=>({onRowPinningChange:X$(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?G1():e.initialState?.rowPinning??G1()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=e1(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),t1(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=e1(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),t1(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=e1(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},t1(e.options,`debugRows`,`getCenterRows`))}},q1={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:X$(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{J1(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=e1(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Y1(e,n):{rows:[],flatRows:[],rowsById:{}},t1(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=e1(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Y1(e,n):{rows:[],flatRows:[],rowsById:{}},t1(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=e1(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Y1(e,n):{rows:[],flatRows:[],rowsById:{}},t1(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return J1(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return X1(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return Z1(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return Z1(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},J1=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>J1(e,t.id,n,r,i))};function Y1(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=X1(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function X1(e,t){return t[e.id]??!1}function Z1(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(X1(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=Z1(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Q1=/([0-9]+)/gm,$1=(e,t,n)=>s0(o0(e.getValue(n)).toLowerCase(),o0(t.getValue(n)).toLowerCase()),e0=(e,t,n)=>s0(o0(e.getValue(n)),o0(t.getValue(n))),t0=(e,t,n)=>a0(o0(e.getValue(n)).toLowerCase(),o0(t.getValue(n)).toLowerCase()),n0=(e,t,n)=>a0(o0(e.getValue(n)),o0(t.getValue(n))),r0=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},i0=(e,t,n)=>a0(e.getValue(n),t.getValue(n));function a0(e,t){return e===t?0:e>t?1:-1}function o0(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function s0(e,t){let n=e.split(Q1).filter(Boolean),r=t.split(Q1).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var c0={alphanumeric:$1,alphanumericCaseSensitive:e0,text:t0,textCaseSensitive:n0,datetime:r0,basic:i0},l0=[o1,I1,E1,O1,l1,x1,R1,z1,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:X$(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return c0.datetime;if(typeof n==`string`&&(r=!0,n.split(Q1).length>1))return c0.alphanumeric}return r?c0.text:c0.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return Z$(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??c0[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},w1,B1,W1,K1,q1,M1];function u0(e){let t=[...l0,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(Y$(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:e1(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),t1(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:e1(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=r1(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},t1(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:e1(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),t1(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:e1(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),t1(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:e1(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),t1(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function d0(){return e=>e1(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=c1(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},t1(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function f0(e,t){return e?p0(e)?v.createElement(e,t):e:null}function p0(e){return m0(e)||typeof e==`function`||h0(e)}function m0(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function h0(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function g0(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:u0(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var _0={"super admin":`default`,admin:`secondary`,user:`outline`};function v0({roleId:e,roleName:t,roles:n}){let r=n.find(t=>t.id===e),i=t??r?.name??e;return(0,H.jsx)(XC,{variant:_0[i.toLowerCase()]??`secondary`,children:i})}function y0({user:e,currentUserId:t,currentUserRole:n,onEdit:r,onDelete:i}){let a=e.id===t,o=(e.role_name??``).toLowerCase()===`super admin`,s=n.toLowerCase()===`super admin`;return(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground`,disabled:o&&!a&&!s,onClick:()=>r(e),children:(0,H.jsx)(vo,{className:`size-3.5`})}),(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,disabled:a||o,onClick:()=>i(e),children:(0,H.jsx)(Mo,{className:`size-3.5`})})]})}var b0={email:``,password:``,roleId:``};function x0(){let{user:e,updateUser:t}=ia(),{data:n,loading:r,refetch:i}=fa(`/cms/admin/users`),{data:a,loading:o}=fa(`/cms/admin/roles`),s=r||o,{request:c,loading:l,error:u}=Tv(),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(b0),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)({email:``,roleId:``,firstName:``,lastName:``}),[b,x]=(0,v.useState)(null),S=a??[],C=e?.role?.toLowerCase()===`super admin`?S:S.filter(e=>e.name.toLowerCase()!==`super admin`),w=(0,v.useMemo)(()=>[{id:`name`,header:`Name`,cell:({row:e})=>{let{first_name:t,last_name:n}=e.original;return!t&&!n?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):(0,H.jsx)(`span`,{className:`font-bold`,children:[t,n].filter(Boolean).join(` `)})}},{accessorKey:`email`,header:`Email`},{accessorKey:`role_id`,header:`Role`,cell:({row:e,getValue:t})=>(0,H.jsx)(v0,{roleId:t(),roleName:e.original.role_name,roles:S})},{id:`actions`,header:``,cell:({row:t})=>(0,H.jsx)(y0,{user:t.original,currentUserId:e?.id??``,currentUserRole:e?.role??``,onEdit:e=>{g(e),y({email:e.email,roleId:e.role_id,firstName:e.first_name??``,lastName:e.last_name??``})},onDelete:x})}],[S,e?.id,e?.role]),T=g0({data:(0,v.useMemo)(()=>[...n??[]].sort((e,t)=>{let n=[e.first_name,e.last_name].filter(Boolean).join(` `)||e.email,r=[t.first_name,t.last_name].filter(Boolean).join(` `)||t.email;return n.localeCompare(r)}),[n]),columns:w,getCoreRowModel:d0()});async function E(e){e.preventDefault();try{await c(`/cms/admin/users`,`POST`,p),f(!1),m(b0),i()}catch{}}async function D(n){n.preventDefault();try{await c(`/cms/admin/users/${h.id}`,`PUT`,_),h.id===e?.id&&t({email:_.email,firstName:_.firstName||null,lastName:_.lastName||null}),g(null),i()}catch{}}async function O(){try{await c(`/cms/admin/users/${b.id}`,`DELETE`),x(null),i()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Users`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage who has access to the admin panel.`})]}),(0,H.jsxs)(q,{onClick:()=>f(!0),children:[(0,H.jsx)(yo,{className:`size-4`}),`New user`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:T.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:f0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:s?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:w.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):T.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:w.length,className:`h-24 text-center text-muted-foreground`,children:`No users found.`})}):T.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:f0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:d,onOpenChange:f,children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New user`})}),(0,H.jsxs)(`form`,{id:`create-user-form`,onSubmit:E,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-email`,children:`Email`}),(0,H.jsx)(Ev,{id:`c-email`,type:`email`,placeholder:`user@example.com`,value:p.email,onChange:e=>m(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-password`,children:`Password`}),(0,H.jsx)(Ev,{id:`c-password`,type:`password`,placeholder:`Min. 8 characters`,value:p.password,onChange:e=>m(t=>({...t,password:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`c-role`,children:`Role`}),(0,H.jsxs)(ow,{value:p.roleId,onValueChange:e=>m(t=>({...t,roleId:e})),children:[(0,H.jsx)(lw,{id:`c-role`,children:(0,H.jsx)(cw,{placeholder:`Select a role`})}),(0,H.jsx)(fw,{children:C.map(e=>(0,H.jsx)(mw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>f(!1),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-user-form`,disabled:l,children:l?`Creating…`:`Create user`})]})]})}),(0,H.jsx)(ZC,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Edit user`})}),(0,H.jsxs)(`form`,{id:`edit-user-form`,onSubmit:D,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-email`,children:`Email`}),(0,H.jsx)(Ev,{id:`e-email`,type:`email`,value:_.email,onChange:e=>y(t=>({...t,email:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-fname`,children:`First name`}),(0,H.jsx)(Ev,{id:`e-fname`,value:_.firstName,onChange:e=>y(t=>({...t,firstName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-lname`,children:`Last name`}),(0,H.jsx)(Ev,{id:`e-lname`,value:_.lastName,onChange:e=>y(t=>({...t,lastName:e.target.value}))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`e-role`,children:`Role`}),(0,H.jsxs)(ow,{value:_.roleId,onValueChange:e=>y(t=>({...t,roleId:e})),children:[(0,H.jsx)(lw,{id:`e-role`,children:(0,H.jsx)(cw,{placeholder:`Select a role`})}),(0,H.jsx)(fw,{children:C.map(e=>(0,H.jsx)(mw,{value:e.id,children:e.name.charAt(0).toUpperCase()+e.name.slice(1)},e.id))})]})]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>g(null),children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`edit-user-form`,disabled:l,children:l?`Saving…`:`Save changes`})]})]})}),(0,H.jsx)(ZC,{open:!!b,onOpenChange:e=>{e||x(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete user`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:b?.email}),`? This action cannot be undone.`]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>x(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:O,disabled:l,children:l?`Deleting…`:`Delete`})]})]})})]})]})}var S0=[{key:`content-types`,label:`Content Types`,actions:[`read`,`write`,`delete`]},{key:`entries`,label:`Entries`,actions:[`read`,`write`,`delete`]},{key:`media`,label:`Media`,actions:[`read`,`write`,`delete`]},{key:`settings:overview`,label:`Settings / Overview`,actions:[`read`,`write`]},{key:`settings:users`,label:`Settings / Users`,actions:[`read`,`write`,`delete`]},{key:`settings:roles`,label:`Settings / Roles`,actions:[`read`,`write`]},{key:`settings:api-tokens`,label:`Settings / API Tokens`,actions:[`read`,`write`,`delete`]},{key:`settings:webhooks`,label:`Settings / Webhooks`,actions:[`read`,`write`,`delete`]}],C0=[{key:`read`,label:`R`},{key:`write`,label:`W`},{key:`delete`,label:`D`}];function w0(e){return Object.fromEntries(e.map(e=>[e.id,new Set(e.permissions)]))}function T0(e,t){return e.includes(t)}function E0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/roles`),{request:i,loading:a}=Tv(),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(!1);(0,v.useEffect)(()=>{t&&s(w0(t))},[t]);function f(e,t){s(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:r}}),l(t=>new Set(t).add(e))}async function p(e){await i(`/cms/admin/roles/${e.id}`,`PUT`,{permissions:Array.from(o[e.id]??[])}),l(t=>{let n=new Set(t);return n.delete(e.id),n})}async function m(){await i(`/cms/admin/roles/reset`,`POST`),d(!1),l(new Set),r()}let h=e?.role===`Super Admin`,g=(t??[]).filter(e=>e.name!==`Super Admin`),_=(t??[]).find(e=>e.name===`Super Admin`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Roles`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure what each role can do across the CMS.`})]}),h&&(0,H.jsxs)(q,{variant:`outline`,onClick:()=>d(!0),children:[(0,H.jsx)(xo,{className:`size-4`}),`Reset defaults`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsxs)(_w,{children:[(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[(0,H.jsx)(bw,{className:`w-40`,rowSpan:2}),_&&(0,H.jsx)(bw,{colSpan:3,className:`border-l text-center`,children:_.name}),g.map(e=>(0,H.jsx)(bw,{colSpan:3,className:`border-l`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{children:e.name}),(0,H.jsxs)(q,{size:`sm`,variant:c.has(e.id)?`default`:`ghost`,className:`h-6 px-2 text-xs`,disabled:!c.has(e.id)||a,onClick:()=>p(e),children:[(0,H.jsx)(So,{className:`size-3`}),`Save`]})]})},e.id))]}),(0,H.jsxs)(yw,{className:`hover:bg-transparent`,children:[_&&C0.map((e,t)=>(0,H.jsx)(bw,{className:`w-12 text-center font-normal ${t===0?`border-l`:``}`,children:e.label},e.key)),g.map(e=>C0.map((t,n)=>(0,H.jsx)(bw,{className:`w-12 text-center font-normal ${n===0?`border-l`:``}`,children:t.label},`${e.id}-${t.key}`)))]})]}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:99,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):S0.map(({key:e,label:t,actions:n})=>(0,H.jsxs)(yw,{children:[(0,H.jsx)(xw,{className:`font-medium`,children:t}),_&&C0.map((e,t)=>(0,H.jsx)(xw,{className:`text-center ${t===0?`border-l`:``}`,children:T0(n,e.key)?(0,H.jsx)(iO,{checked:!0,disabled:!0}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},e.key)),g.map(t=>C0.map((r,i)=>{let a=T0(n,r.key),s=`${e}:${r.key}`;return(0,H.jsx)(xw,{className:`text-center ${i===0?`border-l`:``}`,children:a?(0,H.jsx)(iO,{checked:o[t.id]?.has(s)??!1,onCheckedChange:()=>f(t.id,s)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})},`${t.id}-${r.key}`)}))]},e))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:d,children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Reset to defaults`})}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This will restore all role permissions to their original configuration. Any custom changes will be lost.`}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>d(!1),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:m,disabled:a,children:a?`Resetting…`:`Reset`})]})]})})]})]})}var D0={"full-access":`default`,"read-only":`secondary`},O0={"full-access":`Full access`,"read-only":`Read only`};function k0({value:e}){let[t,n]=(0,v.useState)(!1);function r(){navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return(0,H.jsx)(q,{type:`button`,size:`icon`,variant:`outline`,className:`shrink-0`,onClick:r,children:t?(0,H.jsx)(Da,{className:`size-4 text-green-500`}):(0,H.jsx)(Ra,{className:`size-4`})})}var A0={name:``,accessType:``};function j0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/api-tokens`),{request:i,loading:a,error:o}=Tv(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:api-tokens:write`),l=s.includes(`*`)||s.includes(`settings:api-tokens:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(A0),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),y=[{accessorKey:`name`,header:`Name`},{accessorKey:`access_type`,header:`Access`,cell:({getValue:e})=>{let t=e();return(0,H.jsx)(XC,{variant:D0[t]??`secondary`,children:O0[t]??t})}},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`flex size-8 items-center justify-center rounded text-destructive hover:bg-destructive/10 hover:text-destructive`,onClick:()=>_(e.original),children:(0,H.jsx)(Mo,{className:`size-3.5`})}):null}],b=g0({data:t??[],columns:y,getCoreRowModel:d0()});async function x(e){e.preventDefault();try{h(await i(`/cms/admin/api-tokens`,`POST`,{name:f.name,accessType:f.accessType})),r()}catch{}}function S(){d(!1),h(null),p(A0)}async function C(){try{await i(`/cms/admin/api-tokens/${g.id}`,`DELETE`),_(null),r()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`API Tokens`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage tokens for consuming the public API.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(yo,{className:`size-4`}),`New token`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:b.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:f0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:y.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):b.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:y.length,className:`h-24 text-center text-muted-foreground`,children:`No tokens yet.`})}):b.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:f0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:e=>{e||S()},children:(0,H.jsx)(tw,{className:`sm:max-w-md`,children:m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Token generated`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200`,children:`Make sure to copy your token now. You won't be able to see it again.`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{children:`Token`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Ev,{readOnly:!0,value:m.token,className:`font-mono text-xs`}),(0,H.jsx)(k0,{value:m.token})]})]})]}),(0,H.jsx)(rw,{children:(0,H.jsx)(q,{onClick:S,children:`Done`})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New API token`})}),(0,H.jsxs)(`form`,{id:`create-token-form`,onSubmit:x,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-name`,children:`Name`}),(0,H.jsx)(Ev,{id:`token-name`,placeholder:`e.g. Production frontend`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`token-access`,children:`Access type`}),(0,H.jsxs)(ow,{value:f.accessType,onValueChange:e=>p(t=>({...t,accessType:e})),children:[(0,H.jsx)(lw,{id:`token-access`,children:(0,H.jsx)(cw,{placeholder:`Select access type`})}),(0,H.jsxs)(fw,{children:[(0,H.jsx)(mw,{value:`read-only`,children:`Read only`}),(0,H.jsx)(mw,{value:`full-access`,children:`Full access`})]})]})]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:S,children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-token-form`,disabled:a||!f.accessType||!c,children:a?`Generating…`:`Generate token`})]})]})})}),(0,H.jsx)(ZC,{open:!!g,onOpenChange:e=>{e||_(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Revoke token`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to revoke`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:g?.name}),`? Any frontend using it will immediately lose access.`]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:C,disabled:a||!l,children:a?`Revoking…`:`Revoke`})]})]})})]})]})}var M0=[{value:`entry.published`,label:`Entry published`},{value:`entry.unpublished`,label:`Entry unpublished`},{value:`entry.created`,label:`Entry created`},{value:`entry.updated`,label:`Entry updated`},{value:`entry.deleted`,label:`Entry deleted`}],N0={name:``,url:``,events:[]};function P0(){let{user:e}=ia(),{data:t,loading:n,refetch:r}=fa(`/cms/admin/webhooks`),{request:i,loading:a,error:o}=Tv(),s=e?.permissions??[],c=s.includes(`*`)||s.includes(`settings:webhooks:write`),l=s.includes(`*`)||s.includes(`settings:webhooks:delete`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(N0),[m,h]=(0,v.useState)(null),g=[{accessorKey:`name`,header:`Name`},{accessorKey:`url`,header:`URL`,cell:({getValue:e})=>(0,H.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground truncate max-w-xs block`,children:e()})},{accessorKey:`events`,header:`Events`,cell:({getValue:e})=>(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e().map(e=>(0,H.jsx)(XC,{variant:`secondary`,className:`text-xs font-mono`,children:e},e))})},{accessorKey:`created_at`,header:`Created`,cell:({getValue:e})=>new Date(e()).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`})},{id:`actions`,header:``,cell:({row:e})=>l?(0,H.jsx)(q,{size:`icon`,variant:`ghost`,className:`size-8 text-destructive hover:text-destructive`,onClick:()=>h(e.original),children:(0,H.jsx)(Mo,{className:`size-3.5`})}):null}],_=g0({data:t??[],columns:g,getCoreRowModel:d0()});function y(e){p(t=>({...t,events:t.events.includes(e)?t.events.filter(t=>t!==e):[...t.events,e]}))}async function b(e){e.preventDefault();try{await i(`/cms/admin/webhooks`,`POST`,f),d(!1),p(N0),r()}catch{}}async function x(){try{await i(`/cms/admin/webhooks/${m.id}`,`DELETE`),h(null),r()}catch{}}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Webhooks`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Notify external services when content events occur.`})]}),(0,H.jsxs)(q,{onClick:()=>d(!0),disabled:!c,children:[(0,H.jsx)(yo,{className:`size-4`}),`New webhook`]})]})}),(0,H.jsxs)(`section`,{className:`mt-24`,children:[(0,H.jsx)(`div`,{className:`rounded-md border`,children:(0,H.jsxs)(gw,{children:[(0,H.jsx)(_w,{className:`font-bold uppercase`,children:_.getHeaderGroups().map(e=>(0,H.jsx)(yw,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,H.jsx)(bw,{className:`px-4 py-3 text-left font-medium text-muted-foreground`,children:f0(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(vw,{children:n?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:g.length,className:`h-24`,children:(0,H.jsx)(iy,{className:`mx-auto size-5`})})}):_.getRowModel().rows.length===0?(0,H.jsx)(yw,{children:(0,H.jsx)(xw,{colSpan:g.length,className:`h-24 text-center text-muted-foreground`,children:`No webhooks yet.`})}):_.getRowModel().rows.map(e=>(0,H.jsx)(yw,{children:e.getVisibleCells().map(e=>(0,H.jsx)(xw,{className:`px-4 py-3`,children:f0(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})}),(0,H.jsx)(ZC,{open:u,onOpenChange:e=>{e||(d(!1),p(N0))},children:(0,H.jsxs)(tw,{className:`sm:max-w-md`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`New webhook`})}),(0,H.jsxs)(`form`,{id:`create-webhook-form`,onSubmit:b,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-name`,children:`Name`}),(0,H.jsx)(Ev,{id:`webhook-name`,placeholder:`e.g. Dokploy deploy`,value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`webhook-url`,children:`URL`}),(0,H.jsx)(Ev,{id:`webhook-url`,type:`url`,placeholder:`https://...`,value:f.url,onChange:e=>p(t=>({...t,url:e.target.value})),required:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Y,{children:`Events`}),M0.map(({value:e,label:t})=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(iO,{id:`event-${e}`,checked:f.events.includes(e),onCheckedChange:()=>y(e)}),(0,H.jsxs)(`label`,{htmlFor:`event-${e}`,className:`text-sm cursor-pointer`,children:[t,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e})]})]},e))]}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o})]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,type:`button`,onClick:()=>{d(!1),p(N0)},children:`Cancel`}),(0,H.jsx)(q,{type:`submit`,form:`create-webhook-form`,disabled:a||f.events.length===0||!c,children:a?`Creating…`:`Create webhook`})]})]})}),(0,H.jsx)(ZC,{open:!!m,onOpenChange:e=>{e||h(null)},children:(0,H.jsxs)(tw,{className:`sm:max-w-sm`,children:[(0,H.jsx)(nw,{children:(0,H.jsx)(iw,{children:`Delete webhook`})}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Are you sure you want to delete`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:m?.name}),`? It will stop receiving events immediately.`]}),(0,H.jsxs)(rw,{children:[(0,H.jsx)(q,{variant:`outline`,onClick:()=>h(null),children:`Cancel`}),(0,H.jsx)(q,{variant:`destructive`,onClick:x,disabled:a||!l,children:a?`Deleting…`:`Delete`})]})]})})]})]})}function F0({...e}){return(0,H.jsx)(Ty,{"data-slot":`collapsible`,...e})}function I0({...e}){return(0,H.jsx)(Sy,{"data-slot":`collapsible-content`,...e})}function L0(){let{user:e,updateUser:t}=ia(),{loading:n,error:r,request:i}=Tv(),{request:a}=Tv(),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(e?.firstName??``),[_,y]=(0,v.useState)(e?.lastName??``),[b,x]=(0,v.useState)(e?.jobTitle??``),[S,C]=(0,v.useState)(e?.organization??``),[w,T]=(0,v.useState)(e?.country??``);function E(){p&&(g(e?.firstName??``),y(e?.lastName??``),x(e?.jobTitle??``),C(e?.organization??``),T(e?.country??``)),m(!p)}async function D(e){let n=e.target.files?.[0];if(n){c(!0),f(null);try{t({avatarUrl:await DZ(n)})}catch(e){f(e instanceof Error?e.message:`Upload failed.`)}finally{c(!1),o.current&&(o.current.value=``)}}}async function O(){u(!0),f(null);try{await a(`/cms/admin/users/me/avatar`,`DELETE`),t({avatarUrl:null})}catch(e){f(e instanceof Error?e.message:`Delete failed.`)}finally{u(!1)}}async function k(e){e.preventDefault();try{let e=await i(`/cms/admin/users/me`,`PATCH`,{firstName:h,lastName:_,jobTitle:b,organization:S,country:w});t({firstName:e.first_name,lastName:e.last_name,jobTitle:e.job_title,organization:e.organization,country:e.country}),m(!1)}catch{}}return(0,H.jsx)(F0,{open:p,onOpenChange:m,children:(0,H.jsxs)(B$,{children:[(0,H.jsxs)(V$,{children:[(0,H.jsx)(H$,{className:`uppercase`,children:`Account`}),(0,H.jsx)(U$,{children:(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:E,children:p?(0,H.jsx)(Bo,{className:`size-4`}):(0,H.jsx)(vo,{className:`size-4`})})})]}),(0,H.jsxs)(W$,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4 -mt-4`,children:[(0,H.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`block`,onClick:()=>o.current?.click(),disabled:s||l,title:`Change avatar`,children:[(0,H.jsx)(ul,{avatarUrl:e?.avatarUrl,firstName:e?.firstName,lastName:e?.lastName,email:e?.email,className:`size-20`,fallbackClassName:`text-xl`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center rounded-full bg-black/40 opacity-0 transition-opacity group-hover:opacity-100`,children:s||l?(0,H.jsx)(`div`,{className:`size-4 animate-spin rounded-full border-2 border-white border-t-transparent`}):(0,H.jsx)(Ea,{className:`size-5 text-white`})})]}),e?.avatarUrl&&!s&&!l&&(0,H.jsx)(`button`,{type:`button`,onClick:O,title:`Remove avatar`,className:`absolute -top-1 -right-1 flex size-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground opacity-0 transition-opacity group-hover:opacity-100`,children:(0,H.jsx)(Mo,{className:`size-3`})})]}),(0,H.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,className:`hidden`,onChange:D}),(0,H.jsxs)(`div`,{children:[d&&(0,H.jsx)(`p`,{className:`text-xs text-destructive mb-1`,children:d}),(0,H.jsx)(`p`,{className:`font-bold text-xl`,children:e?.firstName||e?.lastName?`${e.firstName??``} ${e.lastName??``}`.trim():e?.email}),(e?.jobTitle||e?.organization)&&(0,H.jsx)(`p`,{className:`text-sm`,children:[e.jobTitle,e.organization].filter(Boolean).join(` · `)}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e?.email}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-2`,children:[(0,H.jsx)(XC,{className:`capitalize`,children:e?.role}),e?.country&&(0,H.jsx)(XC,{variant:`outline`,children:e.country})]})]})]}),(0,H.jsx)(I0,{children:(0,H.jsxs)(`form`,{onSubmit:k,className:`space-y-4 mt-8`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`firstName`,children:`First name`}),(0,H.jsx)(Ev,{id:`firstName`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`lastName`,children:`Last name`}),(0,H.jsx)(Ev,{id:`lastName`,value:_,onChange:e=>y(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`jobTitle`,children:`Job title`}),(0,H.jsx)(Ev,{id:`jobTitle`,value:b,onChange:e=>x(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`organization`,children:`Organization`}),(0,H.jsx)(Ev,{id:`organization`,value:S,onChange:e=>C(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`country`,children:`Country`}),(0,H.jsx)(Ev,{id:`country`,value:w,onChange:e=>T(e.target.value)})]})]}),r&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:r}),(0,H.jsx)(q,{type:`submit`,disabled:n,children:n?`Saving…`:`Save changes`})]})})]})]})})}var R0=Object.defineProperty,z0=Object.getOwnPropertySymbols,B0=Object.prototype.hasOwnProperty,V0=Object.prototype.propertyIsEnumerable,H0=(e,t,n)=>t in e?R0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U0=(e,t)=>{for(var n in t||={})B0.call(t,n)&&H0(e,n,t[n]);if(z0)for(var n of z0(t))V0.call(t,n)&&H0(e,n,t[n]);return e},W0=(e,t)=>{var n={};for(var r in e)B0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&z0)for(var r of z0(e))t.indexOf(r)<0&&V0.call(e,r)&&(n[r]=e[r]);return n},G0;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(G0||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(G0||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(G0||={});var K0=G0,q0={L:K0.QrCode.Ecc.LOW,M:K0.QrCode.Ecc.MEDIUM,Q:K0.QrCode.Ecc.QUARTILE,H:K0.QrCode.Ecc.HIGH},J0=128,Y0=`L`,X0=`#FFFFFF`,Z0=`#000000`,Q0=!1,$0=1,e2=4,t2=0,n2=.1;function r2(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function i2(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function a2(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*n2),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function o2(e,t){return t==null?e?e2:t2:Math.max(Math.floor(t),0)}function s2({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=v.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...K0.QrSegment.makeSegments(t)),e),[]);return K0.QrCode.encodeSegments(r,q0[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=v.useMemo(()=>{let e=c.getModules(),t=o2(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:a2(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var c2=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),l2=v.forwardRef(function(e,t){let n=e,{value:r,size:i=J0,level:a=Y0,bgColor:o=X0,fgColor:s=Z0,includeMargin:c=Q0,minVersion:l=$0,boostLevel:u,marginSize:d,imageSettings:f}=n,p=W0(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=W0(p,[`style`]),g=f?.src,_=v.useRef(null),y=v.useRef(null),b=v.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=v.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=s2({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});v.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=i2(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,c2?t.fill(new Path2D(r2(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),v.useEffect(()=>{S(!1)},[g]);let D=U0({height:i,width:i},m),O=null;return g!=null&&(O=v.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),v.createElement(v.Fragment,null,v.createElement(`canvas`,U0({style:D,height:i,width:i,ref:b,role:`img`},h)),O)});l2.displayName=`QRCodeCanvas`;var u2=v.forwardRef(function(e,t){let n=e,{value:r,size:i=J0,level:a=Y0,bgColor:o=X0,fgColor:s=Z0,includeMargin:c=Q0,minVersion:l=$0,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=W0(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:y}=s2({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),b=g,x=null;p!=null&&y!=null&&(y.excavation!=null&&(b=i2(g,y.excavation)),x=v.createElement(`image`,{href:p.src,height:y.h,width:y.w,x:y.x+h,y:y.y+h,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=r2(b,h);return v.createElement(`svg`,U0({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&v.createElement(`title`,null,d),v.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),v.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});u2.displayName=`QRCodeSVG`;function d2(){let{user:e,updateUser:t,logout:n}=ia(),{loading:r,error:i,request:a}=Tv(),{loading:o,error:s,request:c}=Tv(),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)([]),[M,N]=(0,v.useState)(!1);(0,v.useEffect)(()=>{typeof e?.twoFactorEnabled==`boolean`&&x(e.twoFactorEnabled)},[e?.twoFactorEnabled]);function P(){u(``),f(``),m(``),g(``),y(null),C(null),T(``)}function F(){C(null),T(``),D(``),k(!1),N(!1)}async function I(e){if(e.preventDefault(),y(null),p!==h){y(`New passwords do not match`);return}try{await a(`/cms/admin/users/me/password`,`PATCH`,{currentPassword:d,newPassword:p}),P()}catch{}}async function L(){C(await c(`/cms/admin/users/me/2fa/setup`,`POST`))}async function R(){let e=await c(`/cms/admin/users/me/2fa/verify`,`POST`,{code:w});x(!0),t({twoFactorEnabled:!0}),C(null),T(``),k(!0),j(e.backupCodes??[])}async function ee(){await c(`/cms/admin/users/me/2fa/disable`,`POST`,{code:w,password:E}),x(!1),t({twoFactorEnabled:!1}),T(``),D(``),j([]),N(!1)}return(0,H.jsxs)(B$,{children:[(0,H.jsxs)(V$,{children:[(0,H.jsx)(H$,{className:`uppercase`,children:`Security`}),(0,H.jsx)(U$,{})]}),(0,H.jsx)(W$,{className:`space-y-6`,children:(0,H.jsxs)(kA,{value:l,children:[(0,H.jsxs)(AA,{children:[(0,H.jsx)(jA,{value:`password`,onClick:()=>u(e=>e===`password`?``:`password`),children:`Password`}),(0,H.jsx)(jA,{value:`two-factor`,onClick:()=>u(e=>e===`two-factor`?``:`two-factor`),children:`2FA`})]}),(0,H.jsx)(MA,{value:`password`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Update your account password.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:P,children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsxs)(`form`,{onSubmit:I,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`current`,children:`Current password`}),(0,H.jsx)(Ev,{id:`current`,type:`password`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`new`,children:`New password`}),(0,H.jsx)(Ev,{id:`new`,type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,minLength:8})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`confirm`,children:`Confirm new password`}),(0,H.jsx)(Ev,{id:`confirm`,type:`password`,value:h,onChange:e=>g(e.target.value),required:!0})]}),(_??i)&&(0,H.jsx)(`p`,{className:`text-destructive text-sm`,children:_??i}),(0,H.jsx)(q,{type:`submit`,disabled:r,children:r?`Saving…`:`Update password`})]})]})}),(0,H.jsx)(MA,{value:`two-factor`,className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[!b&&!S&&(0,H.jsx)(q,{variant:`secondary`,onClick:L,disabled:o,children:`Enable 2FA`}),S&&!b&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scan this QR code with your authenticator app and enter the 6-digit code.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:F,children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsx)(`div`,{className:`inline-flex rounded-md bg-white p-2`,children:(0,H.jsx)(u2,{value:S.otpauthUri,size:176})}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Manual code: `,S.secret]}),(0,H.jsx)(Qv,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)($v,{className:`w-fit`,children:[(0,H.jsx)(ey,{index:0}),(0,H.jsx)(ey,{index:1}),(0,H.jsx)(ey,{index:2}),(0,H.jsx)(ey,{index:3}),(0,H.jsx)(ey,{index:4}),(0,H.jsx)(ey,{index:5})]})}),(0,H.jsx)(q,{onClick:R,disabled:o||w.length!==6,children:`Confirm and enable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]}),b&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-4`,children:[O&&(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-emerald-500/40 bg-emerald-500/10 p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-emerald-300`,children:`2FA is now enabled.`}),(0,H.jsx)(`p`,{className:`text-xs text-emerald-200/90`,children:`For security, re-login is recommended now. This prevents accidental changes and confirms your new security state.`}),(0,H.jsx)(q,{variant:`default`,onClick:()=>{n()},children:`Re-login now`}),A.length>0&&(0,H.jsxs)(`div`,{className:`space-y-2 rounded-md border border-emerald-400/30 bg-background/40 p-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-emerald-200`,children:`Save these backup codes now. Each code can be used once if you lose access to your authenticator.`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:A.map(e=>(0,H.jsx)(`code`,{className:`rounded bg-black/20 px-2 py-1 text-xs text-emerald-100`,children:e},e))}),(0,H.jsx)(q,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(A.join(`
223
+ `)),N(!0),setTimeout(()=>N(!1),2e3)}catch{N(!1)}},children:M?`Copied`:`Copy backup codes`})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enter a verification code from your authenticator app to disable 2FA.`}),(0,H.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>{T(``),D(``)},children:(0,H.jsx)(Bo,{className:`size-4`})})]}),(0,H.jsx)(Qv,{maxLength:6,value:w,onChange:T,containerClassName:`w-fit`,className:`w-fit`,children:(0,H.jsxs)($v,{className:`w-fit`,children:[(0,H.jsx)(ey,{index:0}),(0,H.jsx)(ey,{index:1}),(0,H.jsx)(ey,{index:2}),(0,H.jsx)(ey,{index:3}),(0,H.jsx)(ey,{index:4}),(0,H.jsx)(ey,{index:5})]})}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(Y,{htmlFor:`disable-2fa-password`,children:`Current password`}),(0,H.jsx)(Ev,{id:`disable-2fa-password`,type:`password`,value:E,onChange:e=>D(e.target.value),required:!0})]}),(0,H.jsx)(q,{variant:`destructive`,onClick:ee,disabled:O||o||w.length!==6||!E,children:`Disable 2FA`}),s&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:s})]})]})})]})})]})}function f2(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ry,{children:(0,H.jsx)(`h1`,{className:`text-2xl font-bold -mt-2`,children:`Profile`})}),(0,H.jsx)(`section`,{className:`mt-18`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-4 items-start`,children:(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(L0,{}),(0,H.jsx)(d2,{})]})})})]})}var p2=ki([{path:`/login`,element:(0,H.jsx)(ny,{})},{element:(0,H.jsx)(da,{children:(0,H.jsx)(wv,{})}),children:[{index:!0,element:(0,H.jsx)(ww,{})},{path:`content`,element:(0,H.jsx)(bO,{}),children:[{index:!0,element:(0,H.jsx)(xO,{})},{path:`:slug`,element:(0,H.jsx)(YO,{})},{path:`:slug/new`,element:(0,H.jsx)(d$,{})},{path:`:slug/:id`,element:(0,H.jsx)(d$,{})}]},{path:`media`,element:(0,H.jsx)(k$,{})},{path:`content-types`,element:(0,H.jsx)(da,{permission:`content-types:write`,children:(0,H.jsx)(Dw,{})}),children:[{index:!0,element:(0,H.jsx)(Fw,{})},{path:`new`,element:(0,H.jsx)(vO,{})},{path:`:slug`,element:(0,H.jsx)(vO,{})}]},{path:`settings`,element:(0,H.jsx)(da,{permission:`settings:overview:read`,children:(0,H.jsx)(N$,{})}),children:[{index:!0,element:(0,H.jsx)(zr,{to:`overview`,replace:!0})},{path:`overview`,element:(0,H.jsx)(da,{permission:`settings:overview:read`,children:(0,H.jsx)(J$,{})})},{path:`users`,element:(0,H.jsx)(da,{permission:`settings:users:read`,children:(0,H.jsx)(x0,{})})},{path:`roles`,element:(0,H.jsx)(da,{permission:`settings:roles:read`,children:(0,H.jsx)(E0,{})})},{path:`api-tokens`,element:(0,H.jsx)(da,{permission:`settings:api-tokens:read`,children:(0,H.jsx)(j0,{})})},{path:`webhooks`,element:(0,H.jsx)(da,{permission:`settings:webhooks:read`,children:(0,H.jsx)(P0,{})})}]},{path:`profile`,element:(0,H.jsx)(f2,{})}]},{path:`*`,element:(0,H.jsx)(zr,{to:`/`,replace:!0})}],{basename:`/admin/`.replace(/\/$/,``)||`/`});function m2(){return(0,H.jsx)(ra,{children:(0,H.jsx)(oa,{children:(0,H.jsx)(la,{children:(0,H.jsx)($i,{router:p2})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(v.StrictMode,{children:(0,H.jsx)(m2,{})}));