@plank-cms/plank 0.15.2 → 0.15.3

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};
@@ -216,7 +216,7 @@ ${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){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.3`,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`,`
220
220
  font-size: .6rem;
221
221
  font-weight: bold;
222
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(`